Problems booting with PRU

50 views
Skip to first unread message

Tallak Tveide

unread,
Jan 3, 2020, 3:43:05 AM1/3/20
to BeagleBoard
Hi. I managed to compile a PRU binary and get it running.

I created a simple web app to start at bootup, with a simple script to configure the pins before starting the server. It turned out that the file `/sys/class/remoteproc/remoteproc2/state` was not present for the first ~20 seconds after boot, causing the configuration script to fail. I created the following script to overcome this:

```
$ cat configure_pru.sh                                                                                                    
#/bin/sh

while [ ! -e /sys/class/remoteproc/remoteproc2/state ]
do
    echo "waiting for remoteproc to start"
    sleep 1
done

config-pin 8.45 pruout
config-pin 8.46 pruin
config-pin 8.39 pruout
config-pin 8.40 pruin
config-pin 8.27 pruout
config-pin 8.29 pruin
config-pin 8.28 pruout
config-pin 8.30 pruin
echo -n start > /sys/class/remoteproc/remoteproc2/state

```

This worked well as a kludge until I upgraded my kernel. Now at kernel `4.14.108-ti-r124` this no longer works, as the file will be present immediately after boot.


Right now, the PRU code will not run correctly if I start the web service just after boot. It I wait half a minute before configuring the PRU, everything works well. I expect that I need to wait for some service to start up after boot, before initializing the PRU, but I have not found any documentation mention of how to do this.

So my question is: how could I detect that the PRU is ready for use after boot. Just now I am using a `sleep`, but this is not a robust solution.

Extra question: Is there a way to boot the PRU code automatically at boot without having to echo `start` to the `state`file?

Thx

Tallak Tveide

unread,
Jan 3, 2020, 4:25:12 AM1/3/20
to BeagleBoard
I was able to rewrite my configuration script into this, which is again working. I would still like to hear if anyone has better ways of achieving this.

#/bin/sh


config-pin 8.45 pruout
config-pin 8.46 pruin
config-pin 8.39 pruout
config-pin 8.40 pruin
config-pin 8.27 pruout
config-pin 8.29 pruin
config-pin 8.28 pruout
config-pin 8.30 pruin

while [ ! -e /dev/rpmsg_pru31 ]
do
    echo "Trying to start PRU remoteproc "
    echo -n start > /sys/class/remoteproc/remoteproc2/state
    sleep 1
done

Tallak Tveide

unread,
Jan 9, 2020, 3:12:12 PM1/9/20
to BeagleBoard

Does anyone know why it takes > 30 sec to boot the PRU after ssh login? Would be really nice if it just started by itself, working on boot...

TJF

unread,
Jan 10, 2020, 11:55:07 AM1/10/20
to BeagleBoard
Sure, there's a simple way:


Am Freitag, 3. Januar 2020 09:43:05 UTC+1 schrieb Tallak Tveide:
So my question is: how could I detect that the PRU is ready for use after boot. Just now I am using a `sleep`, but this is not a robust solution.

Extra question: Is there a way to boot the PRU code automatically at boot without having to echo `start` to the `state`file?

Drop rprog and use uio_pruss instead. The PRU starts depending on your ARM code. Ie early in the boot sequence, like 7 seconds after poweron, and 12 seconds before network is up and SSH can connect (in a 19 seconds boot). 
Reply all
Reply to author
Forward
0 new messages