bigjosh / TSL

CW&T Time Since Launch
https://cwandt.com/products/time-since-launch
Other
13 stars 6 forks source link

"ClockError” failures after programming #52

Closed bigjosh closed 5 years ago

bigjosh commented 5 years ago

DESCRIPTION: A programmed TSL will show “ClockError” some time after it has been programmed.

IMPACT: This would be a sucky problem if the “clockerror” happened after the unit shipped, or (worse) after the trigger was pulled.

CURRENT BEST THEORY: I think due to variance maybe the RTC backup capacitor is sometimes not getting fully charged before we program the start time and then reset the low voltage flag in the RTC. Int his case, since the voltage was still low when we reset the flag, it would just instantly get set again. We only check this flag when the XMEGA resets, so we do not notice until the next reset – which thanks to the problem below actually can happen spontaneously with some static. If this turns out to be the case, then the spontaneous reset issue was actually a lucky break because it helped uncover this issue!

MITIAGTION STRATEGY: I just pushed a new firmware P0.7T that uses a 2-prong approach…

Firstly it uses a transistor that is built into the RTC to connect the backup capacitor to the battery for 1 second before resetting the low power flag. Hopefully this should make sure that the voltage on that cap is high enough that the RTC will not see a low voltage after we reset the flag.

Secondly, it causes a software reset immediately after setting the start time to the RTC. The idea here is that we will fail fast and at least catch any failure cases where the low voltage flag is still set by testing it during the programming sequence rather than whenever the next reset happens to occur.

bigjosh commented 5 years ago

Resolved by letting the battery charge for a second before setting the time in 7a799e7b1bf7fc59ed855c384ab2b735c93e7ac9