Moving PRU App from Linux 3.8.x to new 4.1.x

I current have PRU code working on Linux 3.8.13-bone73, and now
want to move to Linux 4.1.x

Having troubles - here is what I have done so far:

  1. apt-get install linux-image-4.1.4-ti-r9
    (good, or should I use linux-image-4.1.4-bone15 ?)

  2. Add dtb=am335x-boneblack-overlay.dtb to uEnv.txt

  3. Update dtc per https://github.com/beagleboard/bb.org-overlays

  4. Rebuild my dt overlay:
    dtc -O dtb -o bbb-k-pru-00A0.dtbo -b 0 -@ bbb-k-pru.dts
    cp bbb-k-pru-00A0.dtbo /lib/firmware/

  5. Loading the overlay with:
    echo “bbb-k-pru” > /sys/devices/platform/bone_capemgr/slots

Which produces this:
[ 43.410941] bone_capemgr bone_capemgr: part_number ‘bbb-k-pru’, version ‘N/A’
[ 43.421476] bone_capemgr bone_capemgr: slot #4: override
[ 43.426969] bone_capemgr bone_capemgr: Using override eeprom data at slot 4
[ 43.434081] bone_capemgr bone_capemgr: slot #4: ‘Override Board Name,00A0,Override Manuf,bbb-k-pru’
[ 43.458733] gpio-of-helper ocp:gpio_helper: ready
[ 43.474759] bone_capemgr bone_capemgr: slot #4: dtbo ‘bbb-k-pru-00A0.dtbo’ loaded; overlay id #0
[ 43.543242] pruss_uio 4a300000.pruss: No children

Now Attempting to run my PRU app produces:
“Failed to open the PRU-ICSS, have you loaded the overlay?”

But, lsmod shows uio_pruss loaded.

Any ideas about what is wrong?

(One thing I was wondering is if I need a new version of the libprussdrv
which I link with for the PRU app. If so, how/where would I get this?)

Thanks.

BTW, For reference my bbb-k-pru.dts is below:

-----cut-----

// Device Tree Overlay for enabling PRU stuff

/dts-v1/;
/plugin/;

/ {
compatible = “ti,beaglebone”, “ti,beaglebone-black”;

part-number = “bbb-k-pru”;
version = “00A0”;

/* This overlay uses the following resources */
exclusive-use =
“P9.11”, “P9.13”, “P9.27”, “P9.28”, “P9.25”, “P9.29”, “P9.30”, “pru0”;

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

gpio_pins: pinmux_gpio_pins { // The GPIO pins
pinctrl-single,pins = <
0x070 0x07 // P9_11 MODE7 | OUTPUT | GPIO pull-down
0x074 0x27 // P9_13 MODE7 | INPUT | GPIO pull-down

;
};

pru_pru_pins: pinmux_pru_pru_pins { // The PRU pin modes
pinctrl-single,pins = <
0x1a4 0x05 // P9_27 pr1_pru0_pru_r31_5, MODE5 | OUTPUT | PRU
0x19c 0x26 // P9_28 pr1_pru0_pru_r30_3, MODE6 | INPUT | PRU
0x1ac 0x26 // P9_25 pr1_pru0_pru_r30_7, MODE6 | INPUT | PRU
0x194 0x26 // P9_29 pr1_pru0_pru_r30_1, MODE6 | INPUT | PRU
0x198 0x26 // P9_30 pr1_pru0_pru_r30_2, MODE6 | INPUT | PRU

;
};
};
};

fragment@1 { // Enable the PRUSS
target = <&pruss>;
overlay {
status = “okay”;
pinctrl-names = “default”;
pinctrl-0 = <&pru_pru_pins>;
};
};

fragment@2 { // Enable the GPIOs
target = <&ocp>;
overlay {
gpio_helper {
compatible = “gpio-of-helper”;
status = “okay”;
pinctrl-names = “default”;
pinctrl-0 = <&gpio_pins>;
};
};
};
};

-----cut-----

I current have PRU code working on Linux 3.8.13-bone73, and now
want to move to Linux 4.1.x

Having troubles - here is what I have done so far:

1. apt-get install linux-image-4.1.4-ti-r9
   (good, or should I use linux-image-4.1.4-bone15 ?)

That's good, it'll be best to stick with the 4.1.x-ti branch..

2. Add dtb=am335x-boneblack-overlay.dtb to uEnv.txt

3. Update dtc per https://github.com/beagleboard/bb.org-overlays

4. Rebuild my dt overlay:
   dtc -O dtb -o bbb-k-pru-00A0.dtbo -b 0 -@ bbb-k-pru.dts
   cp bbb-k-pru-00A0.dtbo /lib/firmware/

5. Loading the overlay with:
   echo "bbb-k-pru" > /sys/devices/platform/bone_capemgr/slots

   Which produces this:
   [ 43.410941] bone_capemgr bone_capemgr: part_number 'bbb-k-pru',
version 'N/A'
   [ 43.421476] bone_capemgr bone_capemgr: slot #4: override
   [ 43.426969] bone_capemgr bone_capemgr: Using override eeprom data at
