cancel
Showing results for 
Search instead for 
Did you mean: 

stm32mp157c rpmsg comminucation problem

aliMesut
Associate III

Hello,

I am working stm32mp157c. It has two processor (A7 and M4). They can communicate with each other over virt uart(rpmsg). When I want to send a message to a7 over m4, if the message is filled with constant data, everything is ok. If the message is filled with sequential data, the data cannot be fully transmitted. For example,

while(1)

{

OPENAMP_check_for_message();

uint8_t buffer[496] = { 0 };

for(uint16_t i = 0; i < sizeof(buffer); i++)

buffer[i] = 48;

VIRT_UART_Transmit(&huart0, buffer, sizeof(buffer));

HAL_Delay(1000);

}

In the above case everything is ok. But the following situation

while(1)

{

OPENAMP_check_for_message();

uint8_t buffer[496] = { 0 };

for(uint16_t i = 0; i < sizeof(buffer); i++)

buffer[i] = i;

VIRT_UART_Transmit(&huart0, buffer, sizeof(buffer));

HAL_Delay(1000);

}

It can only receive 251 of 496 bytes of data. IPCC clock speed is 210MHz.

What could be the problem?

1 ACCEPTED SOLUTION

Accepted Solutions
ArnaudP
Senior

This probably comes from the TTY termios settings which should be set to raw.

The logic analyser demo uses the TTY . Could you test if demo settings available fix your issue:

https://github.com/STMicroelectronics/meta-st-stm32mpu-app-logicanalyser/blob/dunfell/recipes-graphics/st-software/logic-analyser-backend/backend.c#L277

View solution in original post

10 REPLIES 10
ArnaudP
Senior

Hello @aliMesut​ 

I have never seen such an issue.

I would suggest you as a first step to determine if the issue is comming from Linux or stm32Cube firmware

For this, you can trace rpmsg in linux kernel trace by enabling Linux Kernel dynamic traces as described here

you should see similar trace:

[ 7978.646821] virtio_rpmsg_bus virtio0: From: 0x401, To: 0x35, Len: 40, Flags: 0, Reserved: 0
[ 7978.646857] rpmsg_virtio RX: 01 04 00 00 35 00 00 00 00 00 00 00 28 00 00 00  ....5.......(...
[ 7978.646876] rpmsg_virtio RX: 72 70 6d 73 67 2d 74 74 79 00 00 00 00 00 00 00  rpmsg-tty.......
[ 7978.646892] rpmsg_virtio RX: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
[ 7978.646906] rpmsg_virtio RX: 01 04 00 00 00 00 00 00                          ........

With the Len value indicating the number of data received

aliMesut
Associate III

Hi @ArnaudP​ ,

Thank you supporting.

If there is 0x1C(file seperator) data in buffer while sending a message, it stops sending the message.

I think it's because of serial port comminucation (tty).

The code running in linux that takes the data is as follows.

int main(void)

{

  #define VIRT_BUF_SIZE 188 * 2

  uint8_t readBuf[VIRT_BUF_SIZE] = { 0 };

  int fd;

  fd = open("/devttyRPMSG0", 0_RDWR);  

  if(fd < 0)

    return EXIT_FAILURE;

  

  while(1)

  {

    read(fd, readBuf, VIRT_BUF_SIZE);

    ...

  }

}

ArnaudP
Senior

This probably comes from the TTY termios settings which should be set to raw.

The logic analyser demo uses the TTY . Could you test if demo settings available fix your issue:

https://github.com/STMicroelectronics/meta-st-stm32mpu-app-logicanalyser/blob/dunfell/recipes-graphics/st-software/logic-analyser-backend/backend.c#L277

aliMesut
Associate III

Thank you so much @ArnaudP​ .

I did what you said and now I can transfer raw data!

Hello @aliMesut​ ,

While executing your c code on A7 side did you also try to send the (Transmit) command first? Becasue I think only when you transmit first form A7 , M4 receives(in a call back ) and transmit.

Is it possible also to not transmit from the A7 side and able to transmit directly from the M4 side? @ArnaudP​  am I correct?

Regards,

P

During its initialization the Cortex-M4 creates (for instance) a rpmsg TTY channel sending it rpmsg endpoint address to the Cortex-A7. At this step the the Cortex-A7 knows the Cortex-M4 endpoints address, but the inverse is not true.

So the Cortex-A7 has to send a first message to the Cortex-M4 endpoint to provide its address.

@ArnaudP​ thanks for the clarification, hat makes sense.

thr api name is virt_uart.. so is there any baud rate settings as well we have to do?

i am getting a continous stream of data from m4 but with some characters garbled( different signs) on the minicom(115200 8n1) .

what could be the reason. I used the code you posted above for backend.c except i removed the gui elements(related to gtk)

thete is no baud rate setting in that.

just to tel you that if i do virt_uart_transmit(..,�?some string�?,..) this goes fine but a uint8 buffer is all garbled up.

like (uint8*)uint8buffer_array_name

@aliMesut​ can you please share your A7 code if possible(with possible properiety code removed)

thanks in advance !!

regards

p

> what could be the reason. I used the code you posted above for backend.c except i

> removed the gui elements(related to gtk)

> thete is no baud rate setting in that.

Your issue probably comes from the TTY setting. If you want to verify the rpmsg payload you can enable Linux kernel traces to dump rpmsg in kernel trace:

https://wiki.st.com/stm32mpu/wiki/Linux_RPMsg_framework_overview#How_to_trace_and_debug_the_framework

@ArnaudP​ 

on enabling the traces i am getting :

systemd-journald[292]: /dev/kmsg buffer overrun, some messages lost...

i am continously sending the 150 byte data in a for loop , single buffer of 150 element also tested with 1 character at a time in a loop of 150.

DO i need to change any RPMSG buffer setting?

system clock is 72Mhz.

Regards,