cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with OpenAMP_TTY_echo example and creation of /dev/ttyRPMSG0 device

Mike Thompson
Associate III

I'm trying to work through and understand the OpenAMP_TTY_echo example project provided by the Keil MDK pack STM32MP1xx_DFP v1.3.1.

The environment I'm running on is the STM32MP157D-DK1 with a Yocto built Linux image.

I can build in Keil MDK and then transfer the OpenAMP_TTY_echo.axf file to the /lib/firmware/ directory with the following command.

scp -oStrictHostKeyChecking=no -r OpenAMP_TTY_echo.axf root@192.168.90.165:/lib/firmware/openamp_tty_echo

And then run it on the CM4 processor using the following commands:

echo openamp_tty_echo > /sys/class/remoteproc/remoteproc0/firmware
echo start > /sys/class/remoteproc/remoteproc0/state
[ 3906.420033] remoteproc remoteproc0: powering up m4
[ 3906.424980] remoteproc remoteproc0: Booting fw image openamp_tty_echo, size 512184
[ 3906.432298] remoteproc0#vdev0buffer: assigned reserved memory node vdev0buffer@10042000
[ 3906.445158] virtio_rpmsg_bus virtio0: rpmsg host is online
[ 3906.457752] remoteproc0#vdev0buffer: registered virtio0 (type 7)
[ 3906.462916] remoteproc remoteproc0: remote processor m4 is now up
[ 3906.468828] virtio_rpmsg_bus virtio0: creating channel rpmsg-tty-channel addr 0x0
[ 3906.479913] virtio_rpmsg_bus virtio0: creating channel rpmsg-tty-channel addr 0x1

As far as I can tell with the Keil MDK debugger the CM4 example is running and the following calls seem to succeed without errors.

/*
* Create Virtual UART device
* defined by a rpmsg channel attached to the remote device
*/
log_info("Virtual UART0 OpenAMP-rpmsg channel creation\r\n");
if (VIRT_UART_Init(&huart0) != VIRT_UART_OK) {
log_err("VIRT_UART_Init UART0 failed.\r\n");
Error_Handler();
}

log_info("Virtual UART1 OpenAMP-rpmsg channel creation\r\n");
if (VIRT_UART_Init(&huart1) != VIRT_UART_OK) {
log_err("VIRT_UART_Init UART1 failed.\r\n");
Error_Handler();
}

/*Need to register callback for message reception by channels*/
if(VIRT_UART_RegisterCallback(&huart0, VIRT_UART_RXCPLT_CB_ID, VIRT_UART0_RxCpltCallback) != VIRT_UART_OK)
{
Error_Handler();
}
if(VIRT_UART_RegisterCallback(&huart1, VIRT_UART_RXCPLT_CB_ID, VIRT_UART1_RxCpltCallback) != VIRT_UART_OK)
{
Error_Handler();
}

However, on the Linux CA7 side I fail to see the /dev/ttyRPMSG0 and /dev/ttyRPMSG1 devices created. The documentation seems to indicated the code above on the CM7 side should trigger the creation of these devices under Linux, but I'm not sure how that is supposed to work.

Any suggestions on where I should look to understand where things might be going wrong?

I do see the following defined in the kernel config file so I think the right things are present in the kernel.

CONFIG_RPMSG_TTY=m

But I wonder if it is possible my Yocto-based Linux image doesn't have the right device tree to run the examples?

Any ideas on what I might be missing would be very helpful.

Thanks,
Mike

1 REPLY 1
Mike Thompson
Associate III

I can answer my own question.

It appears the Keil MDK pack is now deprecated and the last version is STM32MP1xx_DFP version 1.3.1. This seems to be incompatible with OpenAMP drivers in the latest STM32MP1 Linux kernels.

I needed to use switch to using the the CM4 firmware in the newer STM32CubeMP1 which is at version 1.6.0.  This can be found on Github at the following URL:

https://github.com/STMicroelectronics/STM32CubeMP1/

Switching to this newer firmware and its OpenAMP_TTY_echo example works correctly when built within the Keil MDK.  The /dev/ttyRPMSG0 and /dev/ttyRPMSG1 devices are correctly created in Linux and echo data as expected.