Datasheet
CRC Generation
CRC bytes are provided as part of the device’s 64-bit
ROM code and in the 9th byte of the scratchpad memory.
The ROM code CRC is calculated from the first 56 bits
of the ROM code and is contained in the most significant
byte of the ROM. The scratchpad CRC is calculated from
the data stored in the scratchpad, and therefore changes
when the data in the scratchpad changes. The CRCs
provide the bus master with a method of data validation
when data is read from the device. To verify that data has
been read correctly, the bus master must recalculate the
CRC from the received data and then compare this value
to either the ROM code CRC (for ROM reads) or to the
scratchpad CRC (for scratchpad reads). If the calculated
CRC matches the read CRC, the data has been received
error free. The comparison of CRC values and the
decision to continue with an operation are determined
entirely by the bus master. There is no circuitry inside
the device that prevents a command sequence from pro-
ceeding if the device CRC (ROM or scratchpad) does not
match the value generated by the bus master.
The equivalent polynomial function of the CRC (ROM or
scratchpad)is:
CRC = X
8
+ X
5
+ X
4
+ 1
The bus master can recalculate the CRC and compare
it to the CRC values from the MAX31820PAR using the
polynomial generator shown in
Figure 4. This circuit
consists of a shift register and XOR gates, and the shift
register bits are initialized to 0. Starting with the least
significant bit of the ROM code or the least significant bit
of byte 0 in the scratchpad, one bit at a time should be
shifted into the shift register. After shifting in the 56th bit
fromtheROMorthemostsignificantbitofbyte7from
the scratchpad, the polynomial generator contains the
recalculatedCRC.Next,the8-bitROMcodeorscratch-
pad CRC from the device must be shifted into the circuit.
At this point, if the recalculated CRC was correct, the shift
register contains all 0s. Additional information about the
Maxim Integrated 1-Wire CRC is available in Application
Note 27: Understanding and Using Cyclic Redundancy
Checks with Maxim iButton® Products.
iButton is a registered trademark of Maxim Integrated
Products, Inc.
Figure 4. CRC Generator
1ST
STAGE
2ND
STAGE
3RD
STAGE
4TH
STAGE
7TH
STAGE
8TH
STAGE
6TH
STAGE
5TH
STAGE
X
0
X
1
X
2
X
3
X
4
POLYNOMIAL = X
8
+ X
5
+ X
4
+ 1
INPUT DATA
X
5
X
6
X
7
X
8
MAX31820PAR 1-Wire, Parasite-Power,
Ambient Temperature Sensor
www.maximintegrated.com
Maxim Integrated
│
10