This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF52 RTC Update Issue

Hi,

I'm using nrf52832 to interface RTC using nrf_calendar.c file.

I have start the RTC at 8:59:00, it will reaches 9:00:00. After that automatically it will resets and again start from 8:59:00 upto 9:00:00.

It repeats same operation.

Intialize the RTC time only once in the main().

Kindly give the solution as soon as possible.

Thanks & Regards

Senthilkumar

  • Hi 

    If I understand you correctly you have integrated the nrf_calendar.c file in a larger project?

    Could there be some other issue with the application that leads to a system assert and a reset?

    What about the watchdog, is it enabled?

    When you say that you "start the RTC at 8:59:00", how do you configure this?

    Best regards
    Torbjørn

  • Hi,

    Thanks for your reply.

    RTC configuration.

    #define CAL_RTC NRF_RTC2
    #define CAL_RTC_IRQn RTC2_IRQn
    #define CAL_RTC_IRQHandler RTC2_IRQHandler
    #define CAL_RTC_IRQ_Priority 3

    To Configure RTC time using nrf_cal_set_time(19, 10, 16, 8, 59, 00);

    Read RTC data in while loop using strftime(date_time, 9, "%X", nrf_cal_get_time());

    WDT is not used.

    But, i have two I2C devices.

    Thanks & Regards

    Senthilkumar

  • Hi

    Are you able to run the debugger and see what happens?

    If you put a breakpoint at the start of main you should be able to detect if the code resets during execution. 

    Also, if you have any error handlers in the application, see if they are called when the application is running. 

    Best regards
    Torbjørn

  • Hi,

    reset problem is solved.

    my project is based on date & time. So,need to check date & time, do some functions then device enter into sleep mode.

    Note: date and time update till the battery power down (or) Change by coding 

    which type of RTC is suitable for my project? 

    internal RTC means (App_timer based RTC or RTC1 or RTC2)?

    external RTC?

    kindly give the solution.

    Regards,

    Senthilkumar

  • Hi 

    Good to hear you figured out the reset issue Slight smile

    By internal RTC I assume you mean internal LF clock?

    Whether you are using app_timer, RTC0, RTC1 or RTC2 you have the choice of using the internal 32kHz RC oscillator, or using the external 32kHz crystal. 

    The external crystal will usually have an accuracy of 20ppm or better, which means you are looking at a worst case clock drift of 1.7 seconds pr day. 

    The internal LF oscillator is way less accurate, and can cause minutes or hours of drift every day, so I would not recommend using this if you need to keep track of time. 

    It is important to know that the external LF crystal is optional on nRF52 based designs. The development kits have a crystal included, but if you make your own PCB, or buy some third party module, the crystal might not be included. 

    Best regards
    Torbjørn

Related