Start pru at boot

891 views
Skip to first unread message

Paul Van den Bergh

unread,
Oct 25, 2017, 9:48:46 AM10/25/17
to BeagleBoard
Hello,

I'm trying to load and start pru firmware at boot time.  I see that the images are loaded, but the execution doen't start:

root@beaglebone:~# dmesg | grep pru
[    3.620397] ti-pruss 4a300000.pruss: creating PRU cores and other child platform devices
[    3.620598] irq: no irq domain found for /ocp/pruss@4a300000/intc@4a320000 !
[    3.633760] irq: no irq domain found for /ocp/pruss@4a300000/intc@4a320000 !
[    3.671299]  remoteproc1: 4a338000.pru1 is available
[    3.681586] pru-rproc 4a338000.pru1: booting the PRU core manually
[    3.681620]  remoteproc1: powering up 4a338000.pru1
[    3.681935]  remoteproc1: Booting fw image am335x-pru1-fw, size 35392
[    3.682009]  remoteproc1: remote processor 4a338000.pru1 is now up
[    3.682052] pru-rproc 4a338000.pru1: PRU rproc node /ocp/pruss@4a300000/pru1@4a338000 probed successfully
[    3.690194]  remoteproc2: 4a334000.pru0 is available
[    3.696169] pru-rproc 4a334000.pru0: booting the PRU core manually
[    3.696201]  remoteproc2: powering up 4a334000.pru0
[    3.696513]  remoteproc2: Booting fw image am335x-pru0-fw, size 36296
[    3.696585]  remoteproc2: remote processor 4a334000.pru0 is now up
[    3.696621] pru-rproc 4a334000.pru0: PRU rproc node /ocp/pruss@4a300000/pru0@4a334000 probed successfully
root@beaglebone
:~#

I have to manualy do:

root@beaglebone:~# rmmod -f pru-rproc
root@beaglebone
:~# modprobe pru-rproc

After doing so the pru's are executing as expected....  Is there a way so that the firmware starts automatic each boot time?

my environment:

root@beaglebone:~# uname -a
Linux beaglebone 4.4.91-ti-r133 #1 SMP Tue Oct 10 05:18:08 UTC 2017 armv7l GNU/Linux
root@beaglebone
:~# cat /boot/uEnv.txt
#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0

uname_r
=4.4.91-ti-r133
#uuid=
#dtb=


###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
###Master Enable
enable_uboot_overlays
=1
###
###Overide capes with eeprom
#uboot_overlay_addr0=/lib/firmware/<file0>.dtbo
#uboot_overlay_addr1=/lib/firmware/<file1>.dtbo
#uboot_overlay_addr2=/lib/firmware/<file2>.dtbo
#uboot_overlay_addr3=/lib/firmware/<file3>.dtbo
###
###Additional custom capes
uboot_overlay_addr4
=/lib/firmware/BB-UART1-00A0.dtbo
uboot_overlay_addr5
=/lib/firmware/BB-I2C1-00A0.dtbo
uboot_overlay_addr6
=/lib/firmware/BB-I2C2-00A0.dtbo
uboot_overlay_addr7
=/lib/firmware/DCC_V3-00A0.dtbo
###
###Custom Cape
#dtb_overlay=/lib/firmware/<file8>.dtbo
###
###Disable auto loading of virtual capes (emmc/video/wireless/adc)
disable_uboot_overlay_emmc
=1
disable_uboot_overlay_video
=1
disable_uboot_overlay_audio
=1
disable_uboot_overlay_wireless
=1
#disable_uboot_overlay_adc=1
###
###PRUSS OPTIONS
###pru_rproc (4.4.x-ti kernel)
uboot_overlay_pru
=/lib/firmware/AM335X-PRU-RPROC-4-4-TI-00A0.dtbo
###pru_uio (4.4.x-ti & mainline/bone kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
###
###Cape Universal Enable
enable_uboot_cape_universal
=1
###
###Debug: disable uboot autoload of Cape
#disable_uboot_overlay_addr0=1
#disable_uboot_overlay_addr1=1
#disable_uboot_overlay_addr2=1
#disable_uboot_overlay_addr3=1
###
###U-Boot fdt tweaks...
#uboot_fdt_buffer=0x60000
###U-Boot Overlays###

cmdline
=coherent_pool=1M net.ifnames=0 quiet

#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 quiet video=HDMI-A-1:1024x768@60e

##Example v3.8.x
#cape_disable=capemgr.disable_partno=
#cape_enable=capemgr.enable_partno=

##Example v4.1.x
#cape_disable=bone_capemgr.disable_partno=
cape_enable
=bone_capemgr.enable_partno=BB-UART1,BB-I2C1,BB-I2C2

##enable Generic eMMC Flasher:
##make sure, these tools are installed: dosfstools rsync
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh

