Nvm_ReadAll Returns Ok, but Data Is Deprecated
Background information: NvM behavior with enabled NvMCalRamBlockCrc to reduce read requests and accelerate initialization phase:
Before reading a block out of NvRam, NvM compares the calculated Crc with Crc of permanent RAM block. In case the Crc is matching, NvM will skip reading data from NvRam as it seems to be unnecessary. NvM will set current block result to NVM_REQ_OK and continue with next block.
If the newer data has been written with NvM_WriteBlock by using a temporary RAM buffer, the internal CRC buffer will not be updated for this request. When initiating another NvM_ReadAll (e.g. for a soft-reset after a diagnostic service) the updated NvRam data may not be read and the RAM buffer will hold deprecated data.
Note: This could only happen if the linkage of CRC buffers and data buffers differ (e.g. CRC buffer linked to retention RAM, data buffer to initialized RAM).
Solving the problem:
To solve such a situation with NvMCalRamBlockCrc configured using temporary RAM blocks for writing data must be avoided. Instead, update the corresponding RAM data and either call NvM_WriteBlock(<BlockID>, NULL_PTR) to write the data immediately or call NvM_SetRamBlockStatus(<BlockID>, TRUE) to mark the data as changed for NvM_WriteAll().