Skip to content

[mbed boards] Packet drops cause failures #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
polldo opened this issue Oct 26, 2020 · 2 comments
Open

[mbed boards] Packet drops cause failures #130

polldo opened this issue Oct 26, 2020 · 2 comments
Labels
type: imperfection Perceived defect in any part of project

Comments

@polldo
Copy link
Contributor

polldo commented Oct 26, 2020

Background
Mbed boards (nano33ble, portentaH7) running ArduinoBLE have two relevant concurrent threads in execution: one executes the main arduino sketch, the other one handles the transport of HCI packets and stores the received ones in an internal buffer.
The thread executing the sketch should regularly call the BLE.poll() function to retrieve and analyze the packets stored by the other thread.

Problem:
If too much time passes between calls to the BLE.poll() function, then the buffer of received packets may become full. If it becomes full then the new packets received will be dropped. (see code)
This behaviour may result in a buffer overflow and consequently in a system crash.

Possible solutions

  • Discourage the use of blocking functions (delay(millis) should be avoided. An alternative BLE.delay() that calls BLE.poll() could be implemented)
  • Handle packets drop to prevent buffer overflows
  • Increase the reception buffer to increase reliability in case some blocking function is essential.
  • Stop the controller until some space is freed from the buffer (see #96)

Related issues
#126
#73
#102

@polldo polldo added the type: imperfection Perceived defect in any part of project label Oct 26, 2020
This was referenced Oct 26, 2020
@andbe-gh
Copy link

Hi @polldo,
the changes in HCICordioTransport.cpp (#96) seem to fix my problem (#126) with hanging arduino when many BLE devices are nearby. I've succesfully tested it with 32 devices.

@andbe-gh
Copy link

Is the problem fixed in the new release? I can't find anything in the changelog from 1.1.3 to 1.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants