Closed
Description
It appears something is causing my Arduino Nano 33 BLE and Arduino Nao 33 BLE Sense to load repeated HCI_EVENT_PKT
bytes into _recvBuffer
. This is what the serial output looks like when using BLE.debug(Serial)
:
HCI EVENT RX <- 0404040404
3E
1B
Another example failure:
HCI EVENT RX <- 0404043E0C0201
HCI EVENT RX <- 0401B7DAD7FA625700C80404040404040404040404043E1E02010001B7DAD7FA62571202011A020A070BFF4C001006381E04B474BFCE043E0C02010401B7DAD7FA625700CE040404043E1D020100001BF99F3732501102011A020A0C0AFF4C0010050314109CE8BD04043E0C02010401A7AE7B27BD5000CD040404043E2B02010301D9201A4FC5331F1EFF060001092002DF763A72CF5951F1D056BB5486C5A6EE4DA5E21EE2AF5CAD04043E1D020100001BF99F373250110201
1A
After that, the Serial interface hangs and the main LED repeatedly flashes 4 long and 4 short.
I was able to hack this fix into void HCIClass::poll(unsigned long timeout)
:
while (HCITransport.available()) {
byte b = HCITransport.read();
//haxhaxhax for repeated start-event bytes
if (_recvIndex == 1 && _recvBuffer[0] == HCI_EVENT_PKT && b == HCI_EVENT_PKT) {
_recvIndex = 0;
}
//ENDhaxhaxhax
_recvBuffer[_recvIndex++] = b;
if (_recvBuffer[0] == HCI_ACLDATA_PKT) {
This works for my particular use case because I'm dealing only with advertisements, but it would break for anyone trying to make connections since it would blow up an HCI_Connection_Request
event.
If anyone has any guidance for what might be causing the HCI_EVENT_PKT
byte to be repeated, I can work on a real patch and pull-request.