Another Perplexing Temporary Issue and Delay

During testing of a new modification I added, MOSFET power control to bring down the weather station standby current, everything was looking great until I monkeyed around with the 1-Wire rain gauge counter and the windvane.  (I completed the 1-wire counter retrofit, BTW, more on that later.)  All I wanted to do was add header pin connectors to both device’s cables and run the MetOne weather station code (and as the saying goes: “All I wanted to do was drain the swamp and then I found myself up to my ass in alligators”).  Upon reconnecting my newly completed and soldered 1-wire counter module (new post coming forthwith), the debug output was going crazy trying to find any 1-Wire devices.  Like…huh?!?  This WAS working before. 

Here’s what was going on from output from PlatformIO: 

Checking for I2C devices…:
Checking for 1-Wire devices…
There are devices present on 1-Wire bus

Searching 1-Wire bus with OWSearch()…
Found device: { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
Calculated CRC of device serial is 0
Found device: { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80 }
Calculated CRC of device serial is 0
Found device: { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40 }
Calculated CRC of device serial is 0
Found device: { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0 }
Calculated CRC of device serial is 0
Found device: { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20 }
Calculated CRC of device serial is 0
Found device: { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0 }
(it doesn’t ever stop!)

Great.  Now I have to delve back into the 1-Wire search algorithm to find out what the hell is going on. 🙁    So, I loaded up a KNOWN WORKING code and ran that.  Same thing!!  And I tried another one I had, and it showed the same output.  Now my mind is totally blown – what happened?!?  Was it the DS2482??  This has me really bummed out – thought I was on the home stretch finally, especially now when (according to Seattle standards, anyway), a monster lightning storm moved through and dumped a TON of rain.  And me with non-working rain gauge now. 🙁

As it turns out this was probably good thing that I found this now.  The problem was that the 1-Wire bus was shorted to ground (on my breadboard), and I didn’t test for the SD (short detected) bit in the DS2482’s status register.  Now I’m going to fix that and update my DS248X 1-wire library.  (Interesting that other DS2482 libraries didn’t catch this as well.)  Considering the kind of rat’s nest of jumpers, maybe it’s a small wonder that it didn’t happen before.  Those white wires are connected to ground common to set the DS2482 address.  I need more black jumpers apparently to make it more obvious.

So, I added some debugging info showing the bit status of the DS2482 status register to the OWReset() function.  This function tests for a “Presence Pulse” from ANY 1-Wire devices on the bus or whether the bus is shorted.  Here is some output from my test:

         DS2482 Status Register bit definitions:

     bit7    bit6   bit5    bit4   bit3   bit2  bit1   bit0
     DIR   TSB   SBR   RST   LL     SD   PPD  1WB
       \                                            \      \
    Direction                                   \    Presence Pulse Detected
                                                        \
                                                   Short Detected

Checking for 1-Wire devices…
Status Register: 10101010

There are devices present on 1-Wire bus

Searching 1-Wire bus with OWSearch()…
Status Register: 10101010
Found device: { 0x10, 0x67, 0xBB, 0xE0, 0x02, 0x08, 0x00, 0xF2 }
Calculated CRC of device serial is F2
This device is a 1-wire thermometer
Status Register: 10101010
Status Register: 10101010 <– Normal
Found device: { 0x12, 0x05, 0x1C, 0x22, 0x00, 0x00, 0x00, 0x40 }
Calculated CRC of device serial is 40
Status Register: 01001010 <– Normal
Found device: { 0x1D, 0x97, 0x87, 0x01, 0x00, 0x00, 0x00, 0xE2 }
Calculated CRC of device serial is E2
Found 1-wire counter at { 0x1D, 0x97, 0x87, 0x01, 0x00, 0x00, 0x00, 0xE2 }
Status Register: 10101010
Status Register: 10101010 <– Normal
DS2423 returned: 0

Checking for I2C devices…:
Checking for 1-Wire devices…
Status Register: 10100110
There are devices present on 1-Wire bus
Searching 1-Wire bus with OWSearch()…
Status Register: 10100110      <– weird… SD bit (bit 2) set AND Presence Pulse (bit 1) (??)

Found device: { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
Calculated CRC of device serial is 0
Status Register: 00000110    <– weird… SD bit (bit 2) set AND Presence Pulse (bit 1) (??)
Found device: { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80 }
Calculated CRC of device serial is 0
Status Register: 10000110
Found device: { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40 }
Calculated CRC of device serial is 0
Status Register: 00000110
Found device: { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0 }
Calculated CRC of device serial is 0
Status Register: 10000110
Found device: { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20 }
Calculated CRC of device serial is 0
Status Register: 00000110
Found device: { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0 }
Calculated CRC of device serial is 0

In each case when the short is detected (SD bit set) the presence pulse (PPD) is also set.  I don’t understand that-it’s not supposed to be set when SD is set.  Very odd.  Anyway, now to fix the library and the weather station code.

Leave a Reply

Your email address will not be published. Required fields are marked *