w1-gpio, w1-therm

Options
Phil Miesle
Phil Miesle New Member Posts: 2
edited October 2016 in UP Board Linux
Hello,

Trying to figure out how to configure a basic 1-wire temperature probe, similar to https://www.modmypi.com/blog/ds18b20-one-wire-digital-temperature-sensor-and-the-raspberry-pi (which I have working).

I'm using the ubilinux image build, updated:
Linux alpha 4.4.0-ubi3-amd64 #1 SMP Debian 4.4.13-1 (2016-06-17) x86_64 GNU/Linux

However it seems this kernel lacks w1-gpio module?
phil@alpha:~$ sudo modprobe w1-gpio
modprobe: FATAL: Module w1-gpio not found.
phil@alpha:~$ sudo modprobe w1-therm
phil@alpha:~$ echo $?
0

I've made an attempt to download the ubilinux source and compile a custom kernel:
apt-get source apt-get install linux-ubilinux-source
apt-get --no-install-recommends install kernel-package
apt-get install linux-ubilinux-source
apt-get install git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc

and then with menuconfig:
->Device Drivers->(M) Dallas 1-wire support->
-> 1WireBusmaster
-> (M) Maxim DS…
-> (M) GPIO 1wire busmaster
->1wireslaves
-> (M) Thermal family Implementation

After rebooting into that kernel, the w1-gpio module is loaded...but no bus devices (not even the master).

Has anybody gotten this working with ubilinux? Or, for that matter, any Linux?

Comments

  • Dan O'Donovan
    Dan O'Donovan Administrator, Moderator, Emutex Posts: 241 admin
    Options
    Hi mieslep

    Sorry for this late reply. Unfortunately I missed it before now.

    The w1-gpio driver is designed to be used in 2 ways:
    1. by declaring a "w1-gpio" device in the Device Tree. Raspberry Pi uses device tree, and to enable the w1-gpio driver there you might add something like "dtoverlay=w1-gpio,gpiopin=7" in your /boot/config.txt file
    2. by using another kernel module to register a "w1-gpio" platform device, and passing the required gpio number via the platform data for that device.

    The UP board (and most x86-based platforms) doesn't use a Device Tree. Instead, it gets similar board-level information from ACPI tables provided by the UEFI BIOS.

    For now, I'd say the best option would be to create a simple kernel module to exercise Option 2 above. One caveat I'd add here is that GPIO performance on UP is slower than on Raspberry Pi. The implication of this is that I'm not sure if it will allow you to meet the timing constraints of the 1-wire protocol, but its probably worth a try.

    Alternatively, you could consider an I2C to 1-wire bridge chip such as the DS2482. I've used one of these with an UP board, and it worked well for me.