cancel
Showing results for 
Search instead for 
Did you mean: 

I2C bug in CubeMX 5.0.1?

sima2
Associate III

In my code I use I2C. But when I reset the MCU with my debugger (I-jet from IAR) the I2C peripheral indicates BUSY as soon as it is initialized by the MX_I2C1_Init() function.

But if I add the following I2C reset in the MX_I2C1_Init() function before the HAL_I2C_Init(&hi2c1) the BUSY flag is cleared:

  I2C1->CR1 |= I2C_CR1_SWRST;
  I2C1->CR1 &= ~I2C_CR1_SWRST;

Is this a CubeMX bug?

1 REPLY 1
sima2
Associate III

Solved. It was my I-jet debugger that did do a soft reset. A soft reset does not clear all hardware registers.