Hello,
I don't know the details of your application but the issue can be caused by existing partition code that is programmed on your device. The partition code can be erased by the Erase All Blocks Command only, see the detailed description in the Program Partition Code chapter in the MK10DX128 reference manual. You can also configure the debugger to execute this erase operation. For example the PEMicro debugger provides "Mass Erase on connect" options or you can use the J-link Commander to execute the mass erase operation and programming of the device.
You can also use the following code (main.c program module) to check the state of your device in your application. The code use the Cpu_GetFlexNVMPartitionCode() method to check the current state of the device (partition code in data flash IFR).
/* User includes (#include below this line is not maintained by Processor Expert) */
#include "FTFL_PDD.h"
/*lint -save -e970 Disable MISRA rule (6.3) checking. */
int main(void)
/*lint -restore Enable MISRA rule (6.3) checking. */
{
/* Write your local variable definition here */
uint16_t PartitionCode;
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal initialization. ***/
PartitionCode = Cpu_GetFlexNVMPartitionCode();
switch (PartitionCode) {
case FLEX_NVM_NOT_PARTITIONED:
printf("FlexNVM has not been partitioned yet.\n");
printf("SetFlashNVMPartition() method will be called.\n");
if (Cpu_SetFlexNVMPartition() != ERR_OK) {
printf("ERROR: SetFlexNVMPartition() failed.\n");
} else {
printf("SetFlexNVMPartition() done\n");
while(!FTFL_PDD_GetEEEReady(FTFL_BASE_PTR));
PartitionCode = Cpu_GetFlexNVMPartitionCode();
}
break;
case FLEX_NVM_REQUESTED_PARTITION_CODE:
printf("FlexNVM has been already partitioned. Current partition settings:\n");
printf(" EEPROM Data Set Size 0x%02x\r\n", (PartitionCode >> 8) & 0x3F);
printf(" FlexNVM Partition Code 0x%02x\r\n", PartitionCode & 0x0F);
while(!FTFL_PDD_GetEEEReady(FTFL_BASE_PTR));
break;
default:
printf("FlexNVM has been already partitioned but different partition settings has been detected. Current partition settings:\n");
printf(" EEPROM Data Set Size 0x%02x\r\n", (PartitionCode >> 8) & 0x3F);
printf(" FlexNVM Partition Code 0x%02x\r\n", PartitionCode & 0x0F);
printf(" Expected partition settings:\n");
printf(" EEPROM Data Set Size 0x%02x\r\n", (FLEX_NVM_REQUESTED_PARTITION_CODE >> 8) & 0x3F);
printf(" FlexNVM Partition Code 0x%02x\r\n", FLEX_NVM_REQUESTED_PARTITION_CODE & 0x0F);
}
if (PartitionCode == FLEX_NVM_REQUESTED_PARTITION_CODE) {
*((uint32_t *)0x14000000) += 1;
printf("Number of MCU resets form last Mass erase:%d\n",*((uint32_t *)0x14000000));
}
Best Regards,
Marek Neuzil