ESP32 UART Hardware Serial Ports Help
ESP32 UART Hardware Serial Ports Help
Hello there, I am working out on ESP32 for one of my projects as it says that it has the advantage of direct access to use 3 hardware UART serial ports. But I found that it has only one hardware UART serial port which works actually only i.e RX 16, TX 17 and other 2 UART hardware serial ports not work at all as they are internally connected and can not use externally and if tried to use they don't work and crash the ESP32. So its wrongly described about the advantage of direct access to use 3 hardware UART serial ports on ESP32. If someone has successfully used these UART0, UART1 ports externally just like UART2 (RX 16, TX 17) please let me assist with the same. Thanking you.
-
- Posts: 826
- Joined: Mon Jul 22, 2019 3:20 pm
Re: ESP32 UART Hardware Serial Ports Help
You can assign the serial ports to whatever pins you have available when you initialize.
https://github.com/espressif/arduino-es ... ard-pinmap
Code: Select all
Serial1.begin(115200, SERIAL_8N1, RX_1, TX_1);
Serial2.begin(9600, SERIAL_8N1, 21, 22);
Re: ESP32 UART Hardware Serial Ports Help
Hello, sorry i have already been gone through this and it didn't work at all. Actually, I want to use GPS on UART1 serial port of ESP32 and when run the code sketch it didn't work at all on UART1 serial port and when I run the same code sketch on UART2 i.e. RX 16/TX 17 of ESP32 it works very well without any issue. Thanks.lbernstone wrote: ↑Tue Jul 12, 2022 5:01 pmYou can assign the serial ports to whatever pins you have available when you initialize.https://github.com/espressif/arduino-es ... ard-pinmapCode: Select all
Serial1.begin(115200, SERIAL_8N1, RX_1, TX_1); Serial2.begin(9600, SERIAL_8N1, 21, 22);
Re: ESP32 UART Hardware Serial Ports Help
Default pins for UART1 (GPIO9 and GPIO10) do not work. Because they are internally connected to flash. You can use any other GPIO pins. You can check this tutorial: https://microcontrollerslab.com/esp32-u ... s-example/
I create ESP32 tutorials and Projects using ESP-IDF https://esp32tutorials.com/
Re: ESP32 UART Hardware Serial Ports Help
Actually, I have already been gone through your provided tutorial, but it didn't work. Secondly, I want to use UART1 hardware serial as per its datasheet and software serial no longer works with ESP32 at all. Thanks.Momin786 wrote: ↑Wed Jul 13, 2022 5:24 amDefault pins for UART1 (GPIO9 and GPIO10) do not work. Because they are internally connected to flash. You can use any other GPIO pins. You can check this tutorial: https://microcontrollerslab.com/esp32-u ... s-example/
Re: ESP32 UART Hardware Serial Ports Help
I have myself followed the same tutorial and used the HardwareSerial example in that tutorial and changed UART2 to UART1 in the example code, it worked fine for me.
I create ESP32 tutorials and Projects using ESP-IDF https://esp32tutorials.com/
Re: ESP32 UART Hardware Serial Ports Help
ESP32 dev kit.
I create ESP32 tutorials and Projects using ESP-IDF https://esp32tutorials.com/
Re: ESP32 UART Hardware Serial Ports Help
#include <HardwareSerial.h>
HardwareSerial SerialPort(1); // use UART1
void setup()
{
SerialPort.begin(15200, SERIAL_8N1, 4, 2);
}
HardwareSerial SerialPort(1); // use UART1
void setup()
{
SerialPort.begin(15200, SERIAL_8N1, 4, 2);
}
I create ESP32 tutorials and Projects using ESP-IDF https://esp32tutorials.com/
Who is online
Users browsing this forum: No registered users and 79 guests