I2C on STM32L100 - "faulted started"

by Amomum   Last Updated June 25, 2018 13:25 PM

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) );

and sometimes it works, transfer is completed, all is well. But some other times instead of full transfer on I2C lines I see this (SCL and SDA are in different scale): enter image description here

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?

Tags : stm32 i2c

Related Questions


Updated March 26, 2015 13:08 PM

SPI to USB converter Question (for STM32F105)

Updated March 28, 2015 06:08 AM

STM32 SWD Issue

Updated April 08, 2015 22:10 PM