cancel
Showing results for 
Search instead for 
Did you mean: 

stm8s105c6 i2c problem

fenerlibora
Associate
Posted on July 25, 2012 at 16:49

I used pe1 and pe2 pin for i2c but this pins not work normally now. i make high pe1 and pe2 but this pins always low but pe0 and pe3 can be high. how do i connect this pins for i2c? 

2 REPLIES 2
klaasdc
Associate II
Posted on July 26, 2012 at 08:25

Hello,

If I remember correctly, the I2C pins (and maybe others from port PE) don't have the pull-up functions.

https://my.st.com/public/STe2ecommunities/mcu/Lists/STM8SDiscovery/AllItems.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2FSTM8SDiscovery%2FGPIO%20Pull%2Dup%20resistors%20on%20Port%20E

MuratUrsavas
Associate III
Posted on August 01, 2012 at 16:25

Hello Bora,

As Klaas said, I2C pins do not have WPU (Weak Pull-Up) feature (You can find the info at the Revision history of the datasheet (Revision 8)). Therefore you have to provide your own pull up circuit (via connecting two 4.7K resistors). You can find an example circuit at page 95 of the datasheet.

As an additional info, you should enable the clock of I2C first and then do the other things (like setting the I2C specific parameters). Or else your parameters won't be set correctly and you couldn't see the I2C peripheral working.