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

RTC synchronization between NRF52840 and PC application

Hi,

I have a NRF52840 device connected by BLE to another NRF52840 BLE USB dongle connected throw USB to a PC application.

I want to synchronize the RTC on the connected device to the clock of the PC application.

what is the most acceptable way to synchronize them?  

BR

JK

Parents Reply Children
  • Hi JK 

    jawadk said:
    What USB class are you using for the USB dongle?

    I use the app_usbd_cdc_acm_t from the usbd_ble_uart example

     In that case you would probably need to run some kind of application or script on the PC side to read the local timestamp and send it over the CDC comport. 

    jawadk said:
    the timing accuracy shall be <= 1 ms

    I doubt you can achieve accuracy down to a millisecond with this kind of setup. 

    First off a PC is not a realtime system, and you could have unpredictable latencies when trying to read the local time. 

    Then there are the latencies over the USB interface, and secondly over the wireless link. USB has a polling rate of 1ms, so you should be able to send a packet pretty quick, but packet loss can happen. Over the BLE link the shortest connection interval you can use is 7.5ms, which sets your latency, but there is also a risk that you will have packet loss over the air which will lead to further delays. 

    Possibly you can implement a system where you update the time multiple times, and take some kind of average to reduce the impact of random PC, USB or BLE delays. 

    Best regards
    Torbjørn

  • Hi Ovrebekk,

    And thanks for your help.

    I saw at the Devzone that the BLE connection interval can be 1 ms using the nRF connect SDK., is that correct !?

    I already used for my project the nRF52 SDK, is there an easy way to switch using the nRF connect SDK?

    and my application will still behave the same ?

    Remember that both the dongle and the device is programmed with the nRF5 SDK and I need to convert the two of them.

    Best Regards

    JK

  • Hi JK

    You are correct, there is a 'low latency packet mode' available in NCS (nRF Connect SDK) which allows down to 1ms connection interval. 

    There is no easy way to switch unfortunately. NCS is based on the Zephyr RTOS, and most of the API's are completely different. You will essentially have to implement your application from the ground up if you plan to migrate to NCS. 

    That being said, NCS is the platform that we are going to be developing going forward, so if you plan to migrate to later Nordic devices such as the nRF53 series you will at some point have to make the migration anyway. 

    Best regards
    Torbjørn

Related