W1-therm onewire 18b20 sensor not working

I built my own v19.07.2 with kmod-w1 and kmod-w1-gpio-custom as well as the desired kmod-w1-slave-therm for a Linkit Smart 7688 Target.
I added echo "w1-gpio-custom bus0=0,19,0 bus1=1,20,0" > /etc/modules.d/55-w1-gpio-custom as described in the docs. I also checked the GPIO as described here.
But the connected device (i double checked and even tried a second absolutely new 18b20) does not apear. In fact there are randomly changeing ID's apearing in the Kernel Log like these last 6 lines:

[ 2884.519815] w1_master_driver w1_bus_master1: Attaching one wire slave 00.ec0000000000 crc 4a
[ 2884.570850] w1_master_driver w1_bus_master1: Family 0 for 00.ec0000000000.4a is not registered.
[ 2947.839911] w1_master_driver w1_bus_master1: Attaching one wire slave 00.1c0000000000 crc 3e
[ 2947.890353] w1_master_driver w1_bus_master1: Family 0 for 00.1c0000000000.3e is not registered.
[ 2987.045575] w1_master_driver w1_bus_master1: Attaching one wire slave 00.9c0000000000 crc b2
[ 2987.132644] w1_master_driver w1_bus_master1: Family 0 for 00.9c0000000000.b2 is not registered.

I read a lot in raspi forums and had to regret that the /overlay stuff is not in my knowledge range.
It maybe also differs to what openwrt is because it seems to be another way to do same things.
I then tried to understan the kernel.org description but without success.

root@openwrt:/sys/bus/w1/devices# lsmod | grep "w1"
w1_gpio                 2352  0 
w1_gpio_custom           912  0 
w1_smem                  496  0 
w1_therm                4752  0 
wire                   17171  3 w1_therm,w1_smem,w1_gpio
root@openwrt:/sys/bus/w1/devices# ls
00-020000000000  00-7c0000000000  00-fc0000000000  w1_bus_master1
root@openwrt:/etc/modules.d# ls
20-usb-core             51-i2c-core             ipt-nat                 nf-flow                 pppoe
30-gpio-button-hotplug  55-w1-gpio-custom       ipt-offload             nf-ipt                  pwm-mediatek-ramips
30-sound-core           58-i2c-smbus            lib-crc-ccitt           nf-ipt6                 sdhci-mt7620
35-usb-ehci             59-i2c-mt7628           mmc                     nf-nat                  w1-master-gpio
40-usb2                 60-leds-gpio            mt7603                  nf-reject               w1-slave-smem
42-ip6tables            ipt-conntrack           nf-conntrack            nf-reject6              w1-slave-therm
50-usb-ohci             ipt-core                nf-conntrack6           ppp
root@openwrt:/etc/modules.d# cat 55-w1-gpio-custom 
w1-gpio-custom bus0=0,1,0
root@openwrt:/etc/modules.d# cat w1-master-gpio 
root@openwrt:/etc/modules.d# cat w1-slave-therm 

What can I do more?

Let me share my notes on this.
Modules required:
kmod-w1 kmod-w1-gpio-custom kmod-w1-master-gpio kmod-w1-slave-therm

Using gpio5:
echo "w1-gpio-custom bus0=0,5,0" > /etc/modules.d/55-w1-gpio-custom

cat /sys/devices/w1_bus_master1/28-xxxxxxxxxxxx/w1_slave

interessting path. My device shows at that path:

root@openwrt:~# cat /sys/devices/w1_bus_master1/28*/w1_slave
cat: can't open '/sys/devices/w1_bus_master1/28*/w1_slave': No such file or directory
root@openwrt:/sys/devices/w1_bus_master1# ls
00-400000000000            w1_master_add              w1_master_pullup           w1_master_timeout
00-800000000000            w1_master_attempts         w1_master_remove           w1_master_timeout_us
driver                     w1_master_max_slave_count  w1_master_search
subsystem                  w1_master_name             w1_master_slave_count
uevent                     w1_master_pointer          w1_master_slaves

