Hello Friends, Could anyone provide me with the latest documentation to get a c program to run on the pru?
I am using this version of Debian GNU/Linux 10 (buster), Linux beaglebone 4.19.94-ti-r42 #1buster SMP PREEMPT Tue Mar 31 19:38:29 UTC 2020 armv7l GNU/Linux
https://dr-download.ti.com/software-development/ide-configuration-compiler-or-debugger/MD-FaNNGkDH7s/2.3.3/ti_cgt_pru_2.3.3_armlinuxa8hf_busybox_installer.sh - Install this PRU compiler
https://git.ti.com/cgit/pru-software-support-package/pru-software-support-package/snapshot/pru-software-support-package-6.2.0.zip Download this and navigate to examples/am335x/PRU_gpioToggle and do make. It should give you a notice that you must set an env var, and a symbolic link. Do that. Then run make again. It should successfully run.
It should say “Output files can be found in the “gen” directory”. That means it was successful at compiling for the PRU. Now you need to move the generated file, and then start the PRU.
Move the file in gen/ to /lib/firmware, while also renaming the file. We are going to stick to PRU0 for now… PRU0 is expecting a file in /lib/firmware with a specific name of ‘am335x-pru0-fw’ (which can be changed as you get familiar with the beagle bone. We will stick to the default for now)
cp gen/PRU_gpioToggle.out /lib/firmware/am335x-pru0-fw
Now you need to start PRU0
There exists 3 directories under /sys/class/remoteproc
remoteproc0 - ignore this one
remoteproc1 - this is PRU0
remoteproc2 - this is PRU1
Run the following command to start PRU0
echo “start” > /sys/class/remoteproc/remoteproc1/state
You should be able to run less /sys/class/remoteproc/remoteproc1/state and see an output of ‘running’.
Hopefully this helps! and that I didn’t type anything wrong here(as I’m trying all this without access to a board ATM)
@roberte1997 , the PRU software support package is a good starting point. But do note that version 6.2.0 is not compatible with rony_vargas’ kernel (4.19). It requires kernel 5.10 or later.
@RobertCNelson , The existing code base is already in C and it was written in C before for “high precision with PWM” according to its author. Would you recommend that i translate it from C → python? 2.7 or 3+? Is python on the pru easiest than C?
I remember that 5.7.0 release worked with kernel 4.19. Maybe 5.9.0 would work, too.
But I would suggest to upgrade both kernel and PRU software package to their latest versions. Especially if one is starting a new project.
@roberte1997 I did the steps but only show me the remoteproc0
what could be the problem?
@roberte1997 Yes mu friend,it doesn’t show me the remoteproc1
Could you run
my friend @roberte1997
the version that I have is the kernel 4.19.94.ti-r42
@roberte1997 I was proving the version pru-package-software 5.9.0 but it didn’t work. Also it shows me the remoteproc0, remoteproc1 and remoteproc2
It looks like you somehow got the PRUs to show up…
Your screenshot is showing
ls, but it looks like you scrolled up or something. Because I dont see all the files
could you do
sudo less /sys/class/remoteproc/remoteproc1/firmware
This will tell you what the filename should be of the executable that will go in /lib/firmware
Here my friend @roberte1997
Well my friend @roberte1997 it said the state PRUI1 is offline but when I did the command echo “start”> /sys/class/remoteproc/remoteproc1/state, it doesn’t work.
do you see a file named ‘am335x-pru0-fw’ in /lib/firmware?
Compiling of the PRU_gpioToggle project should have produced a ‘PRU_gpioToggle.out’ which needs to be moved to /lib/firmware and renamed
my friend @roberte1997 the code example works of the PRU_gpioToggle, but I have another question Can I do my own in the PRU starting to work from this code, I want to make changes to that code and then compile and make it work, is it posible my friend?
Yes, that’s exactly what I did. Started with an example, and just slowly added to the code until it did what I needed it to do.
Just modify the PRU_gpioToggle.c file, and then run ‘make’ and copy the file and start the PRU again.
I use Code Composer Studio on my Desktop to create PRU code for both the BBB and BBAI-64. I then upload the code and run it on my BeagleBone. I have several examples on GIT https://github.com/gitklindsayjrBeaglebone and GitHub - gitklindsayjr/Beaglebone_AI64: Repository for CCS and Eclipse Beaglebone AI-64.