IMX8MPlus-RPMsg- Linux Code

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IMX8MPlus-RPMsg- Linux Code

207 Views
ramesh91720721
Contributor I

HI , 

I managed to run the sample code with the RPMsg Pingpong example. 

I am trying to incorporate the Reading the data from my application . 

Is there any sample to achieve it. 

Thanks,

Ramesh.

 

 

 

0 Kudos
Reply
2 Replies

77 Views
ramesh_rajagopal
Contributor I

Daniel, 

Thanks, It worked. Solved the problem. 

 

 

0 Kudos
Reply

133 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi @ramesh91720721 

 

On the A-core (Linux) side.  Once the RPMsg channel is establised between  core A (Linux) and Cortex-M (RTOS), you can assess it via a character device.   /dev/ttyPRMSG0

You can use the standard Linux file (open, read, write)

For example,   

 

#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>

 

int main() {
    int fd = open("/dev/ttyRPMSG0", O_RDONLY);
    if (fd < 0) {
        perror("Failed to open RPMsg device");
        return -1;
    }

 

    char buffer[128];
    while (1) {
        int len = read(fd, buffer, sizeof(buffer) - 1);
        if (len > 0) {
            buffer[len] = '\0';
            printf("Received: %s\n", buffer);
        }
    }

 

    close(fd);
    return 0;
}

 

Any support, information, and technology (“Materials”) provided by NXP are provided AS IS, without any warranty express or implied, and NXP disclaims all direct and indirect liability and damages in connection with the Material to the maximum extent permitted by the applicable law. NXP accepts no liability for any assistance with applications or product design.  Materials may only be used in connection with NXP products. Any feedback provided to NXP regarding the Materials may be used by NXP without restriction.

 

 

Regards

Daniel