Go Down

Topic: 1-Wire, DS18B20... How do I search the bus? (Read 22 times) previous topic - next topic

Waffle

To my knowledge nobody has ever posted what the bug is exactly. I've made a best guess by "simulating" a bunch of 1-Wire devices in C# and ported the OneWire library search code across and debugged it there. In my simulation commenting out that line makes the search algorithm work (otherwise it loops between two devices in the same way shown in the first post of this thread).

I don't believe this bug has anything to do with CRC errors. That must be a different issue. Maybe you need try a different pull-up resistor? Try a 2k or 1.5k resistor (don't go lower than this).

blalor

I got around the problem by using two 1-Wire buses. :)

Ward

I have experienced the same problem with search not terminating when there are more than four devices on the wire. Last night I put together a test system, demonstrated it has the same problem, studied the signaling with a scope, and tracked the problem to what appears to be a misplaced statement, line 268.

The logic is complex enough that I want to go through it again with a clear head. I would like to know more about Waffle's simulation. What search tree configurations did you simulate? I ask because I suspect some missing flag initialization which removing line 268 does not address.

Kudos to Waffle, and to my friend Wayne, for their assistance tracking down this problem.

Rusty in Texas

#8
Apr 27, 2009, 02:10 am Last Edit: Apr 27, 2009, 02:11 am by Fe2o3Fish Reason: 1
FWIW, I currently have 4 1-wire devices hooked up to my Arduino,
2 1820's and 2 18B20's and have not had a single problem although
the distance between the Arduino and my sensors is about 6-inches (15-cm).
 [Yeah, I know, not very useful 'cept for testing the sensors]

Longer runs will probably require a stronger pullup resistor (lower
resistance) on the data line (I'm using the standard 4K7-ohm resistor)
and probably low-capacitive cabling like CAT-5 or 5e.  Longer runs
may possibly preclude the use of parasitic power and require Vcc to
be brought down the cable as well.

Dallas Semi (now part of Maxim IC) has a number of documents with
regards to longer 1-wire network cabling if that's what you're dealing
with.

Ward

Rusty -- Can you hook up a couple more devices and see if search still works? I found that the OneWire search code would fail when adding the 5th or 4th device, depending on which devices were already on the bus. I assume this is because the particular id bit patterns lead the search algorithm toward or away from the faulty logic. Perhaps having two different device codes is protecting you from the faulty logic too. -- Ward

Go Up