cancel
Showing results for 
Search instead for 
Did you mean: 

The I2c is not working when I enter in debug mode from the STM32CubeIDE. Do you know why?

YScha.1
Associate

I am reading a accelerometer and gyros of the IKS01A2 board with the provided STM library (lsm6dsl) on the Nucleo STM32F446Re. I modified the I2c to be able to used with the board using CubeMx.

Now the i2C communication only works when I plug the Nucleo to the USB. When I try to start the board in Debug mode (in the STMCubeIDE) the I2c never strarts. It only starts again when I unplug the board from USB and plug it in again. Also pressing the reset button in debug mode does not help to start the I2C. I was searching now for a long time but I did not find any post which was describing the same problem. Do you have any iday what my problem could be?

1 REPLY 1
YScha.1
Associate

Apparently, the problem was that SDA was staying LOW because the data transmission was not finished during the reset which occurs when entering the debug mode. I solved the problem by checking at start-up if the SDA pin is LOW.  If it is, I cycle the SCL Pin 9 times and check again if the SDA pin went HIGH.

Bus locking due to transmission abortion is a well-known I2C issue, that’s why I am wondering if there is no standard routine to solve this issue?