2012-07-25 07:49 AM
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?
2012-07-25 11:25 PM
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%20E2012-08-01 07:25 AM
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.