-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Serial.begin() flushes RX FIFO + changing RX IO inserts BREAK to UART Line #9020
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
I don't know about the S3, but on ESP32-WROOM32UE "Serial1" isn't available because it's used internally for the flash memory. I always use "Serial" and "Serial2". |
@mrengineer7777 using standard configs, both serial 1+2 work without issues |
Hi, any updates to this please :) |
Yes, there is some problem with ESP32-S3 UART2 indeed. I'll continue to investigating it. |
Thank you for getting round to looking at this. |
@terrafirma2021 - Just to check, you are using Arduino Core 3.0.0-Alpha3 or some other specifc version (or actually it was checked out from master)? I don't get any panic (in the sense of a Guru Mediation and a reset), but it seems that there is some issue with how Please post the error messages / output from Serial Monitor / etc. |
I found out something: void sendHOverSerial1() {
Serial1.begin(115200, SERIAL_8N1, 38, 3); // Re-initialize Serial1 with different pins
Serial1.write("H");
delay(1000);
Serial1.begin(115200, SERIAL_8N1, 38, 1); // Initialize Serial1 back to stock pins
}
void sendIOverSerial2() {
Serial2.begin(115200, SERIAL_8N1, 47, 21); // Initialize Serial2 with pin swap
Serial2.write("I");
delay(1000);
// Serial2.begin(115200, SERIAL_8N1, 11, 10); // <------- causes panic
}
Changing RX IO causes a UART BREAK signal in the line. This causes an error in the HardwareSerial driver. Other detail: I'm working on some possible patch. |
Hi, sorry for not reaching back to you sooner, I never tested on the latest core ide it was an earlier version. The issue still exists as noted above on the latest core ide, seeing the serial.begin bug also explains why I was having issues whereby the serial monitor would drop out, I thought it was the way I handled my code, but it was a bug for sure, thanks for confirming this also! As a workaround I was keeping track of sent bytes to handle echo, which avoided pin swap. |
@terrafirma2021 - #9095 shall fix it for Arduino 3.0.0. |
Your a star thank you very much :D |
Closing this as solved by above mentioned PR. |
Thank you ! |
Board
esp32-s3
Device Description
wokwi S3
Feather-S3
Hardware Configuration
No
Version
latest master (checkout manually)
IDE Name
2.2.1
Operating System
win 10 x64
Flash frequency
240
PSRAM enabled
yes
Upload speed
115200
Description
// works fine
void sendHOverSerial1() {
Serial1.begin(115200, SERIAL_8N1, 38, 3); // Re-initialize Serial1 with different pins
Serial1.write("H");
delay(1000);
Serial1.begin(115200, SERIAL_8N1, 38, 1); // Initialize Serial1 back to stock pins
}
// Causes panic
void sendIOverSerial2() {
Serial2.begin(115200, SERIAL_8N1, 47, 21); // Initialize Serial2 with pin swap
Serial2.write("I");
delay(1000);
// Serial2.begin(115200, SERIAL_8N1, 11, 10); // <------- causes panic
}
Also when
void sendIOverSerial2() {
is enabled
void sendHOverSerial1() { // breaks
Sketch
Debug Message
Other Steps to Reproduce
https://wokwi.com/projects/384481453752614913
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: