Hi,
I am interested in hearing about suggestions for protecting flash write operations using the FWKEY password field in MSP430 processors. All examples I have seen, and all of my own code use "FCTLx = FWKEY + ..." when writing to flash control registers. Using anything other than FWKEY, which is 0xA500, will cause a POR. Presumably, this is to guard against spurious writes to the flash control registers if , say, a pointer gets corrupted.
However, hard-coding FWKEY doesn't protect against spurious execution, say when there is a brownout and code randomly executes. If the routine to manipulate flash gets executed, then the hard-coded keys are all set, and the flash operation takes place.
I have considered setting a global variable, let's call it pwd) equal to FWKEY only while flash operations are allowed (like when executing certain commands in my application) and resetting it during all other times. That way, if the flash manipulation routine is spuriously activated, the flash control register access, which looks like "FCTLx = pwd + ...", will fail as desired because pwd != FWKEY.
Any other suggestions on strategies you have used? Any general reference on this?
Thanks,
Mike
 
				 
		 
					 
                           
				 
				