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

NRF52840 BLE throughput improvement

Hi everyone,
I’m using an NRF52840 device with an external 32MB flash memory. I need to send memory content to a mobile app through BLE when the user asks for.For now I send 240 bytes indications one after another, the next packet is sent when I receive the indication confirmation of the previous.As the mobile app is not developed yet, I do testing with a nRF dongle with nRFconnect.
I currently get a data rate at 40 kbps. That means it would take about 1,3 hours for a complete transfer if the flash memory is full of data…As BLE parameters for data rate optimisation, I use
  • Softdevice S140
    ATT MTU = 240 bytes
  • LE 1M PHY (tried to activate 2M PHY but I have not seen a significant difference)
  • DLE enabled (NRF_SDH_BLE_GAP_DATA_LENGTH = 251)
  • Minimum connection interval 7,5ms
  • Maximum connection interval 20ms
  • NRF_SDH_BLE_GAP_EVENT_LENGTH = 6 (not sure what I can do with that parameter. Set it equal to the connection interval ?)
I have two questions then :
-> Is there any parameters I can still modify to improve my data rate with indications ?
-> I know notifications data rate is obviously better than indications, but how can I use it to transfer a lot of data ? I mean, how can the packets be triggered one after the other in an efficient way ? I can send notifications with a regular timer and validate the interval with experimental testing, but I can’t do so for a lot of smartphones and I suppose there are BLE max rate differences between them. Without confirmation, I could miss some packets.Thank you for your help.
Parents
  • Hello,

    Notifications are multiple times faster than indications when you try to send data like this and generally equally reliable (acking and re-transmits  are handled at the lower protocol layers). And as required by spec., the connection will be terminated if a notification packet was not received after x number of failed re-transmit attempts (exact number depends on negotiated connection paramaters)

    For now I send 240 bytes indications one after another, the next packet is sent when I receive the indication confirmation of the previous.

    sd_ble_gatts_hvx() only returns NRF_SUCCESS if a notification is successfully added to the Softdevice TX output queue and you are allowed to queue up multiple notifications packet, which is something you should do if you want to optimize for max. throughput. The Softdevice will signal the application with the BLE_GATTS_EVT_HVN_TX_COMPLETE event (GATTS Handle Value Notification) after the queued notification(s) have been received by the client.

    I know notifications data rate is obviously better than indications, but how can I use it to transfer a lot of data ? I mean, how can the packets be triggered one after the other in an efficient way ? I

     You can queue up packets until sd_ble_gatts_hvx() starts returning NRF_ERROR_RESOURCES indicating that the output buffer is full, and then you can BLE_GATTS_EVT_HVN_TX_COMPLETE before attempting to queue up more packets.

    I made a throughput test example based on the ble_app_uart example earlier. I'm including it here in case you want test how fast your phone can receive notifications:

    3823.nrf5_sdk_17.0.2 - ble_app_uart_throughput.zip

    Best regards,

    Vidar

  • Hi Vidar,

    Thank you for your message. Following you recommandation, we have implemented the notification and the queue system. By doing this change, we have increased the throughput by 6 which is big improvement. It's good but still not the maximum throughput regarding SoftDevice S140 specification. To retrieve the whole flash (32Mo) we need 17 minutes which is really too long. 

    What are the other parameters that we can adjust ( connection interval / maximum number of packets per connection interval ...)?  

    Thank you

Reply
  • Hi Vidar,

    Thank you for your message. Following you recommandation, we have implemented the notification and the queue system. By doing this change, we have increased the throughput by 6 which is big improvement. It's good but still not the maximum throughput regarding SoftDevice S140 specification. To retrieve the whole flash (32Mo) we need 17 minutes which is really too long. 

    What are the other parameters that we can adjust ( connection interval / maximum number of packets per connection interval ...)?  

    Thank you

Children
Related