prussdrv_init() fails

175 views
Skip to first unread message

n.dani...@gmail.com

unread,
Jun 8, 2018, 11:40:41 AM6/8/18
to BeagleBoard
Hello!

I would like to ask for some help getting the PRUs working on my BeagleBone Black Rev C. I have a very simple C loader program using the PRU Linux Appication Loader API, which looks like this:

>>>
#include <stdio.h>
#include <prussdrv.h>
#include <pruss_intc_mapping.h>

#define PRU_NUM 0

int main()
{
        int n;
        int retval;
        const tpruss_intc_initdata pruss_intc_initdata=PRUSS_INTC_INITDATA;

        retval=prussdrv_init();
        printf("prussdrv_init() returned %d\n", retval);
        retval=prussdrv_open(PRU_EVTOUT_0);
        printf("prussdrv_open() returned %d\n", retval);
        retval=prussdrv_pruintc_init(&pruss_intc_initdata);
        printf("prussdrv_pruintc_init() returned %d\n", retval);

        retval=prussdrv_exec_program(PRU_NUM, "./asmtest2.bin");
        printf("prussdrv_exec_program() returned %d\n", retval);
        n=prussdrv_pru_wait_event(PRU_EVTOUT_0);
        printf("PRU program completed, event number: %d\n", n);

        prussdrv_pru_disable(PRU_NUM);
        prussdrv_exit();

        return 0;
}
<<<

"asmtest2.bin" is the binary which should be loaded onto PRU0 and it consist of a single HALT instruction, for testing purposes.

Basically, my loader program fails at prussdrv_open(), which returns -1, i.e. it fails. The next function call, "prussdrv_pruintc_init()" causes a segmentation fault. Please note that the PRU program (asmtest2.bin) is not causing the problem since the loader program does not even get to the line which contains its name.

I beleive that I have enabled the PRU, because I uncommented the following line in /boot/uEnv.txt (and then rebooted):
uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo

I have also tried uncommenting or adding these lines in the same file:
uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-4-TI-00A0.dtbo
uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-9-TI-00A0.dtbo
uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-4-TI-PRUCAPE-00A0.dtbo

The DTBO files indicated above exist.

I have also tried running the loader application as an administrator. None of these had any effect.

Can you help me figure out what is causing the problem?

My Linux version is: Linux version 4.9.82-ti-r102 (root@b2-am57xx-beagle-x15-2gb) (gcc version 6.3.0 20170516 (Debian 6.3.0-18) )


Thanks and regards
Daniel

Robert Nelson

unread,
Jun 8, 2018, 11:46:29 AM6/8/18
to Beagle Board, n.dani...@gmail.com
Please run:

sudo /opt/scripts/tools/version.sh

Regards,

--
Robert Nelson
https://rcn-ee.com/

NagyDani91

unread,
Jun 8, 2018, 1:47:46 PM6/8/18
to BeagleBoard
Hello, thank you for your reply! Here is the output for "sudo /opt/scripts/tools/version.sh":

>>>
git:/opt/scripts/:[e307a944e0be0610ff5296e0abe4ad31a6e70daa]
eeprom:[A335BNLT000C1713BBBG0565]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Image 2018-03-05]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2018.01-00002-ge9ff418                                                                                        fb8]:[location: dd MBR]
kernel:[4.9.82-ti-r102]
nodejs:[v6.13.0]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg:[bb-cape-overlays]:[4.4.20180305.0-0rcnee0~stretch+20180305]
pkg:[bb-wl18xx-firmware]:[1.20170829-0rcnee2~stretch+20180104]
pkg:[firmware-ti-connectivity]:[20170823-1rcnee0~stretch+20170830]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev us                                                                                        ers systemd-journal i2c bluetooth netdev cloud9ide gpio pwm eqep admin spi tisdk                                                                                         weston-launch xenomai]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/m                                                                                        mcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet]
dmesg | grep pinctrl-single
[    1.370008] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
dmesg | grep gpio-of-helper
[    1.371018] gpio-of-helper ocp:cape-universal: ready
END
<<<

Best regards
Daniel

Robert Nelson

unread,
Jun 8, 2018, 2:36:29 PM6/8/18
to Beagle Board, nd...@windowslive.com
On Fri, Jun 8, 2018 at 12:47 PM, NagyDani91 <nd...@windowslive.com> wrote:
> Hello, thank you for your reply! Here is the output for "sudo
> /opt/scripts/tools/version.sh":
>
>>>>
> git:/opt/scripts/:[e307a944e0be0610ff5296e0abe4ad31a6e70daa]
> eeprom:[A335BNLT000C1713BBBG0565]
> model:[TI_AM335x_BeagleBone_Black]
> dogtag:[BeagleBoard.org Debian Image 2018-03-05]

Yeap, this is a common bug with this image, we fixed a few weeks after .;)

> bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot
> 2018.01-00002-ge9ff418
> fb8]:[location: dd MBR]
> kernel:[4.9.82-ti-r102]

First upgrade this ^:

debian@beaglebone:~$ cd /opt/scripts/tools/
debian@beaglebone:/opt/scripts/tools$ git pull
debian@beaglebone:/opt/scripts/tools$ sudo ./update_kernel.sh


> nodejs:[v6.13.0]
> uboot_overlay_options:[enable_uboot_overlays=1]
> uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo]
> uboot_overlay_options:[enable_uboot_cape_universal=1]
> pkg:[bb-cape-overlays]:[4.4.20180305.0-0rcnee0~stretch+20180305]

Next upgrade this ^

sudo apt install --only-upgrade bb-cape-overlays

and now just reboot. ;)

NagyDani91

unread,
Jun 9, 2018, 7:41:09 AM6/9/18
to BeagleBoard
Thank you very much, that solved it!
Reply all
Reply to author
Forward
0 new messages