This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM6442: RPMsg device files suddenly disappearing

Part Number: AM6442

Hello

I wan to try a simple RPMsg echo from Linux to an R5F core and back again. For the R5F core I used a demo project from the MCU SDK. However, I am struggling with the Linux part. When I check the contents of the /dev directory on my EVM, I find the following character device files: rpmsg0 ... rpmsg4 and rpmsg_ctrl0 ... rpmsg_ctrl3.

For my initial test I wanted to write and read from the rpmsg0 file as in the attachment. After I started the R5F demo project I wanted to launch that program from the attachment, but it turned out that rpmsg0 and rpmsg1 disappeared. What could cause this?

I am not sure whether my approach is correct in the first place. I can't find any documentation about how to use those device files and what they do. Is there any documentation about them? My online research always leads me here, but that example does not answer my question. In the end I just want to be able to send and receive messages from/to the remote cores (R5F, M4F and PRUs).

I would appreciate any help about RPMsg from and to Linux.

Many thanks

Leon Rigoni

  • Addition:

    I run the example project ipc_rpmsg_echo_linux_am64x-evm_r5fss0-0_freertos_ti-arm-clang on the first R5F core. With the debugger I found out that the FreeRTOS task blocks at line 300:    status = RPMessage_waitForLinuxReady(SystemP_WAIT_FOREVER); .

    What do I have to do on the Linux side to signal to the remote core that Linux is ready? Bullet point 4 in the Linux academy about RPMsg states

    • This is needed to be done else Linux cannot initiate message exchange with RTOS/NORTOS CPUs."

    But how does Linux initiate this message exchange? I can't find a demo anywhere. I tried to run the application in the attachment with one of the /dev/rpmsgX device files as parameter, but it never receives anything.

    Many thanks

    #include <stdio.h>
    
    int main(int argc, char** argv)
    {
    	if (argc != 2) {
    		printf("One argument only!\n");
    		return -2;
    	}
    	char tx_buffer[4] = {'A', '5', '3', 0};
    	char rx_buffer[512] = {0};
    	printf("Trying to open file %s\n", argv[1]);
    	FILE* handle = fopen(argv[1], "rb+");
    	if (!handle) {
    		printf("Failed to open device file!\n");
    		return -1;
    	}
    	fwrite(tx_buffer, 1, 4, handle);
    	printf("Sent message: %s\n", tx_buffer);
    	fread(rx_buffer, 1, 512, handle);
    	printf("Received message: %s\n", rx_buffer);
    	fclose(handle);
    	return 0;
    }
    

    Leon

  • Hello Leon,

    For the initialization of the R5F getting stuck at status = RPMessage_waitForLinuxReady(SystemP_WAIT_FOREVER);, please refer back to our discussion in your previous thread: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1289532/am6442-problems-loading-demo-project-into-r5f-from-linux

    The R5F code is waiting for Linux to come back and say that it has initialized the resource table in DDR, and point to the VRING locations that are used for RPMsg communication. If you are starting the R5F from CCS (instead of from Linux), then Linux will never know that the R5F has been initialized and is waiting.

    Please make sure you are following the steps in section "Debug the remote core program from CCS while Linux is running" to make sure that you are letting Linux initialize the R5F first, and then simply connecting CCS to the R5F (instead of re-loading the firmware with CCS): https://dev.ti.com/tirex/explore/node?node=A__AVn3JGT9fqm0PbS.pegO-g__AM62-ACADEMY__uiYMDcq__LATEST

    For guidance on how to use RPMsg, check out the getting started docs here:
    https://dev.ti.com/tirex/explore/node?node=A__AAtN.uvfmDSx4mvQ7f4R.w__linux_academy_am64x__7qm9DIS__LATEST (AM64x version)
    https://dev.ti.com/tirex/explore/node?node=A__AXINfJJ0T8V7CR5pTK41ww__AM62-ACADEMY__uiYMDcq__LATEST (AM62x version)

    And then for more detailed information, refer to the RPMsg docs here:
    https://dev.ti.com/tirex/explore/node?node=A__AVjm7chph.4Q-bCWodAr.w__AM62-ACADEMY__uiYMDcq__LATEST

    Regards,

    Nick