For ESP32C3 Cannot receive UART input on GPIO20 RX D7

All three UART’s on the XIAO-esp32C3 are being used. Serial and Serial2 (D9 D10) are working properly. Serial1 TX (D6) is outputting properly but it is not accepting any input from the RX pin. The connection to the RX pin has been verified and is receiving the intended UART input.

Is there some control that I am missing to allow the RX pin to accept the input?

One more point of reference: When the USB CDC On Boot is set to Disabled in the Arduino IDE, the output for Serial that used to go to the PC terminal emulator , now goes to Serial1 and the input on the RX pin is seen properly.

are you sure you dont have rx and tx switched? remember the tx out of one is the rx into another

No, RX and TX are properly connected. See the additional comment that was just added to the original post.

Hi there,
Without seeing the code in question, It’s merely a guess at best.
Have you run the two port serial test example , to check the wiring of the ports?
what about a picture? or compiler output? (first 3 Lines, last 20 Lines b4 upload)
Post the code and allot of smart folks here can help.
GL :slight_smile: PJ

Here is the code to initialize the three UARTs:

HardwareSerial ser__Serial1(0);
HardwareSerial ser__Serial2(1);

Serial.begin(115200); // USB serial port
while(!Serial); // wait for connection

ser__Serial1.begin(115200, SERIAL_8N1,D7,D6); // Serial1 open on RX, TX
// Output works as expected;
// No input is seen; physical connections are correct

				// Tried to force input and pullup but none worked

//NU pinMode(D7,INPUT_PULLUP); // Input and add pullup resistor
//NU pinMode(20,INPUT_PULLUP); // Input and add pullup resistor
//NU pinMode(RX,INPUT_PULLUP); // Input and add pullup resistor

ser__Serial2.begin(115200, SERIAL_8N1, 9, 10); // Serial2 open; It works well


It looks like the RX pin is not in INPUT mode when Serial1 is initialized and therefore can’t see what is being received. Normally when the “begin” function is applied, the pins are also set up properly. Is there something special about HardwareSerial instance 0?

Hi there,
Not allot to go on there,
What LIB’s , Which BSP are you using…
If you post the ACTUAL code , you’ll get better answers.
GL :slight_smile: PJ

seems it should be ?
ser__Serial1.begin(115200, SERIAL_8N1,D6,D7); // Serial1 open on TX, RX

The pin sequence D7,D6 in the begin parameter list seems to work.
I switched to a different XIAO_esp32c3 and now the Serial1 input is working properly.

And then…, I switched back to the original esp32c3 and now input is working on it too!

So… I don’t know what caused the problem and how it was resolved.

However, thanks for your help

1 Like