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!
-----------------------------------------------------------------------------------------------------------------------