Page 1 of 1

using the 2nd uart or uart1 on esp32-c3

Posted: Thu Dec 29, 2022 8:23 am
by calvsg88
Hi,

The ESP32-C3 has 2 hardware uart.
How do I use the 2nd uart?

I've tried

// ESP32 C3 SERIAL1 (second UART)
HardwareSerial mySerial1(1);

int rxPin=4;
int txPin=5;

void setup()
{
Serial.begin(115200);
pinMode(txPin,OUTPUT);
pinMode(rxPin,INPUT);

mySerial1.begin(115200, SERIAL_8N1, rxPin, txPin);
}

void loop()
{
mySerial1.println("AT?");
//delay(100);
if (mySerial1.available())
{ // If anything comes in Serial1 (pins 4 & 5)
while (mySerial1.available())
Serial.write(mySerial1.read()); // read it and send it out Serial (USB)
}

}

but doesn't seem to get response from the esp32...

Re: using the 2nd uart or uart1 on esp32-c3

Posted: Sun Jan 01, 2023 6:39 pm
by bidrohini
You can check this for some clues: viewtopic.php?t=22682