Philip Lane

I2C problem on STM8L152C6T6 Discovery board - sawtooth clock

Discussion created by Philip Lane on Dec 12, 2017
Latest reply on Feb 9, 2018 by Philip Lane

I am using two STM8L152C6T6 Discovery boards. I programmed them with the AN3281 slave / master I2C example, but it fails to work. I keep getting a bus error (BERR bit set). I looked at the lines with a scope - the data looks fine but the clock is saw tooth, totally triangular. Any suggestions ?


PC1 connects to PC1

PC0 connects to PC0

A 4k7 resistor goes from each of these lines to 3.3v


3.3v from master goes to 3.3v slave



ground from master goes to ground slave



Slave is powered through USB


Data line drops from 3v to 0v (square)

clock line does the same

Data line then shows nice square pulses to show bits (0 - 3v)

Clock line shows 9 short triangular pulses (slope up, sudden drop) 0 to two volts (i.e. not full deflection). after ninth pulse it has a gradual curve back to 3v.