Showing results for 
Search instead for 
Did you mean: 

[RPMSG error] No memory for tty_prepare_flip_string

Associate III

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?



ST Employee


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

and on wiki


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.