Rpmsg user space application

I am trying to make an RPMSG user space application for IMX7 and make communication between cortex M4 and cortex A.
I am trying to send data from cortex M to Linux user space application, or to exchange data between them.
I have used and analysed Toradex IMX7 examples from this link freertos colibri-imx7 , and I had noticed imx_rpmsg_pingpong LKM, and I didn’t succeed to make a user space application like that.
I have also noticed imx_rpmsg_tty and I know that it offer /dev/ttyRPMSG for communication, but I can only send data from Linux to cortex M.

Is there a way that allow me to make a use space application to send data from cortex M to cortex A or exchange data between them?

Hi @marouen,

Ping pong is like just demonstration. More practical is str_echo_freertos. Once you make it compiled and working, see RPMsg_TTY_Example, it is quite straight forward how to modify M4 FW for your M4-A7 communications needs. Linux side is almost the same like serial IO via /dev/tty.

Regarding not very friendly cmake projects, well, you have them as they are. Link above provides all required instructions how to build FreeRTOS examples, perhaps something minor is missing.

What do you mean here? Are you sure your /dev/ttyRPMSG is device node and not a regular file?

~# ls -l /dev/ttyRPM*
crw-rw----    1 root     dialout   244,   0 Jun 17 07:16 /dev/ttyRPMSG0
-rw-r--r--    1 root     root             1 Jun 17 07:17 /dev/ttyRPMSG1

^^ here ttyRPMSG0 is device node, see attributes. And ttyRPMSG1 is file, as a result of echo output redirection to non existent device.

Hi @marouen,

Were you able to run the ping pong demo from NXP?
Note that, in order to make this work, you’ll need to change the device tree to work with the Cortex-M UART.

Best regards,

Hi @hfranco.tx
Hi @Edward
I ran all RPMSG examples in tdx-reference-minimal-image. I am just trying to create my user space examples now. The imx_rpmsg_tty allows me to send data only from Linux to cortex M.

Yes, I could send data to /dev/tty/RPMSG which allows me to send to cortex M firmware, and I can’t send data to it from cortex M.

Does example, which I mentioned above work? Does it echo “Test” message back?

# DEV=/dev/`ls /dev/|grep RPMSG`
# stty -F $DEV -echo
# exec 3<> $DEV 
# echo Test >&3 
# cat <&3

Hi @marouen,

In order to use the RPMSG, first you’ll need to disable the UART2, which is the UART used by Cortex-M to communicate. We already have an overlay to disable that, called colibri-imx7_disable-uart-b_overlay.dts.
After enabling this overlay, you can use and USB to UART converter to see the outputs from the cortex M and to send messages to cortex A.
Inside Linux, you’ll need to enable the proper driver for RPMSG. You can do it by running:

root@colibri-imx7-emmc-06877201:~# ls /dev/ | grep -i rpmsg
root@colibri-imx7-emmc-06877201:~# modprobe imx_rpmsg_tty
[  158.208166] imx_rpmsg_tty virtio0.rpmsg-openamp-demo-channel.-1.0: new channel: 0x400 -> 0x0!
[  158.217186] Install rpmsg tty driver!
root@colibri-imx7-emmc-06877201:~# ls /dev/ | grep -i rpmsg

I don’t know if you’ve already followed these steps, but it should work to send messages from cortex M to cortex A.

Best regards,