BasicMicroUK - Forums

www.basicmicro.co.uk
It is currently Tue Jul 17, 2018 5:07 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: A Note on I2C work: Don't forget the SDA pullup!
PostPosted: Tue Aug 04, 2009 12:59 am 
Offline
Master

Joined: Mon Aug 18, 2008 1:26 am
Posts: 799
Location: CA bay Area
I ran into this while writing an I2CIN example for the new manual. I had a Pro28M module on the BasicAtom Lab Board when doing this. I connected my 2 channel o-scope to check the signals for data (SDA) and clock (SCK). What I saw was a constant clock and a flat-lined SDA output. Which is totally wrong! I eventually slapped my head and installed the forgotten 10K pullup resistor on SDA. I then saw the "1010000" come out and the eight clocks to latch it into the missing part. This led to a "fail" message in the program, as expected.
So I fired off an email letting the programmer know of this "problem" and asked if he could add something in his code to detect this condition and signal an "idiot moment" alert, to which he replies:
Code:
Have to have a pullup on SDA. Always.  10k should be fine.  Can't test for a high and fail if it isn't.  That would break I2C protocol. The SDA line MUST have a pullup on it.  If some other device is using the bus(eg SDA is low) I have to retry which is exactly what I do. The error label is only used if during communications something fails.  While trying to start communications it will not fail while SDA is LOW.  For example EEPROMs hold SDA low at the end of a write until the write is finished. If I failed on a low SDA this would break EEPROMs.  And that is only one example. Almost all I2C devices hold SDA low at some port or another for some reason.

OK, no relief, you'll just have to get it right the first time! Or come to the forums and do a search!

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO