Rewriting the Bonescript for BeagleBoneMay 4, 2014
So this has been a code-heavy week for us at Octal.
Unfortunately, setting up GPIO pins as outputs is not as simple as on the Arduino. BeagleBone requires a bit of trickery to have those GPIO pins properly ready and available. Initially as my fellow programmer Aditya describes here, defining GPIO pins as output pins with the
setPinmode function kept throwing errors. Some of the pins were failing to be configured as output. That left us with less than 54 pins for use as GPIO.
The HDMI cape problem
We discovered that there’s a pool of pins that are used for the HDMI port on the board. Those pins cannot be reconfigured without disabling the HDMI cape (as shown here). So there’s that with those pins. It’s rather trivial to make those pins available even though it’s very unintuitive. Here’s the tip: open the
uEnv.txt file on the root of your board and uncomment the HDMI cape line. Then reboot the board, and you have those HDMI pins available straightaway.
Moving on. We needed even more. After spending more than 10 nights on this, we found out that the existing bonescript code had a few issues which prevented us from setting those pins and was also bringing in a slew of problems in the efficient execution of the code. We decided to take matters in our own hands - forked the repo and started working on it.
With this new OctalBonescript, you can have all possible GPIO pins at your disposal barring the eMMC pins which are not possible to be used as GPIO. The unusable pins are 3 to 6 and 20 to 25 on P8. Effectively, we can have 65 - 10 = 55 pins. Just works for us!
Final pin diagram for your reference
Brand new OctalBoneJS
Get it here: theoctal/octalbonescript
It works and has been tested on BeagleBone Black Rev B and Rev C. It installs socket.io and Express.js as dependencies. It’s also Mac OS X ready for your testing when you don’t have the BeagleBone with you.
To install it as a Node.js package:
npm install octalbonescript.