For the MIMXRT1062, how can I tell whether the SRTC has been started. I want to create a one-time setup and run function that will only initialize the LP SRTC the first time it runs after a product is manufactured. After that, it will be left alone on subsequent reboots. The product can always change the time later, but only when the product gets it from the cloud.
Hello Jeffery,
The only way to know for sure that SRTC has been started is by enabling RTC_EN bit. If you check our SDK drivers you will find SNVS_HP_RTC_StartTimer API that does the following to make sure the RTC was correctly enabled.
/*!
* @brief Starts the SNVS RTC time counter.
*
* @param base SNVS peripheral base address
*/
static inline void SNVS_HP_RTC_StartTimer(SNVS_Type *base)
{
base->HPCR |= SNVS_HPCR_RTC_EN_MASK;
while (0U == (base->HPCR & SNVS_HPCR_RTC_EN_MASK))
{
}
}
Hope it helps!
Best regards,
Felipe
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Thanks, Felipe!
Jeff Thompson | Senior Electrical Engineer-Firmware
+1 704 752 6513 x1394