Issue in data flash partitioning

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

Issue in data flash partitioning

1,897 Views
nitinverma
Contributor III

Dear support team,

We are using  S32K148 device. We wanted to create partitions of 1.5 MB (Flash) and 512KB of data flash.

We are unable to perform dataflash Partition using DEFlash Partition Command with S32K148.
It throws Access Error when enters into Flash Command Sequence function. Flash Command Sequence function goes into code ram section as per requirement.

Thanks,

Nitin verma

3 Replies

1,235 Views
RadekS
NXP Employee
NXP Employee

Hi Nitin,

Unfortunately, I don’t have an S32K148 device here for testing.

The potential root causes for Access Error result are listed in Table 33-45. Program Partition command error handling in RM.

Since you use the flash driver, the most probable reason will be incorrect EEPROM Data Set Size Code or FlexNVM Partition Code (correct should be EEESIZE=0x02, DEPART=0x04).

 

The second most probable reason is that FlexNVM module is already partitioned.

Did you use FLASH_DRV_EraseAllBlock() for complete erase of all flash blocks include data flash IFR followed by reprogramming security byte?

I am not sure with your sentence “We wanted to create partitions of 1.5 MB (Flash) and 512KB of data flash.”.

The S32K148 contains 1.5 MB Program Flash and 512kB of FlexNVM memory. The 64kB from FlexNVM area may be used for emulated EEPROM. In this case, the rest (448kB) will stay accessible as D-Flash (programmed by flash controller commands). The default state for new MCU is that emulated EEPROM feature is not used and the whole 512kB of FlexNVM memory is usable as data flash. For enabling emulated EEPROM feature, we must execute Program Partition command (once after EraseAllBlock).

So, if you don’t need EEE or you need 512kB data flash, you don’t need to execute Program Partition command.

The Program Partition command does not affect Program Flash memory size.

I hope it helps you.

Have a great day,
Radek

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,235 Views
ummerkunnummalk
Contributor III

Hi Radek,

               I have similar problem due to the second reason you have mentioned.

My intention is to setup the EEPROM with my configuration during the initial stage of my software even if it is already partitioned in some other configuration. To achieve that, if I erase all blocks - my software will fail as the flash contents are erased. Can you suggest any alternate method through which I can achieve this?.

Please note that running the complete software from RAM is NOT AT ALL an option for me. 

0 Kudos

1,235 Views
RadekS
NXP Employee
NXP Employee

Hi Ummer,

unfortunately, the FlexNVM isn't designed for such a scenario.  

pastedImage_1.png

The flash configuration with partitioning settings may be erased only by mass erase command - typically with a connected debugger. 
It is hard to imagine the use case where the dynamic change of EEPROM settings may be handled without potential security issues. Since EEPROM is also used for storing CSEc keys, the dynamic change of EEPROM settings is even more difficult and critical. 

One of the other main reasons, why such an operation isn't allowed, is flash endurance.

The partition command initialize sector counters in FlexNVM and these counters are also used for flash aging (erase/write times slowly grow with a number of cycles for ensuring data reliability). When we do a mass erase very often, the reliability cannot be guaranteed according to values in S32K RM/DS.     

I hope it helps you.

 

Have a great day,
Radek