You are here

Using the RTC8564

If you have come across the RTC8564 Real Time Clock, made by Epson, you know it is a nice alternative to the Dallas DS1307RTC. I have not found the DS clock floating around Akihabara, but Akizuki Denshi carries the Epson part mounted as a through hole module. So I figured I should give it a try. It can't be too hard to interface, since they are both I2C.
I started playing with it, but could not find a library for it on the net. There are several libraries out there for other RTCs but this one was left out in the cold for some reason. I DID stumble upon a Japanese site with some code examples for PIC, which was a bit helpful.
The biggest help actually turned out to be comparing the data sheets for both the Epson and Dallas part. The product ID is of course different. The time fields on the Dallas chip start at zero, with the start stop control bit in the high byte of the seconds field. On the Epson, the time fields start at address 0x02, with the address 0x00 and 0x01 being control registers (the start stop bit is in there).
The nice thing was that in both parts, the field order was the same. So I figured I could find any library for the DS1307RTC, and simply change the product ID, time field start address, and clock bit to get it working. I would hack out alarms and the interupt output later. I picked up the Arduino Time library. Next, I copied the DS1307RTC folder, and renamed it RTC8564. From here, I edited all references with the .cpp and .h files from DS1307RTC to RTC8564.
Finally, I went through the .cpp file and changed all the addresses. With the library in order, I loaded up an example in the Arduino ide and changed the include to reflect the new library, verified and uploaded.... and..... nothing. After much confusion, Akiba from FreakLabs.org reminded me that the I2C pins have internal pullups, but the library may not be enabling them. So I soldered the jumper pads on the clock and prestochango, Arduino knows the time! I am attaching a zip of the modified library.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer