Comments on: Chapter 15: Real-Time Interfacing with the PRU-ICSS http://exploringbeaglebone.com Companion Site for the Book by Derek Molloy Wed, 01 Apr 2020 18:28:26 +0000 hourly 1 https://wordpress.org/?v=5.9.2 By: Stefan http://exploringbeaglebone.com/chapter15/#comment-2288 Wed, 01 Apr 2020 18:28:26 +0000 http://exploringbeaglebone.com/?page_id=849#comment-2288 Thanks for your excellent chapter on using the PRUs. Your program descriptions and the examples helped me a lot to start using the PRU.
I’m trying to use signed values in assembly using clpru. I didn’t find the support for quick branch instructions using signed values. Have you got a tip how to do that?
Moreover I didn’t find a solution how to access the carry flag, that is set by the add or sub instructions. In the documentation it is noted that “for 16- and 32-bit destinations, bit 16 and bit 32 are used as the carry bit, respectively”, but how can I access bit 32 of a register?

Regards,
Stefan.

]]>
By: Derek http://exploringbeaglebone.com/chapter15/#comment-2285 Mon, 16 Dec 2019 10:30:37 +0000 http://exploringbeaglebone.com/?page_id=849#comment-2285 In reply to Simon.

Hi Simon, Yes, it will be fine. See the SPI ADC example on the website page. The way that I generate the bit sequence for SPI is the same as what you need. I would start with the clock generator circuit. Derek.

]]>
By: Simon http://exploringbeaglebone.com/chapter15/#comment-2283 Sat, 14 Dec 2019 07:34:45 +0000 http://exploringbeaglebone.com/?page_id=849#comment-2283 Hi Derek,
Thank you for your excellent book, and the great descriptions of the PRU in Chapter 15.

I have a question regarding the PRU and changing the pin mode in PRU code.
Specifically, I am trying to read a DHT22 Temperature and Humidity Sensor. It uses a single cable for input and output.
To read the sensor, you need to:
1. Set the pin LOW for 500µs.
2. Set the pin High for 30µs.
the signal then changes to input, and sends to 80µs bursts [low then high] before transmitting the data.

The signal bursts are 50µs low and 26µs or 70µs high, and so needs the speed of the PRU.

Can PRU code change the pin mode after executing the initialization sequence?

]]>
By: wjmd http://exploringbeaglebone.com/chapter15/#comment-2260 Thu, 05 Sep 2019 18:27:05 +0000 http://exploringbeaglebone.com/?page_id=849#comment-2260 In reply to wjmd.

I was getting the following in dmesg:

[ 5701.912888] remoteproc remoteproc1: powering up 4a334000.pru
[ 5701.913007] remoteproc remoteproc1: loading /lib/firmware/am335x-pru0-fw failed with error -22
[ 5701.913018] remoteproc remoteproc1: Direct firmware load for am335x-pru0-fw failed with error -22

so I copied blinkLED.out file to /lib/firmware and ran
$ echo ‘blinkLED.out’ | sudo tee /sys/class/remoteproc/remoteproc1/firmware
$ echo start | sudo tee /sys/class/remoteproc/remoteproc1/state
$ cat /sys/class/remoteproc/remoteproc1/state
running

I’m still not sure why the above step was necessary but I can now get the PRUs running.
Maybe this will help others

]]>
By: wjmd http://exploringbeaglebone.com/chapter15/#comment-2258 Thu, 05 Sep 2019 16:48:57 +0000 http://exploringbeaglebone.com/?page_id=849#comment-2258 In reply to hiden.

I have the same or a similar problem, also similar to Rob’s (on June 13). The PRUs are initialized, new firmware is compiled and in the correct directory, but I cannot figure out how to bring the PRUs “online”. Is this something in the device tree?

debian@beaglebone:~$ uname -r
4.14.108-ti-r115

root@beaglebone:~# dmesg |grep pru
[ 92.427760] pruss 4a300000.pruss: creating PRU cores and other child platform devices
[ 92.471521] remoteproc remoteproc1: 4a334000.pru is available
[ 92.471648] pru-rproc 4a334000.pru: PRU rproc node /ocp/pruss_soc_bus@4a326004/pruss@0/pru@34000 probed successfully
[ 92.483689] remoteproc remoteproc2: 4a338000.pru is available
[ 92.483821] pru-rproc 4a338000.pru: PRU rproc node /ocp/pruss_soc_bus@4a326004/pruss@0/pru@38000 probed successfully

