PDA

View Full Version : 1-Wire drivers for DS18b20 temperature probes



phswartz
30-Apr-2018, 14:01
Hello All,
I'm trying to convert my RPi3 boxes running Raspbian to SLES12sp3 that collect temperature reading from a DS18b20 probe. I'm not finding any docs for either openSUSE or SLES that describes the process, but from what I can tell is that I'm missing the w1-gpio.ko drivers or whatever it is called in SLES/openSUSE. Are the w1 drivers available? Are there any docs that discuss the use of the GPIO bus?

Thanks!

malcolmlewis
30-Apr-2018, 14:47
Hello All,
I'm trying to convert my RPi3 boxes running Raspbian to SLES12sp3 that collect temperature reading from a DS18b20 probe. I'm not finding any docs for either openSUSE or SLES that describes the process, but from what I can tell is that I'm missing the w1-gpio.ko drivers or whatever it is called in SLES/openSUSE. Are the w1 drivers available? Are there any docs that discuss the use of the GPIO bus?

Thanks!
Hi
I don't see the drivers in the current 4.4.126 kernel config via;


zcat /proc/config.gz > config.txt
cat config.txt | grep W1

For comparison in the current openSUSE Tumbleweed kernel I see;


zcat /proc/config.gz > config.txt
cat config.txt | grep W1
CONFIG_REGMAP_W1=m
CONFIG_CW1200=m
CONFIG_CW1200_WLAN_SDIO=m
# CONFIG_CW1200_WLAN_SPI is not set
CONFIG_W1=m
CONFIG_W1_CON=y
CONFIG_W1_MASTER_MATROX=m
CONFIG_W1_MASTER_DS2490=m
CONFIG_W1_MASTER_DS2482=m
CONFIG_W1_MASTER_DS1WM=m
CONFIG_W1_MASTER_GPIO=m
CONFIG_W1_SLAVE_THERM=m
CONFIG_W1_SLAVE_SMEM=m
CONFIG_W1_SLAVE_DS2405=m
CONFIG_W1_SLAVE_DS2408=m
CONFIG_W1_SLAVE_DS2408_READBACK=y
CONFIG_W1_SLAVE_DS2413=m
CONFIG_W1_SLAVE_DS2406=m
CONFIG_W1_SLAVE_DS2423=m
CONFIG_W1_SLAVE_DS2805=m
CONFIG_W1_SLAVE_DS2431=m
CONFIG_W1_SLAVE_DS2433=m
CONFIG_W1_SLAVE_DS2433_CRC=y
CONFIG_W1_SLAVE_DS2438=m
CONFIG_W1_SLAVE_DS2760=m
CONFIG_W1_SLAVE_DS2780=m
CONFIG_W1_SLAVE_DS2781=m
CONFIG_W1_SLAVE_DS28E04=m
CONFIG_W1_SLAVE_DS28E17=m


It can be built as a kmp of course, but AFAIK it also needs the overlay file...
Ref: http://www.jumpnowtek.com/rpi/Using-DS18B20-1-wire-Temp-Sensors-with-the-Raspberry-Pi.html

Let me ask my SUSE contacts if there are some docs/info available.

malcolmlewis
30-Apr-2018, 17:14
Hi
As a quick test I manually built the three modules without issuse...

You need to have the kernel-source, kernel-syms, make and gcc installed.
You also need to allow unsupported modules by editing /etc/modprobe.d/10-unsupported-modules.conf

Build as your user;


