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 https://blog.fite.cat/2014/03/upgrade-beaglebone-black-to-debian-7-4-and-kernel-3-14/

I then installed the new kernel from here: https://rcn-ee.net/deb/jessie-armhf/v3.19.0-rc3-bone2/

I then got dtb-rebuilder from https://github.com/RobertCNelson/dtb-rebuilder/tree/3.19.x:
git clone https://github.com/RobertCNelson/dtb-rebuilder.git

I then used the example by Derek Molloy to define the GPIO pullup : https://github.com/derekmolloy/boneDeviceTree/blob/master/overlay/DM-GPIO-Test.dts

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,
Niv

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 https://raw.github.com/RobertCNelson/tools/master/pkgs/dtc.sh
Then just use the ‘dtc.sh’ 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,
Marco