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

nRF51822 S110 - TX Buffer leak when disconnected by Central?

I have a problem within the following szenario:

  • I transfer data from my nRF51822 Peripheral to a connected Central (Android App) as a bunch of Notifications with maximal throughput (sending Notifications until sd_ble_gatts_hvx() returns BLE_ERROR_NO_TX_BUFFERS). Using my Samsung SM-P605 (Android 4.3) as Central, this transfers about 4 packets for each connection interval.
  • During this »full power data transfer«, the Central initiates a disconnect
  • When now doing a new connection between Central and Peripheral, the data transfer became very slow. In each 2nd connection interval there is only 1 notification packet transfered.
  • When performing an additional disconnect / reconnect, the transfer looks good as the at the 1st connect.
  • I'd tested with some different Android Centrals (different devices like Samsung, Nexus, Sony, Htc and different Android versions 4.3, 4.4.2 and 4.4.3) all with the same behaviour. So my conclusion is, that the problem seems to be on the peripheral's side (I'd also analyzed some sniffed communication logs and I come to the same result).

It looks, that the Softdevice don't releases all of it's Tx buffers when the Central initiates a disconnection.

Looking for an Api call to determine the number of free buffers results just in

sd_ble_tx_buffer_count_get()

with a description of an IMHO a bit error-prone way (counting some different circumstances) to get the number of free buffers.

So what can I do to make all Tx buffers released / available on disconnect (or on next connect)?

  • Yep, reboot nRF51822 helps (as I tested this), but that's not a solution for my application.
  • Maybe reinit of the Softdevice could help? I don't tested this until now as I think this also as an ugly workaround.

May there be an Api call like "release / discard all tx buffers()"?

My development details:

  • Softdevice S110 Version 6.0.0
  • Nordic Sdk 5.2.0
  • Gcc 4.8.3 (gcc-arm-none-eabi-4_8-2014q1)
Related