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

You usually skip this by using BoneScript, which does all that in the background. But what if, like me, you don’t want to run JavaScript on your BeagleBone? Thus I created this small helper, which basically does the same, but outputs the result for your bare-Bone usage pleasure. It actually includes the definitions from GitHub, so it’s always up-to-date. Enjoy!

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

Select Pin:
PinName: --
PWM cap?: --
Slew:
Direction:
PullUp/Down:
MuxMode:
sysfs path: --

Output:
Save overlay to

Run on BBB to compile overlay

Put this into your /etc/rc.local

Control pin from this directory

Share this article:

Share on facebook
Share on twitter
Share on linkedin
Share on email
Share on print