2022-05-27 02:37 AM
I have the following setup:
I need to implement RTC synchronization over BLE, and my initial approach is following:
I know that the timing for the write to characteristic operation is random. It will happen on the next connection interval, and it may be repeated on the MAC layer in case it failed.
In order to measure the round trip time (RTT), I set the RTC BLE characteristic using ATTR_ACCESS_WRITE_REQ_ONLY. After B device receives data on the characteristic and sets its RTC it calls aci_gatt_write_resp which should in return send a write response to A and generate aci_gatt_proc_complete_event_rp0 in A's BLE stack.
The idea behind measuring the RTT is that I can repeat the whole procedure in case the RTT is too big. Using the described approach the RTT I measure is usually 22ms or more. I was expecting it to be 2xconnection interval time (2*7.5ms = 15ms) in the worst case, but it looks like it's 3xconnection interval time.
My goal is to achieve under 10ms RTC time synchronization.
1 - Is there anything I can do to get better control over the timing when the packet is sent over BLE if I am using the GATT layer?
2 - Is there any other way to make a similar procedure using STM32WB's radio and perhaps avoid the GATT layer but have this process run much faster? Nordic's SoftDevice API provides Timeslots API which can be used for the above. Is there any similar functionality in ST's BLE stack provided to the end-user?
2024-08-21 05:21 PM
I am facing a similar problem. Could please share with me hold did you implemented your code?