How to use NVM and EEPROM partition in S32k146?

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

How to use NVM and EEPROM partition in S32k146?

1,990 Views
s32k146_ige
Contributor IV

Hi,

I am using S32K146.

I want to use 4Kb EEPROM and 64Kb NVM partition in my project, i tried running code example flash_partitioning_s32k146, which helped me use EEPROM partition.

But i am unable to Write or erase in NVM, The D_Flash size is 0 [ data flash 0 kb emulated eeprom backup 64kb ]as per the flex nvm partition, so the operation is failed.

How to configure the flex nvm partition ? 

Thanks

Labels (1)
Tags (2)
0 Kudos
7 Replies

1,952 Views
s32k146_ige
Contributor IV

Hey Hi @Robin_Shen 

 

Thanks, This worked, I have one more question?

How to write in 32kB backup eeprom like what should be address ? and how to read back data from NVM(DFlash) or EEPROM ? 

0 Kudos

1,901 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

When using the EEPROM of S32K1xx, user does not need to write to the EPROM backup address. It is recommended that you read AN11983 Using the S32K1xx EEPROM Functionality

AN11983.png

0 Kudos

1,840 Views
s32k146_ige
Contributor IV
Dear @Robin_Shen
i am unable to understand here concept of backup EEPROM, i did read the said application note, but failed to grasp if i am using partition setting as 32KB EEPROM and 32kb NVM (DFlash), what actually happens to 32KB EEPROM, as i am going to use bootloader 16KB of NVM is going to be used as Bootloader, so i am left with 16KB of DFlash, but what happens to 32KB backup EEPROM ?
0 Kudos

1,803 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

The training video  Benefit from FlexNVM Flash Block Memory in S32K MCUs introduces Emulated EEPROM from 10:08

Hope it helps.

0 Kudos

1,971 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi 

That example configure FlexNVM for maximum E-Flash size 64K

 * - EEEDataSizeCode = 0x02u: EEPROM size = 4 Kbytes
* - DEPartitionCode = 0x08u: EEPROM backup size = 64 Kbytes */
ret = FLASH_DRV_DEFlashPartition(&flashSSDConfig, 0x02u, 0x08u, 0x0u, false, true);

flash_partitioning_s32k146.pngTable 4. FlexNVM partition codes for 64 kB FlexNVM devices (S32K142, S32K144, S32K146).png

You can Split FlexNVM for D-Flash(32Kbytes) and E-Flash(32Kbytes):
ret = FLASH_DRV_DEFlashPartition(&flashSSDConfig, 0x02u, 0x03u, 0x0u, false, true);

Split FlexNVM for D-Flash and E-Flash.pngBest Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

1,966 Views
s32k146_ige
Contributor IV

Hey Robin thanks for reply,

So going by current configuration, my MCU is configured for 64Kb + 4Kb of EERPOM ? is that right ?

Also how do i access the 64Kb of EEPROM ? as i have checked i can write on 4Kb of EEPROM only 

 

 

        /* Configure FlexRAM as EEPROM and FlexNVM as EEPROM backup region,
         * DEFlashPartition will be failed if the IFR region isn't blank.
         * Refer to the device document for valid EEPROM Data Size Code
         * and FlexNVM Partition Code. For example on S32K146:
         * - EEEDataSizeCode = 0x02u: EEPROM size = 4 Kbytes
         * - DEPartitionCode = 0x08u: EEPROM backup size = 64 Kbytes */
        ret = FLASH_DRV_DEFlashPartition(&flashSSDConfig, 0x02u, 0x08u, 0x0u, false, true);
        DEV_ASSERT(STATUS_SUCCESS == ret);

 

 

 

As per mentioned by You, i also tried doing following changes

ret = FLASH_DRV_DEFlashPartition(&flashSSDConfig, 0x02u, 0x03u, 0x0u, false, true);

but this function return Error (0x1) and code is stuck in assert condition. i have attached screenshot of flashSSDConfig variable data.

 

0 Kudos

1,956 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

That example configure all 64 kB FlexNVM as EEPROM backup. But you want to configure 32 kB FlexNVM as Data Flash and 32kB as EEPROM backup? so:
ret = FLASH_DRV_DEFlashPartition(&flashSSDConfig, 0x02u, 0x03u, 0x0u, false, true);

Please notice the NOTE of that example:

FLASH Partitioning S32K146 RTM 4.0.3.pngflash_partitioning_s32k146 Debug_RAM.pngflash_partitioning_s32k146 Debug.png