Problems in using PRU on BeagleBone

Hi everyone.

My name is Pedro and I’m from Brazil. I’m trying to learn how to use PRUs in BeagleBone (I’m using BeagleBone Green Wireless now) and I’m facing a problem I cannot solve.

I’m reading Derek Molloy’s book (Exploring BeagleBone) and one of the first examples / “hello world”-like is checking which firmware is loaded in PRU0 and start it. However, when I try to do this, I get “write error: Invalid argument” as error output:

debian@beaglebone:/sys/class/remoteproc/remoteproc1$ cat firmware
debian@beaglebone:/sys/class/remoteproc/remoteproc1$ echo ‘start’ > state
-bash: echo: write error: Invalid argument

What am I doing wrong? I would like to see “running” at state value, in order to be sure PRU0 is working.

Here follows some useful information:

Kernel version: 4.19.94-ti-r42
Dmesg output related to remoteproc:

Hi Pedro,

I recommend you take a look at

Have you checked the dmesg to see what is happening at kernel level ?

Hi vinicius.

First of all, thanks for the reply and for indicating me PRU cook book.
Regarding dmesg messages, yes, I’ve checked them (as shown below). It seems PRUs are available for use, am I right?
What do you recommend as a hello world test for PRU?

Hi Pedro,

You are having error 22 - I don’t remember right now the cause , the prucookbook has the explanation and how to fix :slight_smile:

Sorry, I couldn’t find any information on this error 22 on PRU cook book. Please, anyone can help me on handling this error?

Yes ,the answer is there - 4.2


In this reference, I can see a custom firmware has been developes and a header file was missing in its code. However, in my case, I’m using a firmware which is in /lib/firmware by default (am335x-pru1-fw). I assume this firmware works, once it comes with distro (I’m using official image provided in BeagleBone site).

Why am I getting this error with a firmware it’s supposed to work? Please, would you shed some light on it?

Best Regards.

Please send the result of under opt/scripts

Vinicius, here follows the output of

Hi Pedro,

I didn’t find the source code for this firmware.
I recommend you install the TI’s Code Composer Studio (
And follow the PRU cookbook. The book from Derek’s if is the first edition if I am not wrong, is focused on kernel 3.18, I bought the second edition and this is updated to 4.14 version.
So to start with PRU I really recommend the PRUCookbook + CCS.

Best regards.

Hi Vinicius.

Some minutes ago I was able to make it work. I tried to compile a custom firmware, flash it to pru (through remoteproc) and start it, and I’ve got success innchange state value.

However, I’m not able to control (on/off) a LED in BeagleBone Green Wireless. I’ve set in config_pin the gpio P9_27 to pruout successfully, but I’ve got no lucky in controlling the LED I’ve wired to this gpio. I’ll try to do it in BeagleBone Black, and I’ll follow pru cook book as you recommended.


Could you please share your code ?

Have you checked with confit-pin or show-pins to confirm there are as pru out ?

Hi Vinicius. The code I’ve used is the same as available here:

And yes, I’ve confirmed and P9_27 (GPIO to wire the LED) was configured as pruout.

Best Regards,
Pedro Bertoleti

One question

On what pru you are running your code? 0 or 1?
For p9_27 must be pru0

There was something on dmesg?

I’m running on pru0. And I’ve seen no errors in dmesg related to pru.

Hi Vinicius.

I just tried the very same thing on a BeagleBone Black and worked like a charm!
Honestly, I don’t know what gone wrong in BBGW. But it’s ok, I can go further in my studies using BeagleBone Black.

Again, thanks for the help.

Best Regards,
Pedro Bertoleti

Are you using any dtb up in your bbgw?
Both are using the same kernel version ?

Regarding changes in dtb or dtbo, this is a good question. After seeing your question, I remembered I’ve made some experiments in BBGW device tree some months ago. However, now I have absolutely no clue on what I’ve changed that time (my memory betrays me). Maybe I’ve made some mess there.

Regarding Kernel version, both veraiona are the same.

Please take a look on that because the compatibility between bbb,bbg and bbgw are really big - I have the same project running in all of them without any change - except on bbgw - the p8.15 is used by the Wi-Fi card and you can’t use it - and this is the ecap for the pru1, but with this exception the things should work

I’ll write the newest iamge on my BBGW. I think after that everything will back to normal.

Regarding PRUs, I think you can answer me the following: I was able to write data succesfully to shared data segment using PRU0, to confirm I’ve checked memory using devmem2. However, I’m not so sure on how I can read it from host (Linux) side, once Linux side uses virtual memory (= no physical memory address are referred there, per my understanding).

How do you recommend me to read (or write) data to shared memory from host (Linux) side in C? Is there any special library for this? I assume this is the easiest (maybe the only, as I’ve understood so far) way to communicate Linux side and PRUs side.

Best Regards,
Pedro Bertoleti