No Data Received
Verify A-to-A and B-to-B wiring. A common mistake is swapping A and B, which inverts the differential signal. Also confirm both devices are using the same baud rate and serial configuration (data bits, parity, stop bits).
The board includes an SP3485 RS-485 transceiver connected to the ESP32-S3 UART, providing half-duplex differential signaling over twisted pair. RS-485 is a workhorse in industrial and embedded systems for good reason: it supports cable runs up to 1200 meters, data rates up to 10 Mbps, and multi-drop topologies with up to 32 nodes on a single bus. The physical interface is a 3-pin screw terminal carrying A, B, and GND.
The SP3485 handles the translation between the ESP32-S3’s 3.3V UART logic and the RS-485 differential signaling. Direction control (transmit vs receive) is managed automatically by the board hardware, so there is no need to toggle an enable pin in software.
| Signal | GPIO | Description |
|---|---|---|
| TX | IO43 | UART transmit to SP3485 |
| RX | IO44 | UART receive from SP3485 |
Connect A to A and B to B between devices. The GND terminal should also be connected between nodes to establish a common reference, especially on longer cable runs where ground potential differences can exceed the receiver’s common-mode range.
For long runs or multi-drop bus networks, add 120 ohm termination at each physical end of the bus. The board includes an onboard 120 ohm termination resistor controlled by a jumper cap at position 20 on the board (default: OFF). To enable it, place the jumper cap on the RS485 termination header.
The RS-485 lines are protected by SMAJ12CA TVS (Transient Voltage Suppressor) diodes. These clamp surge voltages and transient spikes, providing meaningful protection against ESD events and nearby lightning-induced transients. This is a welcome feature for any deployment where the RS-485 cable leaves a controlled enclosure.
This example initializes UART1 on the RS-485 pins and echoes any received data back to the sender, while also printing it to the USB serial monitor for debugging.
#define RS485_TX_PIN 43#define RS485_RX_PIN 44#define RS485_BAUD 9600
void setup() { Serial.begin(115200); // USB Serial for debug Serial1.begin(RS485_BAUD, SERIAL_8N1, RS485_RX_PIN, RS485_TX_PIN); Serial.println("RS485 Test - Echo Mode");}
void loop() { // Echo received data back if (Serial1.available()) { String data = Serial1.readString(); Serial.print("Received: "); Serial.println(data); Serial1.print(data); // Echo back }}The ESP-IDF UART driver provides explicit RS-485 half-duplex mode support, which handles direction control timing at the driver level.
#include "driver/uart.h"
#define RS485_TX_PIN 43#define RS485_RX_PIN 44#define RS485_UART_NUM UART_NUM_1#define RS485_BAUD 9600#define BUF_SIZE 256
void rs485_init(void) { uart_config_t uart_config = { .baud_rate = RS485_BAUD, .data_bits = UART_DATA_8_BITS, .parity = UART_PARITY_DISABLE, .stop_bits = UART_STOP_BITS_1, .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, .source_clk = UART_SCLK_DEFAULT, }; uart_driver_install(RS485_UART_NUM, BUF_SIZE * 2, 0, 0, NULL, 0); uart_param_config(RS485_UART_NUM, &uart_config); uart_set_pin(RS485_UART_NUM, RS485_TX_PIN, RS485_RX_PIN, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE); uart_set_mode(RS485_UART_NUM, UART_MODE_RS485_HALF_DUPLEX);}No Data Received
Verify A-to-A and B-to-B wiring. A common mistake is swapping A and B, which inverts the differential signal. Also confirm both devices are using the same baud rate and serial configuration (data bits, parity, stop bits).
Intermittent Errors on Long Runs
Enable 120 ohm termination at both ends of the bus. Without termination, signal reflections cause bit errors that worsen with cable length and baud rate. Also verify that the GND terminal is connected between all nodes.