Exchanging buffers with the coprocessor

Revision as of 17:25, 17 July 2019 by Registered User

1. Introduction[edit source]

In the STM32MPU Embedded Software distribution, the RPMsg protocol in in charge of the the communications between the Cortex-A and the Cortex-M (refer to Coprocessor_management_overview article for details).

Before implementing a feature relied on RPMsg protocol, it is important to understand that this protocol has not be designed to directly transfer high rate streams. In consequence , the implementation has to be adapted depending on the use case constraints:

  • For control and low rate data exchange RPMsg is sufficient for the data transfer.
  • For high rate transfer, DMA transfer or real time constraints an indirect buffer exchange mode should be preferred.

2. RPMSG protocol awarness[edit source]

The RPMsg provides through the virtio framework a basic transport layer based on a shared ring buffer:

  • The buffers are pre-negociated and preallocated during coprocessor loading (size , number of buffers).
  • the buffers are allocated in non cacheable memory.
  • There is no direct access to these buffers , they are filled by a copy (no zero copy or DMA transfers).
  • No bandwidth is guaranty. Buffers can be shared between several RPMsg clients.

The size of the buffers is hard-coded ( 512 bytes), but it is possible to customize the number of buffers used. Acting on this parameter will impact the number of buffers allocated in both direction ( refer to [resource table]] for details. Associated to a RPMsg transfer a doorbell signal is sent to the destination processor via the stm32 IPCC mailbox, generating an IRQ for each message transfer.

3. Direct Buffer exchange mode[edit source]

This mode consists in using the RPMsg buffer to transfer the data between the processor.

  • The RPMsg message contains effective data.
  • Memory allocation is limited to the RPMsg buffers allocation.
  • RPmsg client implementation is quite straight forward in term of code implementation.

This implementation is recommended: - for control message, for instance to control a remote processor application, - to exchange low data rate stream (similar to a slow data rate bus).

For application sample, Please refer to List of Availables Projects and have a look into OpenAMP_TTY_echo application.

4. Indirect buffer exchange[edit source]

This mode also called Big Data mode consists in using RPMsg to carry references to some other buffers that contains the effective data. Theses other buffers can be:

  • any size,
  • allocated by multiple means, in cached or non cached memory, in DDR or MCU SRAM, ...
  • mmapped for direct access by application,
  • accessed by DMA.

This implementation is recommended: - for High bit rate transfer (e.g. visual buffers), - for real time transfer (e.g. audio buffers), - to privilege dynamic buffers allocation, - ...

For application sample, Please refer to How to exchange big data between Cortex M4 and Cortex A7 demo.

No categories assignedEdit