15 - 20 mS still seems like a large error to me. There are allot of internal registers in the chronodot, so maybe with library overhead it takes that long to get the stuff written. Maybe the library will let you set only the seconds alone which should be a lot faster to do. You could do the slow call to set everything and then sync the second on a subsequent GPS edge. I don't see why you can't get the error to less than 1mS.
I would agree with you. I'm going to look into the library and copy out some of the code and modify it for my own time sync.
Ok, on the GPS rising edge, that agrees with what I saw out there. Do you find that the chronodot is making a falling edge when the GPS is doing a rising edge?
I setup my interrupts for the Chronodot and the GPS with this:
attachInterrupt(1, pps_interrupt, RISING);
attachInterrupt(0, rtc_interrupt, FALLING);
and the time from both looks to be in sync.
How are you measuring the sync accuracy, do you have a scope?
Am not using a scope. Do not have one. In each of my interrupts I keep track of micros() and I just subtracted the 2 numbers to see the difference between the 2 interrupts.
rtc_micros = micros();
sqw_led_state = false;
sqw_led_state = true;