cancel
Showing results for 
Search instead for 
Did you mean: 

I2C stopped working after STM32F411CEU6 is reset

WRama.1
Associate II

Hi, I've been working with my STM32F411CEU6. I connect my STM with BNO055 IMU sensor that use I2C as its communication protocol. Every time I press the reset button, the program should've start from the beginning, but in my case, that doesn't seem to work all the time. Sometime when I press the reset button, the IMU reading successfully started from the beginning (I can say that because I can see the reading result from the serial monitor). But in most cases, when I press the reset button, the program doesn't restart and the program stopped working instead. Whenever the program stopped working, I have to unplug and re-plug the USB (to my laptop) first in order to make the program able to work again.

Before using STM32F411CEU6, I use STM32 Nucleo 32 L432KC as my MCU, and this problem never happens, the program ALWAYS successfully start from the beginning.

Is this problem has to do with my hardware or is the problem located on my program? Thank you

4 REPLIES 4
KnarfB
Principal III

Check what exactly happens when "the program doesn't restart and the program stopped working instead". Either by step-by-step debugging or flooding your code with logging output.

When the MCU is reset in the middle of a I2C communication, the BNO055 might be in some state that prevents continuing I2C comm. Are you sure that you init BNO055 completely?

There is a recommended procedure to reset I2C bus before doing any comm. You might get the idea from https://www.i2c-bus.org/i2c-primer/analysing-obscure-problems/blocked-bus/ or, better, the official specs.

hth

KnarfB

"or, better, the official specs"

Here: https://www.nxp.com/docs/en/user-guide/UM10204.pdf

WRama.1
Associate II

Thank you for your help guys, appreciate it very much

Alex_OD
Associate

I know I'm 5 years late, but I just wanted to add a couple of comments.

  1. Read the data sheet for the part (IMU BNO055).
    1. I was expecting this to be one of the small footprint devices without a nReset, as that is when I've seen this problem mostly. The stuck I2C bus because the IMU is in a state where it's sending a low. That needs the 8 (or maybe 16) clocks to get out of it.
  2. Check the schematic.
    1. Does MCU reset drive target device reset? If so make sure it's toggled.
    2. Does MCU control target device power? If so, make sure the MCU reset is followed by a good power up sequence, otherwise you will get warm start issues where the target is not in its initial state.
  3. Check the state of SCL/SDA (break out the oscilloscope)
    1. If SDA is stuck low - probably stuck state on target, unless you are holding SDA low from controller
    2. If SDA is high 
      1. check power to target
      2. check reset to target