brainwagon "There is much pleasure in useless knowledge." — Bertrand Russell

10Oct/110

I2C Pull Up Resistors Needed?

The great thing about doing a real project like my satellite tracker is that it makes you learn a lot, in a whole lot of different areas. In other words, it's good exercise! And thus, it is good when you discover something doesn't quite work right: you have another opportunity to learn.

Well, today, something wasn't working right.

Every three minutes, the "active satellite" dot would pass one of the balls on the track. The "track dot" would then get recalculated to the time 2 hours in the future. But I noticed that occasionally, that dot would appear somewhere wrong: a point clearly off the track. It's of course possible that I had a bug. But I also remembered that this didn't happen before I placed an LED on the square wave output of the DS1307 real time clock chip I have wired in.

That got me thinking: could some kind of power glitch be occurring that's causing an error when the program reads the time from the I2C bus? So, I pulled the LED out, and left it running. It's an hour and a half later, and the glitch has not reoccurred. Interesting.

So, I got to thinking. I didn't bother putting in any pull up resistors on the I2C bus (laziness, and lack of understanding about how important they are). I realize that the I2C bus is open drain: either the master or the slaves can pull the line down, but perhaps the LED adds enough capacitance to keep the signals from returning to high quickly, which causes a communication error? I suspect it might be informative to check out the signals on my oscilloscope. Stay tuned, but any gurus can go ahead and tell me what's going on in greater detail, or pointing me to materials that will spoon feed me the necessary knowledge.

Addendum: Stuck in a pair of 10K pullups, my glitch did not reoccur. I should hook it up to a scope and see the difference it makes, but for now, I'll just consider the problem fixed.