How to enable the PRU's on the Beaglebone black?

I want to use the PRU's with FreeBSD on the BeagleBone black

version:
Code:
# uname -a
FreeBSD beaglebone 12.0-CURRENT FreeBSD 12.0-CURRENT #0 r319859: Tue Jun 13 00:26:37 UTC 2017     root@releng3.nyi.freebsd.org:/usr/obj/arm.armv6/usr/src/sys/BEAGLEBONE  arm
I installed pructl with pkg.
Code:
# pructl -t ti
pructl: unable to allocate PRU structure: No such file or directory
I do not see a device node in /dev and no PRU device in dmesg.

How can the PRU's on the beaglebone black be enabled?
 
Thank you for the answer.
The BBB has 2 PRU's. With FreeBSD 10 I saw a device node for the PRU. FreeBSD 12-current does not show it. Maybe this is a bug in FreeBSD 12-current but it could also be my ignorance.
 
Perhaps one ore more missing device tree files? Have you compared the files in FreeBSD 10 with those ins FreeBSD -CURRENT?
 
https://svnweb.freebsd.org/base/release/10.3.0/sys/boot/fdt/dts/arm/ contains some files for the BBB but https://svnweb.freebsd.org/base/head/sys/boot/fdt/dts/arm/ does not.
Could this be the cause of a missing device node?

I installed FreeBSD 10.3 and it gives me:

Code:
freebsd@beaglebone:~ % uname -a
FreeBSD beaglebone 10.3-RELEASE FreeBSD 10.3-RELEASE #0 r297264: Fri Mar 25 06:52:50 UTC 2016     root@releng1.nyi.freebsd.org:/usr/obj/arm.armv6/usr/src/sys/BEAGLEBONE  arm
freebsd@beaglebone:~ % dmesg | grep pruss
ti_pruss0: <TI Programmable Realtime Unit Subsystem> mem 0x4a300000-0x4a37ffff irq 20,21,22,23,24,25,26,27 on simplebus0
ti_pruss0: AM33xx PRU-ICSS
freebsd@beaglebone:~ %
 
JWB , you can simply copy .dts files over, also, most likely, you can re-use the compiled ones (.dtbs) since they are just descriptions, they do not provide any functionality, just letting the kernel know what exists and how the pins have to be configured.
 
Since 10.3-RELEASE (or was it 11), FreeBSD adopted the so-called vendor distribution of the device tree description files, however, I cannot find anymore the notice when exactly this happened. Anyway, the result was that some devices on the Beaglebone Black disappeared in 12-CURRENT. For example, in order to activate the ADC on my Beaglebone Black, I needed to create a DT overlay (s. Enable the ADC device of the Beaglebone Black on FreeBSD 12.0-CURRENT).

I just tried the overlay approach for activating the PRU as well, but unfortunately this didn't work out -- perhaps because I don't know all the DT overlay magics, and so I ended up hacking the PRUSS code directly into the main DTB as follows:

Code:
# uname -a
FreeBSD CyStat-BBB 12.0-CURRENT FreeBSD 12.0-CURRENT #0 r320095: Mon Jun 19 19:07:02 UTC 2017
  1. decompile the current device tree blob:
    cd /boot/dtb
    dtc -I dtb -O dts -o am335x-boneblack.dts am335x-boneblack.dtb

  2. save the original .dtb file:
    mv am335x-boneblack.dtb am335x-boneblack.dtb.orig

  3. edit the device tree source, adding the pruss@4A300000 entries below the rng records:
    nano am335x-boneblack.dts
    Code:
                interrupts = <0x6f>;
                linux,phandle = <0xca>;
                phandle = <0xca>;
            };
    
            pruss@4A300000 {
                compatible = "ti,pruss-v2";
                reg = <0x4a300000 0x80000>;
                interrupt-parent = <0x1>;
                interrupts = <0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b>;
            };
    Code:
            sham = "/ocp/sham@53100000";
            aes = "/ocp/aes@53500000";
            mcasp0 = "/ocp/mcasp@48038000";
            mcasp1 = "/ocp/mcasp@4803C000";
            rng = "/ocp/rng@48310000";
            pruss = "/ocp/pruss@4A300000";
            vmmcsd_fixed = "/fixedregulator0";
            clk_mcasp0_fixed = "/clk_mcasp0_fixed";
            clk_mcasp0 = "/clk_mcasp0";
            dailink0_master = "/sound/simple-audio-card,cpu";
        };
  4. compile the edited device tree source file into the new device tree binary:
    dtc -I dts -O dtb -o am335x-boneblack.dtb am335x-boneblack.dts

  5. restart the Beaglebone Black:
Code:
# dmesg | grep pruss
ti_pruss0: <TI Programmable Realtime Unit Subsystem> mem 0x4a300000-0x4a37ffff irq 53,54,55,56,57,58,59,60 on simplebus0
ti_pruss0: AM33xx PRU-ICSS
Code:
# ls -l /dev/pruss*
crw-------  1 root  wheel  0x2e Jun 21 19:34 /dev/pruss0

EDIT: Corrected the commands for (de)compiling the device tree (steps 1 & 4), s. message of JWB below.
 
Last edited:
Obsigna, I followed your instructions and it worked great:
Code:
# uname -a
FreeBSD beaglebone 12.0-CURRENT FreeBSD 12.0-CURRENT #0 r319859: Tue Jun 13 00:26:37 UTC 2017     root@releng3.nyi.freebsd.org:/usr/obj/arm.armv6/usr/src/sys/BEAGLEBONE  arm
root@beaglebone:~ # dmesg | grep pruss
ti_pruss0: <TI Programmable Realtime Unit Subsystem> mem 0x4a300000-0x4a37ffff irq 53,54,55,56,57,58,59,60 on simplebus0
ti_pruss0: AM33xx PRU-ICSS
root@beaglebone:~ #
I had to correct a typo for the command to compile the edited dts file to dtb:
Code:
# dtc -I dts -O dtb -o am335x-boneblack.dtb am335x-boneblack.dts
 
Back
Top