using the 2nd uart or uart1 on esp32-c3

calvsg88
Posts: 10
Joined: Tue Aug 09, 2022 7:54 am

using the 2nd uart or uart1 on esp32-c3

Postby calvsg88 » Thu Dec 29, 2022 8:23 am

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...

bidrohini
Posts: 202
Joined: Thu Oct 27, 2022 12:55 pm

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

Postby bidrohini » Sun Jan 01, 2023 6:39 pm

You can check this for some clues: viewtopic.php?t=22682

Who is online

Users browsing this forum: No registered users and 65 guests