How to use RPMsg on Torizon 6 Colibri i.MX8X with containers

There is a long thread regarding something similar for the Verdin: RPMSG on TorizonCore 6 with Verdin iMX8M-Mini

The observations in the thread regarding use of ‘cat’ were useful as I was also confused by that behaviour. However, the thread doesn’t get to the part I remain unsure of.

Torizon wants us to now be using containers for all our functionality. Having got a functioning RPMsg tty device in Linux on the i.MX itself, in a containerised environment we presumably want one container serving the data in/out to all consumers.
However, I don’t know how to connect the /dev/ttyRPMSG30 device to a container - usual tty references regarding docker containers are for connecting console devices to the container, not a tty used as a bidirectional pipe as we are doing with RPMsg.

What do I need to do to use /dev/ttyRPMSG30 in a container please?

This is assuming I should be using the tty method rather than writing a customer kernel module (but that would presumably be even harder to interface to a container).

Greetings @Sebtombs,

Could you elaborate more on your use-case and expectations here. So you want to be able to access the file descriptor /dev/ttyRPMSG30 in a container and do what? Send and receive messages on it? Or something more complex?

Have you tried anything so far and what were the results?

Best Regards,
Jeremias

Hi Jeremias.

I apologise for the long delay in replying - had to look at some other aspects of migration to Torizon first due to customer needs.

The RMPsg tty mechanism creates a /dev/ttyRPMSG device in Linux when the M4 creates an end-point. The tty is then used for bidirectional transfer between the M4 and Linux on that endpoint. It behaves as a tty device but doesn’t really have some of the usual tty attributes such as baud rate, parity, etc.

We have high-speed functionality running on the M4 which is distilled down to lower speed signals published to the Linux app. These are passed across using RPMsg, so what I would like to be able to do is access the endpoint ttys in appropriate containers. I have found documentation on how to connect a specific console tty to a container but in my use case here I don’t want a console.

I therefore haven’t tried anything yet as I don’t know what arguments to pass to docker and/or the Torizon VS Code plugin to connect a tty in the container to the actual tty on the docker host.

If this isn’t the recommended way of tackling the issue then I will be most grateful if you would point me in the right direction please - I was wondering whether I needed to add a kernel module to use the same interface to the M4 but appear to Linux as a network socket but that’s non-trivial.

All the best,

Mark

Okay I think I understand now. So essentially you want access to this /dev/ttyRPMSG file descriptor in a container, correct?

If that is the case can you try making this available in the container via the --device flag for docker run. If this file descriptor is similar to other UART/tty like devices then the concepts in the following article should apply: How to Use UART on Torizon OS | Toradex Developer Center

Once /dev/ttyRPMSG is available inside the container you can try to access it and see what happens from there.

Best Regards,
Jeremias

Thanks Jeremias, the UART guidance looks like a good basis for this work as you say. I will give that a try as soon as I am able to (a display issue has cropped up which is taking priority at present).

All the best,

Mark