Hi,
I'm working with S32K116 microcontrollers, trying to set the MCU in secure mode and later switch it to unsecure mode using the backdoor key, as described in the S32K Reference Manual in section 36.5.12.2.1. To do this, I have a code where the first step is modifying the startup_S32K116.S file by adding the backdoor key in the flash configuration section and setting the FSEC to 0xF instead of 0xE at the end, to put the MCU in secure mode. Here's an example in the following image:
Then, I create a function to update the FCCOB register, as described in the manual, to check if the key is correct and switch the MCU back to unsecure mode:
Finally, in my main function, I ensure that a message is sent via UART at the start of the program, indicating that the MCU is in secure mode. Then, it calls the key verification function and sends another UART message showing the current status.
I first flashed the program in unsecure mode to verify that it worked and sent the messages via UART. Then, I flashed it in secure mode, but nothing happened, and I could no longer flash the MCU again.
Why isn't it working?
Best regards, and thank you in advance.
Thw problem with UART is solved, it is working properly and show that when the program starts the mcu is secure and after the backdoor_key_verify is unsecured
But even if the secure mode is unlocked, it still doesn't let me reflash the microcontroller.
Hi @David_Estevez,
The MCU goes back to the secure state after a system reset.
The debugger/programmer must not reset the MCU before the MCU is erased/reprogrammed.
Regards,
Daniel
To reprogram without resetting the MCU, what options do I have to disable in debug configurations? because it's not working for me. I am using a PE micro multilink.
Regards.
The PE Micro plugin in S32DS IDE allows the Multilink to be attached to the MCU without reset:
Once attached, you can halt the core and debug the MCU.
To erase the MCU after that, you would need a script, I guess.
Please contact PE Micro support.
Regards,
Daniel