I use official board and SDK libraries. I write my project in MDK.
I set the MCU in secure status and enabled backdoor key access.
When I use FLASH_SecurityBypass() function from library, function returned me FLASH Access Error status.
I entered the same backdoor key which is in FCCOB registers. For key entering I use terminal window.
The problem comes from FLASH_SecurityBypass() function where call flash_command_sequence() function.
flash_command_sequence() function returned FLASH Access Error status.
Hi Rysard,
You can try to use the attached pflash.c and startup_MKL82Z7.s test on your FRDM-KL82Z board.
Using pflash exmaple in SDK_2.0_FRDM-KL82Z.
In startup_MKL82Z7.s file I have the following key entered:
/* Flash Configuration */
.section .FlashConfig, "a"
.long 0x01020304 /* //DES was 0xFFFFFFFF */
.long 0x05060708 /* //DES was 0xFFFFFFFF */
.long 0xFFFFFFFF
.long 0xFFFFFFBC /* //DES enable BackDoorKey and lock flash=0xFFFFFFBC was 0xFFFFFFFE */
Using pflash.c I added test code:
uint8_t MyBackDoorKey[]={0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08}; | //DES test works |
The terminal output is:
The Count down gave me time to plug in the FRDM-KL82Z, let the VCOM enumerate, and then allow the terminal window to be open.
I loaded the example and modified it. The two source files attached in ZIP file for reference.
Folder locations:
C:\SDK_2.0_FRDM-KL82Z\boards\frdmkl82z\driver_examples\flash\pflash.c
C:\SDK_2.0_FRDM-KL82Z\devices\MKL82Z7\iar\startup_MKL82Z7.s
Best Regards,
Robin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------