Flash driver

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Flash driver

3,908 Views
stabilo
Contributor II

Hello support team,

 

I would like to know if there is already a flash driver library available for S32K144 ?

 

Thank you

Labels (1)
10 Replies

2,403 Views
stabilo
Contributor II

Hi,

Thank you for all these answers.

I've a last question: is it possible to use an interrupt on command completion for an eeprom (FlexRAM) write operation ? I would like to avoid blocking the entire program when I write to the eeprom. I know that the EE state machine automatically erases flash sectors, could this be a problem if the program is running in parallel ?

When I enable the interrupt (FCNFG_CCIE), the interrupt function is directly reached and the interrupt flag cannot be cleared (FSTAT_CCIF).

Thank you

0 Kudos

2,402 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

CCIF == 1 says that the operation has completed and we can launch new command by clearing the flag.

If you want to use the interrupt, it must be done in this way:

- check if CCIF == 1

- if yes, write to EE and return

- if no, enable interrupt by CCIE and return

- once the interrupt is triggered, disable interrupt by CCIE, do NOT clear the CCIF because it launches new command, write EE and return

Regards,

Lukas

0 Kudos

2,404 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

pastedImage_1.png

Regards,

Lukas

0 Kudos

2,404 Views
stabilo
Contributor II

Thank you for this answer. I've already partionned FlexRAM and FlexNVM, is works well.

So the maximum EEPROM size is 4 KB on the S32K144 ?

Thank you

0 Kudos

2,404 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Yes, if we are talking about emulated EEPROM then the maximum size is 4KB.

If you don't use emulated EEPROM feature, you can use 64KB data flash (the size of individually erasable sectors is 2KB).

Regards,

Lukas

0 Kudos

2,404 Views
stabilo
Contributor II

Hello support team,

Can you please explain me how does the eeprom work on the S32K144 ? What are the differences between the eeprom data set (FlexRam) and the eeprom backup (FlexNVM) ? How to perform read and write operation ?

The datasheet does not give much informations about eeprom.

Thank you.

0 Kudos

2,404 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

see the description of Program Partition command in reference manual. This command is intended to configure the EEPROM - it says how much data flash (FlexNVM) and how much RAM (FkexRAM) is used for EEPROM emulation.

If emulated EEPROM is used, you just read and write the FlexRAM. Internal mechanism will ensure that all data written to FlexRAM will be programmed (as a records) to data flash. After reset or power-on, internal controller goes through all records in data flash and copies them to FlexRAM. That means you will see valid data in FlexRAM after reset/power-on. Everything is done on background without user's intervention.

The emulated EEPROM is supposed to be used for data which are changed frequently. If you have "static" data (data which are changed only rarely in comparison with other data), it is good to store them in data flash which are not used for emulated EEPROM or in program flash. A lot of static data in emulated EEPROM leads to higher number of program/erase cycles due to clean-up mechanism of emulated EEPROM.

Regards,

Lukas

0 Kudos

2,404 Views
stabilo
Contributor II

I've developped my own flash function, I've just one single question :

What are the differences between the commands  Erase Flash Block and Erase Flash Sector ?

I know that for the FlexNVM, a sector has a size of 8KB, but what is the size of a block ? The entire FlexNVM memory ?

So is it possible to erase a section smaller than 8KB ?

Thank you

0 Kudos

2,404 Views
letseatorange
Contributor III

can you tell me how do you use eeprom to store some data? thank you very much.

0 Kudos

2,404 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

there are SDK flash drivers. See the example:

c:\Freescale\S32_ARM_v1.2\S32DS\S32_SDK_EAR_0.8.1\examples\driver_examples\flash\FLASH_Example\

The sector sizes are:

pastedImage_1.png

pastedImage_2.png

Yes, the "block" means whole program flash memory or FlexNVM memory.

From file c:\Freescale\S32_ARM_v1.2\S32DS\S32_SDK_EAR_0.8.1\platform\devices\S32K144\include\S32K144_features.h:

/* @brief P-Flash block count. */
#define FSL_FEATURE_FLASH_PFLASH_BLOCK_COUNT (1u)
/* @brief P-Flash block size. */
#define FSL_FEATURE_FLASH_PFLASH_BLOCK_SIZE (524288u)
/* @brief P-Flash sector size. */
#define FSL_FEATURE_FLASH_PFLASH_BLOCK_SECTOR_SIZE (4096u)

and

/* @brief FlexNVM block count. */
#define FSL_FEATURE_FLASH_FLEX_NVM_BLOCK_COUNT (1u)
/* @brief FlexNVM block size. */
#define FSL_FEATURE_FLASH_FLEX_NVM_BLOCK_SIZE (65536u)
/* @brief FlexNVM sector size. */
#define FSL_FEATURE_FLASH_FLEX_NVM_BLOCK_SECTOR_SIZE (2048u)

Regards,

Lukas