nrf52 time synchron packet not arrived after BLE reconnect

hi,

I use softdevice s140 and nrf5_sdk_17.1. 

I import time sync demo from here (github.com/.../nRF5-ble-timesync-demo) to my project. 

My first usage version:

* nrf52 devices initalize and enable time sync library at startup

* a mobile phone connect to them and set one of them as timesync master

After that time synchronization works well. But if mobile phone reconnect randomly happen that time sync packets not arrived to slaves anymore (usually this happens sometimes everything remains ok). I cannot figure why this happen so I modify my usage:

* time sync library enable not start sd_radio_session

* when BLE connection established sd_radio_session is started and timeslot requested

* when BLE disconnects sd_radio_session is closed

After this modification time synchron packets arrived to slaves continuously if nrf52 device connects first to mobile phone which will be the time sync master. 

If time sync master reconnects none of slaves get more time sync packets. After that slave which is reconnect start to get time sync packets again. 

So my expericen with this second case that time sync packets arrived to slaves which are connected later than time sync master.

Any help would be appreciated.

Parents
  • Hi Attila,

    Audun had some time to test this code and his observations are that, it appears to be a case of MPSL scheduling not aligning properly with the time sync radio packets. Your code uses a 25 ms advertising interval, and with the advertising randomness, Audun suspect there is simply too many scheduling collisions to get a useful number of received sync packets.

     Increasing the advertising interval to 100 ms (mAPP_ADV_FAST_INTERVAL = 0x00A0), things improve quite a bit. The receiver has no long pauses in packet reception now, but I do see the rate of packet reception goes a bit up and down.

    In the test code you need to calibrate the advertising interval and in your main code you need to fine tune the BLE activity to be able to have less timeslot collisions, Ideally the time sync code should be updated to make the radio RX actively align with the TX. In its current form, the receiver always tries to keep the radio in RX as much of the time as possible, while the transmitter only requests MPSL timeslots when it needs to transmit packets (which is a fixed interval). Updating the time sync code is a bigger task than just trying to calibrate the BLE parameters and advertising interval.

  • Hi,

    I test what you mention but not solved the problem for me. But during advertising time sync packets arrived, the problem starts after both device is connected and sync packet sender connects later. 

    Changing the sending frequency from the default 30 to 150 (ts_tx_start()) solves the problem. But maybe is there a better solution?

  • AttilaEgri said:
    Changing the sending frequency from the default 30 to 150 (ts_tx_start()) solves the problem. But maybe is there a better solution?

    Not at this point unfortunately. 

Reply Children
No Data
Related