Dallas 1 Wire on BPI-R2 (Working)


Can anyone help with instructions about using Dallas 1 wire on Debian stretch with kernel 4.14.54-bpi-r2-main (or any really). I have a couple of DS18B20’s here attached to a Raspberry Pi 3 and would like to move them onto the R2. I have recompiled Frank-W’s kernel his repository at https://github.com/frank-w/BPI-R2-4.14 and added in w1-thermal and w1-gpio and they load ok but obviously I need something in the device tree. Now on a Raspberry Pi this is easy but I have no idea how to do it with the R2. So if anyone can give me some clear instructions that would be awesome.

Cheers -Phil-

(Frank W.) #2

How is your circuit and how do you load the module (imho somewhere you need to pass the gpio)?

On rpi a additional overlay-dtb is needed: https://github.com/krzk/tizen-tv-rpi-linux/blob/master/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts

This dtb is loaded via config.txt (not used on bpi) with a line like this:


Currently i don’t knoe how to adapt this to bpi


If by “How is your circuit” you mean how is it connected it has 3 wires, 1 is 3.3v, 1 is ground and 1 is data. I use quite a lot of the pins on the pi at once so this is currently connected to a non standard gpio 25 (Pin 22) instead of gpio 4. The config.txt dtoverlay line looks like dtoverlay=w1-gpio,gpiopin=25 I then load the w1-gpio and w1-therm modules at boot in /etc/modules. It would be a pity if there is no way to do this with the bpi gpio.

(Frank W.) #4

Config.txt does not exit and will not be loaded on bpi.

Pin 22 is gpio 18 see here: https://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:gpio

As for overlay-support…our uboot (2014-4) should be too old: https://forum.digikey.com/t/all-beaglebone-varients-u-boot-overlays/26

@Ryder.Lee @linkerosa do you know a way this can be done on r2?

(Frank W.) #5

maybe this is a way to

Using DTB-Overlay's

Awesome. Thanks for that. I’ll see if I can get it working.

(Frank W.) #7

please tell me if you have success…i can add instructions to my wiki or code to github-repo

More info on overlays: https://www.raspberrypi.org/documentation/configuration/device-tree.md

The w1 overlay for rpi: https://github.com/krzk/tizen-tv-rpi-linux/blob/master/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts


We seem to be missing CONFIG_OF_CONFIGFS in the kernel configs. I see that mentioned here https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=858975 as well as here https://stackoverflow.com/questions/50877808/configfs-do-not-mount-device-tree-overlays. I would attempt to compile that driver mentioned in the last url but obviously need the kernel headers etc. Perhaps you could have a go at compiling it Frank? The device tree would be great actually as I also want to get my gps working on the R2 with PPS for a clocksource. My knowledge of all this is a little limited. Guess I am too used to the ease of doing this in a Raspberry Pi with overlays and blobs. :slight_smile:

(Frank W.) #9

I recently added configfs but you need to add your driver too. So you need to compile kernel by youself and then add dt-overlay. I have not tried it yet due to missing time

grep -i 'configfs\|overlay' .config

I did not found CONFIG_OF_CONFIGFS so i cannot enable it


Yep I have done all that. No go. I see nothing in /sys/kernel/config and trying to create a folder under that results in an error. Oh well. Onward and upward.

(Frank W.) #11

you have modprobed CONFIG_CONFIGFS_FS ?


I have built the kernel with configfs as both a module and modprobed it and and also compiled into the kernel in a different test and neither work. As I alluded to in an earlier post this https://stackoverflow.com/questions/50877808/configfs-do-not-mount-device-tree-overlays shows the same error and links to a driver here https://github.com/ikwzm/dtbocfg or for Debian here https://github.com/ikwzm/dtbocfg-kmod-dpkg but after cloning I couldn’t compile it even under a vm let alone without kernel headers for the R2.

Output of grep of my kernel config of your 4.9-main branch which otherwise works very well.

grep -i ‘configfs|overlay’ .config





(Frank W.) #13

does 4.9 work? seems this option is dropped…maybe handled by already set CONFIG_CONFIGFS_FS


No 4.9 doesn’t work. Where have you seen that it is dropped? Anyway the overlays are not working for me either on the R2 or under a vm.

(Frank W.) #15

if the option exists in 4.9 and not exist in 4.14…

@ryder.lee can you help here?


I don’t know much about this. I guess you’re trying to add a device node to describe " Dallas 1 wire" ?

(Frank W.) #17

We try first to load a simple dt-overlay (via configfs because uboot way does not work)…then we can make a step further…


Ok I now have this working.
To enable w1-gpio on GPIO 19 add the following to the main node of mt7623n-bananapi-bpi-r2.dts and recompile the kernel after setting CONFIG_W1=m, CONFIG_W1_MASTER_GPIO=m and CONFIG_W1_SLAVE_THERM=m in your kernel config

w1 {
   pinctrl-names = “default”;
   compatible = “w1-gpio”;
   gpios = <&pio 19 0>;
   status = “okay”;

Your devices should now show up at /sys/bus/w1/devices/
This is tested and working on kernel 4.9.

mt7623n-bananapi-bpi-r2.dts (19.4 KB)

(Frank W.) #19

thanks please try also with 4.14