-
Notifications
You must be signed in to change notification settings - Fork 23
improve Glitch prevention, Hardware RESET! #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
My prior glitch prevention relied on previous pin configuration. This update sets all values. Also, I think I have found a way to reset the I2C hardware to the same state as a Power Cycle or Hardware reset.
These changes should remove the possibility of a signal glitch when starting or restarting the Wire() object. Also, I think I have found a way to reset the i2c hardware to a Power On or Hardware Reset state.
After hardware reset, all i2c hardware register are back to zero, so the clockrate needs to be recovered.
I had manually applied these changes and misspelled two function names!
Continue with I2C transaction if bus_busy is cleared by i2cInit()
`SCL` and `SDA` need to be detached from the i2c hardware before the i2c hardware is init'd else a glitch is generated. esp32-hal-i2c.c does not know which pins are assigned to the hardware. Return the error and let `TwoWire()` do the reinit. Also, '~' is not the same as '!' My Bad.
The i2c data bus must be disconnected from the i2c peripheral before it is init'd. Else it will generate a glitch on both pins. Since the Hal layer does not remember which pins are assigned, just return the error and let `TwoWire()` handle re-initing.
had to move the hardware init code out of begin, so that I could call it without destroying queued transactions
Reinit i2c hardware when bus fault (busy) is detected
The branch can handle a bus fault, Grounding SDA and or SCL is now recoverable. The signal glitch that was created when attaching pins to the i2c peripheral has now been solved! A This branch should handle both I2C peripherals at the same time, UnTESTED, but, it should work. |
My prior glitch prevention relied on previous pin configuration. This update sets all values.
Also, I think I have found a way to reset the I2C hardware to the same state as a Power Cycle or Hardware reset.