cancel
Showing results for 
Search instead for 
Did you mean: 

STM8L15x I2C : Cannot write I2C registers

Stm32User
Associate II
Posted on April 12, 2010 at 16:32

STM8L15x I2C : Cannot write I2C registers

6 REPLIES 6
Stm32User
Associate II
Posted on May 17, 2011 at 15:08

Solved !

One to watch out for on the STM8Lx parts 

Need to enable peripheral clock seperately in peripheral clock register.

Call to I2C_Init() doesn't do this.  You need to add 

CLK_PeripheralClockConfig(CLK_Peripheral_I2C,ENABLE);

brazov22
Associate II
Posted on May 17, 2011 at 15:08

OPS!!!

I suggest to split the forum for STM8S and STM8L since they seems different devices. For sure, in an ultra low power family like STM8L it's better clock peripherlas are disabled after reset. But on STM8S, by default after reset, all peripheral clocks are enabled, then user can disable selectively unwanted peripheral clock (opposite to STM8L).

brazov

jfelix
Associate II
Posted on May 17, 2011 at 15:08

Hi Patrick,

Did you manage to write a I2C driver for the STM8L discovery board?

I'm trying to write one from the STM8L15x_I2C_master_poll (AN3281) but 

nothing comes out of PC0 and PC1. Do you know if there anything special with the discovery board?

Felix

Stm32User
Associate II
Posted on May 17, 2011 at 15:08

Hi Felix

There are problems with the I2C on this device.

I used the firmware library I2C code initially but there are bugs in the silicon.

There is a workaround which seems to work if you need details I can send to you

vromanov00
Associate
Posted on May 17, 2011 at 15:08

Hi Patrick!

Could you provide me details of workaround. I am stuck with I2C on STM8L15x. Interrupt  BERR - Misplaced Start or Stop condition occured.

jfelix
Associate II
Posted on May 17, 2011 at 15:08

Hi Patrick, Romanov,

I finally managed to get the I2C working with the examples from the AN3281_STM8L_I2C_examples.

I use Polling mode wich is quite simple BUT I had to disable interrupts in the I2C init ie:

I2C1->ITR = 0; (in file i2c_master_poll.c)

I hope this can help someone.

Felix