2
votes

I have spent a solid 12 hours trying to get the PRU's on the beaglebone to work. So far I seem to be completely stuck at the getting the device overlay to work as well as enabling the remoteproc. I have tried to piece together all of the information I have found on the internet but it is either out of date or extremely fragmented. I can't seem to find a current working example or I hit a wall when following along as said previously.

Setup/Environment

I have updated the kernel on the beaglebone followed by multiple "updates", "upgrades" and "dist-upgrades". As far as I can tell I am using the most recent version of everything.

  • Beaglebone Black
  • Debian 8.6
  • kernel 4.4.30-ti-r64
  • dtc 1.4.1

Sample Code

Device Overlay File [PRU-GPIO-BLINK.dts]:

// Setup file for basic PRU GPIO Blinking LED

/dts-v1/;
/plugin/;

/ {
        compatible = "ti,beaglebone", "ti,beaglebone-black";

        part-number = "PRU-GPIO-BLINK";
        version = "00A0";

        // This overlay uses the following resources
        exclusive-use = "P8.11";

        fragment@0 {
                target = <&am33xx_pinmux>;
                __overlay__ {

                        gpio_pins: pinmux_gpio_pins {
                                pinctrl-single,pins = <
                                        0x034   0x06
                                >;
                        };
                };
        };

        fragment@1 {
                target = <&pruss>;
                __overlay__ {
                        status = "okay";
                        pinctrl-names = "default";
                        pinctrl-0 = <&gpio_pins>;
                };
        };
};

The above code compiles using:
root@beaglebone:/lib/firmware# dtc -I dts -O dtb -o /lib/firmware/PRU-GPIO-BLINK-00A0.dtbo /lib/firmware/PRU-GPIO-BLINK.dts
When I go to add this to the bone_capemgr using: root@beaglebone:/lib/firmware# echo "PRU-GPIO-BLINK" > /sys/devices/platform/bone_capemgr/slots
I end up getting either a File or directory cannot be found error or a File Exists error. I have disabled the HDMI in uEnvt.txt like many people have recommended and still no luck.

On top of the above I tried following the exercise here: http://elinux.org/EBC_Exercise_30_PRU_via_remoteproc_and_RPMsg
I make it through most of that exercise, up until I hit the enabling the remoteproc portion. When I go to "uncomment" #include "am33xx-pruss-rproc.dtsi" I can't seem to find it anywhere in the file. When I simply add the line to the file and try calling make the compiler complains that it can't find the file and fails the build.

If anyone is curious here is the output when I run cat /sys/devices/platform/bone_capemgr/slots

 0: PF----  -1
 1: PF----  -1
 2: PF----  -1
 3: PF----  -1
 4: P-O-L-   0 Override Board Name,00A0,Override Manuf,univ-emmc

Question

Does anyone have any suggestions as to why my device overlay is not working and I can't follow along with the exercise on elinux? I am pretty much stuck at this point and most of the examples online reference out of date pathing or approaches. Is there a package that I am missing? From what I have read it seems like all of the compilers and loaders come built into the new beaglebone distributions now. If anyone needs clarification or I forgot to mention something I will be happy to provide it.

Update (11-Nov-2016):

Just as a quick update. I got a response in another forum regarding my inability to follow the elinux example mentioned above. Turns out all I had to do was update my repo with a git pull and the line I was looking for appeared. This fixes my issues regarding the remote_proc but it still doesn't solve my main issue of being unable to enable a device overlay tree.

Update (22-Mar-2017)

I didn't forget about this question. I ended up solving the problem myself a different way through the help of another forum. When I have the time I will write up my detailed solution so anyone with the same issue can hopefully solve it.

1
Hi, I would be very interested to learn how you solved your issues. I am currently trying to run some code on the PRU and am running into all sorts of problems, like being unable to disable HDMI, unable to write to the slots file, etc. - Scrashdown
It's a pity you didn't follow up on this. I'm sure many could use your solution. - gsimard
I'm really sorry I completely forgot about this and at the time I solved this for a class. I'm digging out my old notes now in an attempt to figure out what I did years ago. I'm adding a link as an answer that points to my code repo that should have set the PRU's up to drive an ESC. I don't recall what state it is in but I'll try to clean it up. Sorry again to anyone who found this hoping for an answer. - Wired365

1 Answers

0
votes

I don't have much in the ways of details unfortunately because I failed to post this answer back when all of the information was fresh. Here is the repo I set up years ago that includes scripts for starting and stopping the PRU's as well as something that sets up the device tree along with some sample code for driving an ESC from the PRU. This is well before I got a lot better at programming so it's a little rough.

Beaglebone PRU ESC Controller

Here are some links I found helpful while researching in case my link goes dead:

Here is the script I used to set them up:

export SLOTS=/sys/devices/platform/bone_capemgr

config-pin P9_28 pruout
config-pin P9_29 pruout
config-pin P9_30 pruout
config-pin P9_31 pruout

Below is the command that I have in a bash script to start the PRU's

#!/bin/bash

echo "4a334000.pru0" > /sys/bus/platform/drivers/pru-rproc/bind
echo "4a338000.pru1" > /sys/bus/platform/drivers/pru-rproc/bind

Here is how I would stop them

#!/bin/bash

echo "4a334000.pru0" > /sys/bus/platform/drivers/pru-rproc/unbind
echo "4a338000.pru1" > /sys/bus/platform/drivers/pru-rproc/unbind

I hope all of this helps in some way. If I can find my hand written notes about solving this problem I'll post them.