This might be a general Onewire question or a Mongoose library implementation thing, but how reliable is Onewire communication expected to be?
I have a two separate systems, each with one or more Dallas DS18B20 sensors. The wire lengths are short - two feet tops. I am noticing that I get a pretty consistent level of communication errors in the both systems. For example, one system takes a temperature reading of one of its sensors every 5 seconds. After close to 3 days of operation, that system reports that its success rate at reading the temp sensor is only 97.9% (979 errors in 47351 attempts). The success rate is pretty consistent for me: over the long run, the success rate always ranges around 98%. I have tried pullup resistors from about 10K to 2K, and there is no change to the success rate.
So: why is it not closer to 100%? Is the Onewire protocol simply that unreliable? A 98% success rate for the other serial links like UART communications or I2C or SPI would be abysmal.
In a related vein: when the Onewire library gets initialized, it is a fairly common occurrence for the number of sensors that are detected to be wrong. To look at that specific issue, I changed one test system to re-initialize the Onewire library once per second. All the test does is log how many sensors it believes are attached after each attempt. For the record, that system has exactly 2 sensors attached. After running for over half an hour, this is what I got:
0 sensors observed: 63 times
1 sensor observed: 44 times
2 sensors observed: 2005 times
That would be a success rate of 94.7%.
Once again, is Onewire just lame, or is there something else going on?
Getting the sensor count being wrong as the system boots can be extremely problematic. If a system is "unlucky" and sees the wrong number of sensors as it boots, then it is screwed up from that point on. To mitigate that, I added wrapper code around the initialization that makes multiple initialization attempts, and then "votes" on the correct answer. So far, that has always worked to get me the right sensor count at least, but then I'm back to a 2% error rate on any subsequent Onewire communication.
Is this a standard Onewire experience, or should I be looking for a problem?