AnsweredAssumed Answered

NVRAM protection during mass erase?

Question asked by Raymond White on Oct 26, 2017

I am using a MK10DX128


We store our program in PROGRAM flash (obviously) and we store our calibration data in DATA flash. We have set the flash configuration field FSEC byte to only enable mass erases, hence securing our code.


The problem occurs when we upgrade our firmware (via the SWD interface). When the mass erase is performed it wipes out both the PROGRAM and DATA flash, forcing us to constantly have to re-calibrate our system (a costly and time-consuming operation).


I read the section regarding the FDPROT register. Excepting the "NVRAM special mode" which only seems to apply when using EZ Port, it seems like it is impossible to secure the DATA flash and maintain security on our program. This is because (according to the manual) we can only transition the FDPROT bits from unprotected to protected.


If I set FDPROT byte in the flash configuration field to protect those areas of DATA flash that I want to preserve through a mass erase, it will probably protect the DATA flash from the mass erase, but what good it is if I cannot temporarily unprotect the DATA flash at runtime to write calibration parameters to DATA flash?


I feel like I am missing something about the operation of FDPROT. Any help would be appreciated.