Skip to main content
sima2
Associate III
April 10, 2019
Question

I2C bug in CubeMX 5.0.1?

  • April 10, 2019
  • 1 reply
  • 926 views

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?

This topic has been closed for replies.

1 reply

sima2
sima2Author
Associate III
April 11, 2019

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