After tracing the source code below, I found that the parameters " counterValue " and " startTime " are zeroed out during initialization; wouldn't the MCU lose time every time it reboots?
Hi @dujunqiu
You can refer to the following example code. It may serve as a helpful reference for your implementation.
S32K312: RTC- Preserving RTC counter value from getting resets once after every wakeup
Hi @dujunqiu
Please correct me if I misunderstood your question, but the RTC can actually operate in standby mode. You just need to ensure that the SIRC (Slow Internal RC oscillator) is properly configured to remain enabled during standby.
this sample can't deal my question;
chip on RTC can't runing in standby mode, it need by nvm storage time
Hi @dujunqiu
As indicated in the S32K3xx Reference Manual, Rev. 11, the chip supports RTC operation across functional resets when using the clock sources SIRC or SXOSC.
Additionally, the GPT Standby Wakeup Support ensures that the driver does not clear the interrupt flag, the interrupt enable bit, or disable the counter during initialization.
For further details, please refer to the following threads:
S32K324 RTC value not preserved after sleep
BR, VaneB