Can't load firmware to Pru on Beaglebone Black

Hello i am trying to use the echo command to load firmware to the PRU with the following command:
root@beaglebone:~# echo 'am335x-pru1-fw' > /sys/class/remoteproc/remoteproc2/firmware
However, i get the following error:
-bash: echo: write error: Operation not permitted

I can load firmware into pru0 without error but pru1 does not work. I am currently following the tutorial at this link if you are interested(download the zip file):
https://e2e.ti.com/support/processors-group/processors/f/processors-forum/967535/faq-where-did-the-rpmsg-quick-start-guide-wiki-go

Also the pru1 core seems to be running which might be the culprit?:

root@beaglebone:/sys/class/remoteproc/remoteproc2# cat state
running

And when i try to stop it i get the same error message:

root@beaglebone:/sys/class/remoteproc/remoteproc2# echo 'stop' > state
-bash: echo: write error: Operation not permitted

I tried to change the permission of the state and firmware files with:
chmod ugo+rwx state
chmod ugo+rwx firmware

but the error persists. The current output of ls -l in the /sys/class/remoteproc/remoteproc2/ is:

lrwxrwxrwx 1 root root    0 Jul 28 19:24 device -> ../../../44d00000.wkup_m3
-rwxrwxrwx 1 root root 4096 Jul 28 19:24 firmware
-r--r--r-- 1 root root 4096 Jul 28 19:24 name
drwxr-xr-x 2 root root    0 Jul 28 19:24 power
-rwxrwxrwx 1 root root 4096 Jul 28 19:47 state
lrwxrwxrwx 1 root root    0 Jul 28 19:24 subsystem -> ../../../../../../../class/remoteproc
-rw-r--r-- 1 root root 4096 Jul 28 19:24 uevent

also my kernel on my bbb is:
4.19.94-ti-r42

If you require any other info let me know and thank you!

Could you share the kernel log? Perhaps that should give some hints.

$ dmesg | tail -20

Thanks for the reply! Here is the output:

    root@beaglebone:/sys/class/remoteproc/remoteproc2# dmesg | tail -20
        [   72.321107] Bluetooth: RFCOMM socket layer initialized
        [   72.321161] Bluetooth: RFCOMM ver 1.11
        [   72.372883] wlcore: wl18xx HW: 183x or 180x, PG 2.2 (ROM 0x11)
        [   72.397476] wlcore: loaded
        [   72.971839] wlcore: PHY firmware version: Rev 8.2.0.0.245
        [   73.020025] wlcore: firmware booted (Rev 8.9.0.0.88)
        [   73.035979] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
        [   74.106830] wlan0: authenticate with 0e:c5:b4:f4:bf:e0
        [   74.117049] wlan0: send auth to 0e:c5:b4:f4:bf:e0 (try 1/3)
        [   74.247785] wlan0: send auth to 0e:c5:b4:f4:bf:e0 (try 2/3)
        [   74.386665] wlan0: authenticated
        [   74.400365] IPv6: ADDRCONF(NETDEV_UP): SoftAp0: link is not ready
        [   74.412529] wlan0: associate with 0e:c5:b4:f4:bf:e0 (try 1/3)
        [   74.419144] wlan0: RX AssocResp from 0e:c5:b4:f4:bf:e0 (capab=0x1431 status=0 aid=1)
        [   74.445319] wlan0: associated
        [   74.727768] cryptd: max_cpu_qlen set to 1000
        [   74.822353] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
        [   74.852036] wlcore: Association completed.
        [   76.015765] wlcore: down
        [   76.083856] IPv6: ADDRCONF(NETDEV_CHANGE): SoftAp0: link becomes ready

I seem to remember that I had to provide a default firmware on the filesystem for the PRUs that could be loaded on boot or things were … weird.

I also remember that I had to wait a bit (15-30 seconds) sometimes after boot for the PRUs to resolve themselves.

Good luck.

Did you follow the same tutorial i did and get it working? if so, was your host pc running Debian or ubuntu?

I don’t see any prints from the remoteproc driver. Did you run the “echo” commands before “dmesg” ?

Hi, i did the echo command first. The tail command should retrieve the last few messages but nothing regarding remote proc is showing

Hi @Frank_25 can you please run and share the output of.

sudo /opt/scripts/tools/version.sh

PS, if you update/upgrade the debian bb-customizations package, it’ll include a “sleeping” pru firmware that helps with some of the udev symlinks used to help make loading firmware work easier…

Regards,

@RobertCNelson here is the output:

