[HOW-TO] 1-Wire on A20 debian Jessie

Started by gsbMechatr, October 10, 2016, 12:10:43 PM

Previous topic - Next topic


Hi All,

I've managed to get 1-wire working on my A20 LIME2 running Debian Jessie

1) Log in as root (using root/olimex). In a file browser, navigate to /etc/modules-load.d. Open modules.conf with leafpad or another such editor. Add the end of the file, add each on a separate line below the last


Save and close the file.

2) the script.bin needs to be modified to add the w1 parameters. The script.bin is located in the boot partition. On my image, it is located under /boot. The .bin file needs to be converted to .fex file, edited, and then converted back to the bin file. luckily we have tools for that.

open up terminal and run the command

# bin2fex /boot/script.bin /boot/script.fex

this will generate a file called script.fex located in the /boot directory.

Open /boot/script.fex with a text editor (like leafpad). at the bottom of the file, add the following

gpio = 21

save the file, close it. then in terminal, run the command

# fex2bin /boot/script.fex /boot/script.bin

This will convert your fex file with the w1 parameters into the required bin file.

1-wire uses a GPIO port, so choose one from your gpio list under [gpio_para] within the same script.fex file. Use only the integer part of the pin name (i.e. only integer value 21 of the name pin_21)

for example, I used
pin_21 = port:PH15<0><default><default><default>

Looking at the GPIO layout document, I looked for port PH15 which was located on GPIO_3 header at pin number 23. I plugged the data pin of the 1-wire device to this port on the GPIO header.

Reboot the board.

# reboot

Upon reboot, log in as root. (using root/olimex). Open up terminal, and type in

# lsmod

in the list you should find the modules w1_gpio, w1_sunxi and wire listed. If so, you have successfully loaded the modules required for 1-wire

Make sure your device is properly connected.

the device serial should then be listed under /sys/bus/w1/devices/[IDNumber]

changing the directory to the /sys/bus/w1/devices directory and running the ls command will list the connected 1-wire devices.

root@A20-OLinuXino:~# cd /sys/bus/w1/devices
root@A20-OLinuXino:/sys/bus/w1/devices# ls
01-0000184164eb      w1_bus_master1
root@A20-OLinuXino:/sys/bus/w1/devices# cd 01-0000184164eb

note: the 01 is the 8-bit family name and the part after the "-" is the 48bit unique ID of the 1-wire device, in Hex.

00 00 18 41 64 eb

I hope this may help someone to get their 1-wire bus connected.



Hello & thanks you for this info

I was curious about how to do this

I followed your steps and get my ds18b20 to show up in /sys/bus/w1/devices

BUT I cant read temperature :(

when I try

cat /sys/bus/w1/devices/28-0115616685ff/w1_slave


cat /sys/bus/w1/devices//w1_bus_master/28-0115616685ff/w1_slave

I get "No such file or directory" response

I've seen at some (web) places, references to the necessity of loading w1-therm module, so I've also placed w1_therm (and w1-therm) at /etc/modules-load.d/modules.conf, but always get error when modprobe w1-therm

$ sudo modprobe w1-therm
$ modprobe: FATAL: Module w1-therm not found.

Have you had results with ds18b20 ? , how ?

thanks in advance


I think it would be w1_therm if it is what you need.



Quote from: JohnS on December 10, 2016, 04:01:52 PM
I think it would be w1_therm if it is what you need.


Thank you , I've already did that, no changes, still receiving modprobe error and no temperature reading