2023-05-18 06:16 AM
I am using the Nucleo-H743ZI2 board I wanted to know, how to recover I2C after an error or a locked state which can come due to a glitch or spike on the SDA or SCL line.
There is no bit I could find to reset the i2c peripheral in the control register.
Solved! Go to Solution.
2023-05-18 08:15 AM
Most Slaves don't have an async reset on them.
If they are hanging up the bus you'll need to clock them out of whatever state they are in so they release the bus, and no longer think they are the active device.
Ponder also where this "glitch or spike" is coming from, it you've got the appropriate pull-ups on the bus, and you're working no faster than the slowest device on the bus.
2023-05-18 07:59 AM
Hello @APand.8 ,
If the error is :
If you are facing some erratic behavior on STM32, do not forget to check Errata sheet of the device. There are few points related to I2C interface.
Foued
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-05-18 08:15 AM
Most Slaves don't have an async reset on them.
If they are hanging up the bus you'll need to clock them out of whatever state they are in so they release the bus, and no longer think they are the active device.
Ponder also where this "glitch or spike" is coming from, it you've got the appropriate pull-ups on the bus, and you're working no faster than the slowest device on the bus.
2023-05-18 10:56 AM
Before generating a START bit, check the bus is IDLE (SDA = SCL = high level voltage)
If not, reset the HW I2C (if using), generate 18 STOP bit by SW GPIO bit banging, then reconfigure the I2C and keep going.... works most of the times, and could be conveniently added in I2C examples to reduce support (so many questions seen on this forum about this) ? I2C Bus = 1982...
This should help, may not solve everything...
Of course, Murphy's law-proof it :
Make the STOP bit bitbang compiler maker/optimisation level/core frequency independent.
A rugged and reliable application code is hardly a band-aid quick patch.
2023-05-18 10:18 PM
Thank you for your reply, I2C is working fine, for testing, I was explicitly giving the glitch.
2023-12-16 08:19 AM
Can you share your solution? I'm having exactly the same problem but I couldn't solve it.