I'm using stm32l100C6-A to communicate with gas gauge via I2C. My code tries to start I2C transfer, like this:
I2C1->CR1 |= I2C_CR1_START; // waiting for EV5 - Master Mode Select while( ! (I2C1->SR1 & I2C_FLAG_SB) ); <yadda..yadda..>
As far as I can see - that's just a normal start condition. But I2C1->SR1 is zero, no bits are set, no matter how long I wait.
After that - making I2C reset via
I2C1->CR1 |= I2C_CR1_SWRST; doesn't help, making full reinitialization of I2C doesn't help, resetting RCC for I2C doesn't help. Only full MCU reset helps.
Since full reset helps, the problem must be in the MCU but I couldn't find anything similar in the errata or internet.
I'm using I2C on 85kHz.
I have no idea what's going on and I don't like resetting MCU as a workaround. Any ideas?