How to enable PRU on the BeagleBoard BeagleBone Black?

Trying to run instructions by Shabaz (http://www.element14.com/community/community/knode/single-board_computers/next-gen_beaglebone/blog/2013/05/22/bbb–working-with-the-pru-icssprussv2) on compiling device tree. I’m on Linux ubuntu-armhf 3.8.13-bone20 #1 SMP Wed May 29 06:14:59 UTC 2013 armv7l armv7l armv7l GNU/Linux (previously I went all the ways through compiling a kernel version

ubuntu-13.04-minimal-armhf-2013-08-25.tar.xz to the point of booting it, but I was unable to get any ports open (usb0 or eth0) from host despite editing both /etc/network/interfaces and /etc/resolve.conf on sd card prior to booting and couldn’t find a way around). On the current 3.8.13-bone20 based on an image download, I got eth0 working but not usb0. Anyways, am now stuck again at:

/boot/dtbs> sudo dtc -I dtb -O dts am335x-boneblack.dtb > am335x-boneblack.dts_orig

-bash: am335x-boneblack.dts_orig: Permission denied

any ideas? Thanks.

On a separate issue (that I am also stuck on), in ~/pru/am335x_pru_package/pru_sw/example_apps>

I copied pasm to pasm_2 in ~/pru/am335x_pru_package/pru_sw/utils and was able to assemble and make example; did a modprobe uio_pruss as recommended by boxysean, but am now stuck at:

~/pru/am335x_pru_package/pru_sw/example_apps/bin> sudo ./PRU_memAccessPRUDataRam

INFO: Starting PRU_memAccessPRUDataRam example.
prussdrv_open open failed
~/pru/am335x_pru_package/pru_sw/example_apps/bin>
I tried Radzikowski’s magical hack. Create /usr/local/src/pruss_magic_jr, but this didn't work.
From Przemek, I found
It works for me but before modprobe uio_pruss you have to load device tree overlay by something like echo BB-PRU... > /sys.../cape... Sorry I can't provide exact form as I'm typing on a tiny keyboard underwater in Florida:) but am not sure what echo BB-PRU... > /sys.../cape... is: Can anyone help? Thanks.

Bit Pusher

The redirection happens before you sudo. Just compile the dtc as a
standard user, then use sudo to copy the file to where you want it.

...or, coerce the redirection to occur after the sudo, perhaps with
something like:

sudo -A su -c "dtc -I dtb -O dts am335x-boneblack.dtb >
am335x-boneblack.dts_orig"

/boot/dtbs\> sudo dtc -I dtb -O dts am335x-boneblack.dtb >
am335x-boneblack.dts_orig

-bash: am335x-boneblack.dts_orig: Permission denied

any ideas? Thanks.

sudo dtc -I dtb -O dts am335x-boneblack.dtb > /tmp/am335x-boneblack.dts_orig

Instead of /tmp you can use any other directory in which you can write.
Sudo executes only dtc with root privileges, redirection is done by your
own shell.

On a separate issue (that I am also stuck on),

in ~/pru/am335x_pru_package/pru_sw/example_apps\>

I copied pasm to pasm_2 in ~/pru/am335x_pru_package/pru_sw/utils and was
able to assemble and make example; did a modprobe uio_pruss as
recommended by boxysean, but am now stuck at:

~/pru/am335x_pru_package/pru_sw/example_apps/bin\> sudo
./PRU_memAccessPRUDataRam

INFO: Starting PRU_memAccessPRUDataRam example.
prussdrv_open open failed
~/pru/am335x_pru_package/pru_sw/example_apps/bin\>

Make sure that you loaded overlay enabling PRU and that the PRU driver is
loaded. You can also use strace to see where the program fails. If the
driver is not loaded it will fail on opening device file from /dev/ or a
file from /sys (don't remember exactly).

I tried Radzikowski’s magical hack. Create /usr/local/src/pruss_magic_jr,

but this didn't work.

This bug has been fixed a long time ago and PRU works fine without doing
magical tricks.

j.

Thanks Jacek, this is very helpful; is there any chance you canalso point me to a link re:

Make sure that you loaded overlay enabling PRU and that the PRU driver is loaded? Thanks again.

Bit Pusher

Are you loading any overlays? The device tree loaded during system startup does not enable PRU. You have to switch the subsystem on by loading an overlay, which will load the driver and take care of all the operations necessary to switch PRUSS on. If you don’t have your own overlay yet, try the NIXIE overlay from Angstrom distro or use this example: https://github.com/piranha32/IOoo/blob/master/dts/tlc5946-00A0.dts

Before you load the example overlay you have to compile it:
dtc -O dtb -o …/bin/gpio_hd44780-00A0.dtbo -b 0 -@ gpio_hd44780-00A0.dts

Copy the .dtbo file to /lib/firmware and load it:

echo tlc5946 > /sys/devices/bone_capemgr.*/slots

After loading the overlay you should see PRU kernel module loaded and device files in /dev.

j.

Thanks Jacek, very useful; this should give me plenty to work with.
Bit Pusher