arduino-libraries/ArduinoBLE

ArduinoBLE - Hangs in Event Handler - Poll?

JEG8 opened this issue · 1 comments

JEG8 commented

Hello,

I have a reoccurring issue that I notice when using the ArduinoBLE library. I am wondering if I am misusing the library, and am hoping you can provide some clarification.

I have my BLE characteristics tied to event handlers based on BLEWritten. When the task in the event handler is more complex, such as parsing a String for key/value pairs, the BLE hangs and becomes unresponsive. To solve this, I have simplified my event handlers and tasks to limit the away time between BLE.Poll() calls.

I am wondering what the underlying cause of this issue is? Is there something I can do to prevent the hanging?

Thanks!

Whenever a new HCI packet is received, an interrupt is generated and the packet is copied by ArduinoBLE into a local buffer (_rxbuf). The buffer has a limited size of 256. If you do not call BLE.poll() enough the local buffer may not have enough place to copy the received packet length and then drop the received packet.