cancel
Showing results for 
Search instead for 
Did you mean: 

How to send and receive structured data using /dev/ttyRPMSG0 in openstlinux-4.19-thud-mp1-19-10-09 running openstlinux-eglfs distro on an STM32MP157C-DK2.

PWilk.2
Associate II

I've included the stock OpenAMP echo code for the M4 from CubeIDE 1.10-2 and am able to echo a message to /dev/ttyRPMSG0 and have cat print the echoed message.

I've written a simple app in C to open the RPMSG0 device, write(2) a structure and then read(2) the structure back. I've modified the OpenAMP callback code to modify a sructure member and a debugger on the M4 shows that VIRT_UART_Transmit() buffer arg(2) contains the changed structure member value, however, my read(2) on the A7 displays the original structure member value.

This is for a POC so I'm hoping to simply use /dev/RPMSG driver subsystem as is.

Can the standard st-linux RPMSG facility be used to pass structures to M4 and back to A7 as I'm attempted to do .... open(); write(); read() - no close() as I'm expecting to write and read more messages ?

Are there /dev/RPMSGn settings I need to use in order for this to work as intended ?

Are there examples of how to pass structured messages through RPMSGn ?

The STM32Cube_FW_MP1_V1.1.0 Middlewares->Third Party->OpenAmp is quite different in that it uses openamp library calls, is this what I SHOULD be doing ?

Thanks in advance.

Paul.

1 ACCEPTED SOLUTION

Accepted Solutions
Olivier GALLIEN
ST Employee

Hi @wpaulilkinson​ 

Got feedback from expert that issue may come from lack of equivalence of "stty -onlcr -echo -F /dev/ttyRPMSG0" bash command in your Linux app.

You can first validate this assumption by issuing it prior to launch your app.

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

4 REPLIES 4
Olivier GALLIEN
ST Employee

Hi @wpaulilkinson​ 

I have to contact expert to answer about what can goes wrong with your POC.

Anyway for complex or big data structure there is an alternative presented in those page which maybe better suit your need :

https://wiki.st.com/stm32mpu/wiki/How_to_exchange_large_data_buffers_with_the_coprocessor_-_principle

https://wiki.st.com/stm32mpu/wiki/How_to_exchange_large_data_buffers_with_the_coprocessor_-_example

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.
Olivier GALLIEN
ST Employee

Hi @wpaulilkinson​ 

Got feedback from expert that issue may come from lack of equivalence of "stty -onlcr -echo -F /dev/ttyRPMSG0" bash command in your Linux app.

You can first validate this assumption by issuing it prior to launch your app.

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.

Hi @Community member​ 

Thank you very much for both of your replies, very much appreciated.

The example application you referred me to in your first reply uses rpmsg in addition to rpmsg_sdb so provides an example of what I'm trying to do as well as the code to perform the equivalent of the command line stty(1) command you listed.

Debugging in progress.

Best regards,

Paul.

Turns out I had inadvertently neglected to account for the different structure member padding and layout between the CubeIDE M4 compiler and the open embedded gnueabi compiler for the A7 code.