BBB PRU Input Example
This is a complete example on how to use the Beaglebone Black's PRU to poll for an input signal. The code can be found on GitHub.
This program runs on PRU1 and waits for P8.28 to go high and then pulls P8.29 high.
Circuit
A switch should be placed between the 3.3V and P8.28. An LED should be placed in series with a 1k resistor between P8.29 and ground.
Installation
An updated device tree compiler may be needed:
wget -c https://raw.githubusercontent.com/RobertCNelson/tools/master/pkgs/dtc.sh; chmod +x dtc.sh; ./dtc.sh
The PRU Drivers must also be installed.
The HDMI must be disabled by adding the following line to /boot/uEnv.txt
optargs=quiet capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN
The following will compile all the code for the PRU and main cpu:
make
Compile the device tree overlay and enable it:
cd device-tree
make enable
Running
./input