DS3234 RTC Library

Hi, I was wondering if anyone had a code or library that they used for their DS3234 RTC.
If not, could you guide me towards making a suitable Arduino code/library in order to interface with this SPI device?

The device: Real Time Clock - DS3234 - COM-10079 - SparkFun Electronics

Also, I understand that there is already an Library for the DS3231, which is the I2C version of what I have, however it is using the wire.h library.
Perhaps you could teach me how to extract certain bits from that code to work with SPI.

DS3231 Codes:
chronodot [macetech documentation] (bottom of page)

Oh and thanks in advance! :slight_smile:

Not a lib for the DS but there exist a SPI lib - Arduino Playground - HomePage - that could get you started ...

Furthermore the ethernetlib is rewritten using the spi lib so that is a good source for how to do SPI

Hopes this helps

Thanks, that gave me a head start!
I eventually found some code for the DS1306, which is also SPI.


I compared the datasheet of both and they both use very similar BCD addressing for both chips. Therefore the code was usable. I took an indepth look at the code and found no reason why it wouldn't work with the DS3234 chip.

However, from the serial window, it read 0 sec 0 hours, 0 year.... meaning that it didn't work.

Can't tell if it is because I need a different code or whether my chip failed after soldering.

Is there any way to test if the chip works without necessarily needing a specifically designed code for it?
Is there something I need to change in the DS1307 code to make it work with DS3234?

DS3234 Datasheet: http://datasheets.maxim-ic.com/en/ds/DS3234.pdf

(not dived into it)
Maybe the 1306 library has some identification to check it is an 1306 and return 0 otherwise? I know that temperature sensors in the DS18XXX series have such a signature… You have to compare the datasheets fo details, maybe not the most fun but you might learn quite a lot.

update; noticed this line so maybe the chip just isn’t enabled???
digitalWrite(RTC_CHIPSELECT,LOW); //disable RTC

update; the PDF of the 3234 descriobes the control register when the oscillator runs. MIght be thing to read.