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

Nordic Calendar example (https://github.com/NordicPlayground/nrf5-calendar-example) related issue

I wanted to implement a time sync feature on nRF-52840 DK. I took a reference from this example, but there were certain things unclear to me.

Can somebody explain to me what is calibrated and uncalibrated time here? and what exactly are we doing here in this example?

Parents
  • In this example, a calendar is periodically synced with an outside time-stamp. It does not cover how you obtain the outside time-stamp, just how you can use it to update the calendar. 

    As the calendar uses the RTC as it's base clock, it will experience a fair amount of drift, +/- 10-20ppm at best, and will need to be periodically calibrated/synced. 

    I believe the uncalibrated time is the current time of the calendar, and the calibrated time is the provided synchronization time-stamp.

  • I flashed this example on an nRF52840 DK and I got this output on serial

     when I use the get function(option g) to get the time, I get this as the output where the calibrated and the uncalibrated time is the same.

     next, when I use the run continuous-time updates (option r), I get a time difference of 4 seconds every time and I just don't get it that why is there such a big difference.

    Later I set time to current time and then tried to run continuous-time updates (option r) and still there is a time difference of 4 seconds.

    can you please explain this behavior?

  • Hmm, I'm at a loss.

    A colleague in tech support made that example, but he's away until Monday, can you wait until then? 

  • okay,

    but please get back to me when he comes back.

  • Hi

    I will take over this case since I wrote the example in question. 

    The calibrated time function doesn't really work well unless the call to the set time function happens at exactly the time you indicate. 

    This is hard to do when inputting the time manually from the terminal, but should work better if you set the time programatically in the code. 

    The idea is that if you set the time twice from some accurate external source, and there is some constant drift in the timers in the nRF52, the calibrated time will take this into account. 
    Please be aware that this library is not an official library, and just something I wrote to illustrate how to read date and time. The calibrate function has never been tested properly in a real use case, so I can not guarantee that it works very well in practice ;)

    Best regards
    Torbjørn

Reply
  • Hi

    I will take over this case since I wrote the example in question. 

    The calibrated time function doesn't really work well unless the call to the set time function happens at exactly the time you indicate. 

    This is hard to do when inputting the time manually from the terminal, but should work better if you set the time programatically in the code. 

    The idea is that if you set the time twice from some accurate external source, and there is some constant drift in the timers in the nRF52, the calibrated time will take this into account. 
    Please be aware that this library is not an official library, and just something I wrote to illustrate how to read date and time. The calibrate function has never been tested properly in a real use case, so I can not guarantee that it works very well in practice ;)

    Best regards
    Torbjørn

Children
Related