Nordic Serialisation: BLE_GATTS_EVT_HVN_TX_COMPLETE event is getting delayed

Hi,

I am calling sd_ble_gatts_hvx() api every 100 milli second. but BLE_GATTS_EVT_HVN_TX_COMPLETE event is coming a little late. Initially, for few seconds, this is not observable that much. But after sometime, it is like, I will call sd_ble_gatts_hvx() but BLE_GATTS_EVT_HVN_TX_COMPLETE event won't come, I will call sd_ble_gatts_hvx() again after 100ms. Like that 3,4 times happens. Then BLE_GATTS_EVT_HVN_TX_COMPLETE start coming, all at once. I mean, for the previous 3,4 sd_ble_gatts_hvx(), the BLE_GATTS_EVT_HVN_TX_COMPLETE will come in groups, all at once. And in remote device also, it is happening that way. Like, in remote device the gatt characteristic change is coming as a burst.(It is not coming in regular 100ms interval. Instead after 300, 400 ms it will get all the 3,4 previous update as a burst).

Is there any possible cause for  sd_ble_gatts_hvx() to behave this way?

Parents
  • Hi Dhilshad, 

    We haven't seen any report related to this issue. How often do you see this ? 

    Could you try to capture a sniffer trace so we can see what happens over the air ? 

    When you call sd_ble_gatts_hvx() have you checked if the function return NRF_SUCCESS ? 

    Could you give some more information about the connection interval ?  How did you observe that BLE_GATTS_EVT_HVN_TX_COMPLETE  was delayed, did you use UART log ? Could you try to toggle an LED and then use logic analyzer to check instead? 

    Note that BLE_GATTS_EVT_HVN_TX_COMPLETE  only return after each connection event when there is a HVN tx packet sent, not right after the packet is sent. 

  • For me this issue is always.

    We haven't seen any report related to this issue. How often do you see this ? 


    For me the issue is always

    When you call sd_ble_gatts_hvx() have you checked if the function return NRF_SUCCESS ? 

    sd_ble_gatts_hvx() function is returning success only

    Could you give some more information about the connection interval ?  How did you observe that BLE_GATTS_EVT_HVN_TX_COMPLETE  was delayed, did you use UART log ? Could you try to toggle an LED and then use logic analyzer to check instead? 

    Min Connection interval is set to 400 and Max to 650.
    The delay is observed from logs and also from the remote device. I mean, I am calling sd_ble_gatts_hvx() every 100ms regularly, but BLE_GATTS_EVT_HVN_TX_COMPLETE is not getting in regular interval. Instead for 3,4 sd_ble_gatts_hvx() API calls, BLE_GATTS_EVT_HVN_TX_COMPLETE is coming as a burst. What I am expecting is, if I call sd_ble_gatts_hvx() at 100 regular interval, I should receive BLE_GATTS_EVT_HVN_TX_COMPLETE at regular interval of 100 ms. Not like no BLE_GATTS_EVT_HVN_TX_COMPLETE event for some time, then after sometime, 3,4 BLE_GATTS_EVT_HVN_TX_COMPLETE events comes within 20,30 ms, like that.
    In remote device also, the update is received like this only. For some time there is no gatt attribute update, then after few milliseconds, the update of last few 100ms will come within 20,30 ms. (I have tried multiple remote device, and also tried with nrf android app as remote device, still the issue is there. So issue seems to be at the sender only)

    Note that BLE_GATTS_EVT_HVN_TX_COMPLETE  only return after each connection event when there is a HVN tx packet sent, not right after the packet is sent. 

    I didn't get this point..could you please elaborate or reword

  • Hi Dhilshad, 

    If you have the connection interval of 400ms and max 650ms, how would you expect the BLE_GATTC_EVT_HVX comes at the interval of 100ms ? 

    If you have an interval of minimum 400ms, you should expect an interval of BLE_GATTC_EVT_HVX event at least 400ms. 

    dhilshad said:
    I didn't get this point..could you please elaborate or reword

    Please have a look at this message sequence chart. 

    According to the chart BLE_GATTS_EVT_HVN_TX_COMPLETE event  will not return immediately after you successfully call sd_ble_gatts_hvx() it will return after the notification is sent from the peripheral to the central. 

    In addition, please find a better way to measuring the timing. I would suggest to use GPIO toggling to do so. If you simply use the UART log to measure, it may not be accurate due the fact that printing log is not real time. 

Reply
  • Hi Dhilshad, 

    If you have the connection interval of 400ms and max 650ms, how would you expect the BLE_GATTC_EVT_HVX comes at the interval of 100ms ? 

    If you have an interval of minimum 400ms, you should expect an interval of BLE_GATTC_EVT_HVX event at least 400ms. 

    dhilshad said:
    I didn't get this point..could you please elaborate or reword

    Please have a look at this message sequence chart. 

    According to the chart BLE_GATTS_EVT_HVN_TX_COMPLETE event  will not return immediately after you successfully call sd_ble_gatts_hvx() it will return after the notification is sent from the peripheral to the central. 

    In addition, please find a better way to measuring the timing. I would suggest to use GPIO toggling to do so. If you simply use the UART log to measure, it may not be accurate due the fact that printing log is not real time. 

Children
No Data
Related