3.1 KiB
Connecting an ESP32 to the SP PRO serial port
The SP PRO serial port is RS-232 (±12 V signalling), not RS-485 and not logic-level UART. You therefore must put an RS-232 ↔ 3.3 V level shifter between the inverter and the ESP32 — wiring the SP PRO directly to an ESP32 GPIO will damage the ESP32.
Reference: Selectronic Tech Note
TN0050 "SP PRO Serial Port Pin-out",
cross-checked with the selpi connecting.md
(which connects via an FT232 USB-to-RS232 cable at 57600 baud).
SP PRO RJ45 pinout (TN0050)
| RJ45 pin | Signal | Use |
|---|---|---|
| 1 | +12 V isolated (1 A) | optional supply — do not feed the ESP32 directly |
| 2 | DTR | not needed |
| 3 | TXD | SP PRO → us |
| 4 | GND | common ground (required) |
| 5 | GND | ground (redundant) |
| 6 | RXD | us → SP PRO |
| 7 | DCD | not needed |
| 8 | — | not connected |
Only TXD, RXD and GND are needed. Settings: 57600 baud, 8N1, no flow control.
Level shifter: MAX3232
A MAX3232 (3.3 V RS-232 transceiver with internal charge pump) is the right part — it is the 3.3 V-capable successor to the MAX232. RS-485 transceivers (MAX3485 etc.) are not suitable here. Add the four 0.1 µF charge-pump capacitors per its datasheet.
Wiring
SP PRO (RS-232) MAX3232 ESP32 (3.3V UART2)
--------------- --------- ------------------
RJ45 pin 3 TXD -------> R1IN
R1OUT -------------> GPIO16 (RX2)
RJ45 pin 6 RXD <------- T1OUT
T1IN <------------- GPIO17 (TX2)
RJ45 pin 4 GND -------+- GND ----------------+- GND (common!)
| |
3.3V ----------------- VCC (4x 0.1uF charge-pump caps)
- TXD of one side always goes to RXD of the other — note the crossover above.
- Common ground is mandatory. RS-232 is single-ended and needs a shared reference.
- RS-232 has no direction-control line (unlike RS-485), so there is nothing equivalent to DE/RE to manage.
ESP32 UART
Use UART2 to keep UART0 free for USB logging/flashing:
Serial2.begin(57600, SERIAL_8N1, /*RX=*/16, /*TX=*/17);
GPIO16/17 are safe general-purpose pins on most ESP32 dev boards. (On a few modules with
PSRAM these pins are reserved — pick two other free UART-capable GPIOs and update the
sketch if so.) See examples/Esp32SerialMonitor/.
Quick bring-up checks
- Confirm the SP PRO serial port is enabled and note its baud and password (front panel → Settings → Communications).
- Loopback-test the MAX3232: short its TTL TX→RX and echo bytes through the ESP32.
- With it wired to the SP PRO, the first query at
0xa000should echo back; thesppro-consoledemo (or the sketch) will report "connected" once login succeeds. - If login fails, the usual causes are wrong/blank password, swapped TX/RX, or missing common ground.