Search code examples
embeddedipcrpcmicrocontrolleruart

Microcontroller to microcontroller communication library (over UART/RS232)


I want to interface two microcontrollers with a UART interface and I search a protocol to exchange data between them.

In practice, I want to exchange data periodically (ie: sensors reading) and also data on event (GPIO state). I have around 100-200 bytes to exchange every 100 milli second.

Does anybody know a protocol or library to achieve this kind of task ?

For now, I see protobuf and nano protobuff ? Is there something else ? It would be nice if I could add a software layer over the UART and use "virtual data stream" like if it was a TCP/IP connection to N ports.

Any idea ? Thanks


Solution

  • How about this: eRPC https://community.nxp.com/docs/DOC-334083

    The eRPC (Embedded Remote Procedure Call) is a Remote Procedure Call (RPC) system created by NXP. An RPC is a mechanism used to invoke a software routine on a remote system using a simple local function call. The remote system may be any CPU connected by an arbitrary communications channel: a server across a network, another CPU core in a multicore system, and so on. To the client, it is just like calling a function in a library built into the application. The only difference is any latency or unreliability introduced by the communications channel.

    I have use it in a two processor embedded system, a cortext-A9 CPU with a Context-M4 MCU, which communicate each other with SPI/GPIO.

    Erpc can run over UART, SPI, rpmsg and network(tcp). even when using serial or SPI as transport tunnel, it can do bidirectional calls and with very minimal footprint.