BeagleBone Black kernal 4.1.4 debian 8.1 Jessie device tree manager

I have left the beaglebone black for almost a year since finishing the animeyes project last year. Returning to it again a few things have changed. Last year I was using Ubuntu 13.04 with kernal 3.8, since then my laptop has changed, I lost any OS images I had saved and I could not find any similar images online as they had all been surpased by newer builds. Enter a new kernal 3.14, it nolonger has device tree support. This makes enabling hardware interfaces such as UART and SPI much more complicated. Half the problem with looking for support online is that you have to work out which versions of kernel and os people are working with as it makes a dramatic difference to its relivance to you.

As quick as they take away they give back better than before… Thanks to a post here Robert C Nelson stated that kernel 4.1 has now re-introduced the device tree overlay and not only that but this git repo provides you with many overlays to setup your beaglebone for most tasks.

The readme instructions arent brillianty detailed but here is what I have used to get it all working. Debian 8.1 kernal 4.1 available from the”. As this comes with a recent kernal some of the readme instructions dont need applying.

First check your kernal has cape manager support with:

zcat /proc/config.gz | grep CONFIG_BONE_CAPEMGR

Ignore the kernal update you wont need it.

Check the device tree compiler version:

dtc --version
Version: DTC 1.4.1...

Then get the git repo:

git clone

This installs all those nice handy easy to use overlays to help you set up your BBB. There are a few ways to impliment them but I am most used to the slots system:

debian@beaglebone:~$ cat /sys/devices/platform/bone_capemgr/slots
0: PF---- -1
1: PF---- -1
2: PF---- -1
3: PF---- -1

reveals empty by default…

debian@beaglebone:~$ sudo sh -c "echo 'BB-UART4' > /sys/devices/platform/bone_capemgr/slots"
debian@beaglebone:~$ cat /sys/devices/platform/bone_capemgr/slots
0: PF---- -1
1: PF---- -1
2: PF---- -1
3: PF---- -1
4: P-O-L- 0 Override Board Name,00A0,Override Manuf,BB-UART4

Now the new uart appears and can be access through /dev/ttyO4, note the ‘O’ not the number 0. You can test everything is working easily using pyserial in idle, pyserial.

Enabling uarts on the beaglebone white and black with ubuntu 13.10

This is fairly welly documented around the internet but usually for angstrom distribution and there is a complication when using ubuntu 13.04/10. The beaglebones have up to 5 uarts, although some use the same pins as the hdmi, or lack an rx. In order to be able to use them you have to enable them through the device tree. If you look in /lib/firmware you will see a list of device tree overlays that can be applied to the board to enable certain pin configurations. I assume that the following process can be applied to enable pins for spi, pwm etc.. but have not tried it.

Firstly how do you make an overlay that will set up my io pins? Using a couple of good sources, hipster circuits and ada fruit, you can find the structure of a device overlay which should be saved as a .dts file. The example from ladyada worked great for me;

