How to set an internal pull-up for a gpio in 3.19.0-rc3

I set out to connect a water flow sensor to my bbb.
The water/gas sensor is " G3/4 Water Flow Sensor Switch Hall Effect Flow Meter Counter 1-60L/min"
When water flow in the given direction you will get a pulse. 5.5 pulses , mean 1L passed the sensor.

You connect one pin to +5V one to GND and the middle to a GPIO.
This GPIO pin should be pulled up to the “high” voltage , the GPIO is set to. in our case its 3.3V
So I wanted to use the on-board GPIO pull-up feature.

RobertCNelson maintains a kernel for the BBB and he released the 3.19-rc3-bone2. This kernel has a new way to define the device tree.
You need to define the GPIO to use a pull-up using the device tree.
I first got the debian image and flashed the BBB. Here is how

I then installed the new kernel from here:

I then got dtb-rebuilder from
git clone

I then used the example by Derek Molloy to define the GPIO pullup :

I got this file and saved it under the directory of dtb-rebuilder under the sub-dir src/arm as DM-GPIO-Test.dtsi
I then edit the file am335x-boneblack.dts and add this line at the end of the file:

#include “DM-GPIO-Test.dtsi”


Then from the dtb-rebuilder directory I ran, make , then sudo make install.
I reboot the BBB, and the GPIO is now pulled up.

Thanks Robert Nelson,

Dear Niv, dear all,

thanks for this great tutorial. I think this is exactly what people need to start with GPIO on BBB.

Just one note for beginners: To make & make install the dts file you will need some tools. There is a script available (thanks to Robert Nelson - again!!!):
wget -c
Then just use the ‘’ script and all required tools will be installed.

I have just tried to enable the DCAN1 interface and it works like expected. Open the file ‘am335x-boneblack.dts’, uncomment the two includes regarding ‘can1’, make, make install, reboot. When you then use ifconfig -a the interface will show up!

Thanks Niv, Thanks Robert!

Best regards,