I’ve had the same issue on CWX, tested the battery has plenty of juice figured I’d just made a wrong call somewhere but haven’t bothered with much testing yet, other items are higher priority atm.
You said it hapens “sometimes”. Can you provie more details?
A basic test is to set the clock, power off the board. Power on and then read the time. This test should work fine, so what test can make this break?
Microt, I suppose you have your own hardware.
Do you have the battery directly connected to the VBAT? can you try to add a big capacitor (like 220uF) between VBAT and the ground? This is just to ensure that the VBAT has a continuous voltage supply.
My EMX board works fine. I made a screen to set the time with, which works and survives power cycles completely. On my Cobra, however, this is not the case. Unplugging the USB for any length of time sets the clock to 1977. This is a new Cobra so I can’t believe the battery is dead already.
It’s a bit annoying that the RealTimeClock.IsTimeValid is no longer itself valid as that could be useful for telling if the user needs to set the clock or not.