ds18b20 invalid CRC problem

Oct 28, 2013 8 Replies

Hello,



I've have a temperature monitoring system using Maxim DS18B20 temperature s ensors. To verify correct temperature, I compare the sensor crc (Byte8) in the sctatchpad with the calculated crc. Ninety nine percent of the time, th e 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 i s incorrect. I normally try a number of resamples to try and correct the is sue, but I see that in some cases after 10 resamples the sensor crc is stil l incorrect.



I've checked the pcb and it is fine. I'm using a 4.7K pullup. I don't use p arasitic power supply and the configuration register is set for 9 bit resol ution. 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, snipped-for-privacy@googlemail.com a écrit :

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

formatting link
André

--- news://freenews.netfront.net/ - complaints: snipped-for-privacy@netfront.net ---

Distance between unit and sensor is approx 2 metres.

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.

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, snipped-for-privacy@googlemail.com a écrit :

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: snipped-for-privacy@netfront.net ---

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required