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.

Cannot make RPMSG_PRU31

I'm trying to get /dev/rpmsg_pru31 created but having no luck.

My code executes the sample Lab 5 code for initializing the rpmsg channel system.  When I reach:

   // Create the RPMsg channel between the PRU and ARM user space using the transport structure.
    while(pru_rpmsg_channel(RPMSG_NS_CREATE, &transport, CHAN_NAME, CHAN_DESC, CHAN_PORT) != PRU_RPMSG_SUCCESS);

I do get a "SUCCESS" back.  Shouldn't the /dev/rpmsg_pru31 object be created at that point?

My mods:

root@beaglebone:/boot# lsmod
Module                  Size  Used by
rpmsg_pru               5022  0 
usb_f_mass_storage     51886  0 
usb_f_rndis            28244  0 
u_ether                15473  1 usb_f_rndis
libcomposite           51459  2 usb_f_rndis,usb_f_mass_storage
udc_core               13456  1 libcomposite
virtio_rpmsg_bus       14899  1 rpmsg_pru
pruss_remoteproc       16786  2 
remoteproc             32008  1 pruss_remoteproc
virtio_ring            14634  2 remoteproc,virtio_rpmsg_bus
virtio                  7978  2 remoteproc,virtio_rpmsg_bus
omap_serial_rs485      17668  0 
uio_pdrv_genirq         3623  0 
uio                     9312  1 uio_pdrv_genirq
ipv6                  376810  22 
root@beaglebone:/boot# 

My device directory:

root@beaglebone:/boot# ls /dev
apm_bios         mem                 stdin   tty25  tty44  tty63      vcs2
autofs           memory_bandwidth    stdout  tty26  tty45  tty7       vcs3
block            mmcblk0             tty     tty27  tty46  tty8       vcs4
btrfs-control    mmcblk0boot0        tty0    tty28  tty47  tty9       vcs5
char             mmcblk0boot1        tty1    tty29  tty48  ttyO0      vcs6
console          mmcblk0p1           tty10   tty3   tty49  ttyO1      vcs7
cpu_dma_latency  mqueue              tty11   tty30  tty5   ttyprintk  vcsa
cuse             net                 tty12   tty31  tty50  ttyS0      vcsa1
disk             network_latency     tty13   tty32  tty51  ttyS1      vcsa2
fd               network_throughput  tty14   tty33  tty52  ttyS2      vcsa3
full             null                tty15   tty34  tty53  ttyS3      vcsa4
fuse             port                tty16   tty35  tty54  ttyS4      vcsa5
hwrng            ppp                 tty17   tty36  tty55  ttyS5      vcsa6
i2c-0            ptmx                tty18   tty37  tty56  ttyS6      vcsa7
i2c-2            pts                 tty19   tty38  tty57  ttyS7      vfio
initctl          random              tty2    tty39  tty58  ttyS8      watchdog
input            rtc                 tty20   tty4   tty59  ttyS9      watchdog0
kmem             rtc0                tty21   tty40  tty6   urandom    xconsole
kmsg             shm                 tty22   tty41  tty60  usbmon0    zero
log              snapshot            tty23   tty42  tty61  vcs
loop-control     stderr              tty24   tty43  tty62  vcs1
root@beaglebone:/boot#

Thank you,

