AUTOSAR

AUTOSAR NVM 개념

kkingjae 2025. 2. 2. 12:45

Automotive applications need to retrieve stored information even after a power cycle

Memory Stack modules shall be provided by BSW in order to ensure the data storage and maintenance.

Non volatile memory (NVM)

EEPROM : Application data can be written always at the same address

Data Flash : Application data cannot be written always at the same address

즉, EEPROM과 Flash의 가장 큰 차이점은 저장위치가 가변인가 아닌가 이다.

① 가장 하위 레벨 (HW)

EEPROM, FLASH : HW Level에서 Access 되고, Read Data나 Write Data service를 제공한다.

② Memory Driver

Handle Memory Layout

physical address to NVM (Block ID arrange)

Block ID ↔ Physical Address Manage the link

③Abstraction

④ NVM

Manage SWC(Software component)

Data robustness (CRC, Redundancy ,,,)

Error management

NVM

NVM Manager manager all data request to EEPROM / FALSH used as non-volatile memory

NVM Offers the following features

  • Each block can be synchronized with a permanent RAM area
  • The block consistency can be guaranteed by CRC16 or CRC32
  • The block can be single, redundant or Dataset
  • Priorization scheme : a priority can be assigned to each block
  • Protection : some blocks can be write-protected or write once

NV Block Header : NV Block Data : NV Block CRC 이런 구조로 구성

NVM Block

NVM Block : NvM(EEPROM, FLASH) + RAM + ROM

  • RAM(Optional) : belonging to the application, that will be synchronized with NVM
  • Rom(Optrional) : belonging to the application, contain the default contents

→ NvM은 Power가 Off되어도 지워지지 않은 메모리 구조로 데이터를 쓰고, 읽는 방법에는 두가지가 있다.

Read/Write request in NVM

  • Synchronization on power transition
    • All data are mover from NvM to RAM during LP to HP transition (Read all)
    • The application works with the data in RAM and marks them as valid or invalid for save
    • All the data marked as valid are save to NvM during HP to LP transition (Write all)

첫 번째 방법은 Power Transition일 때 동기화 시키는 방법이다.

모든 데이터는 NvM으로부터 RAM으로 옮겨 진다.

이렇게 옮겨진 RAM Data를 통해 기능이 수행되고, Save 여부를 판단해 mark 한다.

모든 mark된 데이터는 NvM에 기록되어 진다.

  • On-demand block Writes
    • All data are moved from NvM to RAM during LP to HP transition
    • The data are written to NvM in runtime on request by the API
    • During the HP to LP transition, the blocks that need to be saved are saved

위에랑 비슷한 방식이지만 이는 NvMWriteBlock이라는 API 기능에 의해 동작 중 NvM 메모리에 저장된다.

즉, Runtime accesses to NvM이며 NvM에 저장해야하는 Block이 즉시 저장된다.

 

[SWC]

Software Component가 CALIBRATION_1 Block에다가 0x12345678 value를 쓰고 싶다.

 

[NVRAM Manager]

CRC와 SWC data를 추가해 저장할 Block을 구성한다. - 0x12345678F0E1

이렇게 구성된 CALIBRATION_1 Block을 아래의 Symbol에 번역해서 구성한다.

CALIB_1_BLOCK_0

 

[MemIF : Memory Abstraction Interface]

FEE(Flash Emulated Eeprom)에다가 Write 요청을 보낸다.

 

[Flash Emulated EEProm]

FEE에서 이 CALIB_1_BLOCK_0에다가 HW Memory 주소 관리용 데이터를 붙인다.

0x12345678F0E1FFFF000000600020032030AB0

데이터를 쓰기 위해 physical address를 계산한다.

즉, CALIB_1_BLOCK_X를 physical address에 구성한다.

 

[Flash Driver]

이후 HW에 직접 쓴다.

Flash EEPROM emulation (FEE)

FLASH에 있는 데이터를 Read & Write 해보자.

EEPROM과 다른 FLASH의 주요 특징은, 데이터를 저장하는 주소가 가변한다.

Data Flash는 Bank들로 구성되어 있다.

전체 1번부터 10번까지가 Data Flash라고 한다면, 1번부터 3번까지 Bank1, 4번부터 6번까지 Bank2 이렇게 구성되며 각 Bank는 또 Bank Header(시작 주소), Data 저장 영역, Bank Footer(끝 주소)로 구성된다.

Data Flash의 Bank 구조를 더욱 상세하게 살펴보자.

Bank의 시작 주소인 Header는 아래와 같이 구성된다.

Bank Counter : FEE10 : xx : Checksum : Invalidate : Last block address

Bank의 마지막 주소인 Footer는 아래와 같이 구성된다.

Bank Counter : FEE10 : xx : Checksum : Invalidate

Data Flash의 Bank 구조 안에 Block을 알아보자.

Data Flash : Data Bank : Data Block

 

'AUTOSAR' 카테고리의 다른 글

AUTOSAR CAN 통신 Stack 구조 정리  (0) 2025.01.29
Autosar CANNM - Part 1  (1) 2024.06.17