RPMsg Char Example for FreeRTOS


imx_rpmsg_tty driver is quite good, but two or more instances of /dev/ttyRPMSGx would be better. One for data pipe and another one for control, commands etc. As I understand this is not currently possible, only single /dev/ttyRPMSG0?

Alternative could be RPMsg Char Example. Endpoints sound as what I need, one for data I/O, another one for control. But I see no FreeRTOS example for it. Only bare metal str_echo_bm, Linux side of it is quite clear, but M4 side is somewhat fuzzy. Disable interrupt here, enable there. Not really big deal, but I’d like to see a better example.

As I understand it, to make rpmsg_char driver working I need to enable CONFIG_RPMSG_VIRTIO_CHAR, which is not mentioned in the list of required kernel options 1. But if I enable it then imx_rpmsg_tty driver stops working. No CONFIG_RPMSG_VIRTIO_CHAR - then rpmsg_char driver stops working. Isn’t it?

str_echo_bm app for M4 seems being compatible with both rpmsg_char and imx_rpmsg_tty. But str_echo_freertos dead locks Linux as soon as I start test app which opens/closes RPMSG endpoins using /dev/rpmsg_ctrl0. This makes me concerned, should I bother implementing my needs using /dev/rpmsg_ctrl0 and endpoints or indeed implement it using some control/data protocol over /dev/ttyRPMSG?

Greetings @Edward!

You’re right, the default implementation offers only a single endpoint, so a single TTY.

This other community thread mentions that NXP has published some multi-endpoint examples which can be found here and here. I haven’t tried these myself but it seems like they’re using a user-space approach with the rpmsg-sysfs module. I think these should work but I was unable to find some good M4 examples for this.

I think both approaches would work, but I feel that most customers end up implementing their own protocol over /dev/ttyRPMSG.

Hi @gustavo.tx

Thanks for your interesting comment! Unfortunately I see no /sys/class/rpmsg, which is used in those examples to manipulate rpmsg endpoints. Any hints how to enable rpmsg sysfs? Kernel configuration menu doesn’t show something like that and I’m lost where to look next.

Update: Oh, I see the kernel patch for rpmsg-sysfs here. Indeed I’ll postpone it for later, /dev/ttyRPMSG for now.



Yes, that’s exactly the patch! This might just work with our BSP 2.8 since it comes with kernel 4.9 but might need some work for the latest BSP 3.0.4 (kernel 4.14) and BSP 5.x (kernel 5.4).

Please let me know of any further development and do not hesitate to ask if you see any more issues.