Flash Memory Operation
5-7
Flash Memory Controller
Initiating an Erase from RAM
Any erase cycle may be initiated from RAM. In this case, the CPU is not held
and can continue to execute code from RAM. The BUSY bit must be polled to
determine the end of the erase cycle before the CPU can access any flash
address again. If a flash access occurs while BUSY=1, it is an access violation,
ACCVIFG will be set, and the erase results will be unpredictable.
The flow to initiate an erase from flash from RAM is shown in Figure 5−6.
Figure 5−6. Erase Cycle from Within RAM
yes
BUSY = 1
yes
BUSY = 1
Disable all interrupts and watchdog
Setup flash controller and
erase mode
Dummy write
Set LOCK = 1, re-enable
interrupts and watchdog
; Segment Erase from RAM. 514 kHz < SMCLK < 952 kHz
; Assumes ACCVIE = NMIIE = OFIE = 0.
MOV
#WDTPW+WDTHOLD,&WDTCTL
; Disable WDT
DINT
; Disable interrupts
L1 BIT
#BUSY,&FCTL3
; Test BUSY
JNZ
L1
; Loop while busy
MOV
#FWKEY+FN0,&FCTL2 ; SMCLK/2
MOV
#FWKEY,&FCTL3
; Clear LOCK
MOV
#FWKEY+ERASE,&FCTL1
; Enable erase
CLR
&0FC10h
; Dummy write, erase S1
L2 BIT
#BUSY,&FCTL3
; Test BUSY
JNZ
L2
; Loop while busy
MOV
#FWKEY+LOCK,&FCTL3
; Done, set LOCK
...
; Re-enable WDT?
EINT
; Enable interrupts
Summary of Contents for MSP430x1xx
Page 1: ... 2005 Mixed Signal Products User s Guide SLAU049E ...
Page 6: ...vi ...
Page 18: ...1 6 Introduction ...
Page 36: ...2 18 System Resets Interrupts and Operating Modes ...
Page 112: ...3 76 ...
Page 130: ...4 18 Basic Clock Module ...
Page 152: ...5 22 Flash Memory Controller ...
Page 160: ...6 8 Supply Voltage Supervisor ...
Page 168: ...7 8 Hardware Multiplier ...
Page 192: ...8 24 ...
Page 200: ...9 8 Digital I O ...
Page 234: ...11 24 Timer_A ...
Page 260: ...12 26 Timer_B ...
Page 291: ...13 31 USART Peripheral Interface UART Mode ...
Page 314: ...14 23 USART Peripheral Interface SPI Mode ...
Page 346: ...15 32 USART Peripheral Interface I2C Mode ...
Page 358: ...16 12 Comparator_A ...
Page 386: ...17 28 ADC12 ...
Page 418: ...18 32 ADC10 ...
Page 432: ...19 14 DAC12 ...