cancel
Showing results for 
Search instead for 
Did you mean: 

STM8S005K6 I2C Bus always busy

HMoel.1
Associate II

Hi.

Regarding I2C Bus busy problem.

I am using alternative pins (PB4 and PB5), as I have the small chip with fewer pins.

Option bits are set, and verified.

However even at power up the BUSY bit is set. It is set through configuration of the I2C peripheral.

It is cleared when I active SWRST bit, but as soon as I clear it, BUSY is set again.

Is there a problem using alternative pins (or do I need to do something further than setting the option bit)?

1 REPLY 1
HMoel.1
Associate II

Update.

Found the problem. I am using an IAR compiler with a ST-LINK emulator. I need to set the option bits after I have uploaded the program and is in break in main. If I let the program set the option bits just prior to initializing the I2C, the chip does not seem to use the alternative setting for the I2C pins.