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

How do i get whole 31 byte BLE notification data at once?

In BLE notification i am getting 31 byte data but it comes in two packets 20 byte + 11 bytes continually.How do i get last 11 byte data which comes in 2nd packets after 2s time interval so that i can able to merge these two packet and make a array of 31byte at once?

  • FormerMember
    0 FormerMember

    As defined in the Bluetooth core specification v.4.2, vol 3, part F, chapter 3.4.7.1, the maximum amount of data per notification is 20 bytes.

    Since the 2nd packet is transmitted 2 seconds later, I assume that your connection interval is 2 seconds. The S130/S132 v.2.0.1 supports up to six packets per connection interval, so it is possible to achieve much faster transfer than what you experience: When calling sd_ble_gatts_hvx(..) it will return NRF_SUCCESS or an error code. If it returned NRF_SUCCESS, the data will be put in a TX buffer and the application will receive the event BLE_EVT_TX_COMPLETE when the notification has been transmitted. There may not be one BLE_EVT_TX_COMPLETE event for each packet, but when a BLE_EVT_TX_COMPLETE event occurs, but the event contains the number of packets that was transmitted, see this message sequence chart.

    For a fast transfer of data, you can therefore loop over sd_ble_gatts_hvx() as long as it doesn't return any error.

Related