How it is possible to be sure that the value I received from the RTC via RTC_GetCounter() is valid/plausible ?
On the V_bat Pin is a Goldcap (capacitor) which should buffer the voltage for the RTC for some hours in case of power failure, which works fine as long as the voltage is within the spec. (more later). When I force a quick voltage drop with a resistor and then power on the system I become "random" values sometimes only 100 ticks away (100 ticks before! the last value I seen in operation mode) from the right time and other 200000 ticks away. E.g.: system ok: RTC value = 15000 Vcc = 0, Vbat > 1,8 V: RTC value is plausible after power up the system Vcc = 0, Vbat < 1,8 V: RTC value is NOT plausible after power up the system (RTC value = 5000)
One idea was to use the tamper pin, which could erase the BKP-Registers at a transition from HIGH to LOW at the Tamper Pin, when Vcc = 0V.
But here is my problem: - At what voltage will the tamper event happen ? It should happen at 1.8 V (spec. RTC+BKP domain) I can't find any useful stuff in the ST documentation about this.
I made some measurementes. Sometimes the BKP register are not cleared when "Vbat < 1.6 V", other times the register is cleared at "Vbat = 2.4 V".
Thanks for help.