prussdrv_init() fails

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

Please run:

sudo /opt/scripts/tools/version.sh

Regards,

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

  1. június 8., péntek 17:46:29 UTC+2 időpontban RobertCNelson a következőt írta:

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 .:wink:

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. :wink:

Regards,

Thank you very much, that solved it!

  1. június 8., péntek 20:36:29 UTC+2 időpontban RobertCNelson a következőt írta: