2019-04-10 06:46 AM
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?
2019-04-11 03:57 AM
Solved. It was my I-jet debugger that did do a soft reset. A soft reset does not clear all hardware registers.