garyk1968
Posts: 16
Joined: Thu Feb 09, 2012 8:50 am
Location: Bedfordshire
Contact: Website

DS18B20 Still not working...

Mon Jun 08, 2015 9:19 am

I did post a reply to another thread here but I'm not sure how visible it was and could really do with some help!

So I have been using 4 x DS18B20s with a 4.7k pull-up hooked up to a B+ running through one GPIO (#4) I bought at the end of last year. That has been working flawlessly for the last six months. Now I need to build a few more of these setups for a project I am working on so I bought two more B+ from RS.

The problem is I cannot get either of the new Pis to detect the 1-wire sensors at all. Been at this for hours and I know the kernel update has introduced the devicetree so I have made all the changes required but still cannot get anything to work. If I take the sensors and plug them back into the old B+, hey presto works like a charm still.

So I have tried changing config.txt to include dtoverlay=w1-gpio, gpiopin=4 (tried with and without and I know the default is pin 4). I also installed pigpio to test the actual GPIOs and both devices are fine.

I have also tried with devicetree= in config.txt but still no joy. I also turned on dtdebug and ran vcdbg log msg to see if there was anything untoward, I do get this which I'm not sure is related

Code: Select all

003318.224: gpioman: gpioman_get_pin_num: pin LEDS_RUNNING not defined
003318.249: gpioman: gpioman_get_pin_num: pin LEDS_NAND_ACTIVITY not defined
003318.271: gpioman: gpioman_get_pin_num: pin LEDS_USB_ACTIVITY not defined
003318.293: gpioman: gpioman_get_pin_num: pin LEDS_FATAL_ERROR not defined
003318.315: gpioman: gpioman_get_pin_num: pin LEDS_APP_OK not defined
003318.338: gpioman: gpioman_get_pin_num: pin LEDS_APP_FAILED not defined
003318.358: gpioman: gpioman_get_pin_num: pin LEDS_HDCP_AUTH not defined
003318.381: gpioman: gpioman_get_pin_num: pin LEDS_HDCP_UNAUTH not defined
003318.404: gpioman: gpioman_get_pin_num: pin LEDS_HDMI_ON not defined
003318.427: gpioman: gpioman_get_pin_num: pin LEDS_DVI_ON not defined
003318.450: gpioman: gpioman_get_pin_num: pin LEDS_HDMI_HPD_UP not defined
003318.471: gpioman: gpioman_get_pin_num: pin LEDS_REMOTE_CONTROL not defined
003318.493: gpioman: gpioman_get_pin_num: pin LEDS_ARM_CONTROLLED not defined
If I do a ls -l /sys/bus/w1/devices/ it shows absolutely nothing.

The new Pis are running 3.18.14+ and the old one is running 3.18.11+ (was running 3.18.7)

I am completely out of ideas as to what else I can now! :)

Any help most appreciated

Gary

User avatar
rpdom
Posts: 15234
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: DS18B20 Still not working...

Mon Jun 08, 2015 10:10 am

I tried vcdbg log msg to see what it gave on a Pi with a working DS18B20. I think this part (just before the messages you showed) is important

Code: Select all

000934.538: Loading 'kernel.img' from SD card
001170.942: Kernel trailer DTOK property says yes
001171.196: Loading 'bcm2708-rpi-b.dtb' from SD card
001192.691: Loaded overlay 'w1-gpio'
001204.012: dtparam: gpiopin=4
I don't normally bother putting the gpiopin=4 option on, as that is the default and it saves typing. But I added it to make the situation closer to yours.

garyk1968
Posts: 16
Joined: Thu Feb 09, 2012 8:50 am
Location: Bedfordshire
Contact: Website

Re: DS18B20 Still not working...

Mon Jun 08, 2015 10:28 am

Thanks for sharing @rpdom

Thats interesting I don't get the 'loaded overlay w1-gpio' which could well be the issue

Code: Select all

000974.803: Loading 'kernel.img' from SD card
001209.665: Kernel trailer DTOK property says yes
001209.749: Loading 'bcm2708-rpi-b-plus.dtb' from SD card
001223.992: dtparam: pwr_led_gpio=35
001244.427: gpioman: gpioman_get_pin_num: pin SDCARD_CONTROL_POWER not defined
003310.358: vchiq_core: vchiq_init_state: slot_zero = 0x5bc80000, is_master = 1
003314.205: hdmi: HDMI:hdmi_get_state is deprecated, use hdmi_get_display_state instead
But if I do an lsmod it shows both modules loaded:

Code: Select all

Module                  Size  Used by
w1_therm                3325  0 
w1_gpio                 4287  0 
wire                   31248  2 w1_gpio,w1_therm
cn                      5756  1 wire
snd_bcm2835            20818  0 
snd_pcm                90778  1 snd_bcm2835
snd_seq                61097  0 
snd_seq_device          7209  1 snd_seq
snd_timer              23007  2 snd_pcm,snd_seq
snd                    66325  5 snd_bcm2835,snd_timer,snd_pcm,snd_seq,snd_seq_device
uio_pdrv_genirq         3666  0 
uio                     9897  1 uio_pdrv_genirq

User avatar
rpdom
Posts: 15234
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: DS18B20 Still not working...

Mon Jun 08, 2015 12:17 pm

The only thing I can think of at the moment is that somehow you might not be editing the right config.txt and your dtoverlay line is not being processed.

Perhaps you could try making a different change in the config.txt and see if it takes effect?
Put a dummy codec line or something, like

Code: Select all

decode_MPG2=0x12345678
and see if it shows up with vcgencmd config str

Code: Select all

[email protected] ~ $ vcgencmd get_config str
device_tree=-
decode_MPG2=0xdeadbeef
just to prove the file is being processed.

garyk1968
Posts: 16
Joined: Thu Feb 09, 2012 8:50 am
Location: Bedfordshire
Contact: Website

Re: DS18B20 Still not working...

Mon Jun 08, 2015 2:54 pm

Actually when I add that line in you suggested and do vcgencmd get_config str it just shows:

Code: Select all

device_tree=-
That said I also added device_tree_overlay=overlays/w1-gpio-overlay.dtb (clutching at straws here) to config.txt and doing a vcgencmd then showed:

Code: Select all

device_tree_overlay=overlays/w1-gpio-overlay.dtb


I still don't get a line that says; 'Loaded overlay 'w1-gpio' which must be something to do with it.

Think I will swap the sdcard from the old b+ that works into one of the new ones that doesn't just to make double sure it isn't hardware related.


Cheers

Gary

garyk1968
Posts: 16
Joined: Thu Feb 09, 2012 8:50 am
Location: Bedfordshire
Contact: Website

Re: DS18B20 Still not working...

Mon Jun 08, 2015 5:48 pm

Yes its definately something to do with the boot. For the Pi thats working I have the line:

Code: Select all

001160.178: Loaded overlay 'w1-gpio'
But for the one that isn't I don't!

User avatar
DougieLawson
Posts: 36177
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: DS18B20 Still not working...

Mon Jun 08, 2015 6:45 pm

Is this NOOBS/Raspbian or plain Raspbian?
What's your kernel version on the working system vs borked system?

If NOOBS try using the NOOBS recovery system to edit your config.txt.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

garyk1968
Posts: 16
Joined: Thu Feb 09, 2012 8:50 am
Location: Bedfordshire
Contact: Website

Re: DS18B20 Still not working...

Tue Jun 09, 2015 7:53 am

Hi Dougie,

Its NOOBS on both PIs. I bought the SD cards with it pre-installed.

Working unit has a kernel version of 3.18.7. Non working unit *did* have 3.18.14. I say did as I thought that might be the issue so bumped the non-working unit to 3.18.7 also, but still no luck.

I will do a recovery and report back.

Cheers

Gary

garyk1968
Posts: 16
Joined: Thu Feb 09, 2012 8:50 am
Location: Bedfordshire
Contact: Website

Re: DS18B20 Still not working...

Tue Jun 09, 2015 3:19 pm

Hey Dougie,

What can I say!?!?!?

I owe you a beer! Editing using recovery I can see in the dtdebug output it now loads the overlay for w1-gpio. Really strange why that should fix it though? Can you explain why please?

O and if you like ale, this work is because of this: http://www.thebrewtower.com so if you like IPAs/PAs we will be in full brew! :)

Cheers!

Gary

User avatar
DougieLawson
Posts: 36177
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: DS18B20 Still not working...

Tue Jun 09, 2015 3:32 pm

garyk1968 wrote: I owe you a beer! Editing using recovery I can see in the dtdebug output it now loads the overlay for w1-gpio. Really strange why that should fix it though? Can you explain why please?
I can't explain it (on a family forum) other than to say NOOBS is horrible and I won't use it. The real explanation involves lots of bad words that would have shocked my granny.

The bottom line is that NOOBS messes with the boot sequence and the partitions used when the system boots vs the partitions used for the root filesystem. Having used Linux since 1995 I have no need to use NOOBS and will avoid it at all cost.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Return to “Troubleshooting”