Skip to content

Serial.begin() flushes RX FIFO + changing RX IO inserts BREAK to UART Line #9020

Closed
@terrafirma2021

Description

@terrafirma2021

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

//https://wokwi.com/projects/384481453752614913 attached for easy viewing

void setup() {
  Serial.begin(115200);                
  Serial2.begin(115200, SERIAL_8N1, 11, 10);
  Serial1.begin(115200, SERIAL_8N1, 38, 1);
}

void loop() {
  // Check if Serial1 has received any data
  if (Serial1.available()) {
    char byteReceived1 = Serial1.read();
    Serial.print("Byte received on Serial1: ");
    Serial.println(byteReceived1);
  }

  // Check if Serial2 has received any data
  if (Serial2.available()) {
    char byteReceived2 = Serial2.read();
    Serial.print("Byte received on Serial2: ");
    Serial.println(byteReceived2);
  }

  // Call the functions to send "H" and "I"
  sendHOverSerial1();
  sendIOverSerial2(); // Stops sendHOverSerial1() working
}

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
}

Debug Message

00:04.200
100%

ESP-ROM:esp32s3-20210327

Build:Mar 27 2021

rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)

SPIWP:0xee

mode:DIO, clock div:1

load:0x3fce3808,len:0x370

load:0x403c9700,len:0x900

load:0x403cc700,len:0x2364

SHA-256 comparison failed:

Calculated: bea01f04c6f0e287a682f128805e3fce115955179100e98d8f412fe7697f8bdc

Expected: 08ea492e448f88de75319ed18ac319444e578d9c6bc7003c5c4807382bf389bd

Attempting to boot anyway...

entry 0x403c98ac

Other Steps to Reproduce

https://wokwi.com/projects/384481453752614913

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions