3
votes

I desperately try to get the PRU on my BBB working. By working I mean that I would want to use the pins P8 39-46 (GPIO2[6-13]) as a fast output controlled by the PRU.

I installed the debian for BBB (2 weeks ago, should be current) on SD.

Then I started with the following article: http://www.element14.com/community/community/designcenter/single-board-computers/next-gen_beaglebone/blog/2013/05/22/bbb--working-with-the-pru-icssprussv2

doing so, I got the PRU working with the LED example as well as with pin P8[12].

Now I try to get the other pins working. I started all over by just making a little change to the original am335x-boneblack.dtb. I just activated the PRU. I did not change the LED heartbeat as well as pin P8.12.

Then I disabled HDMI in uEnv.txt My "slots" look like this now:

0: 54:PF---
1: 55:PF---
2: 56:PF---
3: 57:PF---
4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G 
5: ff:P-O-- Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
6: ff:P-O-- Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN

I stumbled upon this post here: https://groups.google.com/forum/#!topic/beagleboard/JRG36bOURfk

EXACTLY what I would want to have, so I took the dts ( the second one) , compiled it, copied it to /lib/firmware and loaded it. "slots" says the overlay was loaded.

0: 54:PF---
1: 55:PF---
2: 56:PF---
3: 57:PF---
4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
5: ff:P-O-- Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
6: ff:P-O-- Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN
7: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-PRU-IO

BB-PRU-IO is me.

dmesg says:

... part_number 'BB-PRU-IO', version 'N/A'
... slot #7: generic override
... bone: Using override eeprom data at slot 7
... slot #7: 'Override Board Name,00A0,Override Manuf,BB-PRU-IO'
... slot #7: Requesting part number/version based 'BB-PRU-IO-00A0.dtbo
... slot #7: Requesting firmware 'BB-PRU-IO-00A0.dtbo' for board-name 'Override Board Name', version '00A0'
... slot #7: dtbo 'BB-PRU-IO-00A0.dtbo' loaded; converting to live tree
... slot #7: #2 overlays
... slot #7: Applied #2 overlays.

Looking good I would say.

The problem is the pinmux does not seam to be impressed:

cat pins | grep 8a4 => pin 41 (44e108a4) 0000002f pinctrl-single

This is MODE 7 (GPIO Out). Not what I wanted. For all of pins I intended to switch to PRU Mode 5.

Now I tried the delivered dtbo's for the PRU 01,02 in /lib/firmware

PRU-01.dtbo seems to be a fitting example. Only the Pin is different (P9.27). I loaded it and changed the PRU code example. The pins did not show the expected result: pin 105 (44e109a4) 00000027 pinctrl-single When I run the modified testprogram from the first articel my osci shows a flatline.

I tried PRU-02.dtbo. At least the pins showed the expected result: pin 105 (44e109a4) 00000025 pinctrl-single When I start my little test program I get a "bus error"

dmesg has several lines. the important ones I would say are: [ 119.258978] WARNING: at arch/arm/mach-omap2/omap_hwmod.c:2096 _enable+0x101/0x174() [ 119.259004] omap_hwmod: pruss: enabled state can only be entered from initialized, idle, or disabled state [ 119.259027] Modules linked in: g_multi libcomposite btusb bluetooth rfkill uio_pruss mt7601Usta(O) .... several trace messages [ 119.272382] pru-rproc 4a300000.prurproc: #8 PRU interrupts registered [ 119.272445] pru-rproc 4a300000.prurproc: Failed to read events array [ 119.287545] pru-rproc: probe of 4a300000.prurproc failed with error -22

PRU-02 does more than PRU-01 (what I do not understand). And it does not seem to work for me.

Now I am kind of helpless. Any ideas on that?

EDIT: I did what you should not do. I changed the pinmux setting in the am335x-boneblack.dtb file. I just added: 0xA0 0x05 0xA4 0x05 0xA8 0x05 0xAC 0x05 0xB0 0x05 0xB4 0x05 0xB8 0x05 0xBC 0x05

to pinmux_userled_pins { pinctrl-single,pins = <

Now it works, but I am not happy. I still would appreciate a regular overlay file.

1

1 Answers

3
votes

OK I got it working:

  1. just enable the pruss in the am335x-boneblack.dtb (convert to dts. do the changes as described in the article mentioned in the original post)

  2. Got to the website : http://kilobaser.com/blog/2014-07-28-beaglebone-black-devicetreeoverlay-generator#dtogenerator and let the site create dts files for the various pins in my case P8 46-39. Using a single DTS(DTBO) File for each individual pin works but requires 8 dtbos loaded => I moved all of them into one DTS File.

this is it:

/dts-v1/;
/plugin/;

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

    exclusive-use =
    "P8.46",
    "P8.45",
    "P8.44",
    "P8.43",
    "P8.42",
    "P8.41",
    "P8.40",
    "P8.39",
    "pr1_pru1_pru_r30_6",
    "pr1_pru_pru1_r30_7",
    "pr1_pru1_pru_r30_4",
    "pr1_pru1_pru_r30_5",
    "pr1_pru1_pru_r30_2",
    "pr1_pru1_pru_r30_3",
    "pr1_pru1_pru_r30_0",
    "pr1_pru1_pru_r30_1";

    fragment@0 {
    target = <&am33xx_pinmux>;
    __overlay__ {
        bs_pinmode_pru_out: pinmux_bs_pinmode_pru_out {
            pinctrl-single,pins = <0x0a4 0x5 0x0a0 0x5 0x0ac 0x5 0x0a8 0x5 0x0b4 0x5 0x0b0 0x5 0x0bc 0x5 0x0b8 0x5>;
        };
    };
};

    fragment@1 {
        target = <&ocp>;
        __overlay__ {
            bs_pinmode_pru_out_pinmux {
                compatible = "bone-pinmux-helper";
                status = "okay";
                pinctrl-names = "default";
                pinctrl-0 = <&bs_pinmode_pru_out>;
            };
        };
    };
};

I named the file bspm_pru_out-00A0.dts, compiled it to bspm_pru_out-00A0.dtbo and placed it it in the /lib/firmware.

You can load it via /boot/uEnv.txt or via echo... in a rc.local file... whatever you like.