Or: How to configure the BeagleBone Black's pins on the command line without BoneScript
Impatient? Jump directly to the BeagleBone Black Device-Tree Overlay Generator
This is a continuation of my previous article. To recap: The Linux Device-Tree controls the configuration of your pins: MUX Mode, Direction, Pullup/Pulldown and Slew-Speed. It's Linux solution for dealing with ever-changing ARM hardware configurations. For any pin, whether you want to use its SPI, UART, GPIO or PWM function, chances are you have to change the default configuration.
Said default can usually be found on the BEAGLE_BONE fat boot partition in /dtbs/am335x-boneblack.dtb. While some things, like enabling the PRUSS can be done only by de-compiling, editing and re-compiling this file, for everything else this would be terribly inconvenient. Instead we generate overlays for the device-tree and load or unload those on demand.
Creating GPIO Device-Tree Overlays
Originally it came down to reading the BeagleBone Black device tree introduction and the AM335x Technical Reference Manual and then writing a Device-Tree Overlay from scratch (or modifying an example). Thus setting the right bits in the right register for the right GPIO
Speeding up GPIO pin toggling
One more thing worth mentioning: Once you have configured the gpio pins, you can toggle them about 800 times faster than with SysFS by writing directly to the control registers mapped into the AM335x's memory. If you're interested in how to do that, you should check out my go-bbhw library at github and Alexander Hiam's Blog who has written a Python Library to do that.
BeagleBone Black Device-Tree Overlay Generator
Input Desired Configuration