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

Low level clock

Hello,

I need time synchronization between the two devices. At the same time I want to use the standard means of bluetooth, synchronizing the clock of the connected devices with each other.

Am I able to get the time from the lower level through interaction with a stack (s132)?

For example, when working on the HSI level, there is a command to reset time for handle:

BOOL HCI_Read_Clock (WORD wConnectionHandle, BYTE byWhichClock).

Thanks.

  • HCI is not supported by Nordic stack and all upper layers have no concept of time, just asynchronous calls and events. You can still do it over L2CAP or GATT with some custom protocol but due to stack processing and delay between radio interrupt on LL and event callback to your FW there is limit how precise the time synchronization could be (statistically). I would say safely below 10ms, probably even somewhere around 1-2ms. Good for most of usual "clocks" for humans but probably not enough for any precise measurements and automated applications.

  • In addition to what endnode already explained, another issue is that if a packet is missing it will be re-transmitted and it will mess up with time synchronization.

    I would suggest you to use extra channel to do time synchronization, either by an advertising packet or by proprietary protocol such as ESB. To have full control of the timing when sending the advertising packet, you should use timeslot API.

    Using ESB concurrently with BLE for time synchronization is explained here.

  • Many thanks, I will definitely read and try to understand.

Related