BLE HID latency - time between sd_ble_gatts_hvx() to BLE_GATT_EVT_HVN_TX_COMPLETE

Hi guys. I'm using https://infocenter.nordicsemi.com/index.jsp?topic=%2Fstruct_sdk%2Fstruct%2Fsdk_nrf5_latest.html

nRF5 SDK v17.1.0 HID Mouse Application and I read this thread  Latency

It says

you may for instance measure the time between sd_ble_gatts_hvx() to BLE_GATT_EVT_HVN_TX_COMPLETE event.

If BLE_GATT_EVT_HVN_TX_COMPLETE is generated, does this guarantee that nRF52's TX pool is flushed? Meaning, everything in the TX pool is sent to the BLE client?

Also, if you compare the timing,

T1 = when BLE_GATT_EVT_HVN_TX_COMPLETE is generated from nRF52

VS

T2 = time when BLE client received mouse report / mouse movement is shown due to HID input report notification

is T1 and T2 identical? Are there data about T1 - T2 when using 7.5ms connection interval with an Android phone at 1M or 2M PHY?

Thank you for your awesome help!

  • Hi Matthew, 
    You can take a look at this message sequence chart to have an overview of the BLE_GATTS_EVT_HVN_TX_COMPLETE event: https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.3.0/group___b_l_e___g_a_t_t_s___h_v_n___m_s_c.html?cp=5_7_4_1_2_4_3_5

    Basically the BLE_GATTS_EVT_HVN_TX_COMPLETE is sent from the softdevice to the application to notify about the number of TX packets it sends in the current or last connection event. 

    It doesn't guarantee that the TX buffer in the softdevice is flushed. There can be more packet in the buffer. It also doesn't guarantee that there will be one BLE_GATTS_EVT_HVN_TX_COMPLETE event for each TX packet. There can  be one event for several packets if they are sending in the same connection event. 

    T1 and T2 doesn't have to be identical. As I said the notification may come after multiple of TX packet has been sent. But as far as I know it will not wait until the next connection event. So it will be sent either during a connection event or at the end of the connection event. It will not combine the event for multiple connection events. 

Related