Skip to main content
OBaselga
Associate II
July 26, 2021
Question

[RPMSG error] No memory for tty_prepare_flip_string

  • July 26, 2021
  • 1 reply
  • 1014 views

Hi everyone,

I'm coding an applicaction which needs to send data from CM4 to CA7 through RPMSG framework. FreeRTOS task involved:

void t0Task(void *argument)
{
 int count = 0x0, sim_ch = 9;
 const int SIZE_DATA = 7;
 unsigned char msg[SIZE_DATA * sim_ch], msg2[SIZE_DATA];
 TickType_t xLastWakeTime;
 const TickType_t xFrequency = 1;
 
 while (1)
 {
	 xLastWakeTime = xTaskGetTickCount();
 
	 msg[0] = '\0';
	 int i;
	 for (i = 0; i < sim_ch; i++) {
		 sprintf(msg2, "%06X", count);
		 strcat(msg, msg2);
		 strcat(msg, " ");
		 count = (count + 1) % 0xFFFFFF;
	 }
 
	 VIRT_UART_Transmit(&virtUART0, (uint8_t*)msg, strlen(msg));
	 vTaskDelayUntil( &xLastWakeTime, xFrequency );
 }
}

I need to achieve a throughput near 1.5 MB/s - for that, "sim_ch" variable should be 128.

When this firmware is executing, an error appears after few seconds: "rpmsg_tty virtio0.rpmsg-tty-channel.-1.0: No memory for tty_prepare_flip_string". How can I solve it?

Thanks,

Oscar

This topic has been closed for replies.

1 reply

PatrickF
ST Employee
July 27, 2021

Hi,

at first look, msg size defintion is missing one position to store the '\0' at the end of the string, so in your example msg real length in memory is sim_ch*7+1

maybe try:

unsigned char msg[ (SIZE_DATA * sim_ch) + 1], msg2[SIZE_DATA];

See also this (old) message https://community.st.com/s/question/0D50X0000BNugJi/no-memory-for-ttyprepareflipstring

and on wiki

https://wiki.st.com/stm32mpu/wiki/How_to_exchange_data_buffers_with_the_coprocessor

Regards.

In order to give better visibility on the answered topics, please click on 'Best Answer' on the reply which solved your issue or answered your question.Tip of the day: Try Sidekick STM32 AI agent