slot 4
   [ 43.434081] bone_capemgr bone_capemgr: slot #4: 'Override Board
Name,00A0,Override Manuf,bbb-k-pru'
   [ 43.458733] gpio-of-helper ocp:gpio_helper: ready
   [ 43.474759] bone_capemgr bone_capemgr: slot #4: dtbo
'bbb-k-pru-00A0.dtbo' loaded; overlay id #0
   [ 43.543242] pruss_uio 4a300000.pruss: No children

Now Attempting to run my PRU app produces:
   "Failed to open the PRU-ICSS, have you loaded the overlay?"

But, lsmod shows uio_pruss loaded.

Any ideas about what is wrong?

(One thing I was wondering is if I need a new version of the libprussdrv
which I link with for the PRU app. If so, how/where would I get this?)

yeah, libprussdrv will need to be rebuilt..

Regards,

Thanks Robert.

I grabbed the am335x_pru_package here:
git clone https://github.com/beagleboard/am335x_pru_package.git

Rebuilt it, and installed the various parts, then rebuilt my PRU code.

Still have the SAME basic problem: prussdrv_open() fails.

if (prussdrv_open(PRU_EVTOUT_0) != 0)
{
fprintf(stderr, “Failed to open the PRU-ICSS, have you loaded the overlay?\n”);
exit(1);
}

I noticed when I load the overlay I get “pruss_uio 4a300000.pruss: No children”.
I do not recall seeing this message under 3.8.x

BTW: linux-image-4.1.4-ti-r9 had 1 spontaneous reboot for me in about 3hrs of uptime
today so far. Is that still to be expected, or supposed to be fixed?

double check output of dtc -v - Must be that which is listed on the github for overlays. I made the mistake of using an older dtc myself last week, and it will just silently fail - e.g. no warning if the device tree compiler version is the wrong one.

it 'should' be better, but TI's looking at it now..

Regards,

Hi William,

The notes from “https://github.com/beagleboard/bb.org-overlays” show Version: DTC 1.4.1-g2341721b
I used this as the basis for a build today and it gave me Version: DTC 1.4.1-ga2b02dea

Is this wrong or are the notes just out of sync?

Also, is it reasonable for me to expect my overlay that worked on 3.8.x to also work on 4.1.x
without modification?

Thanks.

Hi William,

The notes from “https://github.com/beagleboard/bb.org-overlays” show Version: DTC 1.4.1-g2341721b
I used this as the basis for a build today and it gave me Version: DTC 1.4.1-ga2b02dea

Is this wrong or are the notes just out of sync?

I think that so long as the dtc version is 1.4.1* it’s good enough. But the older dtc would be I think * 1.4.0 Which is what I had a problem with. What I have now is . .
william@xanbustester:~$ dtc -v
Version: DTC 1.4.1-g8b4fb3be

Which seems to be neither what the github instructions say, or what you have. In either case it worked for the canbus dtb I needed. Technically the older dtc version worked too, but produced a device tree blob file that capemgr for kernel 4.1.x did not understand I guess. e.g. it saw the device, and the file, but would not load the device tree blob.

So, the github instructions are probably just a bit outdated - But still reasonably accurate.

Also, is it reasonable for me to expect my overlay that worked on 3.8.x to also work on 4.1.x
without modification?

Not unreasonable at all I think. It’s exactly what I did for the logic supply canbus cape we use. However the device tree source file could need “adjustment” I suppose - I have no hands on with the PRU stuff yet. So I could not instruct you one way or another, unfortunately.

Robert, or Charles would definitely know more than I in the case of PRU’s for sure.

Just switched to this:

github.com/RobertCNelson/bb.org-overlays (instead of github.com/beagleboard/bb.org-overlays)

It gave me Version: DTC 1.4.1-g4b066e20 and updated the kernel to 4.1.5-bone15

Unfortunately this did not solve my PRU app problem.

Use the beagleboard repo, mine was just for development and its behind…

As long as it says 1.4.1-xxxx your fine.

The pru’s just need some software help, I’ve never used them personally (yet)…

The pru’s just need some software help, I’ve never used them personally (yet)…

makes two of us.

Hmm. I just got to where I had to build a newer dtc, so I got the sources from devicetree.org (in the kernel repo), and built, and got

$ dtc --version

Version: DTC 1.4.1-g554fde2c

But, my dtc doesn’t like -@:

rmann@rlmubuntu:~/dtb-rebuilder$ make

DTC src/arm/am57xx-beagle-x15.dtb

/usr/local/bin/dtc: invalid option – ‘@’

Ah, I found these instructions on how to patch dtc:

http://www.embedded-things.com/bbb/patching-the-device-tree-compiler-for-ubuntu/

Then use the overlay dtc script and build dtc…

Ah yeah, that helped. I found older instructions to build it with -@, but didn't realize it was building an out-of-date version. I seem to be having problems on my 14.04 Ubuntu in that it fails to apt-get update on armhf stuff, but I just commented that part out of your script and it built fine. Thanks.