Page 1 of 1

E (191) uart: uart_set_pin(711): rx_io_num error

Posted: Thu Jan 09, 2025 1:08 pm
by mobizmn1
Hi everyone!

I am a total beginner at ESP32 and I am trying to transmit some data via UART and view it on the logic analyzer. I am using the ESP32-H2-mini-1 board with arduino IDE. Based on the documentation of this board, the UART pins are supposed to be on pin 30 and 31.

Code: Select all

// UART port and pins definitions
#define UART_RX 30
#define UART_TX 31

// Create object for UART communication
HardwareSerial radarComm(1); // Using UART0 for communication

void setup() 
{
  // Initialize UART0 for radar sensor communication
  radarComm.begin(9600, SERIAL_8N1, UART_RX, UART_TX);
}

void loop() 
{
}
When I run the above code, I get the following text in the Serial monitor:

Code: Select all

E (143) uart: uart_set_pin(711): rx_io_num error
E (175) uart: uart_set_pin(710): tx_io_num error
Can anyone please explain to me why the code is not working? Am I selecting the code UART pins? If yes, which pins do I need to select?

Re: E (191) uart: uart_set_pin(711): rx_io_num error

Posted: Thu Jan 09, 2025 1:37 pm
by ESP_Minatel
Hi,

Pins 30 and 31 are used for the UART for flashing and debug by the log output, however, the pin number are not directly related to the GPIO number.

Pins 30 and 31 are GPIO23 and GPIO24. GPIO30 and GPIO31 do not exist on the ESP32-H2.
You can use both GPIOs if you are not using the log output over UART.

Code: Select all

#define UART_RX 23
#define UART_TX 24

Re: E (191) uart: uart_set_pin(711): rx_io_num error

Posted: Fri Jan 10, 2025 6:47 am
by mobizmn1
Actually, the problem with the code was that I was using the wrong UART. When I changed the code to use UART2, the code did not give that error, and the code started to run.

Code: Select all

HardwareSerial radarComm(2);

Re: E (191) uart: uart_set_pin(711): rx_io_num error

Posted: Fri Jan 10, 2025 9:45 am
by ESP_Minatel
Here is the code that works on my ESP32-H2 using Arduino Core 3.1.1.

Code: Select all

#include <Arduino.h>

// Define UART pins
#define UART_TX_PIN 10
#define UART_RX_PIN 11

// Define UART configuration
HardwareSerial radarComm(1); // Use UART1

void setup() {
  // Initialize UART
  Serial.begin(115200);
  radarComm.begin(9600, SERIAL_8N1, UART_RX_PIN, UART_TX_PIN);
}

void loop() {
  // Send a message every second
  Serial.println("Sending: A");
  radarComm.println("A");
  delay(1000);
}