6

I had two of these running fine, but now they've stopped. From reading I've done I think this has something to do with kernel updates and device tree. There seems to be about half a dozen options now with numerous permutations of config, but I haven't got it working at all.

I have a Pi B+ and I've wired:

  • 4.7kΩ Resistor between pin 1 (3.3V) and pin 7 (GPIO 4)
  • pin 1 (3.3V) to the +ve of the DS18B20
  • pin 6 (GND) to the ground of the DS18B20
  • pin 7 (GPIO 4) to the data of the DS18B20

I am running updated Raspian Linux raspberrypi 4.1.7+ #817 PREEMPT

From what I've read the options are:

  • modules, and possibly parameters, in /etc/modules
  • blacklist statements in /etc/modprobe.d/raspi.blacklist.conf
  • device_tree= or not in /boot/config.txt, and if not, then dtoverlay statement that includes
    • w1-gpio-pullup or w1-gpio
    • gpiopin=X where X is usually 4
    • extpullup=Y or ommitted where Y is a pin number?

The device(s) is(are) never listed under /sys/bus/w1/devices/ where they used to be. I mostly just have w1_bus_master/ in there.

Things I've tried:

1. Without Device Tree (attempting to go to original config)

device_tree= in /boot/config.txt.

/etc/modules including:

w1-gpio
w1-therm

This was an attempt to revert to the settings that worked before.

2. Without Device Tree but with more module params

device_tree= in /boot/config.txt.

/etc/modules including:

w1-gpio pullup=0 gpiopin=4 extpullup=1
w1-therm strong_pullup=1

3. With Device Tree (hay, it's obviously the cool thing to do)

/boot/config.txt contains: dtoverlay=w1-gpio,gpiopin=4

I've also tried various combinations of blacklisting and listing in /etc/modules the wp-gpio and wp-therm modules.

Things I've read that have only muddied my understanding(!)

Not least because I have a Pi B+ whereas many are working with Pi2 which I don't have.

[EDIT] As suggested in comment:

  • /etc/modules empty.
  • /boot/config.txt does not have device_tree=, thus enabling device tree. It does not contain any w1-* lines at all.

Result: lsmod shows that neither w1-gpio nor w1-therm are there (nor wire which is usually there when the other two are).

After sudo modprobe w1-gpio; sudo modprobe w1-therm there is still nothing in /sys/bus/w1/devices/, not even the w1_bus_master one.

...

And with dtoverlay=w1-gpio-pullup,gpiopin=4 in /boot/config.txt...reboot...

Now lsmod shows wire and w1_gpio and w1_therm. ls /sys/bus/w1/devices/ has the devices! Thanks @Joan!

  • Use device tree. I'm not sure if it is compulsory yet, it will be one day. /etc/modules should not have 1-wire modules mentioned. From memory device tree should load w1-gpio and w1-therm (use lsmod to check). Could you ensure you are using device tree and an empty /etc/modules and reboot. – joan Oct 10 '15 at 18:48
  • Thanks @joan I've edited question with the result of that. – artfulrobot Oct 10 '15 at 18:56
  • The same with dtoverlay=w1-gpio-pullup,gpiopin=4 in /boot/config.txt. – joan Oct 10 '15 at 19:02
  • @joan yes! The winning combination! Thanks so much. – artfulrobot Oct 10 '15 at 19:54
  • github.com/raspberrypi/firmware/issues/348 also has some lengthy explanations on parasite mode. Its all confusing, indeed – x29a Apr 3 '16 at 15:34
2

I'm posting this as it's the answer I got to but all credit is due to the commenter @Joan!

/etc/modules empty.
/boot/config.txt does not have device_tree=, thus enabling device tree. It does not contain any w1-* lines at all.

Result: lsmod shows that neither w1-gpio nor w1-therm are there (nor wire which is usually there when the other two are).

After sudo modprobe w1-gpio; sudo modprobe w1-therm there is still nothing in /sys/bus/w1/devices/, not even the w1_bus_master one.

...

And with dtoverlay=w1-gpio-pullup,gpiopin=4 in /boot/config.txt...reboot...

Now lsmod shows wire and w1_gpio and w1_therm. ls /sys/bus/w1/devices/ has the devices! Thanks @Joan!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.