Modify RPMSG buffer payload size

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Modify RPMSG buffer payload size

Modify RPMSG buffer payload size

 

Environment

i.MX8MP EVK, SDK2.15

 

The default rpmsg buffer size in SDK is 512Bytes(16 Bytes header + 496Bytes payload). This knowledge base will try to change the default buffer size in rpmsg framework.

Steps:

 

1.Modify rpmsg payload size in SDK

PATH: SDK\evkmimx8mp_rpmsg_lite_str_echo_rtos_imxcm7\rpmsg_config.h

 

 

//!  RL_BUFFER_PAYLOAD_SIZE
//!
//! Size of the buffer payload, it must be equal to (240, 496, 1008, ...)
//! [2^n - 16]. Ensure the same value is defined on both sides of rpmsg
//! communication. The default value is 496U.
#define RL_BUFFER_PAYLOAD_SIZE (1008)

 

 

2. Modify buffer size in rpmsg linux framework and buffer pool in dts.

PATH: drivers/rpmsg/virtio_rpmsg_bus.c

           arch/arm64/boot/dts/freescale/imx8mp-evk-rpmsg.dts

Zhiming_Liu_0-1706766805792.pngZhiming_Liu_1-1706766827855.png

 

Test steps:

 

Modify the send buffer in imx_rpmsg_tty.c

 

 

#define MSG		"hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world! hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world! hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!"

 

 

 

Modify buffer limitation in SDK

PATH: evkmimx8mp_rpmsg_lite_str_echo_rtos_imxcm7\main_remote.c

 

 

/* Globals */
static char app_buf[1024]; /* Each RPMSG buffer can carry less than 512 payload */

 

 

 

Terminal output

We can see that the MAX buffer size received in SDK is not limited to 512Bytes

 

 

Nameservice sent, ready for incoming messages...
Get Message From Master Side : "hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world! hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world! hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!hello world!" [len : 674]

 

 

 

If we use a larger buffer like 2022 Bytes, we will see error when driver load.

 

 

[ 2673.447384] imx_rpmsg_tty virtio0.rpmsg-virtual-tty-channel-1.-1.30: message is too big (2022)
[ 2673.456271] imx_rpmsg_tty virtio0.rpmsg-virtual-tty-channel-1.-1.30: rpmsg_send failed: -90
[ 2673.465556] imx_rpmsg_tty virtio0.rpmsg-virtual-tty-channel-1.-1.30: rpmsg_dev_probe: failed: -90
[ 2673.474496] imx_rpmsg_tty: probe of virtio0.rpmsg-virtual-tty-channel-1.-1.30 failed with error -90

 

 

 

 

 

No ratings
Version history
Last update:
‎02-01-2024 12:43 AM
Updated by: