Electronic – arduino – DS1307 RTC Debug

arduinodebuggingi2crtc

I'm having trouble with getting the DS1307 RTC to work. I'm talking to it via an Arduino, and I'm just trying to get an example sketch to work. I've tried two different libraries – one from Ladyada, and one from Seeedstudios. Electrically, I have both the Arduino and the RTC powered by 5V, and the RTC's VBAT input grounded (per the datasheet, since I'm not using a battery during testing). I'm building using the Arduino-0022 IDE. I've got 10k pullups on the SDA and SCL lines. I've traditionally used smaller pullups on the I2C bus (e.g. 3.3k or 4.7k), but I don't think that's my issue.

Both libraries basically indicate that the data being returned by the device is all zeroes for the date and time. So I went and captured the I2C traffic using an oscilloscope (using the Seeedstudios library) and here's what it looks like:

enter image description here

That exact transaction repeats at a regular interval. The yellow trace is SCL, the blue trace is SDA. How do you interpret that I2C exchange? I have my own theories, but I'm looking for an independent assessment. Given that trace, do you think the DS1307 is cooked? Do you think it's a software problem? Other ideas?

Best Answer

You probably have the target chip address wrong. You are sending 68h. Either that is not the address of the chip or it is not wired right. The two sequences you show are first a write then a read to that address. In both cases, no ACK was received so the sequence was terminated. Check the datasheet for the chip address.

Added:

I just looked in the datasheet, and the address of that chip really is 68h (page 12), so that's not the issue. That leaves something not wired right at the chip. Your scope traces look good in that a correctly wired and working chip should have responded with ACK as far as I can tell.