AN-1001: Checksum Calculations
This application note describes how the various checksums generated by the SuperSequencer software are calculated and, when appropriate, discusses the locations in EEPROM where these calculated checksums are stored.
Calculating The Configuration Register Checksums (0x00 TO 0xFF)
The configuration registers contain the data that the user is currently working with (referred to as volatile memory). In the event of a loss of power, all of this data will be lost.
The calculation of the checksum is only concerned with the registers that can be configured by the user, such as the fault detector registers, output registers, DAC registers, general purpose registers, and ADC limit registers.
To calculate the checksum for the configurable locations, the data from all locations in the volatile memory is read from the device. However, only the data from the following locations is used in the calculation of the checksum:
- 0x00 to 0x7B inclusive
- 0x80 to 0x82 inclusive,
- 0x91 to 0x92 inclusive
The data from the above locations is added together and the sum total of the data from these locations is then inverted and then AND’ed with 0xFFFF (see Figure 2).
Calculating The Configuration Eeprom Checksums (0xF800 TO 0xF8FF)
The configuration EEPROM registers contain the data that the user has saved from the controlling registers into the EEPROM (nonvolatile memory). Therefore, in the event of a loss of power all this data will not be lost.
The calculation of this checksum is only concerned with the registers that can be configured by the user, such as the fault detector registers, output registers, DAC registers, general purpose registers, and ADC limit registers.
To calculate the checksum for the configurable EEPROM locations, the data from the first 160 locations in the 0xF8 nonvolatile memory space is read from the device. However, only the data from the following locations is used in the calculation of the checksum:
- 0xF800 to 0xF87B inclusive
- 0xF880 to 0xF882 inclusive
- 0xF891 to 0xF892 inclusive
(for the ADM1062 to ADM1069 devices) - 0xF891 to 0xF89C inclusive
(for ADM1166, ADM1168, and ADM1169 devices)
The data from the above locations is added together and the sum total of the data from these locations is then inverted and then AND’ed with 0xFFFF (see Figure 3).
In addition, when data is saved to EEPROM, the checksum calculations are also stored in the EEPROM of the device and can be read by the user at any time.
The locations of these stored checksums is shown in Figure 1 These calculations can be viewed in the text file which is generated by the SuperSequencer software. Note in the example shown here that xx stands for the checksum data expressed in hexadecimal.
Calculating The User Eeprom Checksums (0xF900 TO 0xF9FF)
The user EEPROM registers contain the data that the user has saved, perhaps to help identify a particular revision of configuration or particular board ID. On the ADM1062 to ADM1069 devices, there are 256 user EEPROM locations from 0xF900 to 0xF9FF, and on the ADM1166, ADM1168, and ADM1169, there are 128 user EEPROM locations from 0xF900 to 0xF97F. This user data has no impact on the function of the SuperSequencer device.
To calculate the checksum for the user EEPROM locations, the data from the relevant locations in the 0xF9 nonvolatile memory space is read from the device.
The read data are then added together and the sum total of the data from these locations is then inverted and then AND’ed with 0xFFFF.
The range from 0xF980 to 0xF9FF is not included in the EEPROM checksum for the ADM1166, ADM1168, and ADM1169. This is because it is used to store black box fault records that are written under state machine control. Because this portion of the EEPROM is subject to change on an ongoing basis, it is not covered by the user EEPROM checksum.
Calculating The Sequence Engine Eeprom Checksums (0xFA00 TO 0xFBFF)
The sequence engine EEPROM registers contain the data, which the user has saved from the sequencing engine editor in the SuperSequencer software.
To calculate the checksum for the sequence engine EEPROM registers, the data from all locations in the 0xFA00 to 0xFBFF is read from the device.
The data from the above locations are added together and the sum total of the data from these locations is then inverted and then AND’ed with 0xFFFFF.
Calculating The Intel Hexadecimal Checksums (0xF800 TO 0xFBFF)
When an Intel hexadecimal file is generated, the checksum is calculated by adding all the end of line twos complement checksums, excluding the 0xFF on the last line of the file and excluding the checksums in the area of EEPROM from 0xF8A0 to 0xF8FF. This area in the EEPROM is not user accessible since it contains all the factory trim and configuration registers specific to the device. These are set up in the test process at Analog Devices, Inc. This space is locked to prevent the user from inadvertently erasing this data and rendering the device useless.
Displayed Checksums On Software Startup
Figure 4 shows the display box that appears on the bottom right of the top level SuperSequencer evaluation software.
On startup the software looks to the registers in the EEPROM space shown in Figure 1 and displays this data. If no data is available in the EEPROM, then a calculation of the configuration registers and the Intel hexadecimal file only is performed and the results are displayed.