Bryan

  • Hi Bryan,

    Which Linux SDK version is this?
  • Biser, I'm not sure what you mean by "Linux SDK". Could you be more specific? You you talking about the versions of the drivers or the Labs I've downloaded ... or?

    Thank you,
    Bryan
  • Bryan,

    Can you confirm that you have changed the CHAN_NAME definition to 'rpmsg-pru'. This channel name is how Linux decides which driver to probe (either the sample kernel driver or the user space character device driver).

    Biser is trying to ask which version of the Linux Processor SDK you are using. The latest version is 2.0.1.7 which comes with the PRU Software Support Package included in the 'example-applications' folder.

    Jason Reeder

  • Jason,

    I've tried both ways.. "rpmsg_pru" and "rpmsg-pru" (underscore vs dash). No luck either way. I noticed in TI's rpmsg code the use a dash in one place, an underscore in another (the sample driver). The version of rpmsg_pru.c I have has no version number in the header, just a copyright date (2015 with you as the contact.. jreeder@ti.com)

    Some what confusing...

    For example, in rpmsg_pru.c, look at line 225,
    225 dev_err(&rpdev->dev, "Failed to get a minor number for the rpmsg_pru device: %d\n",
    226 ret);

    ... and 240,

    240 prudev->dev = device_create(rpmsg_pru_class, &rpdev->dev, prudev->devt,
    241 NULL, "rpmsg_pru%d", rpdev->ds

    .. and 261,
    261 dev_info(&rpdev->dev, "new rpmsg_pru device: /dev/rpmsg_pru%d",
    262 rpdev->dst);

    ... but then see line 293-295:

    293 static const struct rpmsg_device_id rpmsg_driver_pru_id_table[] = {
    294 { .name = "rpmsg-pru" },
    295 { },

    Which is it? I can only assume the smart choice would be line 294, no? (dash vs underscore).

    My code is currently using CHAN_NAME from the Lab 5....

    #define CHAN_NAME "rpmsg-pru"
    #define CHAN_DESC "Channel 31"
    #define CHAN_PORT 31

    As for the Linux processor SDK... ok, I understand now. I don't know, my rpmsg, etc., was included in the distro I pulled which is:

    root@beaglebone:/boot# uname -r
    4.1.15-ti-rt-r48

    I believe this is Beaglebone.org's current "approved" distro (4.1.17 is coming up behind it right now). Where exactly is this "example-application" folder? Can you point to it on TI's site? I'll compare it to what I have...

    For the record, I am using the sample code on the PRU along with the rpmsg library-- it seems to work without throwing errors.

    Thank you so very much for responding!
    Bryan
  • Bryan,

    CHAN_NAME should be 'rpmsg-pru' as shown in the Lab 5 example.

    A return value of PRU_RPMSG_SUCCESS from the 'pru_rpmsg_channel' function means that the PRU was able to successfully get a buffer, fill it, and then place it on the virtqueue and notify the ARM core. At that point, it is up to Linux on the ARM to receive the message and probe the rpmsg_pru driver. You may need to debug the kernel that you are using to see if the probe function is getting called.

    Here is a download of the latest Linux Processor SDK from TI: http://software-dl.ti.com/processor-sw/esd/PROCESSOR-SDK-LINUX-AM335X/latest/index_FDS.html. The PRU Software Support Package is included at 'example-applications/pru-icss-4.0.1/' and matches the v4.0.1 tag on the git repo here: https://git.ti.com/pru-software-support-package/pru-software-support-package/trees/v4.0.1.

    For questions on the BeagleBoard.org distributions you'll have to use their community forums here: http://beagleboard.org/Community/Forums

    Jason Reeder

     

  • Jason,

    Okay, I verified I was using:

    pru-software-support-package-pru-software-support-package-v4.0.1.tar.gz

    ti-processor-sdk-linux-am335x-evm-02.00.01.07-Linux-x86-Install.bin

    These appear to be the latest according to your links.

    My dev dir is:

    root@beaglebone:~# ls /dev
    autofs           memory_bandwidth    tty    tty26  tty44  tty62      vcs
    block            mmcblk0             tty0   tty27  tty45  tty63      vcs1
    char             mmcblk0boot0        tty1   tty28  tty46  tty7       vcs2
    console          mmcblk0boot1        tty10  tty29  tty47  tty8       vcs3
    cpu_dma_latency  mmcblk0p1           tty11  tty3   tty48  tty9       vcs4
    cuse             mqueue              tty12  tty30  tty49  ttyO0      vcs5
    disk             net                 tty13  tty31  tty5   ttyO1      vcs6
    fd               network_latency     tty14  tty32  tty50  ttyprintk  vcsa
    full             network_throughput  tty15  tty33  tty51  ttyS0      vcsa1
    fuse             null                tty16  tty34  tty52  ttyS1      vcsa2
    hwrng            ppp                 tty17  tty35  tty53  ttyS2      vcsa3
    i2c-0            ptmx                tty18  tty36  tty54  ttyS3      vcsa4
    i2c-2            pts                 tty19  tty37  tty55  ttyS4      vcsa5
    initctl          random              tty2   tty38  tty56  ttyS5      vcsa6
    input            rtc                 tty20  tty39  tty57  ttyS6      vfio
    kmem             rtc0                tty21  tty4   tty58  ttyS7      watchdog
    kmsg             shm                 tty22  tty40  tty59  ttyS8      watchdog0
    log              stderr              tty23  tty41  tty6   ttyS9      xconsole
    loop-control     stdin               tty24  tty42  tty60  urandom    zero
    mem              stdout              tty25  tty43  tty61  usbmon0
    root@beaglebone:~#

    The modules loaded are:

    root@beaglebone:~# lsmod
    Module                  Size  Used by
    rpmsg_pru               4867  0
    usb_f_mass_storage     50672  0
    usb_f_rndis            27558  0
    u_ether                15054  1 usb_f_rndis
    libcomposite           49424  2 usb_f_rndis,usb_f_mass_storage
    udc_core               12911  1 libcomposite
    virtio_rpmsg_bus       14370  1 rpmsg_pru
    pruss_remoteproc       16527  2
    remoteproc             31022  1 pruss_remoteproc
    virtio_ring            13415  2 remoteproc,virtio_rpmsg_bus
    virtio                  6371  2 remoteproc,virtio_rpmsg_bus
    omap_serial_rs485      17074  0
    uio_pdrv_genirq         3480  0
    uio                     8881  1 uio_pdrv_genirq
    ipv6                  366398  22
    root@beaglebone:~#

    I have mailboxes setup in my dtsi file:

    823                 pruss: pruss@4a300000 {                                                                                        
    824                         compatible = "ti,am3352-pruss", "ti,pruss-v2";                                                         
    825                         ti,hwmods = "pruss";                                                                                   
    826                         reg = <0x4a300000 0x2000>,                                                                             
    827                               <0x4a302000 0x2000>,                                                                             
    828                               <0x4a310000 0x3000>,                                                                             
    829                               <0x4a320000 0x2000>,                                                                             
    830                               <0x4a326000 0x2000>;                                                                             
    831                         reg-names = "dram0", "dram1", "shrdram2", "intc", "cfg";                                               
    832                         interrupts = <20 21 22 23 24 25 26 27>;                                                                
    833                         #address-cells = <1>;                                                                                  
    834                         #size-cells = <1>;                                                                                     
    835                         ranges;                                                                                                
    836                                                                                                                                
    837                         pru0: pru@4a334000 {                                                                                   
    838                                 compatible = "ti,am3352-pru-rproc";                                                            
    839                                 reg = <0x4a334000 0x2000>,                                                                     
    840                                       <0x4a322000 0x400>,                                                                      
    841                                       <0x4a322400 0x100>;                                                                      
    842                                 reg-names = "iram", "control", "debug";                                                        
    843                                 mboxes = <&mailbox &mbox_pru0>;                                                                
    844                         };                                                                                                     
    845                                                                                                                                
    846                         pru1: pru@4a338000 {                                                                                   
    847                                 compatible = "ti,am3352-pru-rproc";                                                            
    848                                 reg = <0x4a338000 0x2000>,                                                                     
    849                                       <0x4a324000 0x400>,                                                                      
    850                                       <0x4a324400 0x100>;                                                                      
    851                                 reg-names = "iram", "control", "debug";                                                        
    852                                 mboxes = <&mailbox &mbox_pru1>;                                                                
    853                         };                                                                                                     
    854                 }; 

    My setup code in the PRU system is:

    void init_rpmsg()
    {
        volatile uint8_t *status;
    
        // Clear the status of event MB_INT_NUMBER (the mailbox event) and enable the mailbox event.
        // This must be the first step performed on the PRU before opening a virtual queue.
    
        CT_INTC.SICR_bit.STS_CLR_IDX = MB_INT_NUMBER;
        CT_MBX.IRQ[MB_USER].ENABLE_SET |= 1 << (MB_FROM_ARM_HOST * 2);
    
        // Make sure the Linux drivers are ready for RPMsg communication.
    
        status = &resourceTable.rpmsg_vdev.status;
        while (!(*status & VIRTIO_CONFIG_S_DRIVER_OK));
    
        // Initialize pru_virtqueue corresponding to vring0 (PRU to ARM Host direction)
    
        pru_virtqueue_init(&transport.virtqueue0, &resourceTable.rpmsg_vring0, &CT_MBX.MESSAGE[MB_TO_ARM_HOST], &CT_MBX.MESSAGE[MB_FROM_ARM_HOST]);
    
        // Initialize pru_virtqueue corresponding to vring1 (ARM Host to PRU direction)
    
        pru_virtqueue_init(&transport.virtqueue1, &resourceTable.rpmsg_vring1, &CT_MBX.MESSAGE[MB_TO_ARM_HOST], &CT_MBX.MESSAGE[MB_FROM_ARM_HOST]);
    
        // Create the RPMsg channel between the PRU and ARM user space using the transport structure.
        while(pru_rpmsg_channel(RPMSG_NS_CREATE, &transport, CHAN_NAME, CHAN_DESC, CHAN_PORT) != PRU_RPMSG_SUCCESS)
        {
        	//cycleleds();
        }
    }

    Note that the above init_rpmsg code runs with no issues.

    Thanks,

    Bryan

  • Jason,

    One last thing... I duplicated the channel creation line and make 10 channels.

       while(pru_rpmsg_channel(RPMSG_NS_CREATE, &transport, CHAN_NAME, CHAN_DESC, CHAN_PORT + [0...9]) != PRU_RPMSG_SUCCESS)

    Looking at the dmesg output, I got the following... maybe this would be more of a clue, I don't know.  Perhaps just arbitrarily creating 10 channels wasn't a wise idea... but note that creating channel #1 seemed to be successful...?

    [    7.990690]  remoteproc0: powering up 4a334000.pru0
    [    8.000113]  remoteproc0: Booting fw image am335x-pru0-fw, size 139300
    [    8.007824] pru-rproc 4a334000.pru0: version 0 event_chnl_map_size 1 event_chh
    nl_map 000001f0
    [    8.007849] pru-rproc 4a334000.pru0: sysevt-to-ch[59] -> 1
    [    8.007864] pru-rproc 4a334000.pru0: skip intr mapping for chnl 0
    [    8.007878] pru-rproc 4a334000.pru0: chnl-to-host[1] -> 1
    [    8.007891] pru-rproc 4a334000.pru0: skip intr mapping for chnl 2
    [    8.007904] pru-rproc 4a334000.pru0: skip intr mapping for chnl 3
    [    8.007917] pru-rproc 4a334000.pru0: skip intr mapping for chnl 4
    [    8.007930] pru-rproc 4a334000.pru0: skip intr mapping for chnl 5
    [    8.007943] pru-rproc 4a334000.pru0: skip intr mapping for chnl 6
    [    8.007955] pru-rproc 4a334000.pru0: skip intr mapping for chnl 7
    [    8.007968] pru-rproc 4a334000.pru0: skip intr mapping for chnl 8
    [    8.007981] pru-rproc 4a334000.pru0: skip intr mapping for chnl 9
    [    8.008000] pruss-rproc 4a300000.pruss: SYSEV59 -> CH1 (CMR14 0x01000000)
    [    8.008016] pruss-rproc 4a300000.pruss: CH1 -> HOST1 (HMR0 0x00000100)
    [    8.008032] pruss-rproc 4a300000.pruss: configured system_events = 0x080000000
    00000000 intr_channels = 0x00000002 host_intr = 0x00000002
    [    8.030642]  remoteproc0: starting PRU0: entry-point = 0x0
    [    8.030666]  remoteproc0: remote processor 4a334000.pru0 is now up
    [    8.047713]  remoteproc1: mbox msg: 0x0
    [    8.047738]  remoteproc1: no message was found in vqid 0
    [    8.047753]  remoteproc1: mbox msg: 0x0
    [    8.047764]  remoteproc1: no message was found in vqid 0
    [    8.047776]  remoteproc1: mbox msg: 0x0
    [    8.047787]  remoteproc1: no message was found in vqid 0

  • Bryan,

    You can follow this wiki page to get up and running with RPMsg quickly on the 2.0.1.7 Processor SDK: processors.wiki.ti.com/.../RPMsg_Quick_Start_Guide

    This version of the SDK actually has everything needed to test RPMsg user space echo examples built in. You just need to enable remoteproc and rpmsg in your .config file, rebuild, copy everything over to your board, and reboot (the wiki page walks through every step).

    Once you get that basic example working you can try to scale up to 10 channels.

    Jason Reeder
  • Thank you, Jason... unfortunately we've decided to move to another hardware platform.
  • I’m having the same problem. I cannot get the /dev/rpmsg_pru31 device node to show up. Doesn’t work on a reboot either.
    Thoughts?

    Built from: git://git.ti.com/pru-software-support-package/pru-software-support-package.git
    $ git rev-parse HEAD
    5e08c1f7c1f1d642b508e8b9cea246d9d8ef54c8

    Modified file pru-software-support-package/labs/lab_5/solution/PRU_RPMsg_Echo_Interrupt1/main.c to set:
    #define CHAN_NAME "rpmsg-pru"
    #define CHAN_DESC "Channel 31"
    #define CHAN_PORT 31

    Copy firmware and reload driver
    $ sudo cp gen/PRU_RPMsg_Echo_Interrupt1.out /lib/firmware/am335x-pru1-fw
    $ sudo rmmod -f pru_rproc
    $ sudo modprobe pru_rproc
    $ sudo modprobe rpmsg_pru

    Firmware loads:
    [ 434.383630] remoteproc1: 4a338000.pru1 is available
    [ 434.383650] remoteproc1: Note: remoteproc is still under development and considered experimental.
    [ 434.383663] remoteproc1: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
    [ 434.392942] remoteproc1: powering up 4a338000.pru1
    [ 434.392990] remoteproc1: Booting fw image am335x-pru1-fw, size 73816
    [ 434.393117] ti-pruss 4a300000.pruss: configured system_events = 0x00000000000c0000 intr_channels = 0x0000000a host_intr = 0x0000000a
    [ 434.393135] remoteproc1: remote processor 4a338000.pru1 is now up
    [ 434.393542] virtio_rpmsg_bus virtio0: rpmsg host is online
    [ 434.393638] remoteproc1: registered virtio0 (type 7)
    [ 434.393825] pru-rproc 4a338000.pru1: PRU rproc node /ocp/pruss@4a300000/pru1@4a338000 probed successfully

    No dev nodes:
    $ ls -l /dev/rp*
    ls: cannot access /dev/rp*: No such file or directory
    $ ls -l /dev/*pru*
    ls: cannot access /dev/*pru*: No such file or directory


    $ hostnamectl
    Static hostname: beaglebone
    Icon name: computer
    Chassis: n/a
    Machine ID: 4459e3b929f248f2ab061d10a139abfd
    Boot ID: 9b447da4abcd4f85a8cb7d3bd8fc3ef0
    Operating System: Debian GNU/Linux 8 (jessie)
    Kernel: Linux 4.4.9-ti-r25
    Architecture: arm

    $ dpkg-query -l |grep pru
    ii am335x-pru-package 0.20141125-1~20141201+1 armhf AM335x PRU PACKAGE
    ii libaprutil1:armhf 1.5.4-1 armhf Apache Portable Runtime Utility Library
    ii libaprutil1-dbd-sqlite3:armhf 1.5.4-1 armhf Apache Portable Runtime Utility Library - SQLite3 Driver
    ii libaprutil1-ldap:armhf 1.5.4-1 armhf Apache Portable Runtime Utility Library - LDAP Driver
    ii ti-pru-cgt-installer 2.1.2-0rcnee1~bpo80+20151217+1 all TI PRU C/C++ CODE GENERATION TOOLS


    $ lsmod |grep pru
    pru_rproc 11359 1
    rpmsg_pru 4846 0
    virtio_rpmsg_bus 13726 1 rpmsg_pru
    pruss_intc 3571 0
    pruss 11679 1 pru_rproc
  • Brian,

    As of the '6980582' commit of the pru-software-support-package, the rpmsg library uses PRU System Events instead of mailboxes in order to 'kick' the ARM core. This change is why the major revision number of the package moved from 4.x.x to 5.x.x with the v5.0.0 tag of the repo.

    It looks like you are on the v5.0.1 tag of the repo but you are using an older community distribution of the Linux kernel. You will either need to use a later version of the Linux kernel, or you will need to checkout the v4.0.2 tag of the pru-software-support-package repo.

    Jason Reeder

  • Jason,

    Thank you for that critical piece of information. It wasn't obvious in the docs I was reading (or maybe I missed it.)

    I looked at the git commit log and it's not clear in which kernel version that change was phased in.  Which kernel do I need to run to use the v5.0 interface?  I'm currently running 4.4.9-ti-r25.  

    Due to changes in the underlying mechanisms of rpmsg, the

    previous examples will no longer work with the Linux kernel

    v4.4 drivers. For this reason the major revision number of

    this software package is getting bumped to 5.0.0.

    I built the v4.0.2 code and the example, and now the dev nodes are created.  Yay!

    [ 2730.832125]  remoteproc1: remote processor 4a338000.pru1 is now up

    [ 2730.837238] virtio_rpmsg_bus virtio0: rpmsg host is online

    [ 2730.840386]  remoteproc1: registered virtio0 (type 7)

    [ 2730.840613] pru-rproc 4a338000.pru1: PRU rproc node /ocp/pruss@4a300000/pru1@4a338000 probed successfully

    [ 2730.844514] virtio_rpmsg_bus virtio0: creating channel rpmsg-pru addr 0x1f

    [ 2730.911727] rpmsg_pru rpmsg0: new rpmsg_pru device: /dev/rpmsg_pru31

    I have one more question.  What is the correct way to determine the dst parameter for pru_rpmsg_send()?  The echo example uses the value in the message it receives from the host.  My app is only sending messages.  For src, I use CHAN_PORT.  As a hack I used the value 0x400 for dst, found here, and it works:

    cat /sys/bus/virtio/drivers/virtio_rpmsg_bus/virtio0/rpmsg16/src

    But I imagine there's a programmatic way for the PRU application to determine this.  I expected it to be returned from pru_rpmsg_channel(), but it is not.  

    Brian