Arduino Due SerialUSB bug on monitor close/USB unplug
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- arduino, cpp
- Domain
- embedded-iot
Research direction
Start with the provided Due sketch and reproduce the behavior by closing the native-USB serial monitor or unplugging and reconnecting it while powered through the programming USB. Compare Windows 10 and Linux behavior while tracing the SerialUSB/native USB handling. Done means the loop continues after disconnect or monitor close and the reopened monitor receives the messages in the original order.
Written by the indexing model from the issue text.
Description
Hi all,
I'm trying to develop an application where the arduino Due is continuously working (always powered), and I can connect to it using the native USB, so I can get data about the process. I have found unexpected behavior of the Due board when it is unplugged, or the serial port is closed.
For the following test I have used this Arduino Code. With this one two different problems are observed.
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
SerialUSB.begin(115200);
}
void loop() {
SerialUSB.print("H");
SerialUSB.print("e");
SerialUSB.print("y");
SerialUSB.print(" ");
SerialUSB.print(":");
SerialUSB.println(")");
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(200); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(200); // wait for a second
}
I have found this issues
->If Serial monitor is closed while sending data through the native USB (SerialUSB) the main loop gets freezed, until the serial monitor is opened again. (With the test code, it can be observed that the led stops blinking).
->If unplugged the Native USB while sending data (and keep powered with the other USB), when a new monitor is opened, the received data order is changed. How can it be? The data order gets changed, and while unplugged the led stops blinking.
I also found a post where one of the bugs is mentioned:
https://forum.arduino.cc/index.php?topic=560839.0
As Sanworks_J explains this problem only appears when the computer used as serial monitor is Windows 10. I have check both problems in Linux, and in this case the board works correctly.
I have followed this Steps to in the second issue.
-->Connect both the programming USB (just for power, no data) and Native USB.
--> Upload the sketch to the board, and open the serial monitor, native USB. (Data received correctly).
--> While serial monitor is opened, unplug the Native USB (while powered with the other USB)
--> Plug the Native USB again. Close the monitor opened before(because it is stopped).
--> Open a new serial monitor, and the received data from that moment the data order is wrong.
Since that moment, the received messages are as follows.
)eH y):H
ye:
)eH y):H
ye:
When it should be:
Hey :)
Hey :)
Hey :)
I have made this test in different PCs and with different Arduino Due boards, with the same results in Win10. When used Linux it doesn't happen, but the program gets stopped when unplugged the USB, this problem remains in Linux.
Any possible solution to this issue?
Thanks in advance.
- Dominant language
- HTML
- Stars
- 91
- Forks
- 112
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from arduino/ArduinoCore-sam
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
arduino/ArduinoCore-sam#129 ·
-
Type: Bug USB: CDC serial
Difficulty 4/5 3-5 days Newbie friendliness 52/100
arduino/ArduinoCore-sam#153 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
arduino/ArduinoCore-sam#151 · 5 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
arduino/ArduinoCore-sam#147 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
arduino/ArduinoCore-sam#146 ·
All issues in arduino/ArduinoCore-sam
Similar issues
-
area: config area: firmware priority: P2 - medium size: S type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Mizithra/ActiveTerrain#16 ·
-
external converter
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Koenkk/zigbee2mqtt#33219 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
beagleboard/BeagleBoard-DeviceTrees#121 · 2 comments ·