-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Serial Monitor freezes on input when board doesn't clear RX buffer #11122
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
Comments
It appears I am not the only one having this issue: https://forum.arduino.cc/index.php?topic=609249.0 |
Yes.
But that's no loss because It's absolutely trivial to implement this functionality in the sketch: if (Serial.available()) {
serialEvent();
}
It's right here:
Work is in progress to even more clearly document the support for
See: #8851
The workaround is to go back to using Arduino IDE 1.8.13, which has #8851 fixed. Then update your sketch so it doesn't rely on the unsupported Even though it won't occur with a correctly functioning sketch, the bug you reported is legitimate, since the Serial Monitor should never hang. A minimal demonstration of the problem is to upload any sketch that doesn't clear the serial RX buffer to a native USB board. For example: void setup() {}
void loop() {} Then open Serial Monitor and send input a few times. It will now freeze and you'll need to disconnect the board from the computer to unfreeze it. Let's confine this issue exclusively to further discussion of this original bug, since it seems to be going off on some unrelated tangents now that will make it difficult for the developers to investigate. |
Rolled forward to 1.8.13 again and still had this issue. Then wrote a "completely clean" sketch, and it seems to be working alright. One of the things I am testing right now with my sketch for my testbed is serial handling for quite a complicated command flow from my pc to control the mkr1010 - so its possible in my sketch I am not reading/clearing the buffers correctly and this is causing the monitor to freeze. Unfortunately, that means any mistake I make needs me to restart the ide. Not ideal, but its better than 1.8.9 where I needed to restart my pc. Thanks for your help. Hopefully the serial monitor bug gets fixed in a release. Just have another question though: |
You can see the implementation of
For further discussion of the code for your project, the Arduino Forum is more appropriate. I'll be happy to participate in that, and some of the forum members are very knowledgeable in this subject: |
Thanks for the link to the implementation - looks like serialEvent is only called at the end of the loop, which unfortunately is quite different than what the doc says. |
I'm using an MKR1010 and am trying to run the SerialEvent example: https://www.arduino.cc/en/Tutorial/BuiltInExamples/SerialEvent
I recently updated to the 1.8.13 release a few days ago, and I'm trying to send characters using the serial port monitor as required in the serial even example. The serial port monitor it freezes up after a random number of characters - sometimes 1 sometimes 3. I haven't received any output over the serial port monitor as the sketch should provide.
EDIT: I came across this post on the element14 forums where someone mentions that serialEvent() can't be used with SAMD boards (https://www.element14.com/community/thread/74359/l/reading-uart-rx-buffer-mkr-wifi-1010-mkr-1000). There's no reason given - but can this be officially confirmed? I don't see it in the function's documentation: https://www.arduino.cc/reference/en/language/functions/communication/serial/serialevent/
Also - this might be a separate issue - the library manager is throwing Java concurrent execution errors when I try to open it.
The text was updated successfully, but these errors were encountered: