How to send a message from M4 core (FreeRTOS) to A7 core (Linux) using RPMsg on Colibri iMX7?

Hello,

I am working on a Colibri iMX7 emmc module with colibri evaluation board, I want to send a simple message from the Cortex-M4 core (running FreeRTOS) to the Cortex-A7 core (running Linux) using RPMsg.

I found the str_echo_freertos.c example, which demonstrates string echo functionality using RPMsg as a remote endpoint.
str_echo_freertos.c

My questions are:

  1. How should I modify this example to actively send a message from the M4 core to the A7 core instead of just echoing what the A7 sends?
  2. On the A7/Linux side, which device node should I open (e.g., /dev/ttyRPMSG*, /dev/rpmsg*) to receive this message? and also how to send message bcz in that freertos code its waiting to receive some message
  3. Are there any specific steps required in the Linux side (device tree or drivers) to enable this RPMsg communication with FreeRTOS on the M4?

Here is the reference example I am looking at (from the NXP FreeRTOS RPMsg demo):
[Include your str_echo_freertos.c snippet or attach the file]

Any guidance or example code for M4 → A7 message sending on iMX7 would be greatly appreciated!

Thanks,
Udaykumar

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


RPMsg Communication on Colibri iMX7

Hello Udaykumar,

Based on the Toradex documentation for FreeRTOS on Colibri iMX7, I can help you set up RPMsg communication between the Cortex-M4 and Cortex-A7 cores.

1. Modifying the Example for M4 → A7 Communication

The RPMsg TTY example is designed for bidirectional communication (1). The FreeRTOS firmware uses Colibri UART_B as its debugging console with a baudrate of 115200 (1). To actively send messages from M4 to A7, you can use the existing RPMsg framework which handles both sending and receiving.

2. Linux Side Device Nodes

On the Linux side, you’ll interact with /dev/ttyRPMSG* devices (1). The RPMsg TTY example creates a virtual TTY on Linux side to send RPMsg to FreeRTOS, where each string sent to the FreeRTOS example will be sent back to the Linux host (1).

After loading the kernel module, you can communicate using:

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

(1)

3. Required Linux Configuration Steps

Device Tree Configuration

By default, Linux device tree uses UART_B, which leads to an external abort when the Linux kernel tries to access UART_B (1). You need to alter the device tree and disable UART_B using the status property, which can be done by applying device tree overlays (1).

Loading the Firmware

For eMMC-based Colibri iMX7, you can load the firmware using the ext4load method (1). Use the following commands to enable automatic loading and execution of an elf binary firmware:

> setenv m4boot 'ubi read ${loadaddr} m4firmware && bootaux ${loadaddr}'
> saveenv

(1)

Module Loading

To load the module automatically on every boot, create a config file:

# echo imx_rpmsg_tty > /etc/modules-load.d/rpmsg_tty.conf

(1)

Available Examples

The documentation provides several working examples in the examples/imx7_colibri_m4/demo_apps/rpmsg/ directory (1):

  • RPMsg TTY Example (rpmsg_str_echo_freertos_example.elf) - Uses virtual TTY for bidirectional communication
  • RPMsg PingPong Example (rpmsg_pingpong_freertos_example.elf) - Demonstrates message exchange with incremental values

Important Notes

  • The FreeRTOS firmware uses Colibri UART_B (RS232 X25-Top on the Colibri Evaluation Board) as its debugging console (1)
  • Make sure to connect UART_B to your debugging host and start a serial terminal emulator with baudrate 115200 to see FreeRTOS debug output (1)
  • The Resource Domain Controller (RDC) manages access to peripherals between the cores, and devices used by Cortex-M4 should be disabled in the Linux device tree (1)

Precompiled firmwares are available at: Index of /Colibri/FreeRTOS/Binaries (1)

Best regards, Toradex AI Assistant.

@ToradexAI

n my case, I don’t want bidirectional communication. I just want to continuously send messages from the M4 core to the A7 core using RPMsg.

How can I modify the rpmsg_str_echo_freertos_example to achieve this one-way communication? Do I still need to configure /dev/ttyRPMSG* on Linux, or is there a better way to handle only receiving messages on the A7

Thanks for your response.

Please remember to tick the “Solution” checkbox below if my response solves your question. If you have follow-up questions, just continue to tag me using @ToradexAI in your new posts.

Did you like my answer? :+1: :-1:


One-Way Communication from M4 to A7

For one-way communication from M4 to A7, you can modify the RPMsg TTY example to continuously send messages without waiting for responses (1).

Modifying the M4 FreeRTOS Code

The RPMsg TTY example uses the imx_rpmsg_tty.c Linux kernel module (1). After the nameservice announcement is sent and the link is established, you can send messages periodically using the existing RPMsg framework.

Here’s how to modify the approach:

  1. Initialize RPMsg as usual - Keep the initialization sequence from the example
  2. Send periodic messages - Instead of waiting for incoming messages, send messages at regular intervals
  3. Remove the echo functionality - Don’t wait for or process incoming messages

Linux Side Configuration

Yes, you still need to configure /dev/ttyRPMSG* on the Linux side (1). The RPMsg TTY example creates a virtual TTY on Linux side, and when the kernel module loads, it creates the device node automatically.

After loading the module:

# modprobe imx_rpmsg_tty

(1)

The probe method sends a “hello world” to the M4 side, which should be visible in the Cortex-M4 console (1):

Name service handshake is done, M4 has setup a rpmsg channel [1 ---> 1024]
Get Message From A7 : "hello world!" [len : 12] from slot 0

(1)

Reading Messages on Linux

To continuously read messages from M4, you can use:

# DEV=/dev/`ls /dev/|grep RPMSG`
# cat < $DEV

(1)

This will display all messages sent from the M4 core.

Alternative: RPMsg Char Example

For more control over the communication, you could also consider the RPMsg Char example which uses /dev/rpmsg_ctrl0 and /dev/rpmsg0 devices (1). This approach provides more direct control over endpoint creation and message handling.

Device Tree Considerations

Remember that the Linux device tree uses UART_B by default, which leads to conflicts (1). You need to disable UART_B in the device tree using the status property, which can be done by applying device tree overlays (1).

Important Notes

  • The FreeRTOS firmware uses Colibri UART_B as its debugging console with baudrate 115200 (1)
  • Make sure the imx_rpmsg_tty kernel module is loaded before expecting communication (1)
  • The Resource Domain Controller (RDC) manages peripheral access between cores (1)

This approach allows you to send continuous messages from M4 to A7 without requiring bidirectional communication.

Best regards, Toradex AI Assistant.