2023-04-08 12:41 AM
Hello,
I want to send in reliable way messages from M4 core to A7 core (in my case its the HW is STM32MP157 -DK2 ).
The problem is that when A7 core is busy, the messages are truncated.
The quesiton is how M4 core would know that A7's buffers are full?
I went thru the RPmsg code api and I can see that uart driver uses the api funciton below:
/**
* This function sends rpmsg "message" to remote device.
*
* @param ept - pointer to end point
* @param src - source address of channel
* @param dst - destination address of channel
* @param data - data to transmit
* @param len - size of data
* @param wait - boolean, wait or not for buffer to become
* available
*
* @return - size of data sent or negative value for failure.
*
*/
int rpmsg_send_offchannel_raw(struct rpmsg_endpoint *ept, uint32_t src,
uint32_t dst, const void *data, int len,
int wait)
Which should return <0 in case of failure (I guess it cant send the message due to buffer are full).
My experiment reveals that when A7 is not busy and gets all messages quickly function returns
positive number -> that is OK. But when I completely turns off getting data on A7 side, this function shall eventally return <0, but it returns sometime positive sometime negative number
TX send number -2002
TX send number 360.
TX send number -2002.
TX send number 360.
TX send number 360.
TX send number 360.
TX send number 360.
TX send number -2002.
TX send number 360.
And here is what linux on A7 side tell me
[39841.086851] rpmsg_tty virtio0.rpmsg-tty-channel.-1.1024: Trunc buffer from 460 to 104
[39841.093412] rpmsg_tty virtio0.rpmsg-tty-channel.-1.1024: No memory for tty_prepare_flip_string
[39841.102177] rpmsg_tty virtio0.rpmsg-tty-channel.-1.1024: No memory for tty_prepare_flip_string
[39841.110948] rpmsg_tty virtio0.rpmsg-tty-channel.-1.1024: No memory for tty_prepare_flip_string
[39841.119534] rpmsg_tty virtio0.rpmsg-tty-channel.-1.1024: No memory for tty_prepare_flip_string
This question is also related to debug message
rpmsg_tty virtio0.rpmsg-tty-channel.-1.0: No memory for tty_prepare_flip_string
where kind of solution is in common issues here
https://wiki.st.com/stm32mpu/wiki/Coprocessor_management_troubleshooting_grid