RTC drift

I have a couple of dataloggers using the old IMP001 module. I’ve noticed some RTC drift in all of them; in the one I analyzed in detail just now, the RTC is ahead by about a minute (after running for maybe a year), which unfortunately messes up my readings.

Now from what I read, the imp is supposed to sync its clock when it connects to the agent, which happens roughly every hour with my devices. Clearly that’s not happening, but maybe it’s because I’m doing something wrong? I’m currently sending two messages to the agent, then going to sleep again in onidle(), the idea being to save as much power as possible, so I can get a few months of runtime on a battery charge.

I’ve noticed the clock does get synchronized when the device is powered down and back up, but not when deploying new firmware.

Anyway, is there something I can do to make sure the RTC gets synchronized properly?

That’s quite strange. Could you PM your firmware so we can try to replicate?

As an experiment, trying to delay going to sleep by (eg) using imp.wakeup(3,x) vs imp.onidle(x) might be worth trying.

Thanks for your answer. I’ve implemented your suggestion of delaying the sleep by 3 seconds, I guess I’ll know in about a month whether it makes a difference. It seems there’s not a lot I can do to debug this, the whole RTC updating process is well hidden from me :slight_smile:

Anyway, I’ve sent you the firmware I’m using in PM, I fear there’s quite a bit of simplification required for you to build a test case.

I don’t know if you can do this, but if you can listen in on the messages exchanged between my imps and agents, feel free to do so if you think it helps.