October 08, 2025, 01:51:43 AM

ESPHome issue with UART

Started by ju, October 03, 2025, 11:26:32 AM

Previous topic - Next topic

ju

Hi folks!

So I've been scratching my head a lot the past day or so, maybe someone here can help me out!

I have a working ESPHome project running on an Olimex ESP32-POE-16MB Rev. L1, I don't need POE for this, nor do I need the Ext connector, so I decided to try to move the project to an Olimex ESP32-Gateway-EA Rev. I
I don't use Ethernet on either board.

Since I changed boards, I cannot get UART to work at all.

I used GPIO13 for TX and GPIO5 for RX on the ESP32-POE without issues.
On the ESP32-Gateway, I've so far tried GPIO16&17, GPIO12&13, GPIO4&13: I don't get any response from UART anywhere.
I've used the same cable for both boards, and now switched back to the ESP32-POE, still the same cable, and everything still works on that board.

Is there something I need to do to make UART work on the ESP32-Gateway?

Thanks a lot!

LubOlimex

Try with GPIO16 and GPIO32, pins #11 and #13 from CON1. Make sure to define them in the code for UART operation.

Did you use the esp32-gateway for board config?
Technical support and documentation manager at Olimex

ju

Thanks for the suggestion!
Yes, I've used esp32-gateway as a board config, with esp-idf as a framework.

For a moment there, I thought you had saved me! On my first attempt I could see *something* on the UART RX, garbled noise, but something!
But upon further inspection, it was just a bad solder joint causing intermittent connection.
Reseating a resoldering them got me back to my initial issue: I can TX, I have no idea if the other end receives anything, and I do not RX anything... :-/

LubOlimex

Did you try with simplest UART test? Just create the software serial on the chosen pins and then connect them together (e.g. RX to TX) and then open terminal and see if you get echo when you type something. If there is echo the problem is not with the esp32-gateway.

If there is still a problem, maybe test with Arduino IDE instead. I haven't used esphome a lot but in Arduino IDE serial works. Here is some simple test with instructions for Arduino IDE:

/*
  ESP32-GATEWAY Serial Demo
  -------------------------
  Demonstrates using a second UART on GPIO11 (TX) and GPIO13 (RX).

  ESP32 Arduino package installation:
  1. Open Arduino IDE → File → Preferences
  2. In "Additional Boards Manager URLs" add:
      https://espressif.github.io/arduino-esp32/package_esp32_index.json
  3. Go to Tools → Board → Boards Manager
  4. Search for "esp32" and install the package by Espressif Systems
  5. Select your board under:
      Tools → Board → ESP32 Arduino → "Olimex ESP32-Gateway"

 
  Hardware connections:
  - GPIO11 → TX2 (connect to RX of other device)
  - GPIO13 → RX2 (connect to TX of other device)
  - USB → for Serial Monitor (primary UART)
*/

#define RX2_PIN 13  // Receive pin for Serial2
#define TX2_PIN 11  // Transmit pin for Serial2

void setup() {
  // Start USB serial monitor at 115200 baud
  Serial.begin(115200);
  while (!Serial) {
    ; // Wait for Serial Monitor to open
  }
  Serial.println("ESP32-Gateway Serial2 demo starting...");

  // Initialize Serial2 on GPIO13 (RX) and GPIO11 (TX) at 9600 baud
  Serial2.begin(9600, SERIAL_8N1, RX2_PIN, TX2_PIN);
  Serial.println("Serial2 initialized on GPIO11 (TX) / GPIO13 (RX)");
}

void loop() {
  // Send test message periodically via Serial2
  Serial2.println("Hello from ESP32-Gateway Serial2!");

  // If data is received on Serial2, display it on the USB serial monitor
  if (Serial2.available()) {
    String incoming = Serial2.readStringUntil('\n');
    Serial.print("Received on Serial2: ");
    Serial.println(incoming);
  }

  // Echo any text entered in the Serial Monitor to Serial2
  if (Serial.available()) {
    String input = Serial.readStringUntil('\n');
    Serial2.print("Echo from USB: ");
    Serial2.println(input);
  }

  delay(2000); // Delay 2 seconds between transmissions
}

Let me know if the problem persists with Arduino IDE.
Technical support and documentation manager at Olimex