DS3234 RTC

Hello-

I'm trying to understand the code example that is referenced for my DS3234 RTC. The reference code is available here: https://cdn.sparkfun.com/datasheets/BreakoutBoards/DS3234_Example_Code.pde

The DS3234 data sheet is located here: http://www.sparkfun.com/datasheets/BreakoutBoards/DS3234.pdf

My question is about a statement in the RTC_init() routine:

SPI.transfer(0x60); //60= disable Osciallator and Battery SQ wave @1hz, temp compensation, Alarms disabled

If I understand it right, 0x60 equals binary 01100000

The DS3234 registers are:

| Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 |
| EOSC | BBSQW | CONV | RS2 | RS1 | INTCN | A2IE | A1IE |

What I don't understand is how 0x60 will "disable Osciallator and Battery SQ wave @1hz, temp compensation, Alarms disabled". Can someone please help me understand a little better than I do?

Look at page 14 of the datasheet.

http://www.maximintegrated.com/en/products/digital/real-time-clocks/DS3234.html#popuppdf

Hi Outsider-

Thanks for the link. That’s where my reference for the registers came from. If 0x60 is supposed to disable the oscillator and battery square wave, then 01100000 wouldn’t do that… I don’t think.

It looks like the comment is wrong.

It also appears to be bad code since one should check to see if a conversion is already in progress before requesting one. And why would you even need to do that in the init routine?

As a default at initialization I would either send nothing or maybe 0x00 or 0x40.

Indeed, jboyton. Those were my thoughts, but I needed some validation since I’m new to Arduino programming. Thanks for taking the time to look at it with me.

You have to look at those free libraries carefully. Some are good; others not so much. That sparkfun library doesn't read the time registers correctly. It should be done in a burst read.

I don't know what the best DS3234 library is. When I looked on github I found several that were not very impressive. But there must be a good one.

I ended up just writing my own code to do basic communication with the chip. It's not that complicated.