Initiating a byte/word write from ram – Texas Instruments MSP430x4xx User Manual

Page 135

Advertising
background image

Flash Memory Operation

5-10

Flash Memory Controller

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

yes

BUSY = 1

yes

BUSY = 1

Disable watchdog

Setup flash controller

and set WRT=1

Write byte or word

Set WRT=0, LOCK = 1

re-enable watchdog

; Byte/word write from RAM. 514 kHz < SMCLK < 952 kHz

; Assumes 0FF1Eh is already erased

; Assumes ACCVIE = NMIIE = OFIE = 0.

MOV

#WDTPW+WDTHOLD,&WDTCTL

; Disable WDT

L1 BIT

#BUSY,&FCTL3

; Test BUSY

JNZ

L1

; Loop while busy

MOV

#FWKEY+FSSEL1+FN0,&FCTL2 ; SMCLK/2

MOV

#FWKEY,&FCTL3

; Clear LOCK

MOV

#FWKEY+WRT,&FCTL1

; Enable write

MOV

#0123h,&0FF1Eh

; 0123h −> 0FF1Eh

L2 BIT

#BUSY,&FCTL3

; Test BUSY

JNZ

L2

; Loop while busy

MOV

#FWKEY,&FCTL1

; Clear WRT

MOV

#FWKEY+LOCK,&FCTL3

; Set LOCK

...

; Re-enable WDT?

Advertising