This page is still in development. For now, visit http://elinux.org/Ti_AM33XX_PRUSSv2.
A programmable real-time unit (PRU) is a fast (200-MHz, 32-bit) processor with single-cycle I/O access to a number of the pins and full access to the internal memory and peripherals on the AM3358 processor on BeagleBones (BeagleBone, BeagleBone Black, BeagleBone Green, etc.). They are design to provide software-defined peripherals as part of the Programmable Real-time Unit Industrial Control SubSystem (PRU-ICSS) and are capable of implementing things like 25 pulse-width modulators, 4 soft UARTs, stepper motor drivers and much more. Having these controllers integrated is really handy to avoid throwing in another device to control or interface to a new peripheral. The real power comes when you need high-bandwidth between the main CPU and these controllers, such as in BeagleLogic.net, MachineKit or LEDscape. Those are all supper cool projects to check out.
Ron's presentation at ELC
Materials from the PRU workshop held at the SE Michigan BeagleBone Users' Group meetup will be uploaded here shortly.
Workshop BealgeBone Black flasher image
The image used in the workshop is http://debian.beagleboard.org/images/20141104_pru_sensortag_workshop.img.7z and needs at least a 2GB microSD card. Don't worry if you run out of space flashing your 2GB microSD as it was copied off of a larger card. This image doesn't have bug that you'll see in the video where I forgot to install the 'ply' Python library--instead this image has it already installed.
To create the image, I roughly did the following steps
- Started with the 9/3/2014 Debian image
- Installed an updated kernel that includes PRU Speak
- Installed PRU C compiler version 2.1.0 from http://software-dl.ti.com/codegen/non-esd/downloads/download.htm#PRU
- Processed bone101 with Jekyll
- Installed PRU Speak built firmware, Python scripts and 'ply' Python library using https://github.com/jadonk/pruspeak
- Installed node-red (you can modify it to start on opening port 1880 by using these node-red systemd socket activation configuration files
- Installed node.js sensortag library
- ... more later ...
Help in editing this videos, by combining them into one, switching screens at the right point, adding annotations and indexing, would be very welcome.
- Flash the BeagleBone with the provided build, and boot it up.
- Go to Cloud-9 - http://192.168.7.2:3000/
- Disable HDMI in /boot/uEnv.txt (back in Cloud9 IDE terminal window)
sed -i '/cape_disable=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN$/ s/^#//' /boot/uEnv.txt
- Restart the BeagleBone
shutdown –r now
- Load the kernel module (back in Cloud9 IDE terminal window)
- Load the device tree overlay (from Cloud9 IDE terminal window)
config-pin overlay BB-PRUSPEAKThis the remote proc server, which loads firmware and manages communication between files and the PRU. It is placed inthe OS Kernel.
- (skip) Install 'ply' Python library (not required on provided image, but was needed to
be done during the recording of the workshop)
- Enable Internet Connection Sharing on your host to the BeagleBone network port
- Obtain an IP address (in a Cloud9 IDE terminal subwindow)
- Install the 'ply' Python library using 'pip'
pip install ply
- Run PRU Speak tcp server (in a Cloud9 IDE terminal window)
cd /var/lib/cloud9/examples/extras/pruspeak python bs_tcp_server.pyPRU Speak should now be running
- Use 'netcat' to connect to running PRU Speak server (in a separate Cloud9 IDE terminal window)
nc localhost 6060
- Place an LED (that includes an internal resistor or using a resistor in series) between P9_42 (round side) and P9_46 (flat side). The GPIO mapping can be found in the PRU headers image on the main bone101 support page under where the location of the headers on the board is shown. Sparkfun has a nice article describing the polarity of an LED.
- Execute SET DIO,1 in PRU Speak to turn the LED on.
- Blink LED (to Cloud9 IDE terminal window running netcat connected to PRU Speak server)
SCRIPT SET DIO, 1 WAIT 100 SET DIO, 0 WAIT 100 GOTO 0 ENDSCRIPT RUN