-
Notifications
You must be signed in to change notification settings - Fork 1k
How to avoid I2C bus stuck after a board reset #1661
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
Comments
Hi Carlo, thanks for this sharing. |
Hi @ABOSTM , |
Usefull in case of bus stuck after a reset for example Fixes stm32duino#1661 Signed-off-by: Alexandre Bourdiol <[email protected]>
Useful in case of bus stuck after a reset for example Fixes stm32duino#1661 Signed-off-by: Alexandre Bourdiol <[email protected]>
Useful in case of bus stuck after a reset for example Fixes stm32duino#1661 Signed-off-by: Alexandre Bourdiol <[email protected]>
Hi all, https://www.forward.com.au/pfod/ArduinoProgramming/I2C_ClearBus/I2C_ClearBus.ino.txt The implementation is described in this article: They suggest to do 20 clock loops (> 16) to address also devices that manage 16 bits registers. Besides they do not advice to put high the SDA and SCL because I2C bus is open collector |
Source: https://www.nxp.com/docs/en/user-guide/UM10204.pdf https://bits4device.wordpress.com/2017/07/28/i2c-bus-recovery/ Useful in case of bus stuck after a reset for example Fixes stm32duino#1661 Signed-off-by: Alexandre Bourdiol <[email protected]>
Source: https://www.nxp.com/docs/en/user-guide/UM10204.pdf https://bits4device.wordpress.com/2017/07/28/i2c-bus-recovery/ Useful in case of bus stuck after a reset for example Fixes stm32duino#1661 Signed-off-by: Alexandre Bourdiol <[email protected]>
Source: https://www.nxp.com/docs/en/user-guide/UM10204.pdf https://bits4device.wordpress.com/2017/07/28/i2c-bus-recovery/ Useful in case of bus stuck after a reset for example Fixes #1661 Signed-off-by: Alexandre Bourdiol <[email protected]>
I noticed that sometimes if you reset the board during an I2C transaction the I2C bus remains stuck.
A possible solution that I found is to send a bit-banged STOP sequence before the I2C begin. Maybe it would be better to include this procedure in the Wire begin implementation or in a dedicated Wire API to improve the stability of the library.
You can find below the bit-banged STOP sequence that normally I send to unlock the I2C bus before the I2C begin:
Best Regards,
Carlo
The text was updated successfully, but these errors were encountered: