
From the model to your ESP32
The ESP32 has three UART ports, one of them the console. This lesson lays the course over the board, port by port, and ends with the three things to check first when nothing arrives.
Everything in this course was a model. On an ESP32 the same ideas have pin names, and a few of them have surprises.
Three ports, one of them the console
The ESP32 and the ESP32-S3 each have three UARTs. The ESP32-C3 has two. UART0 is the console: on an ESP32 its TX is GPIO1 and its RX is GPIO3, on an ESP32-S3 they are GPIO43 and GPIO44. The boot log comes out of UART0 before your code runs, at 115200 baud on the boards in this course.
The other ports are not tied to pins. The signals can be routed to almost any GPIO, so you pass the pins you want and you do not rely on a default. The Arduino core has changed its defaults for Serial1 and Serial2 between versions. There are limits all the same: on the ESP32, GPIO34 to GPIO39 can only be inputs, so they can be an RX and never a TX, and GPIO6 to GPIO11 usually belong to the flash.
The USB socket
On most dev boards the USB socket does not reach the chip's UART directly. A bridge chip sits between them, with USB on one side and a logic-level UART on the other, and your computer shows the result as a serial port. The baud you pick in the monitor is the one the bridge uses on its UART side. The serial-ports page lists the usual bridge chips and their drivers.
A board that uses the ESP32-S3's own USB port has no bridge and no UART in that path. That port is USB, not a UART, and UART0 is then free for something else once the boot log is over. On a board with a bridge, UART0 is a poor place for a sensor: you lose your debug output.
A printer on a wire
The 58 mm receipt printer has a sticker that reads 9600 baud, 8N1, and the label printer's reads 115200 baud, 8N1. Printing needs one direction: the ESP32's TX to the printer's RX, plus a common ground. The printer's base board has two headers, one for 3V3 boards and one for 5V boards, and the right one is the one that matches your board. The printers' baud page covers the sticker.
The first three things to check
Wiring. TX goes to RX and RX to TX, and the grounds are joined. Wired straight, TX to TX, both ends transmit and nobody listens. Nothing complains.
Baud. Both ends must use the number on the sticker or in the datasheet. A wrong baud does not stop the bytes. It gives you different bytes, and a receiver that sets a framing error flag your sketch may never look at.
Voltage. The ESP32's pins are 3.3 V logic and not rated for 5 V. A port named RS-232 is a different interface altogether, and so is RS-485.
If all three are right and the link is still wrong, the next suspects are the frame settings at each end, then a receive buffer that is too small for the speed, then flow control.
Where to go next
The ESP32 book keeps the code: UART and baud rates opens a port and passes its pins, and UART, start to stop follows one byte down the wire.
Common mistakes
- Using UART0 for a sensor. It is the console and the boot log. Use another port, and pass its pins.
- Trusting remembered default pins. Pass the pins to
begin()yourself. - Assuming a baud. Read the sticker, and set the ESP32 to it.
Edit this page — content/fundamentals/uart/uart-on-your-esp32.mdx
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.