AnsweredAssumed Answered

MK20 EEPROM failed to write

Question asked by Tony W on Mar 23, 2017
Latest reply on Mar 29, 2017 by Kerry Zhou

Hello,

I am using the MK20DX256VLL10, bare metal with KDS 3.2. I am using the FLASH_LDD from PEx. The EEPROM size is set to 4096 byte. The partition code is 0x4 and the EEPROM size code is 0x22. I am using the following code to configure the partition at the beginning. it seems working.

   Cpu_SetFlexNVMPartition();
  /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
  PE_low_level_init();
  /*** End of Processor Expert internal initialization.                    ***/

....

  if(Cpu_GetFlexNVMPartitionCode() == FLEX_NVM_REQUESTED_PARTITION_CODE){
      SendDataToComputer("Successfully set Partition.\r\n ");
  }else{
      SendDataToComputer("Failed set Partition.\r\n ");
  }

The write function was generated by PEx:

FLASH1_Write(bitFLASH1Ptr, buf, FLASH_EEPROM_LOCATION, 2048);

 

I can write the data into EEPROM once and ONLY ONCE after "Mass erase on connect" is enabled and download the code into target board.

After that even I used the same code, the write function will be returned with FAIL code.

What do I need to do in order to successfully write data to it?

 

Tony W

Outcomes