0% found this document useful (0 votes)
33 views

AUTOSAR Memory Stack

Uploaded by

A7med Ebra7im
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

AUTOSAR Memory Stack

Uploaded by

A7med Ebra7im
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Automotive

Industry
AUTOSAR Memory Stack
“If horses had controlled investment
decisions, there would have been no auto
industry.”

— Warren Buffett
01
Introduction
The way I drive, the way I handle a car, is an
expression of my inner feelings.
Lewis Hamilton
Need of memory stack

● Memory stack provides access to Non-volatile memory

● Kinds of stored information


○ Seat Position
○ A/C Temperature
○ Radio Preferences

● Information are stored in Blocks

● A Block is an array of bytes

● Each application defines the blocks it needs


○ Length
○ Protection
02
Memory Types

The fact is I don’t drive just to get from A to B. I enjoy


feeling the car’s reactions, becoming part of it.
Enzo Ferrari
Memory Types
● RAM

● ROM

● Non-Volatile Memory
○ EEPROM
○ FLASH

● Difference between EEPROM and FLASH


○ Erasing access
○ Speed
○ Cost
○ Lifetime
Main functionalities
● Scheduling of accesses to any NV block for data saving/loading

● Access to blocks through BlockId , with optional queuing and priority management

● NV data safety through:


○ CRC checking
○ Redundancy management
○ Default data recovery

● Automatic multi-block loading/saving for ECU startup/shutdown modes

● NV Jobs priority management

● Explicit NV block invalidation services


Main functionalities
● Write operation ● Read/Restore operation

Application request
Application update RAM
read/restore

Memory stack copy data from


Application request write
NV/ROM to RAM

Memory stack copy data from Application read data from


RAM to NV RAM
03
Structure
I love fast cars… and to go too fast in them.
Lara Flynn Boyle
Structure of memory stack
Memory stack modules roles
● EEP module

● It is responsible for abstraction of MC registers used to control on-chip EEPROM peripheral

● It provides services for reading , writing, erasing to/from EEPROM

● It also provides a service for comparing data

● The EEPROM driver shall not buffer data


Memory stack modules roles
● FLS module

● It is responsible for abstraction of MC registers used to control on-chip FLASH peripheral

● It provides services for reading , writing, erasing to/from FLASH

● It also provides a service for comparing data

● The EEPROM driver shall not buffer data


Memory stack modules roles
● EA module

● It is responsible of providing an abstraction of internal/external EEPROM devices

● It provides the upper layers with a virtual addressing scheme

● It provides “virtually” unlimited number of erase cycles


Memory stack modules roles
● FEE module

● It is responsible of providing an abstraction of internal/external FLASH devices

● It provides the upper layers with a virtual addressing scheme


● It provides “virtually” unlimited number of erase cycles
Memory stack modules roles
● MEMIF module

● It allows the NVRAM manager to access several memory abstraction modules ( FEE
or EA modules)
Memory stack modules roles
● NVM module

● Scheduling of accesses to any NV block for data saving/loading

● Access to blocks through BlockId , with optional queuing and priority management

● Nv data safety through


○ CRC checking
○ Redundancy management
○ Default data recovery

● Automatic multi-block loading/saving for ECU startup/shutdown modes

● Explicit NV block invalidation services


Memory stack main Concepts
● NV blocks

○ The NV block is a basic storage object in NV memory

○ The NV block consist of


■ Optional NV block header (Static block ID)
■ Data
■ Optional CRC
Memory stack main Concepts
● Different types of NV block management
○ Native NV block
○ Redundant NV block
○ Dataset NV block

● Related configuration parameters :


○ NVM_BLOCK_MANAGEMENT_TYPE
○ NVM_NV_BLOCK_NUM
○ NVM_DATASET_SELECTION_BITS
Memory stack main Concepts
● ROM blocks

○ The ROM block is a basic storage object in ROM

○ It provides default data in case of an empty or damaged NV BLOCK

○ The ROM block consists of


■ Constant data

○ Related configuration parameters :


■ NVN_ROM_BLOCK_DATA_ADDRESS
Memory stack main Concepts
● RAM blocks

○ The RAM block is a basic storage object in RAM

○ Used to allow applications to write and read freely

○ It consists of
■ Optional NV block header (Static block ID)
■ Data
■ Optional CRC
Memory stack main Concepts
● CRC calculations

○ CRC shall be recalculated and updated in the RAM block upon each write request from application

○ During read operation


■ CRC bytes are read from NV
■ CRC is calculated over the data read from NV
■ The read value and the calculated value are compared

○ Related configuration parameters :


■ NVM_BLOCK_USE_CRC
■ NVM_BLOCK_CRC_TYPE
■ NVM_CRC_NUM_OF_BYTES
Memory stack main Concepts
● Priority management
○ The memory stack supports a priority based job processing (in case of multiple write/read
requests from application)

○ Two queues exists in memory stack


■ one for immediate write jobs
■ another for all other jobs

○ A write with immediate priority shall preempt the running job

○ The preempted job shall be resumed/restarted by the memory stack


Memory stack main Concepts
● Polling and Callbacks

○ The memory stack can use either polling or callback to get the status of current
write/read job requested from application

○ Mixed configuration can be used along the memory stack

○ The applications also can use polling or callback

○ Related configuration parameters


■ NVM_POLLING_MODE
■ EA/FEE_POLLING_MODE
■ EEP/FLS_USE_INTERRUPTS
■ NVM_SINGLE_BLOCK_CALLBACK
Memory stack main Concepts
● Write verification

○ When a Ram block is written to NV memory the NV block shall be immediately read back and
compared with the original content in RAM block

○ Write verification shall be performed in steps so that the number of bytes read specified by a
configuration parameter
■ NVM_WRITE_VERIFICATION_DATA_SIZE

○ If write verification failed then write retires shall be performed by a configuration parameter
■ NVM_MAX_NUM_OF_WRITE_RETRIES
Memory stack main Concepts
● Protection of NV block

○ Memory stack provides functionality of protecting the NV block from being overwritten

○ Related configuration parameters :


■ NVM_BLOCK_WRITE_PROT
■ NVM_WRITE_BLOCK_ONCE

○ Application could use “Nvm_SetBlockProtection” API to activate/deactivate block protection


during runtime
Memory stack main Concepts
● Write all blocks / Read all blocks

○ Nvm_WriteAll() writes data to all NV blocks witty attributes


■ Block is selected for WriteAll (by configuration)
■ Block has a permanent RAM block

○ Nvm_ReadAll() reads data from al NV Blocks with attributes


■ Block is selected for ReadAll (by configuration)
■ Block has a permanent RAM block

○ Nvm_WriteAll() and Nvm_ReadAll() are called in shutdown and startup respectively


Memory stack main Concepts
● Write operation

○ Test block protection

○ Calculate CRC (if configured)

○ Copy data from RAM to NV


Memory stack main Concepts
● Write sequence diagram - Callbacks
Memory stack main Concepts
● Read operation

○ Copy from NV to RAM

○ CRC calculation and comparison


■ Match
■ Mismatch

○ Reading redundant blocks

○ Loading default values


Memory stack main Concepts
● Read sequence diagram - Callbacks
THANK YOU!
DOES ANYONE HAVE ANY QUESTIONS?

www.imtschool.com
www.facebook.com/imaketechnologyschool/

You might also like