debian@beaglebone:~$ sudo /opt/scripts/tools/version.sh 
git:/opt/scripts/:[b39ec679648a6be8f25f48bd1c9784c1fc5a0c46]
eeprom:[A335BNLTBWA52010BBWG0394]
model:[TI_AM335x_BeagleBone_Black_Wireless]
dogtag:[BeagleBoard.org Debian Buster IoT Image 2020-04-06]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2019.04-00002-g07d5700e21]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-boneblack-uboot-univ.dts]
UBOOT: Loaded Overlay:[AM335X-PRU-RPROC-4-19-TI-00A0]
UBOOT: Loaded Overlay:[BB-ADC-00A0]
UBOOT: Loaded Overlay:[BB-BBBW-WL1835-00A0]
UBOOT: Loaded Overlay:[BB-BONE-eMMC1-01-00A0]
kernel:[4.19.94-ti-r42]
nodejs:[v10.24.0]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[disable_uboot_overlay_video=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.14.20210416.0-0~buster+20210416]
pkg:[bb-wl18xx-firmware]:[1.20210520.0-0~buster+20210520]
pkg:[kmod]:[26-1]
pkg:[librobotcontrol]:[1.0.5-git20200715.0-0~buster+20200716]
pkg:[firmware-ti-connectivity]:[20190717-2rcnee1~buster+20200305]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal bluetooth netdev i2c gpio pwm eqep remoteproc admin spi iio docker tisdk weston-launch xenomai cloud9ide]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet]
dmesg | grep remote
[   13.933307] remoteproc remoteproc0: 4a334000.pru is available
[   13.942100] remoteproc remoteproc1: 4a338000.pru is available
[   69.928256] remoteproc remoteproc2: wkup_m3 is available
[   70.020115] remoteproc remoteproc2: powering up wkup_m3
[   70.020141] remoteproc remoteproc2: Booting fw image am335x-pm-firmware.elf, size 217168
[   70.020393] remoteproc remoteproc2: remote processor wkup_m3 is now up
dmesg | grep pru
[   13.933307] remoteproc remoteproc0: 4a334000.pru is available
[   13.933494] pru-rproc 4a334000.pru: PRU rproc node pru@4a334000 probed successfully
[   13.942100] remoteproc remoteproc1: 4a338000.pru is available
[   13.942279] pru-rproc 4a338000.pru: PRU rproc node pru@4a338000 probed successfully
dmesg | grep pinctrl-single
[    0.958594] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
[    0.971999] gpio-of-helper ocp:cape-universal: ready
lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END

remoteproc2 is the Cortex-M3 PM firmware… :wink:

Install the debian bb-customizations package and then use the udev symlinks. :wink:

debian@bbb-pwr01-ser09:~$ ls /dev/remoteproc/pruss-core*/
/dev/remoteproc/pruss-core0/:
device  firmware  name  power  state  subsystem  uevent

/dev/remoteproc/pruss-core1/:
device  firmware  name  power  state  subsystem  uevent

For reference, this is the udev rule that will be installed:

Regards,

@RobertCNelson Thanks for the response! I am quite new to software development with linux, so i hate to be a bother but can direct me how to install debian bb-customizations package and how to use udev symllinks?

sudo apt update
sudo apt install bb-customizations

Regards,

@RobertCNelson So although i can load firmware with:
root@beaglebone:/dev/remoteproc/pruss-core0# echo 'am335x-pru1-fw' > firmware

I can not start the pru1 with:

        root@beaglebone:/dev/remoteproc/pruss-core0# echo 'start' > state
        [ 4641.508679] remoteproc remoteproc0: request_firmware failed: -22
        [ 4641.521043] remoteproc remoteproc0: Boot failed: -22
        -bash: echo: write error: Invalid argument

The dmesg also shows this:

root@beaglebone:/dev/remoteproc/pruss-core0# dmesg | tail -20
[   76.280829] wlan0: authenticated
[   76.288285] wlan0: associate with 0e:c5:b4:f4:bf:e0 (try 1/3)
[   76.296308] wlan0: RX AssocResp from 0e:c5:b4:f4:bf:e0 (capab=0x1431 status=0 aid=1)
[   76.314051] wlan0: associated
[   76.435254] cryptd: max_cpu_qlen set to 1000
[   76.488316] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[   76.507889] wlcore: Association completed.
[   79.131233] IPv6: ADDRCONF(NETDEV_UP): SoftAp0: link is not ready
[   80.525062] wlcore: down
[   80.591369] IPv6: ADDRCONF(NETDEV_CHANGE): SoftAp0: link becomes ready
[ 4094.228607] remoteproc remoteproc0: powering up 4a334000.pru
[ 4094.231826] remoteproc remoteproc0: loading /lib/firmware/am335x-pru0-fw failed with error -22
[ 4094.231845] remoteproc remoteproc0: Direct firmware load for am335x-pru0-fw failed with error -22
[ 4094.231864] remoteproc remoteproc0: request_firmware failed: -22
[ 4094.244161] remoteproc remoteproc0: Boot failed: -22
[ 4641.505417] remoteproc remoteproc0: powering up 4a334000.pru
[ 4641.508640] remoteproc remoteproc0: loading /lib/firmware/am335x-pru1-fw failed with error -22
[ 4641.508658] remoteproc remoteproc0: Direct firmware load for am335x-pru1-fw failed with error -22
[ 4641.508679] remoteproc remoteproc0: request_firmware failed: -22
[ 4641.521043] remoteproc remoteproc0: Boot failed: -22

Any ideas what went wrong? Thanks

-22 = Invalid Argument.

Regards,

@RobertCNelson It seems that i can load in other firmware into the pru and start/stop them successfully except for the firmwares am335x-pru1-fw and am335x-pru0-fw. I checked that if these files exist and they do, they are located in /lib/firmware

I figure i should try out the next step which is to write to the pru character devices with:
‘echo “test30” > /dev/rpmsg_pru30’
‘echo “test31” > /dev/rpmsg_pru31’

however rpmsg_pru30 and rpmsg_pru31 dont exist in /dev

I found someone who experienced a similar issue and they resolved it at the link below. However the file that the person references as a solution to the problem seems to be empty. I was wondering if you had any insight on this? Thank you.