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

Sending large amount of data through BLE in minimum possible time

Hi,

I have seen some posts from

Ole

and

Hakon

about the bulk data transfer. But I have some confusions which I want to clarify before implementation.

I need to actually send large amount of data from server to client in minimum possible time.

hakon suggest to send 6 packets (6 calls to sd_ble_gatts_hvx) per connection interval? How can I adjust my transfer in between connection interval?

Is it something he just mentioned as an example? Can anyone explain this?

Also I have gone through Ole Code Snippet but have some questions in that as well:

- what is m_rr_interval_enabled and its use?

- When is BLE_EVT_TX_COMPLETE event raised?

Let's say, I have an array of 1024 bytes which I want to send into 64 chunks of 16 bytes (assume characteristic has length of 16 bytes).

Should I just call sd_ble_gatts_hvx 64 times in a while loop without waiting for anything? Will that work?

When is BLE_EVT_TX_COMPLETE event raised in that case?

Thanks

  • Hello,

    could you specify where you found m_rr_interval_enabled?

     

    Regarding the queuing of packets. Yes. You can queue up packets, but not 64 of them. typically around 6. What you need to do is to queue while it returns NRF_SUCCESS. E.g.:

    uint32_t err_code = NRF_SUCCESS;
    while (err_code == NRF_SUCCESS)
    {
        sd_ble_gatts_hvx(parameters);
    }

    Once it returns NRF_ERROR_RESOURCES (may be called something else. That depends on what SDK you are using), it means that the buffer is full, and you have to wait for the event BLE_EVT_TX_COMPLETE to queue more packets. You can queue them inside this event. 

     

    You should know that it is also possible to increase the packet size, which will decrease the time required to send the array. Larger packets means less headers/payload ratio. You should check out this example from the SDK. Play around with the parameters to see how they affect the transfer speed.

     

    Best regards,

    Edvin

     

Related