Saturday, February 26, 2011

Checking out the DS1307 RTC with Bus Pirate

Today I am checking out the functionality of the DS1307 with Bus Pirate.  I am supplying power and clock from the Bus Pirate board so +5/Gnd, MOSI/CLK are the only required pins.   Here is the setup:


I set Bus Pirate to I2C at 50khz and turned on the power:
HiZ>m
1. HiZ
2. 1-WIRE
3. UART
4. I2C
5. SPI
6. JTAG
7. RAW2WIRE
8. RAW3WIRE
9. PC KEYBOARD
10. LCD
(1) >4
Mode selected
Set speed:
 1. ~5KHz
 2. ~50KHz
 3. ~100KHz
 4. ~400KHz
(1) >2
READY
I2C>W
POWER SUPPLIES ON
I2C>
Now I should be able to search for the device on the I2C bus and it finds the device at 0xD0, 0xD1 as expected, so at least it is responding.
I2C>(1)
Searching 7bit I2C address space.
   Found devices at:
0xD0(0x68 W) 0xD1(0x68 R)
I2C>
Now, I try to read four bytes from the DS1307:
I2C>[0xd1 rrrr]
I2C START BIT
WRITE: 0xD1 ACK
READ: 0x00 ACK
READ: 0x00 ACK
READ: 0x01 ACK
READ: 0x01 NACK
I2C STOP BIT
I2C>
So, it looks like things are working, yay!

No comments:

Post a Comment