Hi,
I am using S9KEAZN64AMLC MCU (Custom Board). I want to secure the FLASH After Flashing.
and again when I got the request over LIN or any other external request then I had to Unsecure,
Is there any way to do that?
I went through the start-up code. If we change the value from FE to FD is flash will secure?

Can we do that if I want to change this configuration in run time?
I tried the following


When any request comes from an external environment I am calling this function to unlock the FLASH but when control comes here it is going to default to ISR. Is it the right way to do that?
If not how we can lock and unlock FLASH in RUN time?
And if FLASH is locked and unable to unlock then how we can do MASS Erase? (NOTE: I am using S32DS IDE and PE Micro Multilink Universal )