Best practice for a protocol on top of RpMsg

We’d like to set up an InterProccesor Communication between the A7 and the M4 using RpMsg.
On the A7 side we run a linux and use the imx_rpmsg_tty driver. On the M4 we use the FreeRTOS.

We’d like to implement a protocol on top of the RpMsg layer to ensure that the data is transferred correctly.
Is there a best practise for Implementing a protocol on top of the RpMsg layer?

Regards,
Simon

Dear @SimonNu

I’m afraid there is no best practice for this. I would start your definition with the question, against what kind of error the communication should be secured.
The RpMsg data is stored directly in the DRAM, and the availability of data is signaled through the SoC’s MU peripheral. There cannot be classical transfer errors like on a UART line. Possible failure modes I can think of are all based on misbehavior of the software.

  • if the signaling does not work, the data does not arrive at all
  • the data could be overwritten by another part of the software

The RpMsg data protocol is packet based (as you see it on the M4 side). Only on the Linux side it is converted into a stream (imx_rpmsg_tty).
I probably would keep the fixed-length RpMsg blocks, and secure each block with a CRC.

Regards, Andy

Dear @andy.tx

Thank you for your answer. This seems reasonable to us. However, we wonder how to implement the CRC. There are going to be cases, where the CRC will be a value of a control character (e.g ETX) for the tty.

Regards,
Simon

Dear @SimonNu

I would expect that you receive all characters - including control characters - after you configure the tty to raw mode:

#  stty -F /dev/ttyRPMSG -echo raw

It would be great if you could post here whether this was successful.

Here’s the reference:

Regards, Andy