replacing crystal with TCXO

jboyton:
Yes, do a burst read like the datasheet suggests and like the Maxim example code does.

You don't have to do it for other multi-byte transfers. Since the address auto-increments with each read or write a burst is both convenient and more efficient. But it's your choice.

When writing to the time registers you still have a potential issue of a rollover while in between writing the different bytes. This is dealt with by the fact that writing to the seconds register resets the internal sub-seconds counter to zero. Then you have a whole second to write the other time/date registers before any rollover is possible. So if you just write the seconds register first you'll be fine. I think you are currently doing that.

I wish Maxim had exposed that sub-seconds counter instead of just the seconds. It's one of the reasons I chose not to use the DS3234.

Interesting thing: Either I did something wrong or else reading all registers at once with CS low DOES NOT WORK!!!

As you know, I used the function "_command()" for all data transfers. That function brings CS low, transfers 16 bits of SPI data, then raises CS again. The functions that read or write the clock registers call "_command()" 7 times, resulting in CS being toggled once for each register being read and therefore raising the possibility that a register could roll over during the block read.

So, I tried to do this:

(before)

// read 7 bytes of raw clock data to buffer
void DS3234::_read_time (void)
{
    uint8_t x = 7;
    while (x--) {
        *(_buffer + x) = _command ((0x00 + x), 0x00);
    }
}

(after)

// read 7 bytes of raw clock data to buffer
void DS3234::_read_time (void)
{
    uint8_t x = 7;
    *_SS_PORT &= ~_SS_BIT;
    while (x--) {
        *(_buffer + x) = _spi_transfer (x << 8);
    }
    *_SS_PORT |= _SS_BIT;
}

(note that using the SPI transfer, the command for read is simply "(((0x00 + x) << 8) | 0x00)" which reduces to "(x << 8)" in case it looks strange).

Anyway, this doesn't work! The seconds read back, but when they roll from 59 to 00, the minutes do not increment (nor do the hours). I even tried using "for (x = 0; x < 7)...." to reverse the order of the read - no difference.

Am I doing something wrong here?