How to use Serial on Portenta H7 's M4 core?

Hello,
This is Sandeep. I have been trying to send some data on UART to another device present in my project using cortex M4 of Portenta H7. I was able to transfer data using M7 but not through M4. I don't want to utilize the RPC mechanism as my M7 is already busy doing other task and I don't want to overload M7 for this task.
I tried using the STM32 libraries located in User folder (Windows operating system): AppData\Local\Arduino15\packages\arduino-beta\hardware\mbed\1.2.2\cores\arduino\mbed\targets\TARGET_STM\TARGET_STM32H7\STM32Cube_FW\STM32H7xx_HAL_Driver in order to initialize the peripheral and transmit data using the APIs provided by STM32 libraries. I don't have issue in compilation. Even this has failed to transmit data.
I was unable to understand why M4 is not able you utilize the UART peripheral. Can anyone help me in find a solution to transmit data over any of the UART available on Portenta H7 using cortex M4.
Thank you
Sandeep

How about using the Arduino core API's Serial1 interface on pins 13 and 14?

Hello Pert,

I have connected serial to USB converter and tried reading the data from pin 13 and 14 as you said using serial1.
That also working only for cortex M7 only not for M4.

Thank You
Sandeep

It's working for me.

I have this sketch running on the M7 core:

void setup() {
  bootM4();
}
void loop() {}

And this sketch running on the M4 core:

void setup() {
  Serial1.begin(9600);
}

void loop() {
  Serial1.println("hello");
  delay(1000);
}

Does that work for you?

1 Like

I should also mention that I'm using Arduino Mbed OS Boards platform version 1.3.1. If you're using an old version of the platform then you need to use Serial instead of Serial1:

Thank you Pert.

The package is not working on Arduino IDE. I mean, it is throwing error on installing package as Access denied. After that, I changed the IDE from Arduino IDE to Arduino Pro IDE and installed the Arduino Mbed OS Boards platform version 1.3.1 and in a single shot it started working.

You're welcome. I'm glad if I was able to be of assistance. I'm sorry to hear about the troubles with Arduino IDE, but at least you found a good workaround. If you ever need to get Arduino IDE working, I'm sure the folks here on the forum will be happy to help out.

Enjoy!
Per