Hi @sam_lgu
Thank you for your reply!
I suspect that the IDE or the Debug tools are not letting you update the FSEC with your security settings.
I tried on my side and ran in the same problem , I was not able to update FSEC . I used : the KE04Z ; the MCUXpresso IDE , my and LPC-Link 2 with Segger J-Link firmware.
It was a bit tricky but I managed to update the FSEC as I wanted, see my procedure below.
1 I set the FSEC to 11 (secure mode ) at the Flash config structure , in the MCUXpresso this structure it is located in the startup file .
diego_charles_0-1630529091506.png
2 After , that I generated an hex file to verify if the IDE was generating my image with my desired FSEC setting of 0b11. I used Hexedit to validate that I was generating my settings.
diego_charles_11-1630530779069.png
(The flash security bite containing the FSEC is located at the 0x40C)
3 Then, I programed the application , and using the debugger I checked the value of FSEC ; I wanted it to be 0b11 but it was 0b10 (the default mode with no security ) The same problem you experimented.
diego_charles_1-1630529416058.png
4. Then I changed the MCU in the J-Link debug configuration to the allow security version.
diego_charles_4-1630529587784.png
5. I recompiled the project and debugged one more time. I was able to see that the FSEC now changed to my desired value of 0b11.
diego_charles_6-1630530543215.png
That is why I say that the debugger may not letting you to update the FSEC, also verify if Code warrior is generating the image with the FSEC. Then check the configurations of your probe firmware.
Note : I checked the FSEC during a debug session after programming the MCU with J-Link , but I do not recommend doing that, the best is to read the value of FSEC using code and then display it using a serial terminal , for example.
Let me know your results, or if you have complications.
Diego