root@beaglebone:~# ls /lib/firmware/am335x-pru0-fw
blinkLED.out

root@beaglebone:~# cat /sys/class/remoteproc/remoteproc1/firmware
am335x-pru0-fw

root@beaglebone:~# cat /sys/class/remoteproc/remoteproc1/state
offline

root@beaglebone:~# echo ‘start’ >/sys/class/remoteproc/remoteproc1/state
-bash: echo: write error: Invalid argument

]]>
By: hiden http://exploringbeaglebone.com/chapter15/#comment-2256 Mon, 02 Sep 2019 09:30:27 +0000 http://exploringbeaglebone.com/?page_id=849#comment-2256 hi i have a problem:

root@beaglebone:~# echo ‘start’ > /sys/class/remoteproc/remoteproc1/state
bash: echo: write error: No such file or directory

waht can i do?

]]>
By: hamed http://exploringbeaglebone.com/chapter15/#comment-2254 Sun, 01 Sep 2019 05:02:00 +0000 http://exploringbeaglebone.com/?page_id=849#comment-2254 Dear Derek,
Is it possible to bring an assembly code for PRU operation as a part of QT code in c++?
In other words, I need to control the clock frequency generated by PRU using a user interface but I have no idea how to do this in QT (assembly code is needed to ensure the minimum pulse width i.e. 5ns by setting R30 register).

]]>
By: Stewart Todd Morgan http://exploringbeaglebone.com/chapter15/#comment-2250 Fri, 09 Aug 2019 16:23:52 +0000 http://exploringbeaglebone.com/?page_id=849#comment-2250 2nd Edition, pp. 706-708 (Apparent discrepancy between circuit descriptions for Fig. 15-10 output). If I understand the text correctly, there are two references to components used in the low-pass filter that is applied to the circuit whose output is displayed in Figure 15-10. One description (p. 706) indicates that the low-pass filter consists of “a 4.7 kOhm resistor that is connected to P9_27/P2.34 and a 0.1 uF capacitor”. The other description (p. 708) indicates that the components are a “4.7 kOhm resistor and a 4.7 nF capacitor”. Note the difference in coefficient and scale on the capacitor. Am I misinterpreting the text, or perhaps the reference to Figure 15-10 on page 708 should really be to Figure 15-12 since you do apparently change the component values and therefore the RC time constant for the circuit whose output is displayed in 15-12?

]]>
By: Rob Young http://exploringbeaglebone.com/chapter15/#comment-2238 Fri, 28 Jun 2019 15:40:56 +0000 http://exploringbeaglebone.com/?page_id=849#comment-2238 In reply to Rob Young.

Just for the hallibut, I decided to experiment with making system() calls from inside my user space C code to mimic the makefile commands and use remoteproc. Seems to work just fine and one can /dev/null the output and capture the return codes to deal with stuff. Of course the user space code needs to be sudo’ed.

For example (“flushprint” just prints the constant char * and calls fflush(stdout), saves me some typing):

int LoadPRU1(bool verbose)
{
int retval = 0;

if (verbose) flushprint(“\ncopy PRU code…”);
retval = system(“sudo cp ./gen/sp.out “\
“/lib/firmware/am335x-pru1-fw >>/dev/null 2>>/dev/null”);
if (verbose)
{
if (retval == 0)
printf(“\tOK”);
else
printf(“\t%s”, strerror(retval));
fflush(stdout);
}

if (verbose) flushprint(“\nload PRU code…”);
retval = system(“echo am335x-pru1-fw | sudo tee ” \
“/sys/class/remoteproc/remoteproc2/firmware >>/dev/null 2>>/dev/null”);
if (verbose)
{
if (retval == 0)
printf(“\tOK”);
else
printf(“\t%s”, strerror(retval));
fflush(stdout);
}

return retval;
}

]]>
By: Rob Young http://exploringbeaglebone.com/chapter15/#comment-2237 Mon, 17 Jun 2019 17:49:34 +0000 http://exploringbeaglebone.com/?page_id=849#comment-2237 In reply to Derek.

After further experimenting, it does seem that remoteproc is a bit on the rigid side. Moving on and learning to live with it for the time being.

]]>