cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with ttyRPMSG using OpenAMP Framework

Jatala
Associate II

Hello,

I am working with STM32MP157C-DK2 board and trying to pass messages between the CM4 and the CPU (main processor) using the OpenAMP framework over the com ports ttyRPMSG0 and ttyRPMSG1. On the CPU I have the openstlinux-weston image, and a C program for reading and sending messages through ttyRPMSG ports. In this program for interacting with the ports, I pretty much followed this example. Here is my communication setup:

  •  CPU sends msgs --> ttyRPMSG0 --> CP4 Receives msgs
  •  CM4 sends msgs --> ttyRPMSG1 --> CPU Receives msgs

The CM4 firmware setups and configure OpenAMP and VIRT_UARTs very much as in the OpenAMP_TTY_echo. Here is the issue that I want to resolve.

- The CM4 receives the messages sent from CPU.

- However, on the CPU side, receiving messages only works if in a terminal I run

 echo 'some text' > /dev/ttyRPMSG1

 This is quite annoying. Encapsulating this command in a shell script and launching a

 systemd service does not work (in the sens that the CPU does not receive msgs over the ttyRPMSG1).

What I am looking for:

  • Why the echo command in the terminal is necessary and why it enables the communication channel?
  • Is there a way to avoid this command, and enable the communication channel without executing a command/code in a terminal.

Kind regards

1 ACCEPTED SOLUTION

Accepted Solutions
Olivier GALLIEN
ST Employee

Hi @Jatala​ ,

As you can read in this old post ( https://community.st.com/s/question/0D50X0000BaMkj0SQC/virtuart-or-rpmsg-framework-on-m4-cannot-send-messages-until-a7-host-sends-a-message ) this is an on purpose OpenAMP design decision.

To establish a RPMsg channel both side has to be ready to communicate.

when a new service is created, The receiver has to send a first message to communicate is own address. So you have at least to send an acknowledge dummy message.

if you are using the TTY over rpmsg, you have to send a first message from your Linux application

The rule in this ST use case is that the Linux application has to send the first message. this message will be received by the remote application. So it can be a dummy or a normal message. It depends of your implementation. So either you discard the first one or you can also implement something similar to the UART flow control:

  • send "RTS 1" string when ready to receive ( this will be the first message
  • send "RTS 0" string when you want to suspend the reception.

Typically this is managed by some C applicative code. Not through terminal command.

Hope it help,

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

2 REPLIES 2
Olivier GALLIEN
ST Employee

Hi @Jatala​ ,

As you can read in this old post ( https://community.st.com/s/question/0D50X0000BaMkj0SQC/virtuart-or-rpmsg-framework-on-m4-cannot-send-messages-until-a7-host-sends-a-message ) this is an on purpose OpenAMP design decision.

To establish a RPMsg channel both side has to be ready to communicate.

when a new service is created, The receiver has to send a first message to communicate is own address. So you have at least to send an acknowledge dummy message.

if you are using the TTY over rpmsg, you have to send a first message from your Linux application

The rule in this ST use case is that the Linux application has to send the first message. this message will be received by the remote application. So it can be a dummy or a normal message. It depends of your implementation. So either you discard the first one or you can also implement something similar to the UART flow control:

  • send "RTS 1" string when ready to receive ( this will be the first message
  • send "RTS 0" string when you want to suspend the reception.

Typically this is managed by some C applicative code. Not through terminal command.

Hope it help,

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Jatala
Associate II

Hi @Community member​ 

Thanks, it did the trick. Previously I also tried sending the dummy message from the C/C++ program using the QProcess, essentially executing the terminal command, as QProcess::execute("echo 'dummy msg' > /dev/ttyRPMSG1"); but even though the command was executed successfully, the RPMSG channel was not enabled.

Kind regards

Jatala