{"id":1663,"date":"2024-08-27T17:16:50","date_gmt":"2024-08-28T00:16:50","guid":{"rendered":"https:\/\/unixwizardry.com\/?p=1663"},"modified":"2024-08-27T17:28:58","modified_gmt":"2024-08-28T00:28:58","slug":"another-temporary-issue-and-delay","status":"publish","type":"post","link":"https:\/\/unixwizardry.com\/index.php\/2024\/08\/27\/another-temporary-issue-and-delay\/","title":{"rendered":"Another Perplexing Temporary Issue and Delay"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"1663\" class=\"elementor elementor-1663\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-91737f3 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"91737f3\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-b12adf4\" data-id=\"b12adf4\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-b401f7b elementor-widget elementor-widget-text-editor\" data-id=\"b401f7b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>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.\u00a0 (I completed the 1-wire counter retrofit, BTW, more on that later.)\u00a0 All I wanted to do was add header pin connectors to both device&#8217;s cables and run the MetOne weather station code (and as the saying goes: &#8220;All I wanted to do was drain the swamp and then I found myself up to my ass in alligators&#8221;).\u00a0 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.\u00a0 Like&#8230;huh?!?\u00a0 This WAS working before.\u00a0<\/p><p>Here&#8217;s what was going on from output from PlatformIO:\u00a0<\/p><p><span style=\"color: #0000ff;\"><em>Checking for I2C devices&#8230;:<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>Checking for 1-Wire devices&#8230;<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>There are devices present on 1-Wire bus<\/em><\/span><\/p><p><span style=\"color: #0000ff;\"><em>Searching 1-Wire bus with OWSearch()&#8230;<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>Found device: { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>Calculated CRC of device serial is 0<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>Found device: { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80 }<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>Calculated CRC of device serial is 0<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>Found device: { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40 }<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>Calculated CRC of device serial is 0<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>Found device: { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0 }<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>Calculated CRC of device serial is 0<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>Found device: { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20 }<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>Calculated CRC of device serial is 0<\/em><\/span><br \/><span style=\"color: #0000ff;\"><em>Found device: { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0 }<\/em><\/span><br \/>&#8230; <em><strong>(it doesn&#8217;t ever stop!)<\/strong><\/em><\/p><p>Great.\u00a0 Now I have to delve back into the 1-Wire search algorithm to find out what the hell is going on. \ud83d\ude41\u00a0 \u00a0 So, I loaded up a KNOWN WORKING code and ran that.\u00a0 Same thing!!\u00a0 And I tried another one I had, and it showed the same output.\u00a0 Now my mind is totally blown &#8211; what happened?!?\u00a0 Was it the DS2482??\u00a0 This has me really bummed out &#8211; 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.\u00a0 And me with non-working rain gauge now. \ud83d\ude41<\/p><p>As it turns out this was probably good thing that I found this now.\u00a0 The problem was that the 1-Wire bus was shorted to ground (on my breadboard), and I didn&#8217;t test for the SD (short detected) bit in the DS2482&#8217;s status register.\u00a0 Now I&#8217;m going to fix that and update my DS248X 1-wire library.\u00a0 (Interesting that other DS2482 libraries didn&#8217;t catch this as well.)\u00a0 <img fetchpriority=\"high\" decoding=\"async\" class=\"size-medium wp-image-1731 alignright\" src=\"https:\/\/unixwizardry.com\/wp-content\/uploads\/2024\/08\/DS24820-wiring-fubar-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/unixwizardry.com\/wp-content\/uploads\/2024\/08\/DS24820-wiring-fubar-300x225.jpg 300w, https:\/\/unixwizardry.com\/wp-content\/uploads\/2024\/08\/DS24820-wiring-fubar-230x173.jpg 230w, https:\/\/unixwizardry.com\/wp-content\/uploads\/2024\/08\/DS24820-wiring-fubar-350x263.jpg 350w, https:\/\/unixwizardry.com\/wp-content\/uploads\/2024\/08\/DS24820-wiring-fubar-480x360.jpg 480w, https:\/\/unixwizardry.com\/wp-content\/uploads\/2024\/08\/DS24820-wiring-fubar.jpg 640w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> Considering the kind of rat&#8217;s nest of jumpers, maybe it&#8217;s a small wonder that it didn&#8217;t happen before.\u00a0 Those white wires are connected to ground common to set the DS2482 address.\u00a0 I need more black jumpers apparently to make it more obvious.<\/p><p>So, I added some debugging info showing the bit status of the DS2482 status register to the OWReset() function.\u00a0 This function tests for a &#8220;Presence Pulse&#8221; from ANY 1-Wire devices on the bus or whether the bus is shorted.\u00a0 Here is some output from my test:<\/p><p><span style=\"color: #000000;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0<em>DS2482 Status Register bit definitions:<\/em><\/span><\/p><div><div><em>\u00a0 \u00a0 \u00a0bit7\u00a0 \u00a0 bit6\u00a0 \u00a0bit5\u00a0 \u00a0 bit4\u00a0 \u00a0bit3\u00a0 \u00a0bit2\u00a0 bit1\u00a0 \u00a0bit0<\/em><\/div><div><em>\u00a0 \u00a0 \u00a0DIR\u00a0 \u00a0TSB\u00a0 \u00a0SBR\u00a0 \u00a0RST \u00a0 LL\u00a0 \u00a0 \u00a0SD\u00a0 \u00a0PPD \u00a01WB<\/em><\/div><div>\u00a0 \u00a0 \u00a0 \u00a0\\\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \\\u00a0 \u00a0 \u00a0 \\<\/div><div>\u00a0 \u00a0 Direction\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\\\u00a0 \u00a0 Presence Pulse Detected<\/div><div>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \\<\/div><div>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0Short Detected<\/div><\/div><p><span style=\"color: #0000ff;\">Checking for 1-Wire devices&#8230;<\/span><br \/><span style=\"color: #0000ff;\">Status Register: 10101010<\/span><\/p><p><span style=\"color: #0000ff;\">There are devices present on 1-Wire bus<\/span><\/p><p><span style=\"color: #0000ff;\">Searching 1-Wire bus with OWSearch()&#8230;<\/span><br \/><span style=\"color: #0000ff;\">Status Register: 10101010<\/span><br \/><strong><span style=\"color: #0000ff;\">Found device: { 0x10, 0x67, 0xBB, 0xE0, 0x02, 0x08, 0x00, 0xF2 }<\/span><\/strong><br \/><strong><span style=\"color: #0000ff;\">Calculated CRC of device serial is F2<\/span><\/strong><br \/><strong><span style=\"color: #0000ff;\">This device is a 1-wire thermometer<\/span><\/strong><br \/><span style=\"color: #0000ff;\">Status Register: 10101010<\/span><br \/><span style=\"color: #0000ff;\">Status Register: 10101010 <span style=\"color: #ff0000;\"><em>&lt;&#8211; Normal<\/em><\/span><\/span><br \/><strong><span style=\"color: #0000ff;\">Found device: { 0x12, 0x05, 0x1C, 0x22, 0x00, 0x00, 0x00, 0x40 }<\/span><\/strong><br \/><strong><span style=\"color: #0000ff;\">Calculated CRC of device serial is 40<\/span><\/strong><br \/><span style=\"color: #0000ff;\">Status Register: 01001010 <span style=\"color: #ff0000;\"><em>&lt;&#8211; Normal<\/em><\/span><\/span><br \/><strong><span style=\"color: #0000ff;\">Found device: { 0x1D, 0x97, 0x87, 0x01, 0x00, 0x00, 0x00, 0xE2 }<\/span><\/strong><br \/><strong><span style=\"color: #0000ff;\">Calculated CRC of device serial is E2<\/span><\/strong><br \/><strong><span style=\"color: #0000ff;\">Found 1-wire counter at { 0x1D, 0x97, 0x87, 0x01, 0x00, 0x00, 0x00, 0xE2 }<\/span><\/strong><br \/><span style=\"color: #0000ff;\">Status Register: 10101010<\/span><br \/><span style=\"color: #0000ff;\">Status Register: 10101010 <span style=\"color: #ff0000;\"><em>&lt;&#8211; Normal<\/em><\/span><\/span><br \/><span style=\"color: #0000ff;\">DS2423 returned: 0<\/span><\/p><p><span style=\"color: #0000ff;\">Checking for I2C devices&#8230;:<\/span><br \/><span style=\"color: #0000ff;\">Checking for 1-Wire devices&#8230;<\/span><br \/><span style=\"color: #0000ff;\">Status Register: 10100110<\/span><br \/><span style=\"color: #0000ff;\">There are devices present on 1-Wire bus<\/span><br \/><span style=\"color: #0000ff;\">Searching 1-Wire bus with OWSearch()&#8230;<\/span><br \/><span style=\"color: #0000ff;\">Status Register: 10100110\u00a0 \u00a0 \u00a0 <span style=\"color: #ff0000;\"><em>&lt;&#8211; weird&#8230; SD bit (bit 2) set AND Presence Pulse (bit 1) (??)<\/em><\/span><\/span><\/p><p><span style=\"color: #0000ff;\">Found device: { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }<\/span><br \/><span style=\"color: #0000ff;\">Calculated CRC of device serial is 0<\/span><br \/><span style=\"color: #0000ff;\">Status Register: 00000110\u00a0 \u00a0 <span style=\"color: #ff0000;\"><em>&lt;&#8211; weird&#8230; SD bit (bit 2) set AND Presence Pulse (bit 1) (??)<\/em><\/span><\/span><br \/><span style=\"color: #0000ff;\">Found device: { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80 }<\/span><br \/><span style=\"color: #0000ff;\">Calculated CRC of device serial is 0<\/span><br \/><span style=\"color: #0000ff;\">Status Register: 10000110<\/span><br \/><span style=\"color: #0000ff;\">Found device: { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40 }<\/span><br \/><span style=\"color: #0000ff;\">Calculated CRC of device serial is 0<\/span><br \/><span style=\"color: #0000ff;\">Status Register: 00000110<\/span><br \/><span style=\"color: #0000ff;\">Found device: { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0 }<\/span><br \/><span style=\"color: #0000ff;\">Calculated CRC of device serial is 0<\/span><br \/><span style=\"color: #0000ff;\">Status Register: 10000110<\/span><br \/><span style=\"color: #0000ff;\">Found device: { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20 }<\/span><br \/><span style=\"color: #0000ff;\">Calculated CRC of device serial is 0<\/span><br \/><span style=\"color: #0000ff;\">Status Register: 00000110<\/span><br \/><span style=\"color: #0000ff;\">Found device: { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0 }<\/span><br \/><span style=\"color: #0000ff;\">Calculated CRC of device serial is 0<\/span><\/p><p>In each case when the short is detected (SD bit set) the presence pulse (PPD) is also set.\u00a0 I don&#8217;t understand that-it&#8217;s not supposed to be set when SD is set.\u00a0 Very odd.\u00a0 Anyway, now to fix the library and the weather station code.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>During testing of a new modification I added, MOSFET power control to bring down the weather station standby current, everything was looking [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35,38],"tags":[],"class_list":["post-1663","post","type-post","status-publish","format-standard","hentry","category-programming","category-weather-instruments"],"_links":{"self":[{"href":"https:\/\/unixwizardry.com\/index.php\/wp-json\/wp\/v2\/posts\/1663","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unixwizardry.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unixwizardry.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unixwizardry.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unixwizardry.com\/index.php\/wp-json\/wp\/v2\/comments?post=1663"}],"version-history":[{"count":73,"href":"https:\/\/unixwizardry.com\/index.php\/wp-json\/wp\/v2\/posts\/1663\/revisions"}],"predecessor-version":[{"id":1745,"href":"https:\/\/unixwizardry.com\/index.php\/wp-json\/wp\/v2\/posts\/1663\/revisions\/1745"}],"wp:attachment":[{"href":"https:\/\/unixwizardry.com\/index.php\/wp-json\/wp\/v2\/media?parent=1663"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unixwizardry.com\/index.php\/wp-json\/wp\/v2\/categories?post=1663"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unixwizardry.com\/index.php\/wp-json\/wp\/v2\/tags?post=1663"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}