‎2021-04-25 01:10 PM
Hey there,
I am new to STM32MP1 and this forum has been a great help. During the last week I am trying to understand the OpenAMP between the M4 and A7. The ttyRPMSG makes things quite straight forward for the M4 part. When going to the linux part, using terminal is also very convenient, but I would like to send some simple messages from inside C. Until now, I have struggled quite a bit with getting the concept. I have not found yet any simple examples for that. If you have something in mind it would be of great help.
‎2021-04-26 04:16 AM
Hi, I managed to make something simple for writing that works. I leave it here for future reference and any possible feedback.
//write a fixed message in ttyRPMSG0
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#define TTY_RPMSG "/dev/ttyRPMSG0"
int main()
{
//open the device
int fd = open(TTY_RPMSG, O_RDWR | O_NOCTTY | O_SYNC | O_NDELAY);
//write a simple message and its lenght
write(fd, "restart", 7);
//close the device
close(fd);
return 0;
}
‎2021-04-26 07:59 AM
Hi, see also https://wiki.st.com/stm32mpu/wiki/How_to_exchange_large_data_buffers_with_the_coprocessor_-_example
There is link to logic analyzer example.
Regards.
‎2021-04-27 03:11 AM
Hi Patrick,
Thanks a lot for this! This is my next challenge. Since the code on this one is a bit more complex I was looking for a simpler starting point.
‎2021-04-27 03:14 AM
Did you already look at the OpenAMP_TTY_echo ? https://wiki.st.com/stm32mpu/wiki/Getting_started/STM32MP1_boards/STM32MP157x-EV1/Develop_on_Arm%C2%AE_Cortex%C2%AE-M4/Modify,_rebuild_and_reload_a_firmware
‎2021-04-27 03:17 AM
Yes, this was my starting point. Very clear and super useful! I just wanted to transfer the echo functionality from the console to C. The small C code above did the work just fine for now =)