flexmemory re partition

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

flexmemory re partition

651 Views
zxj
Contributor I

Hello

I had a problem with using the official development board TWR-KE18F's EEPROM, and the main chip used was MKE18F512VLL16, hoping to get directions.

The questions are as follows: I used the official routine

sdk_2.2_TWR-KE18F\\boards\\twrke18f\\driver_examples\\flash\\flexnvm_eeprom\\mdk

Sdk_2.2_TWR-KE18F\\boards\\twrke18f\\driver_examples\\flash\\flexnvm_eeprom\\mdk

I can only write 32BYTE data and show that it has been partitioned. The chip is in a non safe mode. I will do the partition operation. The partition code is as follows:

int partition_flash(int eeprom_size,int dflash_size)

{

FEFx->FCCOB0=FTFE_FCCOB0_CCOBn(0x80);

FEFx->FCCOB1=0x00;

FEFx->FCCOB2=0x00;

FEFx->FCCOB3=0x00;

FEFx->FCCOB4=0x35;

FEFx->FCCOB5=0x04;

FEFx->FSTAT=0x80;

while(!(FEFx->FSTAT & FEFx_FSTAT_CCIF_MASK));

return 1;

}

IMG_1226.JPG

 

 

Compile and run, found the re partition is not used, EEPROM size has been 32BYTE, FLASH all erase, I'm afraid the chip will be damaged, how to re partition, thank you very much.

Tags (1)
0 Kudos
2 Replies

435 Views
tobias_mrs
Contributor III

Hello

I stuck at the same point at the moment.
How could I increase the EEPROM size up to 4 KB. Were could I find the correct EEPROM_DATA_SET_SIZE_CODE and FLEXNVM_PARTITION_CODE

0 Kudos

435 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi z xj

If you run the driver example at least once, then it made a 32 Bytes partition, and the flash information was updated, so at the next reset there will be already a partition, this is how the example works. My recommendation is that you set a mass erase command and then partition your memory only one time in your entire application.

Also, as long as you are using SDK drivers, I recommend you to use those APIs, the example also provide the following code.

if (!eepromTotalSize)
        {
            /* Note: The EEPROM backup size must be at least 16 times the EEPROM partition size in FlexRAM. */
            uint32_t eepromDataSizeCode = EEPROM_DATA_SET_SIZE_CODE;
            uint32_t flexnvmPartitionCode = FLEXNVM_PARTITION_CODE;

            PRINTF("\r\n There is no available EEprom (FlexNVM) on this Device by default.");
            PRINTF("\r\n Example is trying to configure FlexNVM block as EEprom.");

            result = FLASH_ProgramPartition(&s_flashDriver, kFLASH_PartitionFlexramLoadOptionLoadedWithValidEepromData,
                                            eepromDataSizeCode, flexnvmPartitionCode);
            if (kStatus_FLASH_Success != result)
            {
                error_trap();
            }

            /* Reset MCU */
            PRINTF("\r\n Perform a system reset \r\n");
            NVIC_SystemReset();
        }

Where EEPROM_DATA_SET_SIZE_CODE (0x39U) //32 bytes

Hope this helps.

Best Regards

Jorge Alcala