Texas Instruments MSP430x1xx User Manual page 140

Texas instruments modules and peripherals user's guide
Table of Contents

Advertisement

Flash Memory Operation
Initiating a Byte/Word Write from RAM
The flow to initiate a byte/word write from RAM is shown in Figure 5−9.
Figure 5−9. Initiating a Byte/Word Write from RAM
; Byte/word write from RAM. 514 kHz < SMCLK < 952 kHz
; Assumes 0FF1Eh is already erased
; Assumes ACCVIE = NMIIE = OFIE = 0.
L1 BIT
L2 BIT
5-10
Flash Memory Controller
Disable all interrupts and watchdog
yes
BUSY = 1
Setup flash controller
and set WRT=1
Write byte or word
yes
BUSY = 1
Set WRT=0, LOCK = 1
re-enable interrupts and watchdog
MOV
#WDTPW+WDTHOLD,&WDTCTL
DINT
#BUSY,&FCTL3
JNZ
L1
MOV
#FWKEY+FSSEL1+FN0,&FCTL2 ; SMCLK/2
MOV
#FWKEY,&FCTL3
MOV
#FWKEY+WRT,&FCTL1
MOV
#0123h,&0FF1Eh
#BUSY,&FCTL3
JNZ
L2
MOV
#FWKEY,&FCTL1
MOV
#FWKEY+LOCK,&FCTL3
...
EINT
; Disable WDT
; Disable interrupts
; Test BUSY
; Loop while busy
; Clear LOCK
; Enable write
; 0123h −> 0FF1Eh
; Test BUSY
; Loop while busy
; Clear WRT
; Set LOCK
; Re-enable WDT?
; Enable interrupts

Advertisement

Table of Contents
loading

Table of Contents