* Copyright (C) 2013 CircuitCo
* Virtual cape for UART1 on connector pins P9.24 P9.26
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
/ {
    compatible = "ti,beaglebone", "ti,beaglebone-black";
        /* identification */
        part-number = "BB-UART1";
        version = "00A0";
        /* state the resources this cape uses */
        exclusive-use =
            /* the pin header uses */
            "P9.24",    /* uart1_txd */
            "P9.26",    /* uart1_rxd */
            /* the hardware ip uses */
        fragment@0 {
            target = <&am33xx_pinmux>;
            __overlay__ {
                bb_uart1_pins: pinmux_bb_uart1_pins {
                    pinctrl-single,pins = <
                        0x184 0x20 /* P9.24 uart1_txd.uart1_txd MODE0 OUTPUT (TX) */
                        0x180 0x20 /* P9.26 uart1_rxd.uart1_rxd MODE0 INPUT (RX) */
    fragment@1 {
        target = <&uart2>;  /* really uart1 */
        __overlay__ {
            status = "okay";
            pinctrl-names = "default";
            pinctrl-0 = <&bb_uart1_pins>;

In ubuntu I hit a snag when compiling the overlay where the compiler doesnt recognise the ‘@’ syntax. Looking here I found a solution to update the compiler.

wget -c
chmod +x

This solved the compilation issue for me and generated a .dtbo. With regards to understanding the overlay, both ladyada and here provide good information. The main thing to worry about is how you references the pins you want to enable. In the following snippet two numbers are passed for each pin, one defines the pin and the second defines the mode.

       fragment@0 {
            target = <&am33xx_pinmux>;
            __overlay__ {
                bb_uart1_pins: pinmux_bb_uart1_pins {
                    pinctrl-single,pins = <
                        0x184 0x20 /* P9.24 uart1_txd.uart1_txd MODE0 OUTPUT (TX) */
                        0x180 0x20 /* P9.26 uart1_rxd.uart1_rxd MODE0 INPUT (RX) */

From here I found a great table that provides the uart pin numbers which should correlate with the beaglebone srm;

 RX: 0x170 0x20 (j1-p4)  (ZCZ-E15 UART0_RXD mode:0 [datasheet]) = (conf_uart0_rxd 970h [TRM p1126] = 0x0170)
UART1: 0x4802_2000 (/dev/ttyO1)
   TX: 0x184 0x00  (p9-24) (ZCZ-D15 UART1_TXD mode:0 [datasheet]) = (conf_uart1_txd 984h [TRM p1126] = 0x0184)
   RX: 0x180 0x20  (p9-26) (ZCZ-D16 UART1_RXD mode:0 [datasheet]) = (conf_uart1_rxd 980h [TRM p1126] = 0x0180)
UART2: 0x4802_4000 (/dev/ttyO2)
   TX: 0x154 0x01  (p9-21) (ZCZ-B17 SPI0_D0   mode:1 [datasheet]) = (conf_spi0_d0   954h [TRM p1126] = 0x0154)
   RX: 0x150 0x21  (p9-22) (ZCZ-A17 SPI0_SCLK mode:1 [datasheet]) = (conf_spi0_sclk 950h [TRM p1126] = 0x0150)
UART3: 0x481A_6000 (/dev/ttyO3)
   TX: 0x164 0x01  (p9-42)       (ZCZ-C18 ECAP0_IN_PWM0_OUT mode:1 [datasheet]) = (conf_ecap0_in_pwm0_out 964h [TRM p1126] = 0x0164)
   RX: 0x188 0x21  (no breakout) (ZCZ-C17 I2C0_SDA          mode:1 [datasheet]) = (conf_i2c0_sda          988h [TRM p1126] = 0x0188) I2C0_SDA is tied to TDA19988
UART4: 0x481A_8000 (/dev/ttyO4)
   TX: 0x074 0x06  (p9-13) (ZCZ-U17 GPMC_WPn   mode:6 [datasheet]) = (conf_gpmc_wpn   874h [TRM p1124] = 0x0074)
   RX: 0x070 0x26  (p9-11) (ZCZ-T17 GPMC_WAIT0 mode:6 [datasheet]) = (conf_gpmc_wait0 870h [TRM p1124] = 0x0070)
UART5: 0x481A_A000 (/dev/ttyO5)
   TX: 0x0C0 0x04  (p8-37) (ZCZ-U1 LCD_DATA8 mode:4 [datasheet]) = (conf_lcd_data8 8C0h [TRM p1125] = 0x00C0)
   RX: 0x0C4 0x24  (p8-38) (ZCZ-U2 LCD_DATA9 mode:4 [datasheet]) = (conf_lcd_data9 8C4h [TRM p1125] = 0x00C4)

The second number being passed defines the pin mode, and from I know that this relates to the defined modes in the beaglebone srm. If you note down the numbers used you can compare them with the pin mode options in the srm to see whats being enabled and set.

From this you should be able to work out how to create an overlay for any of the uarts available on the beaglebone. So once you have a compiled on the beaglebone you need to copy or move it to the /lib/firmware/ directory. In order to enable this overlay you need to call the command;

echo enable-uart1 > /sys/devices/bone_capemgr.8/slots

Note that the bone_capemgr.# varies between boards. My beaglebone black is 9, whilst white is 8. This command also doesnt quite work in ubuntu. Instead I use the following command in order to achieve the correct user rights to set the overlay.

sudo sh -c "echo enable-uart1 > /sys/devices/bone_capemgr.8/slots”

You can check that the overlay is set by viewing the /sys/devices/bone_capemgr.8/slots file, which should show the overlay you just added.

AVR ATtiny2313 in eclipse

I have just returned to using AVR chips, in particular the ATtiny2313 and it really is tiny to use. I am running on mac os x, and avrstudio wont run on mac, but luckily there is an eclipse avr plugin that works really well. First of all you need to install an avr compiler, avrdude. You can find it to download here cross pack. This provides you with a command line compiler for a selection of avr chips.

Continue reading

Quick update

I have made a couple of things recently but didn’t take many pictures whilst doing it. The first thing is a pallet coffee table, based mostly on these instructions. It turned out like this,


Secondly I wanted to experiment with leather in the laser cutter, so decided to make a mask for halloween. I made some modifications to an old sugar skull graphic, scaled it up and cut it. I then used a wet molding technique to shape the shape the mask and make it more 3D.


After it dried I then added some black feathers to the top using leather glue. The finished product looked like this and I am impressed with how easy it all was.


Milk Pixel update

I have just returned from two sequential festivals presenting MilkPixel. There will be a full update on the new version of Milk Pixel at the website, but here are some photos from both Shambala Festival where Milk Pixel was part of the enchanted forest, and ArcTanGent Festival where Milk Pixel illuminated the main crossroads of the site.

How to vectorise using Inkscape

So you have a nice raster image that would look great blown up on some laser cut wood or just thrown in to a presentation slide but it is so small that it looks awful when you scale it up. You could try vectorising it in Inkscape, which also comes in handy if you want to cut it out on the laser cutter.

So, start with your image;

squid scanned from biology book

Now threshold the image to make the vectorisation simpler. I used GIMP but photoshop or similar will do this for you;

Threshold image

Select your image, and click on Path->Trace Bitmap. There are a lot of options you have to play around with. For example you can separate the image using edge detection or you could do multiple scans of colour ranges. It is best to experiment until you find what you want. The good thing is that Inkscape allows you to export as a dxf file which means you can then load it in to CAD software to cut or machine out later on.


In this example I have separated the image using grey scale values to create four individual object paths. Three of which are shown below (the fourth one didn’t show much).


Animatronic eye

I am working on a lasercut animatronic eye mechanism. Hopefully once I get it working I can opensource the files for others to cut. I am using solid ST4 to CAD and simulate. Here is the first version just to prove the motion.

Extruding projections on surfaces in Solid Edge

Because I always forget how to do this. (Using ST4 in ordered mode).

Draw a sketch on a tangent to the surface you wont to project on to.

Add your text using the text insert tool.

Use the wrap sketch function from the surfaces menu. Select the surface you want and then the sketch/text.

Finally use the add normal from the solids menu. Select the sketch elements and then choose individual settings to suit extrusion distance etc.

word count latex projects

Do you ever want to know how many words are in your latex document? The one thats made up of lots of separate documents? Following this forum post it explains how to use the perl script on your main tex file and it will then return a break down of words in each section and an overall word count. Just call the script as below..

perl documentname.tex

Milk Pixel

I have recently joined up with the Milk Pixel project to help create version two. Milk Pixel is an interactive sculpture made of coloured light and junk (old plastic milk bottles). The colours of light shinging from within the bottles change and react as you move in front of Milk Pixel or sing and talk to it. Sometimes the colours will change and patterns emerge for no reason at all.

Milk Pixel has many different ways of interacting with people and you are never sure which method it will choose next.
Milk Pixel lets you see that even junk can be fun and beautiful.

We are hoping to display the work at a few festivals this year. Here is a latest progress video…