Cannot get third serial port to work on EPS32-S2

DanDodd
Posts: 1
Joined: Thu Jan 19, 2023 12:16 am

Cannot get third serial port to work on EPS32-S2

Postby DanDodd » Thu Jan 19, 2023 12:25 am

On my EPS32-S2, the following code not return anything input. The only connections on the board are between pins 12 and 13, and between Tx(38) and Rx(39), for the loopback tests. If I replace Serial2 with Serial1 in the loop function, the code works as expected, returning what is input. Serial1 is working fine and wired correctly, Serial2 is not, regardless of what pins I use. Thank you for your help.

-----------code follows-----------------
HardwareSerial Serial2(2);
void setup() {
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial1.begin(115200);
Serial2.begin(115200,SERIAL_8N1,13,12);
delay(1000);
Serial.println("Loopback program started");
}
void loop() {
if(Serial.available()){
Serial.write("-");
Serial2.write(Serial.read());
}
if(Serial2.available()){
Serial.write(".");
Serial.write(Serial2.read());
}
delay(200);
}

Who is online

Users browsing this forum: No registered users and 57 guests