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

Synchronisation with advertisement

Hello,

Im trying to create a synchronisation method for sensors using BLE. At the moment i can synchronise them within 10ms accuracy, in theory it should be within 2ms and i can not find this 7ms extra delay. This is my current synchronisation method:

At the sensor(using S110) i'm using the 16 bit timer1 with a resolution of 4us. I'm using a compare match to increment a variable(uint16 msec) within the time it overflows in this case 125ms. Just before the radio gets active(radio notification) i'm reading the current timer1 register and put this in another variable(uint16 usec) and set these time values in the manufacturer specific advertise data. So i'm now sure each time before the radio gets active a new value will be advertised. The advertising interval is set to 1s.

Now at the S120 device im scanning 100% so almost each second it will receive the timing of the sensor. I've measured this with the oscilloscope by setting a pin high when sending at sensor and receiving at S120 device. I've seen a variable delay of Δt 2ms this is noticed as the S120 scans on channel 37,38,39 (1ms inbetween these channels). Immediately after i've received the timing value from the sensor I read the timer1 register of the S120 device and calculate the difference between the S120 and sensor(S110). Now at the next compare event of the S120 device i'm setting a new compare register at timer1: normal compare register + difference (i've calculated the min / max of difference and this is within the timers resolution).

Now in theory i would expect to see a constant delay + Δt 2ms from scanning on 3 different channels. In fact i see the Δt differ within 10ms. Is there anything im missing? Hope someone can help me with this. I've attached some pictures showing the sensor and S120 device timer compare interrupt and zooms.

Regards, Pascal

2014-04-25 11.39.06.jpg

2014-04-25 11.39.57.jpg

IMAG0624.jpg

Advertise.jpg

Parents
  • Made a little progress on this case: i keep reading the timer in my main loop and set this time as advertising data instead of using the radio notification(like in my posts before). So it keeps updating the advertising data until it cannot update anymore because the radio gets active. The synchronisation protocol works much better in this way: most of the time i can see a synchronisation of Δt = 2ms. Sometimes i see a little jitter towards 10ms, but still cannot explain this.

    My question to Nordic: Is the softdevice causing this unexpected delay? Why does the radio notification not give me a constant delay?

  • Softdevice was not causing this delay. My radio notification was to short, so my current advertisement was sent next adv interval. Setting radio notification towards max solved my problem. Im now able to synchronise two devices within an accuracy of 2ms. Nordic told me in future stack release they will implement a way you can advertise on only 1 channel, so 2ms error can be eliminated in future. Hope this helps others

Reply Children
No Data
Related