关于DEM依赖NVM及DTC数量与DEM_NVBlocks关联的技术问询
Hey there, let’s break down your questions clearly based on hands-on AUTOSAR DEM/NVM configuration experience:
1. DEM对NVM的核心依赖
DEM (Diagnostic Event Manager) relies entirely on NVM (Non-Volatile Memory) to persist critical diagnostic data that needs to survive power cycles. This includes things like stored DTCs, freeze frame data, event snapshots, and DTC status flags. Without NVM, DEM can only hold diagnostic data temporarily in RAM—once the vehicle loses power, all fault records are gone. So NVM is the backbone for DEM’s ability to retain diagnostic history.
2. DTC与DEM_NVRamNBlocks的关联
DEM_NVRamNBlocks (specifically DEM_NVBLOCK_PRIMARY) are the dedicated storage partitions that DEM carves out in NVM for holding DTC-related persistent data. Each block isn’t just a raw chunk of memory—it’s structured to store multiple DTC entries, along with their associated metadata: things like confirmation status, clear status, mileage at fault occurrence, and timestamp. Think of each DEM_NVBLOCK_PRIMARY as a "folder" in NVM specifically for DTC storage.
3. Does the number of DTCs affect the number of DEM_NVBLOCK_PRIMARY blocks?
Short answer: Yes, but it’s not a 1:1 mapping—it depends on the block’s configured capacity and the storage footprint of each DTC.
Let’s dive into the details:
- Every
DEM_NVBLOCK_PRIMARYhas a fixed capacity defined during configuration (based on your NVM hardware specs and diagnostic strategy). Each DTC (plus its required metadata) takes up a set amount of space—for example, a basic DTC might use 8-16 bytes, and add more if you include freeze frame or extended status data. - If the total storage required by all your defined DTCs exceeds the capacity of a single
DEM_NVBLOCK_PRIMARY, you’ll need to configure multiple primary blocks to split the load. - Conversely, if your DTC count is small enough that all fit within one block’s capacity, you only need one
DEM_NVBLOCK_PRIMARY.
For a concrete example: Suppose each DTC (with core status data) uses 10 bytes, and a single DEM_NVBLOCK_PRIMARY is sized for 500 bytes. That block can hold roughly 50 DTCs. If your system has 60 unique DTCs, you’ll need at least 2 primary blocks to accommodate all of them.
One quick note: Some DEM implementations reserve small portions of each block for redundancy or future expansion, so the actual number of DTCs per block might be slightly less than the theoretical calculation.
内容的提问来源于stack exchange,提问作者Teja

