Problems with Serial2 communication

Hi,

I am using the Portenta H7 lite for a microcontroller project. To access the arduino's serial ports, I am using the Portenta breakout.

I have been working with Serial1(UART1) and Serial3(UART3) for UART communication with different drivers (temperature controller and a laser driver). The arduino communicates via UART with theses drivers. Using Serial1 or Serial3, I can successfully communicate and receive messages. However with Serial2 (UART2), I am not able to communicate and no messages are received.

The only difference in the code is that the UART defined is Serial2, so just 1 line of code. I know that Serial2 exists as my code compiles and it is defined in the Portenta code. What is curious is that I have a second arduino Portenta H7 with a breakoutboard and the same problem seems to occur.

My question: Am I missing something about how to use the Portenta's Serial2? Is the usage the same as for Serial1 and Serial3?

P.S. I omit the code as it is separated in many files and several different classes. Under you will find the only place where the UART is defined. As a reminder, if defined as Serial1 or Serial3 it works.

DualLaserDriver(std::string component_name = "laser_driver",UART &uart_port =Serial2, int baud_rate=115200);
1 Like

My H7 will be showing up soon and I need to use ALL of the serial ports. It's why I bought it. Your question is important to me. I have the breakout board coming as well. Maybe:

Idea #1:

  • write a very simple sketch that sends data from Serial2 to Serial3
  • then from Serial3 to Serial2
  • loop once a second
  • set the baud rate to 9600 to keep things simple

Idea #2:

  • perform a voltmeter continuity test from the high density 80 pin socket to the Serial2 pins. Should probably do this first.

This is just an interesting link:
(Portenta H7 serial communication with .Net)

1 Like

In the file pins_arduino.h, SERIAL2 is linked to PA_15 (TX) and PF_6 (RX)

Unfortunately this information is incorrect as you already found out.

However, if you check with the latest PORTENTA PINOUT document

And if you go to Page 10, you will see that UART2 is linked to PG_14 (TX) and PG_9 (RX).

I have used these PINs instead and Serial2/UART2 had been working for me:

UART mySerial2(PG_14, PG_9, NC, NC);

Hopefully, they will work for you too :grinning:

4 Likes

Excellent. Thank you! I have all four ports working now at 1M baud with the programming port. Very pleased.

I found some other information and made a post with what I used to test the UART serial ports. Hope it helps some people:

Update firmware first:
Portenta Serial UART Testing - Works

Thanks a lot for looking in it! You definitely helped me out!

You are welcomed.

Hopefully, some Arduino folks also see this post and can fix this error inside the file pins_arduino.h itself.

1 Like

Thanks a lot. I have modded the pins_arduino as this allows the use of the Hardware UART.

FYI: pins_arduino for the Portenta board can be found at: C:\Users........\AppData\Local\Arduino15\packages\arduino\hardware\mbed_portenta\4.0.2\variants\PORTENTA_H7_M7\pins_arduino.h