Developing I/O tasks on Beaglebone (white or black) hardware isn’t really fun (effective May 2014). For digital I/O you’ve to deal with issues like
- multiple source (device tree overlays and you program)
- several device tree compiler versions (option -@)
- pure documentation (spread all over the kernel source)
And also for analog input the situation isn’t better
- faulty ADC kernel driver
- no control over the ADC device setting
- slow sampling rates
Most operations either need root privileges or a lot of configurations to get access for a normal user. Furthermore, all I/O isn’t fast due to the slow file operations.
All these pitfalls don’t realy help when you’re going to focus on your core problem: create new software.
Here’s my solution
libpruio is a driver for the AM33xx processor family. It controls the subsystems
- Control Module (pinmuxing)
- GPIO 0 to 3 (General Purpose Input and Output)
- TSC_ADC_SS (Touch Screen Controler and Analog to Digital Convertor SubSystem)
- PWMSS 0 to 2 (Pulse Width Modulation SubSystem)
in real time by software running on the PRUSS (Programable Realtime Unit SubSystem). The API is designed for easy and safe usage, but also for high speed operations. For the daily work you need not care about mystic tables with CPU ball numbers or GPIO codes. Instead specify what you see (ie. P8_11 = header P8, pin 11).
libpruio handles
- waking up subsystems
- reading original subsystems configurations on start up
- enable or disable subsystems at run-time
- configure subsystems at run-time
- performing GPIO operations (read / write in IO mode)
- output of pulse trains (PWM)
- analysing of pulse trains (CAP)
- setting ADC configurations
- reading single ADC samples (IO mode, timed by host)
- reading multiple ADC samples in a ring buffer and controling digital lines (RB mode, timed by PRUSS)
- reading multiple ADC samples in a buffer (MM mode, timed by PRUSS)
- using triggers to start ADC sampling in MM mode (GPIO or ADC input)
- restoring the original configurations on close down
The library can be used under the terms of the Lesser GNU Public Licence version 2 (LGPLv2). The package also contains a C wrapper for the library and examples (under GPLv3) in FreeBASIC syntax (most of them are also included in C syntax):
- 1: minimal example
- analyse: output initial devices configurations
- io_input: output the digital and analog lines in IO mode
- pwm_cap: output a measured pulse train of a PWM output
- sos: blink a user led in SOS code
- stepper: drive a stepper motor (unipolar)
- pwm_adc: show a graph of analog inputs of three PWM outputs
- oszi: show a graph of analog inputs
- rb_oszi: show a graph of analog inputs
- triggers: start measurements by trigger events in MM mode
Since version 0.2, tools to create, compile and install device tree overlays are included. They support either customized overlays with fixed pin configurations or universal overlays with run-time pinmuxing capability.
Check out the on-line documentation or download it here for off-line usage.
Download the package (source and binaries) at
Comments are not currently available for this post.