
DS2422/DS2423
5 of 25
WRITING WITH VERIFICATION
To write data to the DS242X, the scratchpad has to be used as intermediate storage. First the master
issues the Write Scratchpad command to specify the desired target address, followed by the data to be
written to the scratchpad. Under certain conditions (see Write Scratchpad command) the master will
receive an inverted CRC16 of the command, address and data at the end of the Write Scratchpad
command sequence. Knowing this CRC value, the master can compare it to the value it has calculated
itself to decide if the communication was successful and proceed to the Copy Scratchpad command. If the
master could not receive the CRC16, it has to send the Read Scratchpad command to read back the
scratchpad to verify data integrity. As preamble to the scratchpad data, the DS242X repeats the target
address TA1 and TA2 and sends the contents of the E/S register. If the PF flag is set, data did not arrive
correctly in the scratchpad. The master does not need to continue reading; it can start a new trial to write
data to the scratchpad. Similarly, a set AA flag indicates that the Write command was not recognized by
the device. If everything went correctly, both flags are cleared and the ending offset indicates the address
of the last byte written to the scratchpad. Now the master can continue reading and verifying every data
byte. After the master has verified the data, it has to send the Copy Scratchpad command. This command
must be followed exactly by the data of the three address registers TA1, TA2 and E/S. The master may
obtain the contents of these registers by reading the scratchpad or derive it from the target address and the
amount of data to be written. As soon as the DS242X has received these bytes correctly, it will copy the
data to the requested location beginning at the target address.
MEMORY FUNCTION COMMANDS
The “Memory Function Flow Chart” (Figure 7) describes the protocols necessary for accessing the
memory. An example follows the flowchart. The communication between master and DS242X takes
place either at regular speed (default, OD = 0) or at Overdrive Speed (OD = 1). If not explicitly set into
the Overdrive Mode the DS242X assumes regular speed.
Write Scratchpad Command [0FH]
After issuing the Write Scratchpad command, the master must first provide the 2-byte target address,
followed by the data to be written to the scratchpad. The data will be written to the scratchpad starting at
the byte offset (T4:T0). The ending offset (E4: E0) will be the byte offset at which the master stops
writing data. Only full data bytes are accepted. If the last data byte is incomplete its content will be
ignored and the partial byte flag PF will be set.
When executing the Write Scratchpad command the CRC generator inside the DS242X (see Figure 12)
calculates a CRC over the entire data stream, starting at the command code and ending at the last data
byte sent by the master. This CRC is generated using the CRC16 polynomial by first clearing the CRC
generator and then shifting in the command code (0FH) of the Write Scratchpad command, the Target
Addresses TA1 and TA2 as supplied by the master and all the data bytes. The master may end the Write
Scratchpad command at any time. However, if the ending offset is 11111b, the master may send 16 read
time slots and will receive the CRC generated by the DS242X.
The memory address range of the DS2422 is 0000H to 007FH and 0000H to 01FFH for the DS2423,
respectively. If the bus master sends a target address higher than this, the internal circuitry of the chip
will set the nine (DS2422) or seven (DS2423) most significant address bits to 0 as they are shifted into
the internal address register. The Read Scratchpad command will reveal the target address as it will be
used by the DS242X. The master will identify such address modifications by comparing the target
address read back to the target address transmitted. If the master does not read the scratchpad, a
subsequent Copy Scratchpad command will not work since the most significant bits of the target address
the master sends will not match the value the DS242X expects.