cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to figure out why On STM32F051 I2C bus fails time to time after sometimes working perfectly for 15 to 20 hours

ck.1
Associate III

Hello ,

Unable to figure out why On STM32F051 I2C bus fails time to time after sometimes working perfectly for 15 to 20 hours .

We have 1k pull up resistors on SCL and SDA lines . The bus operates at 400 KHz .

I2C bus fails time to time we are unable to figure out why . Is there any explanation for I2C bus failure and how to recover the I2C bus ?.

Once the I2C bus on the STM hangs up after working perfectly for sometimes about 15 to 20 hours no other devices on the entire I2C bus can be access its like the I2C bus is locked up once we reset the STM32F051 every device starts to communicate else they are dead lock .

1 ACCEPTED SOLUTION

Accepted Solutions
S.Ma
Principal

Deja vu...

First, if you have an oscilloscope, check the rise/fall/low level of the I2C signals, especially the ACK bit at master SDA side.

Second, modify your code to hang if SDA line is LOW before attempting to generate a Start bit.

If you reach this breakpoint in debug mode, bingo!

In this implementation of I2C with SW bit banging, there is an I2C error recovery with 9 stop bits. Some people are telling me 18 Stop bit is even more effective from their experience.

View solution in original post

1 REPLY 1
S.Ma
Principal

Deja vu...

First, if you have an oscilloscope, check the rise/fall/low level of the I2C signals, especially the ACK bit at master SDA side.

Second, modify your code to hang if SDA line is LOW before attempting to generate a Start bit.

If you reach this breakpoint in debug mode, bingo!

In this implementation of I2C with SW bit banging, there is an I2C error recovery with 9 stop bits. Some people are telling me 18 Stop bit is even more effective from their experience.