Bosch Sensortec"| BST-BMP581-DS004-02 30 | 74
Modifications reserved | Data subject to change
without notice Document number: BST-BMP581-DS004-02
Writes to other NVM addresses than the user range will be ignored.
4.8.1.3 UID
The unique device identifier is also stored in the NVM. It can be computed as follows:
UID = ((read_nvm_reg(0x26) & 0xFF) << 40) | (read_nvm_reg(0x25) << 24) | (
read_nvm_reg(0x24) << 8) | ((read_nvm_reg(0x23) & 0xFF00) >> 8)
where read_nvm_reg refers to the NVM read procedure to the given address.
4.8.1.4 NVM CRC check
Integrity of the NVM can be checked using the CRC. The CRC is calculated based content of all memory except for
the aforementioned user range at final test, and except for the error correction bits at 0x1E. That means, the CRC is
calculated on the addresses 0x00 - 0x1D, 0x1F and 0x23 -0x26.The result is written to the CRC NVM address 0x27.
The user can check the integrity of the NVM by repeating the calculation and comparing against the value in address
0x27. If there is a mismatch, the NVM has been altered or corrupted since final test.
The CRC-16 is calculated with CCITT-16, selected polynomial is: x16 + x12 + x5 + 1. The initial content of the register
used to compute the remainder of the division is preset to 0xFFFF. Refer also to: ITU - T Recommendation X.25
(10/96).
Following C-code sample shows the computation of the CRC-16 CCITT checksum:
int datalength = 0;
int datawidth = 0;
int SIZE = 62;
uint16_t Poly = 0x1021;
uint16_t Initval = 0xFFFF;
uint16_t crc ;
uint16_t crc_temp;
crc = Initval;
for( datalength =0; datalength< SIZE; datalength++){
crc_temp = (OTP_DATA[datalength] << 8) ^ crc;
for (datawidth = 0; datawidth < 8; datawidth++)
{
if ((crc_temp & 0x8000) != 0)
{
crc_temp = (crc_temp << 1) ^ Poly;
}
else
{
crc_temp = crc_temp << 1;
}
}
crc = crc_temp;
}
4.9 Final test result
The final test result (good / bad part) can be obtained from the NVM, see Table 15.
Table 15: Final test result
Reg