UART TX Pin Configuration for ESP32-H2-Mini-1

mobizmn1
Posts: 6
Joined: Thu Jan 09, 2025 12:59 pm

UART TX Pin Configuration for ESP32-H2-Mini-1

Postby mobizmn1 » Fri Jan 10, 2025 8:48 am

Hi!

I have been trying to run a code for my ESP32-H2-Mini-1 board. The code is supposed to send a byte via UART TX pin and I then want to view the sent byte on a logic analyzer. Now the problem is that no matter which pin I set for UART TX(e.g. 16, 12, etc), I always see the output on the actual TX pin on the board.
Media (8).jpg
Media (8).jpg (354.21 KiB) Viewed 1632 times
However, when I try to set the actual pin for TX (GPIO24)as per documentation, I can still not see the correct data on the logic analyzer. I see an different value at every second whereas the actual value is supposed to be A.

My code is as follows:

Code: Select all

// UART port and pins definitions
#define UART_RX 23
#define UART_TX 24

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

void setup() 
{
  // Initialize serial communication for debugging
  Serial.begin(115200);
  // Serial.println("Info: Initalizing ESP32...\n");

  // Initialize UART0 for radar sensor communication
  radarComm.begin(9600, SERIAL_8N1, UART_RX, UART_TX);
  // Serial.println("Info: Radar sensor communication initialized.\n");

}

void loop() 
{
  // Send a simple character
    radarComm.write('A'); 
    Serial.println("Sent: A");

  // Add a 1 second delay in transmission
  delay(1000);
}
I have also tried to connect the TX pin to RX pin and then check the data, but the board didn't boot in this scenario.

I have connected to the board via USB-C to USB-C cable on its UART port. I am running the code on Arduino IDE. Also, I'm using Logic 2 to view the data.

Can you please help me figure out the issue?

ESP_Minatel
Posts: 386
Joined: Mon Jan 04, 2021 2:06 pm

Re: UART TX Pin Configuration for ESP32-H2-Mini-1

Postby ESP_Minatel » Fri Jan 10, 2025 9:16 am

Hi,

You have another topic with a related discussion here.

mobizmn1
Posts: 6
Joined: Thu Jan 09, 2025 12:59 pm

Re: UART TX Pin Configuration for ESP32-H2-Mini-1

Postby mobizmn1 » Fri Jan 10, 2025 10:20 am

Well, the problem is different now. My code is running but I don't see the correct data at the output.

ESP_Minatel
Posts: 386
Joined: Mon Jan 04, 2021 2:06 pm

Re: UART TX Pin Configuration for ESP32-H2-Mini-1

Postby ESP_Minatel » Fri Jan 10, 2025 11:01 am

Ok then.
Have you tried this code?

mobizmn1
Posts: 6
Joined: Thu Jan 09, 2025 12:59 pm

Re: UART TX Pin Configuration for ESP32-H2-Mini-1

Postby mobizmn1 » Mon Jan 13, 2025 7:40 am

Yes, I have tested that code, and while the code does indeed run on ESP32, I see no output in the logic analyzer.

ESP_Minatel
Posts: 386
Joined: Mon Jan 04, 2021 2:06 pm

Re: UART TX Pin Configuration for ESP32-H2-Mini-1

Postby ESP_Minatel » Mon Jan 13, 2025 8:50 am

Can you please give more details about your setup?

  1. Arduino Core version.
  2. Printscreen of the Tools menu on the Arduino IDE.
  3. A picture of the wires connection with the logic analyzer.
  4. The code you're testing.

mobizmn1
Posts: 6
Joined: Thu Jan 09, 2025 12:59 pm

Re: UART TX Pin Configuration for ESP32-H2-Mini-1

Postby mobizmn1 » Mon Jan 20, 2025 12:18 pm

Hi,

I apologize for the last reply. I had actually fixed the issue. So the issue was that I was using two serial objects. The main Serial object for debugging and the HardwareSerial object. The working TX pin of the ESP32 was using the Serial object. So when I tried to send data via the HardwareSerial object, it would coincide with data from Serial. So I removed the usage of Serial object and set the HardwareSerial to use UART0, and that is how I started seeing data on the UART TX pin of ESP32.

ESP_Minatel
Posts: 386
Joined: Mon Jan 04, 2021 2:06 pm

Re: UART TX Pin Configuration for ESP32-H2-Mini-1

Postby ESP_Minatel » Tue Jan 21, 2025 9:31 am

Thanks for the feedback!

Who is online

Users browsing this forum: FWM4N! and 73 guests