Hello @aliMesut ,
Ok, I made a small code in c to try to write 200 bytes in one write operation like you:
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
int main (int argc, char **argv)
{
int32_t i32Fd;
int32_t i32Ret;
u_int8_t au8Buffer[200];
int32_t i32Errno;
if (memset(au8Buffer, 0, sizeof(au8Buffer)) == NULL)
{
printf("memset failed\n");
return -1;
}
if ((i32Fd = open("/dev/ttyRPMSG0", O_WRONLY | O_NOCTTY)) < 0)
{
printf("Open failed and returned i32Fd = [%d]\n", i32Fd);
i32Fd = STDERR_FILENO;
return -1;
}
i32Ret = write(i32Fd, au8Buffer, sizeof(au8Buffer));
if (i32Ret < 0)
{
i32Errno = errno;
printf("write failed and returned ret = [%d] and errno = [%d][%s]\n", i32Ret, i32Errno, strerror(i32Errno));
return -1;
}
printf("Success %d bytes written\n", i32Ret);
return 0;
}
And it works every time.
root@stm32mp1:~# ls /dev/ttyRPMSG0 -l
crw-rw---- 1 root dialout 5, 3 Sep 20 11:26 /dev/ttyRPMSG0
root@stm32mp1:~# /usr/local/gtk_hello_world
Success 200 bytes written
root@stm32mp1:~# /usr/local/test
Success 200 bytes written
root@stm32mp1:~# /usr/local/test
Success 200 bytes written
root@stm32mp1:~# /usr/local/test
Success 200 bytes written
root@stm32mp1:~#
I used the application example OpenAMP_TTY_echo that is provided with the STM32Cube_FW_MP1: https://wiki.st.com/stm32mpu/wiki/Getting_started/STM32MP1_boards/STM32MP157x-DK2/Develop_on_Arm%C2%AE_Cortex%C2%AE-M4/Install_STM32Cube_MP1_package
Please follow this page and the next one to test the OpenAMP_TTY_echo.
This application will executes the VIRT_UART_Init and other functions call to create the "/dev/ttyRPMSG0" and makes it operational.
Can you try your code with this M4 application to see how your code behaves.
And please send me the log, if you still encounter issue.
Other wiki page about this application:
https://wiki.st.com/stm32mpu/wiki/Exchanging_buffers_with_the_coprocessor#Direct_buffer_exchange_mode
Hope it helps you,
Regards,
Kevin