PRU User Space API
v1.0.0
An API to control the BeagleBone PRUs using the RemoteProc and RPMsg framework.
|
An API across multiple programming languages to use with the PRUs to load binaries, start/stop, and communicate with the PRUs from the ARM userspace.
An Introductory Video describing the project: https://www.youtube.com/watch?v=3Z2PxDIoCpE&t=5s
An example made using the API: https://www.youtube.com/watch?v=W-Kr37lqM98
The cpp-bindings
interact with the Python Daemon Service through a UNIX Domain Socket file at /tmp/pruss.sock
of the Linux file system.
The cpp-bindings
passes the appropriate request to the daemon through the socket file. The prussd.py
daemon performs the required PRU-related task with root permissions and sends back the return value.
The bindings for other scripting languages can then be built upon the cpp-bindings using SWIG, which takes C++ declarations and creates wrappers needed to access those declarations from other languages. Bindings have also been provided for 'C' language.
cpp-bindings/
: prussd/
: examples/
: example1/
: A simple LED Blinky example.example2-rpmsg-pru1/
: RPMsg Loopback - simplest RPMsg firmware for testing.example3-pwm/
: A PWM generator maximum frequency of about 1MHz.example4-analog-wave-gen/
: A PWM generator maximum frequency of about 1MHz.example5-multichannel-pwm/
: Multi-channel PWM based on the example given in PRU Cookbook - Accuracy needs to be improved.example6-memory-debug/
: To read/write to PRU SRAM/DRAM using /dev/mem and to demonstrate showRegs.example7-stepper-control/
: A library to accurately control stepper motors which are driven by the PRU.example8-multiple-assembly-calls/
: To demonstrate how to link together multiple .asm files and call them from the C-program. Control is passed back to the C-program by using R3.w2example9-multichannel-waveform-gen/
: Expanding example4 to upto 8-channels.swig
: Documentation
: install.sh
: drivers
: pruss_api
There are two ways for installation:-
dpkg -i pruapi_1.0-1_armhf.deb
git clone https://github.com/pratimugale/PRUSS-Bindings
cd PRUSS-Bindings/
bash install.sh
PRUSS-Bindings/examples/firmware_examples/
by cd
'ing into the directory and running make
. The Makefile will compile the PRU-firmware, load them on to the PRU(using /lib/firmware), compile the userspace program and run it.Make sure that RPMsg is working, here's a https://github.com/pratimugale/PRUSS-Bindings/blob/master/Documentation/RPMsg.md "guide" for it.
After installation, this is how a simple userspace program looks like:
If installation is done from the debian package, compile using:
If installed from source, the processor directive must be #include "path/to/cpp-bindings/pruss.h"
. Run this program by:
config-pin
: requires changes in uEnv.txt HDMI should be disabled. Otherwise this error is encountered:
Solution:
sudo vim /boot/uEnv.txt
.disable_uboot_overlay_video=1
The PRU compiler and linker are already installed on the standard images. They are called clpru and lnkpru.
export PRU_CGT=/usr/share/ti/cgt-pru
cd $PRU_CGT
mkdir -p bin
cd bin
./Documentation/RPMsg.md "/Documentation/RPMsg.md"
./Documentation/SWIG.md "/Documentation/SWIG.md"