Loading a custom device tree overlay on Ubuntu

Ok… After getting my 1-Wire temperature sensor to work (see this post), I spent hours trying to get my custom 1-wire virtual cape at boot time using uEnv.txt :

But I always get this error :

Working great from command line after booting :

Seems to be a bug in the kernel : http://hipstercircuits.com/enable-device-tree-overlay-on-startup-on-beaglebone-black/

So, quick and dirty solution (I don’t wan’t / know how to build a custom kernel…) : so I added the command into /etc/rc.local

Now it is loaded at boot time !

DS18B20 temperature sensor on a Beaglebone Black running ubuntu

It was quite of a challenge to make my DS18B20 to work with my BeagleBone Black on Ubuntu…

There are quite a few blogs and web sites (see below) which talks about 1-wire on BeagleBone and about Ubuntu on BeagleBone but not everything was in one place. So I thought I write this little procedure.

As you need to be root for most of those commands, you may want to open a root connection which will avoid having to type in “sudo” in front of each command :


Install Ubuntu and required package

Install Ubuntu : see this post for more details.

Install the devide tree compiler (dtc) :

Update dtc package (required on Ubuntu else you would get “dtc: invalid option — ‘@'” error) using instructions here :

Be aware that it installs a all bunch of package for building new dtc package. Also, actually, you may not need to install the dtc package as it seems Robert C. Nelson’s script is doing it for you.

Connecting the probe to the BBB

That’s simple :

  • VCC on VDD_3.3 i.e. P9.4 for instance
  • Ground on… ground i.e. P9.1 for instance
  • Data on P9.22 (that’s how we’ll configure the BeagleBone, don’t use another pin unless you know what to change in the DTS file we’ll see a bit later.)


Activating 1-wire

What’s interresting is that 1-wire driver is already installed in Ubuntu’s distro. To make sure it is, just try this :

But it is not associated to any pin. So first, create a device tree overlay definition for 1-wire activation (found here actually) on port P9.22 :

Then compile it and copy the compiled file to /lib/firmware :

(not sure why I had to specify the full path of dtc even though which dtc gives the correct path. May be a cache somewhere ?) Check which overlays are loaded :

Load the overlay

Check it is properly loaded :

Now you should see the device in /sys/bus/w1/devices

Almost there…

And the temperature is : 18,312°C !!!


I also used the following web sites / blogs to get all this to work :

Running Ubuntu on Beaglebone Black

Replacing Angstrom with Ubuntu

I quite struggled with Angstrom :

  • could not install most of needed perl modules
  • could not get sftp to work
  • lot of stuff I am not using running by default (and not sure how to remove it)

Not saying Angström is not a good distro. It is good for discovery and just runs out of the box. It is jus a bit raw for me and I am not used to it.

I finally decided to move to Ubuntu, a linux distribution I know a bit more and which has a wider supporting community.

I found all required information to install Ubuntu here : http://elinux.org/BeagleBoardUbuntu. If I do a short summary :

  • Download the eMMC Ubuntu image here : BBB-eMMC-flasher-ubuntu-13.04-2013-10-08.img.xz
  • Unzip it and dump it to an uSD card (2Gb is ok) using WinDiskImage on windows (or dd on linux)
  • Insert SD card into the BBB
  • Power it on
  • Wait for the 4 leds to be solid (can be long, more that 30 minutes…)
  • Remove power
  • Remove SD card
  • Power again : you’re running on Ubuntu !