EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

ds18b20 invalid CRC problem

Started by Unknown October 28, 2013
Hello,

I've have a temperature monitoring system using Maxim DS18B20 temperature sensors. To verify correct temperature, I compare the sensor crc (Byte8) in the sctatchpad with the calculated crc. Ninety nine percent of the time, the CRCs match and everything is fine, but occasionally, I get a CRC mismatch. After verifying against an online CRC checker I see that the sensor crc is incorrect. I normally try a number of resamples to try and correct the issue, but I see that in some cases after 10 resamples the sensor crc is still incorrect.

I've checked the pcb and it is fine. I'm using a 4.7K pullup. I don't use parasitic power supply and the configuration register is set for 9 bit resolution. I also allow one second for conversion.
 
Anybody got any idea what could be wrong or run into this issue themselves? Any help greatly appreciated.

Many Thanks
Bob Carter

Le 28/10/2013 09:50, stenasc@googlemail.com a �crit :
> Hello, > > I've have a temperature monitoring system using Maxim DS18B20 temperature sensors. To verify correct temperature, I compare the sensor crc (Byte8) in the sctatchpad with the calculated crc. Ninety nine percent of the time, the CRCs match and everything is fine, but occasionally, I get a CRC mismatch. After verifying against an online CRC checker I see that the sensor crc is incorrect. I normally try a number of resamples to try and correct the issue, but I see that in some cases after 10 resamples the sensor crc is still incorrect. > > I've checked the pcb and it is fine. I'm using a 4.7K pullup. I don't use parasitic power supply and the configuration register is set for 9 bit resolution. I also allow one second for conversion. > > Anybody got any idea what could be wrong or run into this issue themselves? Any help greatly appreciated. > > Many Thanks > Bob Carter >
What's the distance between your 'host' and the DS18B20?? are you sure about your timing?? this is very snsitive. I found an application note 148:guideline for a reliable long 1 wire networks on http://maximintegrated.com/support Andr� --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
Distance between unit and sensor is approx 2 metres.
On 10/28/13, 4:50 AM, stenasc@googlemail.com wrote:
> Hello, > > I've have a temperature monitoring system using Maxim DS18B20 > temperature sensors. To verify correct temperature, I compare the > sensor crc (Byte8) in the sctatchpad with the calculated crc. Ninety > nine percent of the time, the CRCs match and everything is fine, but > occasionally, I get a CRC mismatch. After verifying against an online > CRC checker I see that the sensor crc is incorrect. I normally try a > number of resamples to try and correct the issue, but I see that in > some cases after 10 resamples the sensor crc is still incorrect. > > I've checked the pcb and it is fine. I'm using a 4.7K pullup. I don't > use parasitic power supply and the configuration register is set for > 9 bit resolution. I also allow one second for conversion. > > Anybody got any idea what could be wrong or run into this issue > themselves? Any help greatly appreciated. > > Many Thanks Bob Carter >
One thing to check, is this failure for specific values being returned? and for these values you consistently get back the same wrong values? (that would explain why resampling doesn't fix it.) I see two possible sources for something like this. 1) You have a data integrity issue in your setup where data patterns with a strong frequency component build up enough "noise" to corrupt the data. I would check this out by looking at the data coming directly out of the chip when you get it in the "bad" mode, and see if that matches what you are reading at your processor. 2) There is an errata/flaw in the chip that corrupts very particular values crc. (normally this would be unlikely, but not totally impossible). If you are fairly sure it isn't number 1, I would contact Maxim about the issue and give the data patterns that come back bad.
Thanks for that...I'll post up some of the invalid data patterns this evening, just to see if anybody notices anything peculiar.


On 28/10/2013 4:50 PM, stenasc@googlemail.com wrote:
> Hello, > > I've have a temperature monitoring system using Maxim DS18B20 temperature sensors. To verify correct temperature, I compare the sensor crc (Byte8) in the sctatchpad with the calculated crc. Ninety nine percent of the time, the CRCs match and everything is fine, but occasionally, I get a CRC mismatch.. After verifying against an online CRC checker I see that the sensor crc is incorrect. I normally try a number of resamples to try and correct the issue, but I see that in some cases after 10 resamples the sensor crc is still incorrect. > > I've checked the pcb and it is fine. I'm using a 4.7K pullup. I don't use parasitic power supply and the configuration register is set for 9 bit resolution. I also allow one second for conversion. > > Anybody got any idea what could be wrong or run into this issue themselves? Any help greatly appreciated. > > Many Thanks > Bob Carter >
Power supply line noise perhaps. Shorten the distance to the sensor right down & retest. Stick some temporary delays in the code to slow comms (if possible within timing constraints).
Data from sensor

Data Byte 0 is 4C 
Data Byte 1 is 01 
Data Byte 2 is 4B 
Data Byte 3 is 46 
Data Byte 4 is 7F 
Data Byte 5 is FF 
Data Byte 6 is 04 
Data Byte 7 is 10 
Data Byte 8 (Sensor CRC) is FD 
Calculated CRC is F5       -- Calculated CRC is correct 


Data Byte 0 is 4F 
Data Byte 1 is 05 
Data Byte 2 is 4B 
Data Byte 3 is 46 
Data Byte 4 is 7F 
Data Byte 5 is FF 
Data Byte 6 is 01 
Data Byte 7 is 10 
Data Byte 8 (Sensor CRC) is CF 
Calculated CRC is 3B     -- Calculated CRC is correct 



Data Byte 0 is 4F 
Data Byte 1 is 11 
Data Byte 2 is 4B 
Data Byte 3 is 46 
Data Byte 4 is 7F 
Data Byte 5 is FF 
Data Byte 6 is 01 
Data Byte 7 is 10 
Data Byte 8 (Sensor CRC) is CF 
Calculated CRC is 34    -- Calculated CRC is correct 


Data Byte 0 is 4E 
Data Byte 1 is 81 
Data Byte 2 is 4B 
Data Byte 3 is 46 
Data Byte 4 is 7F 
Data Byte 5 is FF 
Data Byte 6 is 02 
Data Byte 7 is 10 
Data Byte 8 (Sensor CRC) is D9 
Calculated CRC is 4E     -- Again calculated CRC is correct 
Thanks to all that replied. 

Found the problem....was a timer running on the micro conflicting with the conversion. When disabled during temperature reads, problem disappeared.

Bob
Le 29/10/2013 11:49, stenasc@googlemail.com a �crit :
> Thanks to all that replied. > > Found the problem....was a timer running on the micro conflicting with the conversion. When disabled during temperature reads, problem disappeared. > > Bob
I had a similar pb, I disabled interrupt while reading/writing bits to the DS18B20. That solved the problem. It was different in thje way that the DS.. did not reconiize it's address while a MATCH_ROM. Andr� --- news://freenews.netfront.net/ - complaints: news@netfront.net ---

The 2024 Embedded Online Conference