Hi,
I have enabled the Backdoor key to unsecured the flash and I have set the flash configuration, as mentioned below.
(void(*)(void)) 0xAAAAAAAA, /* 0x400 Backdoor Comparison Key */
(void(*)(void)) 0xAAAAAAAA, /* 0x404 Backdoor Comparison Key */
(void(*)(void)) 0xFFFFFFFF, /* 0x408 FPROT */
(void(*)(void)) 0xFFFFFFBD /* 0x40c FSEC, FOPT, FEPROT, FDPROT */
This was added in the vector table after the end of ISRs. This is part of the Bootloader code.
So, to un-secure the MCU, I am running a backdoor key from the Application, not from the Bootloader code.
The code mentioned below, which is running from Application on keypress.
while((FTFE_BASE_PTR->FSTAT & FTFE_FSTAT_CCIF_MASK) == 0); // wait if operation in progress
FTFE_BASE_PTR->FSTAT = FTFE_FSTAT_ACCERR_MASK | FTFE_FSTAT_FPVIOL_MASK; // clear flags
FTFE_BASE_PTR->FCCOB3 = 0x45;
FTFE_BASE_PTR->FCCOB7 = 0xAA;
FTFE_BASE_PTR->FCCOB6 = 0xAA;
FTFE_BASE_PTR->FCCOB5 = 0xAA;
FTFE_BASE_PTR->FCCOB4 = 0xAA;
FTFE_BASE_PTR->FCCOBB = 0xAA;
FTFE_BASE_PTR->FCCOBA = 0xAA;
FTFE_BASE_PTR->FCCOB9 = 0xAA;
FTFE_BASE_PTR->FCCOB8 = 0xAA;
FTFE_BASE_PTR->FSTAT = FTFE_FSTAT_CCIF_MASK; // launch command
while((FTFE_BASE_PTR->FSTAT & FTFE_FSTAT_CCIF_MASK) == 0); // wait until complete
I am printing the status register before and after running the backdoor command, but the FSEC register
does not have any change, it always has the same value
Here, how to verify the Backdoor key is worked or not.
And also one more question, in MEEN bits in FSEC, if we make Mass erase disabled, is it possible to unlock the flash from the Backdoor key.
Because I have tried with this, I didn't succeed, I end up locking my MCU.