sandeepmistry / arduino-BLEPeripheral

An Arduino library for creating custom BLE peripherals with Nordic Semiconductor's nRF8001 or nR51822.
MIT License
464 stars 180 forks source link

Indicate Deadlocks on nRF5 #184

Open dsanders11 opened 7 years ago

dsanders11 commented 7 years ago

Indications will deadlock on nRF5 after N indications without any other activity. This is because the current code incorrectly considers indications to use one of the TX buffers, and they never get replenished because there is no BLE_EVT_TX_COMPLETE.

Per documentation for the SoftDevices (S110, S130, S132) indications do not consume an application buffer, so they shouldn't be involved in the TX buffer tracking.

I have a fix in my repo (e6117755e841db643211a1836d16565eacbee4a1) but I didn't open a PR because nRF8 needs to be checked for the same issue, and I think more changes should be made to updateCharacteristicValue, like checking the return value of sd_ble_gatts_hvx for the possible error conditions.