Skip to main content
Explorer
November 12, 2021
Solved

stm32mp157c rpmsg comminucation problem

  • November 12, 2021
  • 4 replies
  • 3885 views

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?

    This topic has been closed for replies.
    Best answer by ArnaudP

    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

    4 replies

    ST Employee
    November 16, 2021

    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

    aliMesutAuthor
    Explorer
    November 17, 2021

    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);

        ...

      }

    }

    ArnaudPAnswer
    ST Employee
    November 18, 2021

    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

    aliMesutAuthor
    Explorer
    November 21, 2021

    Thank you so much @ArnaudP​ .

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

    Visitor II
    June 13, 2022

    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

    ST Employee
    June 13, 2022

    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.