~/> mkdir modules
~/> cd modules/
~/modules> set -- /usr/src/linux/drivers/w1/*
~/modules> mkdir source
~/modules> cp -ar "$@" source/
~/modules> mkdir obj
~/modules> export CONFIG_W1_MASTER_GPIO="m"
~/modules> export CONFIG_W1_SLAVE_THERM="m"
~/modules> export CONFIG_W1="m"
~/modules> mkdir -p obj/default
~/modules> cp -r source/* obj/default/
~/modules> make -C /usr/src/linux-obj/aarch64/default modules M=$PWD/obj/default
make: Entering directory '/usr/src/linux-4.4.126-94.22-obj/arm64/default' CC
[M] /home/username/modules/obj/default/w1.o CC
[M] /home/username/modules/obj/default/w1_int.o CC
[M] /home/username/modules/obj/default/w1_family.o CC
[M] /home/username/modules/obj/default/w1_netlink.o CC
[M] /home/username/modules/obj/default/w1_io.o LD
[M] /home/username/modules/obj/default/wire.o CC
[M] /home/username/modules/obj/default/masters/w1-gpio.o CC
[M] /home/username/modules/obj/default/slaves/w1_therm.o
Building modules, stage 2. MODPOST 3 modules
CC /home/username/modules/obj/default/masters/w1-gpio.mod.o
LD [M] /home/username/modules/obj/default/masters/w1-gpio.ko
CC /home/username/modules/obj/default/slaves/w1_therm.mod.o
LD [M] /home/username/modules/obj/default/slaves/w1_therm.ko
CC /home/username/modules/obj/default/wire.mod.o
LD [M] /home/username/modules/obj/default/wire.ko
make: Leaving directory '/usr/src/linux-4.4.126-94.22-obj/arm64/default'


Install modules as root user;


~/modules> su -
Password:
~ # cd /home/username/modules/
/home/username/modules # export INSTALL_MOD_DIR=updates
/home/username/modules # make -C /usr/src/linux-obj/aarch64/default modules_install M=$PWD/obj/default
make: Entering directory '/usr/src/linux-4.4.126-94.22-obj/arm64/default'
INSTALL /home/username/modules/obj/default/masters/w1-gpio.ko
INSTALL /home/username/modules/obj/default/slaves/w1_therm.ko
INSTALL /home/username/modules/obj/default/wire.ko
DEPMOD 4.4.126-94.22-default
/home/username/modules # depmod
/home/username/modules # modprobe wire
/home/username/modules # modprobe w1_therm
/home/username/modules # modprobe w1-gpio
/home/username/modules # modinfo wire
filename: /lib/modules/4.4.126-94.22-default/updates/wire.ko
description: Driver for 1-wire Dallas network protocol.
author: Evgeniy Polyakov <zbr@ioremap.net>
license: GPL
srcversion: 31750B28F8DDCE836DD0167
depends:
vermagic: 4.4.126-94.22-default SMP mod_unload modversions aarch64
parm: delay_coef:int
parm: disable_irqs:int
parm: search_count:int
parm: enable_pullup:int
parm: timeout_us:int
parm: timeout:time in seconds between automatic slave
searches (int) parm: max_slave_count:maximum number of slaves
detected in a search (int) parm: slave_ttl:Number of searches
not seeing a slave before it will be removed (int)

/home/username/modules # modinfo w1_therm
filename: /lib/modules/4.4.126-94.22-default/updates/slaves/w1_therm.ko
alias: w1-family-0x42
alias: w1-family-0x3B
alias: w1-family-0x28
alias: w1-family-0x22
alias: w1-family-0x10
description: Driver for 1-wire Dallas network protocol, temperature
family. author: Evgeniy Polyakov <zbr@ioremap.net>
license: GPL
srcversion: 949AE89193045A9E5041AED
depends: wire
vermagic: 4.4.126-94.22-default SMP mod_unload modversions aarch64
parm: strong_pullup:int

/home/username/modules # modinfo w1-gpio
filename: /lib/modules/4.4.126-94.22-default/updates/masters/w1-gpio.ko
license: GPL
author: Ville Syrjala <syrjala@sci.fi>
description: GPIO w1 bus master driver
srcversion: E96C06A4E7FBCF975B99634
alias: of:N*T*Cw1-gpio*
depends: wire
vermagic: 4.4.126-94.22-default SMP mod_unload modversions aarch64

/home/username/modules # lsmod | egrep "wire|w1_therm|w1_gpio"
w1_gpio 16384 0
w1_therm 16384 0
wire 45056 2 w1_gpio,w1_therm


--
Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
SLES 15 RC3 | GNOME Shell 3.26.2 | 4.12.14-16-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below... Thanks!