-
Notifications
You must be signed in to change notification settings - Fork 529
Description
Describe the bug
When sending and receiving data over the USB CDC Serial the module will randomly lockup.
Set up (please complete the following information)
- pca10059, pca10056
- Windows 10
- No debug log information available. See steps to reproduce.
To Reproduce
Steps to reproduce the behavior:
1: Run this minimal code on the module:
#include <stdio.h>
#include <Arduino.h>
#include <bluefruit.h>
// the setup function runs once when you press reset or power the board
void setup() {
Serial.begin(115200);
//Bluefruit.begin(0, 1);
}
// the loop function runs over and over again forever
void loop() {
if (Serial) {
if (Serial.availableForWrite()) {
Serial.write("|", 1);
}
}
}
- Open the serial port from a PC terminal.
With the "Bluefruit.begin()" commented out you should observe that a stream of data will be received indefinitely as long as the port is open.
When running the code with the Bluefruit.begin() uncommented you should observe that the module will lock up after a short period of time. Sometimes after ~20kb of data sent and sometimes only after a ~100bytes. But it will always lockup in a relatively short amount of time.
In a real-world application I see the lockup occur at random times. Sometime hours and sometimes days. The amount of data transferred over the serial port does not appears to be a factor. The example above creates an extreme condition that produces the same lockup situation reliably in a short amount of time.
The lockup does not appear to coincide with the size of the data sent and it is also preset when simulating data received on the module, not just sending as the example above shows.
Expected behavior
Sending / receiving data over serial should not lockup the module or corrupt the serial buffers.
Additional context
I accept that the root issue may not be directly related to Bluefruit.begin() but this was the way I get the issue to present itself reliably. I do use the BLE library in my application and nothing else.