1-wire with Beaglebone

Hello,

i want to use Dallas One Wire Sensors DS1820 with Beaglebone. The HDQ pin seems not to be available. I have build the w1-gpio driver for the 12.26 image. This module is not initializing:

[ 8062.844312] gpio_request: gpio-265068 (w1) status -22
[ 8062.844350] w1-gpio: probe of w1-gpio.0 failed with error -22

I thin there is an problem with the pin configuration. Where i can do this?

My second try was build the w1-gpio-custom module from OpenWRT (https://dev.openwrt.org/browser/trunk/package/w1-gpio-custom/src?rev=15245)

Wehn i load this module with bus0=0,X,0 (x=1…264796) i get following error messages:

[ 8042.178371] Custom GPIO-based W1 driver version 0.1.0
[ 8042.178409] kobject (cf9cfa10): tried to init an initialized object, something is seriously wrong.
[ 8042.187917] [] (unwind_backtrace+0x1/0x8c) from [] (kobject_init+0x21/0x6a)
[ 8042.187961] [] (kobject_init+0x21/0x6a) from [] (device_initialize+0x15/0x50)
[ 8042.187998] [] (device_initialize+0x15/0x50) from [] (platform_device_register+0xd/0x1a)
[ 8042.188045] [] (platform_device_register+0xd/0x1a) from [] (w1_gpio_custom_add_one+0x62/0x7c [w1_gpio_custom])
[ 8042.188101] [] (w1_gpio_custom_add_one+0x62/0x7c [w1_gpio_custom]) from [] (w1_gpio_custom_init+0x16/0x6b [w1_gpio_custom])
[ 8042.188146] [] (w1_gpio_custom_init+0x16/0x6b [w1_gpio_custom]) from [] (do_one_initcall+0x65/0xf0)
[ 8042.188189] [] (do_one_initcall+0x65/0xf0) from [] (sys_init_module+0xeed/0x1060)
[ 8042.188232] [] (sys_init_module+0xeed/0x1060) from [] (ret_fast_syscall+0x1/0x44)

After reading http://plugcomputer.org/plugforum/index.php?action=printpage;topic=163.0 i have changed this in module code:

-	err = platform_device_register(pdev);
+	err = platform_device_add(pdev);

the module is loading with "modprobe 

w1-gpio-custom bus0=0,1,0" but i cant loading w1-gpio, which seems to be needed.

Has anybody running 1-wire on beagebone?
Where are information about pin-mapping?
It is possible integrating 1-wire into the main distribution?

When anybody is interestet to rebuild the modules i have attached two script. The first sets up the build environment and the second builds the kernel.

01_init.sh (352 Bytes)

02_kernel.sh (6.35 KB)

The AM3359 processor has no 1-wire interface on it. That is why it is missing.

Gerald

Hello,

i want to use Dallas One Wire Sensors DS1820 with Beaglebone. The HDQ pin seems not to be available. I have build the w1-gpio driver for the 12.26 image. This module is not initializing:

[ 8062.844312] gpio_request: gpio-265068 (w1) status -22

Is that gpio actually available?

Huh? A 1-wire interface only requires an open collector or open drain
output with a pullup resistor which can be added externally. The rest
is just software in most systems and not a lot of that.

Rick

The processor has no open drain pins.

Gerald

I've never looked at the data sheet, but none of the pins can be
configured as high impedance? If so they can be set low and the data
used to toggle the high impedance control. This works exactly like an
open drain output.

Rick

Hook up a transistor on a pin?

I'm connecting a 74HC595 to my bone. The chip will work with input voltage from 2 - 7 volts but needs a vcc within 20% of the signal voltage. Since the bus runs at ~3.3v, I figured that the bone would supply 3.3 from pins 3&4 on P9. Before wiring it up, I checked and found that 3&4 were supplying 5v, which is too high and not what the specs say it should be. Do I need to do something to get the pins back to 3.3?

Thanks,

wjr

The Dallas USB adapter (DS9490R) works fine with digitemp (http://
www.digitemp.com). I have compiled the latest on board and it works
with my 1-wire network.

I also interfaced the Dallas DS2482-100 via i2c-3 using a recent image
and tested it with OWFS. Given I needed to power it at 3.3 volts, I'm
not sure it had the ability to power the sensors and got mixed results
with many temp sensors returning 85 which is their error condition.

I'm interesetd in what you find - I'll likely continue down the USB
path for now, but may go back at the i2c approach in the future with a
level shifter so I can run at 5 volts.

Regards,

Wayne

The AM335X Datasheet lists amny ports with pullup/pulldown
capabilities:

Most of DDR_*
ECAP0_IN_PWM0_OUT
EMU0/1
EXTINTn
GPMC_A*
GPMC_AD*
...
LCD_*
...
UART*
...

I think the DS2482 with 5V powered is an good solution for me. For
voltage translation there are an PCA9306 available.

I'm not aware that the bus runs at 3.3 volts. I thought it ran at 5
volts. In fact, now that I consider that I can see it would be
difficult to drive a 1-wire bus directly from the CPU since they
typically aren't 5 volt tolerant. You can use a transistor on one pin
to drive the bus and use a resistor pair as a voltage divider to a
different pin as an input, or a second transistor. I don't get why
you would want to use a 74HC595. This is a shift register that won't
be so easy to use for this. Just use transistors or perhaps an OC
buffer.

Have a look at http://dominion.thruhere.net/koen/cms/using-1-wire-on-a-beaglebone

looking closer, I see 3 wires/pins connected :slight_smile:

The communications is over 1-wire. A 1-wire device still needs a
ground pin. This particular device uses 1.5 mA when converting
temperature so it is best to add a power connection as well.

Rick

Koen, your patch seems to be exactly what I need since I have a DS18B20 that I want to read with the Beaglebone. I just can’t get it to work, I’m sure it is some stupid little rooky detail that I don’t get, could you please help me with a hint?

Thanks a lot!!

This is how far I did get:

root@beaglebone:/sys/bus/w1# uname -a
Linux beaglebone 3.2.16 #1 Thu May 17 11:36:05 CEST 2012 armv7l GNU/Linux

root@beaglebone:/sys/bus/w1# dmesg | grep w1
[ 0.222795] w1-gpio connected to P8_6

root@beaglebone:/sys/bus/w1# ls
devices drivers drivers_autoprobe drivers_probe uevent

root@beaglebone:/sys/bus/w1# ls devices -la
total 0
drwxr-xr-x 2 root root 0 Jan 1 2000 .
drwxr-xr-x 4 root root 0 Jan 1 2000 …
lrwxrwxrwx 1 root root 0 Jan 1 2000 w1_bus_master1 → …/…/…/devices/w1_bus_master1

root@beaglebone:/sys/bus/w1# cat /sys/bus/w1/devices/28-00000256073a/w1_slave
cat: /sys/bus/w1/devices/28-00000256073a/w1_slave: No such file or directory

the '00000256073a' is unique to the sensor, so that will only work with the ds18b20 on my desk :slight_smile: Do an

ls sys/bus/w1/devices/

To see what has been detected. If I recall correctly the hotplug delay is 1 second.

regards,

Koen

Koen,
I did, as you can see in the output below. no devices were detected

tnx
Bastiaan.

make sure you are connecting your sensors correctly. You cannot use parasite power mode with beagle, so each sensor needs the 3.3v, gnd, and pullup between data and vcc. Also make sure you are using the correct pin (check dmesg to see which pin w1 is attached to). the ds18b20 work great with beaglebone, I have a string of 5 currently running, logging to PostgreSQL every 5 minutes, gpio’s switch SSRs to turn heating/cooling devices on or off to maintain environmental control.

had these on my phone from last week, upped em to flickr just to share with this thread. Hope this might help anyone to build a working ds18b20 setup.

http://www.flickr.com/photos/79196010@N02/7257104848/in/photostream

Tnx for your comment! pull up is needed? I thought beagle one has internal pull up? Will try soon. tnx