2

I've designed a test PCB that utilizes an ESP32 S3 and testing pins. During program uploads, I use the USB interface over GPIO20 and GPIO19 as D+ and D-. Everything works fine in this configuration. However, I've encountered an issue where UART0 becomes inactive after using the USB interface. Now, I want to connect the TX pin of a GPS module (NEO 6m) to UART0's RX pin, but I'm unable to do so. It's impractical to run the code as is because when data is received on RX0, it floods the continuous serial screen. I'm looking for a solution to completely disconnect UART0 from the USB interface so that I can use it independently.

In Short How I can receive date from UART0 and than Serial.print to Serial monitor over the USB interface?

#define RXD2 6
#define TXD2 7
void setup() {
 // put your setup code here, to run once:
 Serial.begin(9600);
 while (!Serial)
 delay(200);
 Serial.println("start GPS...");
 Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2);
}
void loop() {
 while (Serial.available()) {
 Serial.print(char(Serial.read()));
 }
}

enter image description here

asked Sep 5, 2023 at 13:12
0

1 Answer 1

2

Serial is 'com' port over USB on esp32 with native USB (and "USB CDC On Boot" option selected in Tools menu). For UART0 the core then creates Serial0.

From documentation:

To use the UART as serial output, you can use Serial0.print("Hello World!"); instead of Serial.print("Hello World!"); which will be printed using USB CDC.

answered Sep 8, 2023 at 6:58

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.