This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Retaining RTC Time After resetting NRF52840.

Hello Respected members, I have a question regarding the #nrf5-calendar example that is, is there any way to retain the NRF52 time after resetting the device. I am using the nrf_calendar example which is using RTC0 and when I reset the device the time is no longer retained ( which I have set from the GUI). Now my question is, is there any way to retain the time even after resetting the device, should I go for app_timer instead of RTC, or do I have to store the time in flash which holds the values after reset. If flash is the solution then kindly elaborate how would I save time values in flash.
Thanks and regards
Engr. Sami Ul Haq

Parents
  • Hello Sami Ul Haq,

    While it could be possible to store the date to flash, I am not sure that this would be feasible for a calendar application since the device does not know how long it has been in SYSTEM_OFF mode - so if the last thing written to flash was 60 days ago, it will not have any way to know this, and it will resume its RTC as if no time has passed.
    The only thing this would tell is with certainty is that the date and time in flash has passed, at least.

    There is unfortunately no way to resume the RTC and date-time keeping in a more accurate way through a SYSTEM_OFF, since the RTC also is off during this time. My advice would be to connect to the device following a reset, and update / synchronize the calendar time before starting operation again.

    If your application really needs to keep track of the time passed in SYSTEM_OFF sleep you might have to add an external RTC that could do this for you while the nRF is in SYSTEM_OFF sleep.

    Best regards,
    Karl

  • Hello Karl sir,

    Thank you for your reply. I got it but what will be the solution when I know the time for which the device will be in SYSTEM_OFF mode? as you said we do not know the time for which the device will be in SYSTEM_OFF mode. And I have one more thing in mind that is it possible that the time will increment/update after each second in flash.?

    Thanks and Regards,

    Sami Ul Haq

  • Sami Ul Haq,

    I got it, You are amazing Sir. For now, my concept is cleared. If there is any other doubt with the passage of time I will let you know. Please respond to my reply whenever there are any other questions. 

    Again thank you so much. 

    Kind Regards,

    Sami Ul Haq

  • Sami Ul Haq said:
    I got it, You are amazing Sir.

    Thank you for saying so!

    Sami Ul Haq said:
    For now, my concept is cleared. If there is any other doubt with the passage of time I will let you know.

    I am glad to hear that it is now clear. Please do not hesitate to open another ticket if you should encounter any issues or questions in the future.

    Good luck with your development!

    Best regards,
    Karl

  • I am glad to hear that it is now clear.

    I am glad too, to hear from you, and sorry for disturbing you. Sir, I have a question regarding the Button battery which are on the backside of the NRF52840 Development board, as you can see in the attached picture. The question is what is the purpose of that button battery ? Is it used for an external RTC or Internal RTC can also operate on that cell?  

  • The internal RTC can operate on this battery as well. Just switch the SW9 power switch to battery powered, then this coin cell battery will be used instead.
    The RTC is internal to the nRF52840, so the entire nRF52840 will need to be powered for the RTC to function.

    Best regards,
    Karl

  • I got it, Sir. Thank you so much for such an amazing explanation. 

    Kind Regards,

    Sami Ul Haq.

Reply Children
Related