-
Notifications
You must be signed in to change notification settings - Fork 119
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linux CDC (/dev/ttyACM*) <=> TinyUSB on nRF52 freezes with too much data #127
Comments
thank you for opening the issue, however your sketch is too complicated, which can have its own issue e.g ble interfering with usb etc.. Can you
|
Okay! I wrote a mini serial-echo sketch, and a mini load-tester script, and have edited the first post to include the new repro case. Any help is welcome!! 馃檱 (Reproducing now with the arduino IDE to make sure there's not something weird going on with the |
Reproduced with stock Arduino IDE. |
Reproduced (exact same behavior) with a Mac as the host. |
Reproduced (exact same behavior) on Feather nRF52840 (not surprising, it's a very similar design as the Circuit Playground, just doesn't have all the extra playground peripherals). (The Feather nRF52832 does NOT reproduce this behavior, which is also not surprising, because it uses a CP2104 USB/serial bridge instead of tinyusb.) |
@egnor superb ! thank you for your update, this is exactly what needed to reproduce the issue. I will try to test it out and post update here when available |
@egnor sorry for late response, I was busy with other works. I confirmed the issue occurred with your sketch and script. It is probably be the race condition or mutex locking issue. I will spend more time looking at this and post the update here. PS: I also realize that the Serial is lacking read(buf, bufsize) API and added it as well When reading multiple bytes at once, the hanged up is less likely to happen (but still occurred !!). So it is definitely a race condition void loop() {
if (Serial.available()) {
uint8_t buf[64];
uint8_t count = Serial.read(buf, 64);
Serial.write(buf, count);
digitalToggle(LED_BUILTIN);
}
} |
Update I put more effort looking debugging the nrf52. nrf52840 is not hanged, it appear to be running just fine:
further troubleshooting |
That matches my understanding -- the nrf52840 is still running, but somehow USB-serial has wedged. Glad to hear there's progress, let me know if I can help! |
@egnor this takes more time than troubleshoot than I would expect. Please give it a try I am glad it is fixed now. This has been 3rd time I got to fix the easydma race condition with nrf, previous one lack the intense test script like yours. |
First of all many thanks 馃檹 馃帀 for excellent and very useful software!
Operating System
Linux (reproduced on Ubuntu 21.04 and also Raspberry Pi OS "buster")
IDE version
Reproduced with Arduino IDE 1.8.16.
Board
Adafruit Circuit Playground Bluefruit, S140 6.1.1, Level 0 (Release)
BSP version
Version 1.1.0, I think?
TinyUSB Library version
Adafruit TinyUSB Library 1.4.4 (and whichever tinyusb that bundles)
Sketch
I can repro with this simple read-and-echo-back sketch:
I use the following Python script to write to the device (requires pyserial installed):
What happened ?
With a small chunk size and a low rate, it will run for a while:
Going to a larger chunk size and/or higher rate freezes fairly quickly:
Once frozen, the USB-serial port is borked for host-to-device; any attempt to write will freeze the program. (Verified in a terminal program as well, or even just "cat" to the port.) Device-to-host data still flows, however.
I took some usbmon traces which I can share if they are interesting, they seem to show the device failing to respond to requests for data in that direction?? But I am not very versed in the nuts and bolts of USB communication.
POSSIBLY relevant: #57 (but the opposite direction).
How to reproduce ?
Run the above sketch on the device.
Run the above tester program on the connected host (setting
--port
if necessary).Debug Log
(I'm not sure how to collect this log, but I can research it.)
Screenshots
(See text traces above.)
The text was updated successfully, but these errors were encountered: