kernel patch for Dallas 1-wire interface


224 posts   Page 7 of 9   1 ... 4, 5, 6, 7, 8, 9
by szigeti » Tue Dec 18, 2012 3:01 pm
szigeti wrote:Which ASCII character is good for the "00000000" or "11111111" pin output?

Gabor


I found the answer:
echo -e '\x00' |dd of=output bs=1 count=1
and
echo -e '\xff' |dd of=output bs=1 count=1

So in this case you can set your hexadecimal value as output value.
Posts: 10
Joined: Thu Sep 06, 2012 1:29 pm
by rudiratlos » Thu Dec 27, 2012 2:09 pm
# uname -a
Linux raspberrypi 3.1.9+ #3 PREEMPT Tue Aug 14 14:23:01 CEST 2012 armv6l GNU/Linux

# modprobe w1_gpio pullup=1
ERROR: could not insert 'w1_gpio': Unknown symbol in module, or unknown parameter (see dmesg)

what's wrong ??
Posts: 64
Joined: Tue May 01, 2012 8:47 am
by thsBavR10 » Thu Dec 27, 2012 2:34 pm
You are using a rather outdated version of rasbian (maybe supplied from RS on SDcard ?).
Try an actual image e.g. this:
http://downloads.raspberrypi.org/images ... spbian.zip
Posts: 216
Joined: Sat Jul 21, 2012 3:11 pm
by rudiratlos » Thu Dec 27, 2012 4:26 pm
now upgraded to:
root@raspberrypi ~ # uname -a
Linux raspberrypi 3.2.27+ #307 PREEMPT Mon Nov 26 23:22:29 GMT 2012 armv6l GNU/Linux

root@raspberrypi ~ # modprobe w1_gpio pullup=1
ERROR: could not insert 'w1_gpio': Unknown symbol in module, or unknown parameter (see dmesg)

still have the error.
Posts: 64
Joined: Tue May 01, 2012 8:47 am
by thsBavR10 » Thu Dec 27, 2012 4:41 pm
please try
Code: Select all
sudo modprobe w1-gpio && lsmod

Now w1_gpio should be in the list of loaded modules.
See also http://www.frank-buss.de/raspberrypi/index.html
Posts: 216
Joined: Sat Jul 21, 2012 3:11 pm
by rudiratlos » Thu Dec 27, 2012 4:51 pm
I can modprobe w1-gpio
Also my 1-Wire bus runs ok, since several weeks.
But I need the internal pull-up resistor, because I want to get rid of my external resistor
Posts: 64
Joined: Tue May 01, 2012 8:47 am
by thsBavR10 » Thu Dec 27, 2012 5:08 pm
It seems, you need the patched drivers from mkj,
http://www.raspberrypi.org/phpBB3/viewtopic.php?t=6649&p=193456#p229425.
If it's not working, you can send him a PM.
Posts: 216
Joined: Sat Jul 21, 2012 3:11 pm
by stephelton » Fri Dec 28, 2012 4:38 am
When I've worked with the w1 interface before (in my Arduino days) I was able to get some extremely high performance out of the 5+ temperature probes I was using compared to the performance I get when I use this kernel module.

First, a command like "cat /sys/bus/w1/devices/28-000001d169fe/w1_slave" takes about 0.8 seconds. I assume this is because the command causes the master to (1) address the probe, (2) tell it to take a sample, and (3) get that sample after the required time has elapsed (750ms IIRC).

When I was using numerous probes, I would do something more like the following:

(1) for each probe, (a) address the probe, (b) tell it to take a temperature sample
(2) wait the required time (depends on the desired precision, I stuck with 750ms)
(3) for each probe, (a) address the probe, (b) ask the temperature

The advantage to this should be pretty clear -- in under a second, I was able to address every single probe and obtain a temperature reading with full precision.

Unless I'm missing something, this kernel module won't support that -- I need to patiently wait for every single temperature probe I have. If I'm not missing anything, any ideas for improving this? I'll be glad to help out with some programming.

Second, the desired precision affects the necessary wait time. At very low precision, a temperature probe could be read extremely quickly (something on the order of 100ms, IIRC). For some applications, this could be very desirable.

Here's a table I copied from http://datasheets.maximintegrated.com/en/ds/DS18B20.pdf

Resolution / Max Conversion Time
9 bits : 93.75 ms
10 bits : 187.5 ms
11 bits : 375 ms
12 bits : 750 ms

With my technique described above and 9 bit precision, you could get a LOT of data from these things.
Posts: 2
Joined: Mon Oct 29, 2012 5:27 pm
by mkj » Sat Dec 29, 2012 2:10 am
thsBavR10 wrote:It seems, you need the patched drivers from mkj,
http://www.raspberrypi.org/phpBB3/viewtopic.php?t=6649&p=193456#p229425.
If it's not working, you can send him a PM.


I've put the kernel and modules I'm using at http://matt.ucc.asn.au/rpi/w1-pullup-3. ... t1.tar.bz2

Put the .img in /boot, modules in /lib/modules 3.2.whatever, and set it to boot the new kernel (sorry for brevity, on a phone).

I've now tested with 3 ds18b20s and it works fine. I'll send a pull request to raspbian at some point.
Posts: 6
Joined: Sat Dec 08, 2012 4:22 am
Location: Perth, Australia
by szigeti » Sat Jan 05, 2013 1:40 pm
Hi again!
I have two questions:
A)
Anybody has an idea how can I check the read command's output (by DS2408). It was good or not?
It return so many times FF output because the set status was another and I can not read the latest right status from the output register.

B)
How can I use this switch as input? Any hints?

Many thanks,
Gabor
Posts: 10
Joined: Thu Sep 06, 2012 1:29 pm
by Fruity Pebbles » Sat Jan 12, 2013 6:41 pm
I want to say thanks for all the work on the kernel modules, and the info in this thread. I connected some DS18B20s to my Pi this morning and they're working great. Thanks!

Jim
Posts: 2
Joined: Sat Jan 12, 2013 6:38 pm
by rudiratlos » Mon Jan 14, 2013 11:42 am
Hi,
recently upgraded to
Linux raspberrypi 3.6.11+ #352 PREEMPT Wed Jan 9 17:16:53 GMT 2013 armv6l GNU/Linux

but the pullup=1 parameter is still not accepted.

Any plans to pull it to a newer distribution.

Thanks.
Posts: 64
Joined: Tue May 01, 2012 8:47 am
by mkj » Mon Jan 14, 2013 12:48 pm
rudiratlos wrote:but the pullup=1 parameter is still not accepted.

Any plans to pull it to a newer distribution.


There's a pull request waiting for some more testing and feedback.

https://github.com/raspberrypi/linux/pull/186
Posts: 6
Joined: Sat Dec 08, 2012 4:22 am
Location: Perth, Australia
by luckygray » Fri Jan 18, 2013 9:24 pm
I chime in after reading your posts.
I have a RPI with two DS18S20 temperature sensors on GPIO 4
with kernel modules wire, w1_gpio and w1_term.
( http://www.gtkdb.de/index_7_2035.html )
This works just fine. I can read the temperatures with a local bash or a
python script.
Now I'd like to access the temperatures from another computer running
the fhem home automation. For this "owserver" should be running.
- Has anybody managed to run owserver with the mentioned configuration?
- How does the /etc/owfs.conf looks like?
--
luckygray
Posts: 4
Joined: Thu Jan 17, 2013 10:12 pm
by fladdy » Sat Jan 19, 2013 8:19 am
luckygray wrote:I chime in after reading your posts.
I have a RPI with two DS18S20 temperature sensors on GPIO 4
with kernel modules wire, w1_gpio and w1_term.
( http://www.gtkdb.de/index_7_2035.html )
This works just fine. I can read the temperatures with a local bash or a
python script.
Now I'd like to access the temperatures from another computer running
the fhem home automation. For this "owserver" should be running.
- Has anybody managed to run owserver with the mentioned configuration?
- How does the /etc/owfs.conf looks like?


I'm afraid OWFS doesn't support the bitbanging kernel modules. One way to get your temperatures into fhem home automation would be to install fhem on the RPi, use the GPIO4 module from fhem contrib to get the temperature into RPi's fhem, and finally use fhem2fhem to get the data into your main fhem.
Posts: 7
Joined: Tue Sep 04, 2012 11:45 am
by luckygray » Sat Jan 19, 2013 10:50 am
That was very helpful for me, thanks.

"man owserver" mentions the "w1 kernel module" by using the "--w1" option, and
"... and the implementation was still in progress as of owfs v2.7p12 and linux 2.6.30."
But "man 5 owfs.conf" does not mention the w1 kernel module as source.
Since my RPi runs owfs version 2.8p15 and "Linux raspberrypi 3.2.27+"
I had some hope that there was some progress...

Anyway, the fhem2fhem solution is good for me.
--
luckygray
Posts: 4
Joined: Thu Jan 17, 2013 10:12 pm
by fehlfarbe » Tue Jan 22, 2013 10:43 pm
Hi,
I set up my RasPi and a DS18S20 as described at http://www.cl.cam.ac.uk/freshers/raspbe ... mperature/

But when I want to load the kernel modules I get these errors:
Code: Select all
pi@servberry ~ $ sudo modprobe wire
ERROR: could not insert 'wire': Invalid argument
pi@servberry ~ $ sudo modprobe w1-gpio
ERROR: could not insert 'w1_gpio': Invalid argument
pi@servberry ~ $ sudo modprobe w1-therm
ERROR: could not insert 'w1_therm': Invalid argument

The modules should be installed. When I'm typing
Code: Select all
sudo modprobe w1<TAB>
I get a list where "w1-gpio" and "w1_therm" is included.
Posts: 11
Joined: Wed Jun 20, 2012 7:49 pm
Location: Dresden, Germany
by luckygray » Tue Jan 22, 2013 11:35 pm
This occurs usually when the modules are corrupt or do not match the running kernel.

My hints:
- make sure /usr/src/linux points to the running kernel
- rmmod <module>
- modprobe <module>
- If that still doesn't work, reboot.
--
luckygray
Posts: 4
Joined: Thu Jan 17, 2013 10:12 pm
by fehlfarbe » Wed Jan 23, 2013 12:45 am
Reboot doesn't help.
How can I reinstall the kernel with modules? Maybe from the repositorys.

My current kernel is:
Code: Select all
Linux servberry 3.2.27+ #307 PREEMPT Mon Nov 26 23:22:29 GMT 2012 armv6l GNU/Linux
Posts: 11
Joined: Wed Jun 20, 2012 7:49 pm
Location: Dresden, Germany
by jpoder » Fri Jan 25, 2013 2:50 pm
So, I seem to have the same issue someone posted earlier about having the driver return 85 for the temp regardless. I am using a DS18B20 chip and have tried several different ones with the same results. I tried this using some arduino code I wrote and get the correct temperature measurement if I set the wait delay (for temp conversion) >750mS but get 85 if I set it less than that. Is this a known issue? A problem with my particular devices (DS18B20 in general, or maybe just mine)? It looks like the RPi just isn't waiting long enough for the conversion to take place. Thoughts?

Here is the output from my Arduino and from my RPi.

on arduino with 1000 mS wait time

ROM = 28 CE 9A C5 2 0 0 6F
Chip = DS18B20
Data = 1 6A 1 4B 46 7F FF 6 10 5F CRC=5F
Temperature = 22.62 Celsius, 72.72 Fahrenheit

ROM = 28 A5 A5 C5 2 0 0 BF
Chip = DS18B20
Data = 1 69 1 4B 46 7F FF 7 10 5E CRC=5E
Temperature = 22.56 Celsius, 72.61 Fahrenheit
No more addresses.

on Arduino with 500 mS wait time

ROM = 28 CE 9A C5 2 0 0 6F
Chip = DS18B20
Data = 1 50 5 4B 46 7F FF C 10 1C CRC=1C
Temperature = 85.00 Celsius, 185.00 Fahrenheit
ROM = 28 A5 A5 C5 2 0 0 BF
Chip = DS18B20
Data = 1 50 5 4B 46 7F FF C 10 1C CRC=1C
Temperature = 85.00 Celsius, 185.00 Fahrenheit
No more addresses.

On RPi:

pi@raspberrypi /sys/bus/w1/devices $ ls
28-000002c59ace 28-000002c5a5a5 w1_bus_master1
pi@raspberrypi /sys/bus/w1/devices $ cat 28-000002c59ace/w1_slave
50 05 4b 46 7f ff 0c 10 1c : crc=1c YES
50 05 4b 46 7f ff 0c 10 1c t=85000
pi@raspberrypi /sys/bus/w1/devices $ cat 28-000002c5a5a5/w1_slave
50 05 4b 46 7f ff 0c 10 1c : crc=1c YES
50 05 4b 46 7f ff 0c 10 1c t=85000
pi@raspberrypi /sys/bus/w1/devices $
Posts: 1
Joined: Fri Jan 25, 2013 2:45 pm
by Fruity Pebbles » Sat Jan 26, 2013 11:41 pm
jpoder wrote:So, I seem to have the same issue someone posted earlier about having the driver return 85 for the temp regardless. I am using a DS18B20 chip and have tried several different ones with the same results. I tried this using some arduino code I wrote and get the correct temperature measurement if I set the wait delay (for temp conversion) >750mS but get 85 if I set it less than that. Is this a known issue? A problem with my particular devices (DS18B20 in general, or maybe just mine)? It looks like the RPi just isn't waiting long enough for the conversion to take place. Thoughts?


I got this same result when I re-wired my sensors to use parasite power, but I don't have the updated driver that supports parasite power. When I changed back to +3.3V on the DS18B20's Vcc pin I got valid temperatures again.
Posts: 2
Joined: Sat Jan 12, 2013 6:38 pm
by joshmosh » Thu Jan 31, 2013 12:54 pm
Fruity Pebbles wrote:
jpoder wrote:So, I seem to have the same issue someone posted earlier about having the driver return 85 for the temp regardless. I am using a DS18B20 chip and have tried several different ones with the same results. I tried this using some arduino code I wrote and get the correct temperature measurement if I set the wait delay (for temp conversion) >750mS but get 85 if I set it less than that. Is this a known issue? A problem with my particular devices (DS18B20 in general, or maybe just mine)? It looks like the RPi just isn't waiting long enough for the conversion to take place. Thoughts?


I got this same result when I re-wired my sensors to use parasite power, but I don't have the updated driver that supports parasite power. When I changed back to +3.3V on the DS18B20's Vcc pin I got valid temperatures again.


Same here. Since I am using existing cabling, I do not have the option to supply power to the Vcc pin. You mention an updated driver supporting parasite power. I guess that driver will have a longer delay ( as mentioned in the quote above yours). Any hint where to get that updated driver ?

Thanks
Joshi
Posts: 62
Joined: Fri Aug 03, 2012 12:04 pm
by rudiratlos » Mon Feb 04, 2013 4:15 pm
is pullup=1 option in new kernel ?
Posts: 64
Joined: Tue May 01, 2012 8:47 am
by anbodearg » Tue Feb 05, 2013 11:01 am
Hello Frank,

Can this patch be used on Raspbmc distro?

Alternatively, is there any utility anywhere which could be used to poll the sensor reading from GPIO4,
on demand?

Thanks.
Posts: 1
Joined: Sun Dec 30, 2012 11:04 am
by rena555 » Sat Feb 09, 2013 7:38 am
eikcam wrote:
netomx wrote:If mine says:
It was tried in place 2K ohm?
I was successful in 1K8 (1.8K ohms).

Code: Select all
root@raspberrypi:/sys/bus/w1/devices/w1_bus_master1/28-0000030a0170# cat w1_slave
50 05 4b 46 7f ff 0c 10 1c : crc=1c YES
50 05 4b 46 7f ff 0c 10 1c t=85000


I'm using the wrong resistor?

85c is the initial value of the sensor on power up. It seems that your sensor isnt doing any calculations. What size resistor are you using? 4.7k?
Posts: 1
Joined: Sat Feb 09, 2013 7:31 am