Search code examples
linuxembedded-linuxbeagleboneblackdevice-tree

Load device tree overlay for Beaglebone Black Kernel 4.4.17 and load PRU .bin


I am having trouble loading a device tree overlay on my BBB. I'm running Debian Linux 8 (jessie), Kernel 4.4.17-bone13

The OS did not come with cape manager installed so I got it from here... https://github.com/beagleboard/bb.org-overlays

I followed the instruction to get it setup, everything seemed to go fine. Now I have try to load my device tree overlay...

root@beaglebone:~# cd /lib/firmware
root@beaglebone:/lib/firmware# dtc -O dtb -I dts -o /lib/firmware/PRU-GPIO-EXAMP                                                                                                                                                             LE-00A0.dtbo -b 0 -@ PRU-GPIO-EXAMPLE-00A0.dts
root@beaglebone:/lib/firmware# cat /sys/devices/platform/bone_capemgr/slots
 0: PF----  -1
 1: PF----  -1
 2: PF----  -1
 3: PF----  -1
root@beaglebone:/lib/firmware# sudo sh -c "echo 'PRU-GPIO-EXAMPLE-00A0' > /sys/devices/platform/bone_capemgr/slots"
root@beaglebone:/lib/firmware# cat /sys/devices/platform/bone_capemgr/slots
 0: PF----  -1
 1: PF----  -1
 2: PF----  -1
 3: PF----  -1
 4: P-O-L-   0 Override Board Name,00A0,Override Manuf,PRU-GPIO-EXAMPLE

So far it looks good now I try to load my PRU program...

root@beaglebone:/usr# cd /usr/local/test
root@beaglebone:/usr/local/test# ls
Makefile  libprussdrv.a  pasm  pruss_intc_mapping.h  prussdrv.h  testPRU  testPRU.c  testPRU_Off.bin  testPRU_Off.p  testPRU_On.bin  testPRU_On.p
root@beaglebone:/usr/local/test# ./testPRU testPRU_On.bin
prussdrv_open() failed

I almost got everything working but I'm getting a prussdrv_open() failed error and no clue why. The code for everything came off here... http://credentiality2.blogspot.com/2015/09/beaglebone-pru-gpio-example.html

 // If this segfaults, make sure you're executing as root.  
  prussdrv_init();  
  if (prussdrv_open(PRU_EVTOUT_0) == -1) {  
   printf("prussdrv_open() failed\n");  
   return 1;  
  }  

If I had to guess the example I have been following is out of date and something has changed. I already know the way you load tree overlays has changed. Maybe the .dts file format has changed or I have to make another call to the prussdrv libarary before I make the prussdrv_open() call now. Let me know what you think could be causing this.


Solution

  • The solution for me was to go back to an older version, I tried 4.1 still had problems. So I went back to 3.8 where everything was pre-installed on the OS. Everything is working now!