I think i have found the /sys/bus path in this resource.
It seams to be the same in a reduced way.

I have also added the right GPIO. My first post has a copy and paste failure from the docs to this thread. It is not quite what I have done really as I have set GPIO 1:

echo "w1-gpio-custom bus0=0,1,0" > /etc/modules.d/55-w1-gpio-custom

not GPIO 19 & 20:

its visable here:

I uninstalled kmod-w1-slave-smem, still no sensor is found.
Don't know what to do...

cat /sys/devices/w1_bus_master1/*-*/w1_slave

Thanks! Here the answer:

root@openwrt:~# cat /sys/devices/w1_bus_master1/*-*/w1_slave
cat: can't open '/sys/devices/w1_bus_master1/*-*/w1_slave': No such file or directory


1 Like
ls /sys/devices/w1_bus_master1/00-400000000000/
ls /sys/devices/w1_bus_master1/00-800000000000
ls /sys/bus/w1/devices/00-020000000000/
ls /sys/bus/w1/devices/00-7c0000000000/
ls /sys/bus/w1/devices/00-fc0000000000/

p.s. i don't know much about i2c just filling in till @AndrewZ gets back... these seemed like the next step based on what you guys have written... but I suspect your issue is lower level.

based on

i believe with one-wire it often needs some sort of pull-up/down somewhere... for bias/reference

I suggest to check (or even try another) gpio port, sensor wiring and, finally, the log file. I don't have 1-wire configured right now, so cannot show you the desired output. Maybe @anon50098793 can provide an example from his log.

1 Like

i2c is absolutely different story. Actually, I switched from 1-wire to i2c in order to put several devices I had on the same bus.

1 Like

alas, i've only used these things on uC/microcontrollers... :sneezing_face: , having said that 9/10 it's a wiring issue...

I'm a bit skeptic about using gpio1... what is your router model? Can you try another gpio? Better to check it with multimeter before configuring 1-wire stuff.

My "router" model is a Linkit Smart 7688 and i have doublechecked the gpio by deleting the file in /etc/modules.d/55-w1-gpio-custom rebooting and toggle the gpio 1 whith this script stolen from the docs:

GPIOBASE=`cat /sys/class/gpio/gpiochip*/base | head -n1`
GPIOmin=`expr $1 + $GPIOBASE`
GPIOmax=`expr $2 + $GPIOBASE`
cd /sys/class/gpio
for i in `seq $GPIOmin $GPIOmax`; do
     echo "[GPIO$i] Trying value $3"
     echo $i > export; echo out >gpio$i/direction
     echo $3 > gpio$i/value
     echo $i > unexport

and executeing it like that:

./gpio 1 1 1
./gpio 1 1 0

While measuring the voltage on the pin 13.
That pin goes to 3.3V when ./gpio 1 1 1 is given.
So the wiring seams to be good.

But granted, the pin can be not able to handle w1.
I will solder it to another Pin and check. Thanks for the thoughts in the meanwhile, very appreciated.

is this how its wired? ( pull-up to 5v or 3.3 )? you measured the logic levels in circuit?

Checked the dts file - even gpio1 should be good.

Yes that's how its wired.
I have a Ground as well so my connection has 3 wires in total.

  • 3.3V
  • Data
  • GND

Data and 3.3V are connected over a 4.7k Resistor. Data goes in to P13 = GPIO1

1 Like

I now changed the W1 Data wire to GPIO2 with no success.
I have a previous built device in my house with 12 18b20 sensors on same Linkit Smart 7688 (it's productive) but that one is on OpenWrt SNAPSHOT r11009-4a85748040 / LuCI Master (git-19.264.32154-6dba41c) and it works on the GPIO2.
I do not know how to compare what changed between that (wrongly built master branch) and the v19.07.2 tag.
Is it possible to compare those two somehow?

rule out faulty sensor first.

1 Like

OMG. GPIO1 does not work but GPIO2 does.
I realized today, I forgot the 4.7k resistor on my test yesterday with GPIO2.
What's the difference between GPIO1 and 2?