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

Measure Latency on nRF52 DK (nRF52832)

Hi everyone,

Recently, I have bought two nRf52 DK, and I want to test the latency between central and peripheral in 2Mbps.

Can someone give me some suggestions about where I can start? or which example I can refer to?  Thanks a lot~

Parents Reply Children
  • Hi Kenneth,

    It is BLE.

    Best regards,

    OscarTW0410

  • Hi,

    Then the latency will be up to the connection interval, e.g. BLE can support down to 7.5ms. Though due to possible interference and packet loss it's not possible to guarantee a maximum latency, so it can potentially be N * 7.5ms in noisy environment or when you are close to the maximum range.

    If you want to measure latency you would basically need to toggle a GPIO when writing a notification on the peripheral side, and then toggle a GPIO on the central side when the notification is received. E.g. use the BLE blinky central and peripheral example as basis, and measure on an oscillscope the distance between the two edges.

    Best regards,
    Kenneth

  • Hi Kenneth,

    I used SDK16.XXX/examples/ble_central/ble_app_blinky_c/hex on Central board, and .../ble_peripheral/ble_app_blinky/hex on Peripheral board.

    I triggered button 1 GPIO by using Signal-Generator at the same time and measured the LED 3 signal. The result I got is that the delay is about 80ms. Is it correct? Or where I missed?

    Best regards,

    OscarTW0410

  • Hi,

    When a user press a button it can be by accident or debounce (ripple) may occur on the button press, to avoid that this cause multiple button presses to be logged, the application is setup with a BUTTON_DETECTION_DELAY to ensure a correct button press. This is by default 50ms. If you are interested in the actual wireless delay you should measure the time from ble_lbs_on_button_change() is called in main() on the peripheral to the LED toggled on the central.

    However in this case you will also notice that MIN_CONN_INTERVAL is by default set to 100ms, this will of course not be ideal if you are concerned about latency, so make sure it is 7.5ms on both central and peripheral.

    Best regards,
    Kenneth

Related