AnsweredAssumed Answered

toggling program flash protection mk22fn1m0vlh12

Question asked by daafies on Jan 20, 2017
Latest reply on Jan 24, 2017 by daafies

hi i'm trying to turn on and off flash protection. i can see how to do it in PE or by using 

 

/* Flash configuration field */
__attribute__ ((section (".cfmconfig"))) const uint8_t _cfm[0x10] = {
/* NV_BACKKEY3: KEY=0xFF */
0xFFU,
/* NV_BACKKEY2: KEY=0xFF */

 

etc

 

but how do i change the following field in my application:

/* NV_FPROT3: PROT=0xFF */
0xFFU,
/* NV_FPROT2: PROT=0xFF */
0xFFU,
/* NV_FPROT1: PROT=0xFF */
0xFFU,
/* NV_FPROT0: PROT=0x7F */

 

i tried 

NV_FPROT3 = 0xFF;
NV_FPROT2 = 0xFF;
NV_FPROT1 = 0xFF;
NV_FPROT0 = 0x7F;

 

but that causes hard fault. i can read from those however. 

 

thanks for help

dave

Outcomes