beautypg.com

Texas Instruments MSP430x1xx User Manual

Page 420

background image

Flash Memory Data Structure and Operation

C-8

Table C–1. Control Bits for Write or Erase Operation

FUNCTION PERFORMED

SEGWRT

WRT

Meras

Erase

BUSY

WAIT

Lock

Write word or byte

0

1

0

0

0

0

0

Write word or byte in same segment, segment

write mode

1

1

0

0

0

1

0

Erase one segment by writing to any address

in the target segment (0 to n or A or B)

0

0

0

1

0

0

0

Erase all segments (0 to n) but not the informa-

tion memory (SegmentA and SegmentB)

0

0

1

0

0

0

0

Erase all segments (0 to n and A and B) by writ-

ing to any address in the flash memory module

0

0

1

1

0

0

0

Note:

A write to flash memory performed with any other combination of bits SEGWRT, WRT, Meras, Eras, BUSY, WAIT, and
Lock will result in an access violation. ACCVIFG is set and an NMI is requested if ACCVIE=1.

C.2.4 Flash Memory Status During Code Execution

The flash memory module delivers data for code execution in the same
manner as any masked ROM or RAM. The flash memory module should be
in read mode, with no write (programming) or erase operation active. By
default, power-on reset (POR) puts the flash memory into read mode. No
control bits need to be defined in the flash memory control registers after POR
for code execution.

C.2.5 Flash Memory Status During Erase

The default bit level of the flash memory is 1. Any successful erase sets all bits
of a segment or a block to this default level. Once a bit is programmed to the
0-level, only the erase function can reset it back to 1. Erase can be performed
for one segment, a group of segments, or for an entire module. This can vary
for each device configuration, and the exact implementation should be noted
in the data sheet.

The erase operation starts with the following sequence:

1) Set the correct input-clock frequency of the timing generator by selecting

the clock source and predivider.

2) Reset the LOCK control bit, if set.

3) Watch the BUSY bit. Continue to the next steps only if the BUSY bit is re-

set.

4) Set the erase control bit

Erase to erase a segment, or

5) Set the

mass-erase control bit MEras to erase a group of segments or

6) Set the

mass-erase (MEras) and erase (Erase) control bits to erase the

entire flash memory

7) Execute a dummy write to any address in the range to be erased.