y
root@beaglebone
:~# cd /lib
root@beaglebone
:/lib# cd firmware/
root@beaglebone
:/lib/firmware# ls DC*
DCC_V3
-00A0.dtbo  DCC_V3-00A0.dts
root@beaglebone
:/lib/firmware# cat DCC_V3-00A0.dts
// This DTS overlay sets up the pins for use by
 
// DCC_V3

 
// Save this file wherever you want (but I recommend /lib/firmware), as
 
// "DCC_V3-00A0.dts".

 
// Compile with:
 
// dtc -O dtb -I dts -o /lib/firmware/DCC_V3-00A0.dtbo -b 0 -@ DCC_V3-00A0.dts

 
/dts-v1/;
 
/plugin/;

 
/ {
   
// This determines which boards can use this DTS overlay
   compatible
= "ti,beaglebone", "ti,beaglebone-green", "ti,beaglebone-black";

   
// I think part-number is supposed to correspond with the filename,
   
// so we'd save this as "PRU-DCC-00A0.dts".
   part
-number = "DCC_V3";

   
// This always seems to be 00A0, and all the .dtbo files in /lib/firmware
   
// seem to be named foo-00A0.dtbo, but then are loaded without that suffix.
   version
= "00A0";

   
// List the pins and resources we'll be using. This table:
   
// http://elinux.org/Ti_AM33XX_PRUSSv2#Beaglebone_PRU_connections_and_modes
   
// shows which pins can be used with PRU0 and PRU1 for input and output via
   
// registers R31 and R30.
   
//
   
// Beware: Many other PRU EGP pins are reserved by HDMI or onboard flash, which
   
// would need to be disabled first by editing uEnv.txt and rebooting.
   exclusive
-use =
     
"P8.43", "pr1_pru1_pru_r30_2",
     
"P8.45", "pr1_pru1_pru_r30_0",
     
"P8.46", "pr1_pru1_pru_r30_1",
     
"P9.12", "gpio1_28",
     
"P9.15", "gpio1_16",
     
"P9.23", "gpio1_17",
     
"P9.25", "gpio3_21",
     
"P9.29", "pr1_pru0_pru_r30_1",
     
"P9.30", "pr1_pru0_pru_r30_2",
     
"P9.31", "pr1_pru0_pru_r30_0"
     
;

   fragment@0
{
    target
= <&am33xx_pinmux>;
    __overlay__
{
      dcc_pins
: dcc_pins_V3 {

       
// Table 9-60 in the TRM: http://www.ti.com/lit/ug/spruh73l/spruh73l.pdf
       
// helps us calculate the rest of the configuration value.

       pinctrl
-single,pins = <
         
0x0a8 0x05
         
0x0a0 0x05
         
0x0a4 0x05
         
0x078 0x27
         
0x040 0x07
         
0x044 0x07
         
0x1ac 0x27
         
0x194 0x05
         
0x198 0x05
         
0x190 0x05
       
>;
     
};
   
};
   
};

   
// This enables the PRU and assigns the GPIO pins to it for use in EGP mode.
   fragment@1
{
    target
= <&pruss>;
    __overlay__
{
      pinctrl
-names = "default";
      pinctrl
-0 = <&dcc_pins>;
      status
= "okay";
   
};
   
};
 
};  root@beaglebone:/lib/firmware#


Thanks in advance.

Paul

Robert Nelson

unread,
Oct 25, 2017, 10:07:37 AM10/25/17
to Beagle Board, vdberg...@gmail.com
I'd try running:

sudo update-initramfs -uk `uname -r`
sudo reboot

maybe the firmware isn't loaded early enough into the pru???

Regards,

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

Paul Van den Bergh

unread,
Oct 25, 2017, 10:17:31 AM10/25/17
to BeagleBoard
OK, thanks, this made it....

Can you explain (or give link(s) to explain) what was the problem and how update-initramfs... solved it?

Thanks again.

Robert Nelson

unread,
Oct 25, 2017, 10:29:49 AM10/25/17
to Beagle Board, vdberg...@gmail.com
It's a race condition..

When the pru-rproc module (or built-in) loads it looks for the
firmware files. While they are on the filesystem at /lib/firmware/,
the file system isn't fully loaded, thus they aren't really available.

By running:

sudo update-initramfs -uk `uname -r`

The am335x-pru0-fw/am335x-pru1-fw files will be coped into the initrd,
that way they'll be available for pru-rproc right away, thus no longer
depended on the rootfs being up..

Here is the update-initramfs hook-functions that does the coping:

https://github.com/rcn-ee/repos/blob/master/bb-customizations/suite/jessie/debian/ti_pru_firmware

PS, this also has a side affect, make sure you re-run:

sudo update-initramfs -uk `uname -r` ; sudo reboot

on "every" pruX-fw modification, as the initrd will always have the
"last" version...
Reply all
Reply to author
Forward
0 new messages