Show Posts
Pages: [1]
1  Forum 2005-2010 (read only) / Interfacing / Re: 1-Wire, DS18B20... How do I search the bus? on: April 28, 2009, 01:10:24 am
I have now commented out line 268 as suggested by Waffle, deleted the OneWire.o file to cause a recompile, and tested the revised code with seven devices. It works.

For those who might want to duplicate this fix, here is a print out of the area in question with the commented line in place.

  263                } else {                            // we are blazing new tree, take the 0
  264                  a = 0;
  265                  searchJunction = i;
  266                  done = 0;
  267                }
  268                // lastJunction = i;
  269            }
  270            if ( a) address[ ibyte] |= ibit;
  271            else address[ ibyte] &= ~ibit;
2  Forum 2005-2010 (read only) / Interfacing / Re: 1-Wire, DS18B20... How do I search the bus? on: April 27, 2009, 11:23:42 am
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
3  Forum 2005-2010 (read only) / Interfacing / Re: 1-Wire, DS18B20... How do I search the bus? on: April 26, 2009, 10:43:47 am
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.
Pages: [1]