Flash Memory Operation
5-15 Flash Memory Controller
5.3.5 Stopping a Write or Erase Cycle
Any write or erase operation can be stopped before its normal completion by
setting the emergency exit bit EMEX. Setting the EMEX bit stops the active
operation immediately and stops the flash controller. All flash operations
cease, the flash returns to read mode, and all bits in the FCTL1 register are
reset. The result of the intended operation is unpredictable.
5.3.6 Configuring and Accessing the Flash Memory Controller
The FCTLx registers are 16-bit, password-protected, read/write registers. Any
read or write access must use word instructions and write accesses must
include the write password 0A5h in the upper byte. Any write to any FCTLx
register with any value other than 0A5h in the upper byte is a security key
violation, sets the KEYV flag and triggers a PUC system reset. Any read of any
FCTLx registers reads 096h in the upper byte.
Any write to FCTL1 during an erase or byte/word write operation is an access
violation and sets ACCVIFG. Writing to FCTL1 is allowed in block write mode
when WAIT=1, but writing to FCTL1 in block write mode when WAIT=0 is an
access violation and sets ACCVIFG.
Any write to FCTL2 when the BUSY=1 is an access violation.
Any FCTLx register may be read when BUSY=1. A read will not cause an
access violation.
5.3.7 Flash Memory Controller Interrupts
The flash controller has two interrupt sources, KEYV, and ACCVIFG.
ACCVIFG is set when an access violation occurs. When the ACCVIE bit is
re-enabled after a flash write or erase, a set ACCVIFG flag will generate an
interrupt request. ACCVIFG sources the NMI interrupt vector, so it is not
necessary for GIE to be set for ACCVIFG to request an interrupt. ACCVIFG
may also be checked by software to determine if an access violation occurred.
ACCVIFG must be reset by software.
The key violation flag KEYV is set when any of the flash control registers are
written with an incorrect password. When this occurs, a PUC is generated
immediately resetting the device.
5.3.8 Programming Flash Memory Devices
There are three options for programming an MSP430 flash device. All options
support in-system programming:
- Program via JTAG
- Program via the Bootstrap Loader
- Program via a custom solution