PRU Problems with Debian Stretch - Segmentation Fault


#1

In the past I had some PRU code running on Beaglebone Black with Debian Jessie. Recently upgraded to Debian Stretch (ver 9.4) and existing PRU code now generates a segmentation fault.

I’ve updated uBoot to use the old dbto file (that worked in Jessie) and uBoot seems OK. (I’ve included the output of version.sh)

root@engraver:~# /opt/scripts/tools/version.sh
git:/opt/scripts/:[ea6ea9fca05f36f5044398884375b0231348d6e2]
eeprom:[A335BNLT000C1826BBBG0816]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Image 2018-01-28]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2018.01-00002-g9aa111a004]
kernel:[4.9.78-ti-r94]
nodejs:[v6.12.3]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-4-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg:[bb-cape-overlays]:[4.4.20180126.0-0rcnee0~stretch+20180126]
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 users systemd-journal i2c bluetooth netdev cloud9ide gpio pwm eqep admin spi tisdk weston-launch xenomai]
dmesg | grep pinctrl-single
[ 1.385819] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
END

I’ve also tried building the example PRU files in /am335x_pru_package/pru_sw/example_apps/PRU_memAccess_DDR_PRUsharedRAM and still get a segmentation fault.


#2

@texasEE, your u-boot overlay doesn’t match the kernel version:

kernel:[4.9.78-ti-r94]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-4-TI-00A0.dtbo]
pkg:[bb-cape-overlays]:[4.4.20180126.0-0rcnee0~stretch+20180126]

Use instead (in /boot/uEnv.txt):

uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-9-TI-00A0.dtbo

Also it’s wise to update u-boot, kernel, and bb-cape-overlays

debian@test-bbb-2:~$ cd /opt/scripts/tools/
debian@test-bbb-2:/opt/scripts/tools$ git pull
Already up-to-date.
debian@test-bbb-2:/opt/scripts/tools$ sudo ./update_kernel.sh 
debian@test-bbb-2:/opt/scripts/tools$ sudo ./developers/update_bootloader.sh 
debian@test-bbb-2:/opt/scripts/tools$ sudo apt install --only-upgrade bb-cape-overlays

Regards,


#3

Updated u-boot, kernel and bb-cape-overlays. Still have segmentation error.

What is difference between the two PRUSS Options in /boot/uEnv? WHen do you use one vs the other and also there are now several AM335X-PRU-RPROC-* files in /lib/firmware. Any information on which one should be used and when?

Thanks,


#4

Bummer, at least the kernel and overlay match now.

So over the lifetime of the Beagle there’s been currently 4 major methods to communicate with the pru:

UIO: (almost every kernel): AM335X-PRU-UIO-00A0.dtbo
ti-remoteproc: 4.4.x kernel: AM335X-PRU-RPROC-4-4-TI-00A0.dtbo
ti-remoteproc: 4.9.x kernel: AM335X-PRU-RPROC-4-9-TI-00A0.dtbo
ti-remoteproc: 4.14.x kernel: AM335X-PRU-RPROC-4-14-TI-00A0.dtbo

uio came first, initially supported in 3.8.x based kernels, we’ve been patching the driver since all the way up to v4.18.x (v4.19.x brought in major changes to the uio driver, so i need to fix that)… Almost all examples use this driver (machinekit,etc)…

TI decided the uio driver was not “proper” for the am335x pru’s so they’ve been developing their own driver, each incompatible with each other:

4.4.x-ti remoteproc: biggest user was libroboticape (BeagleBone Blue) up to v0.3.4
4.9.x-ti remoteproc: biggest user was BeagleLogic
4.14.x-ti remoteproc: libroboticape from 0.4.0 -> 1.0.x

also for 4.14.x-ti remoteproc, there’s a new book in development:

https://markayoder.github.io/PRUCookbook/

Regards,


#5

Problem Resolved by including the following lines in the /boot/uEnv file.

###PRUSS OPTIONS
uboot_overlay_pru = /lib/firmware/AM335X-PRU-PROC-4-14-TI-00A0.dtbo
uboot_overlay_pru = /lib/firmware/AM335X-PRU-UIO-00A0.dtbo

Also make sure that none of the other dtbo files listed in the /boot/uEnv file contain the IO mapping for the PRUSS.

It is an error to include the example from Listing 13-1 in Derek Molloy’s book on PRU mapping. In that dts file you must not include the following lines:

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

They will cause the PRUSS mapping to be incorrect and result in a segmentation error.


#6

Sadly Derek’s current book is very much tied to the old 3.8.x kernel.

Hopefully he will have a chance to update it now that we have things working great with U-Boot overlays.

Regards,