53
3850 Group (Spec. H/A)
SINGLE-CHIP 8-BIT CMOS MICROCOMPUTER
MITSUBISHI MICROCOMPUTERS
Outline Performance (CPU Rewrite Mode)
CPU rewrite mode is usable in the single-chip or Boot mode. The
only User ROM area can be rewritten in CPU rewrite mode.
In CPU rewrite mode, the CPU erases, programs and reads the in-
ternal flash memory by executing software commands. This
rewrite control program must be transferred to the RAM before it
can be executed.
The MCU enters CPU rewrite mode by applying 5 V ± 0.5 V to the
CNV
SS
pin and setting
“
1
”
to the CPU Rewrite Mode Select Bit (bit
1 of address 0FFE
16
). Software commands are accepted once the
mode is entered.
Use software commands to control program and erase operations.
Whether a program or erase operation has terminated normally or
in error can be verified by reading the status register.
Figure 58 shows the flash memory control register.
Bit 0 is the RY/BY status flag used exclusively to read the operat-
ing status of the flash memory. During programming and erase
operations, it is
“
0
”
(busy). Otherwise, it is
“
1
”
(ready).
Bit 1 is the CPU Rewrite Mode Select Bit. When this bit is set to
“
1
”
, the MCU enters CPU rewrite mode. Software commands are
accepted once the mode is entered. In CPU rewrite mode, the
CPU becomes unable to access the internal flash memory directly.
Therefore, use the control program in the RAM for write to bit 1. To
set this bit to
“
1
”
, it is necessary to write
“
0
”
and then write
“
1
”
in
succession. The bit can be set to
“
0
”
by only writing
“
0
”
.
Bit 2 is the CPU Rewrite Mode Entry Flag. This flag indicates
“
1
”
in
CPU rewrite mode, so that reading this flag can check whether
CPU rewrite mode has been entered or not.
Bit 3 is the flash memory reset bit used to reset the control circuit
of internal flash memory. This bit is used when exiting CPU rewrite
mode and when flash memory access has failed. When the CPU
Rewrite Mode Select Bit is
“
1
”
, setting
“
1
”
for this bit resets the
control circuit. To set this bit to
“
1
”
, it is necessary to write
“
0
”
and
then write
“
1
”
in succession. To release the reset, it is necessary
to set this bit to
“
0
”
.
Bit 4 is the User Area/Boot Area Select Bit. When this bit is set to
“
1
”
, Boot ROM area is accessed, and CPU rewrite mode in Boot
ROM area is available. In Boot mode, this bit is set to
“
1
”
auto-
matically. Reprogramming of this bit must be in the RAM.
Figure 59 shows a flowchart for setting/releasing CPU rewrite
mode.
Fig.58 Structure of flash memory control register
F
F
l
M
a
s
C
h
R
m
e
m
o
r
y
c
o
n
t
r
o
l
r
e
g
i
s
t
e
r
(
a
d
d
r
e
s
s
0
F
F
E
1
6
)
(
N
o
t
e
1
)
RY/BY status flag
0: Busy (being programmed or erased)
1: Ready
CPU rewrite mode select bit (
Note 2
)
0: Normal mode (Software commands invalid)
1: CPU rewrite mode (Software commands acceptable)
CPU rewrite mode entry flag
0: Normal mode
1: CPU rewrite mode
Flash memory reset bit
(Note 3
)
0: Normal operation
1: Reset
User ROM area / Boot ROM area select bit
(Note 4
)
0: User ROM area accessed
1: Boot ROM area accessed
Reserved bits (Indefinite at read/
“
0
”
at write)
b0
b7
N
o
t
e
s 1
:
T
R
F
t
w
U
T
h
O
o
i
s
i
l
s
h
s
e
U
e
M
r
l
b
e
i
s
t
t
s
e
c
t
h
p
e
t
i
n
t
o
v
i
r
o
h
b
g
h
n
e
s
c
g
e
i
t
e
t
r
b
e
e
c
i
b
c
e
s
i
n
i
o
t
d
n
e
o
s
i
t
o
t
s
n
t
o
u
r
n
v
a
3
n
,
e
a
t
r
l
t
t
r
o
t
b
,
t
o
i
d
o
o
f
h
e
t
e
l
“
l
f
i
h
d
p
w
1
p
l
a
s
i
s
d
r
h
”
r
o
s
a
e
h
d
t
b
u
o
g
e
.
g
d
t
o
i
t
r
i
r
a
n
m
r
w
n
g
m
t
h
e
e
“
1
m
s
s
”
i
l
l
t
h
i
e
o
i
,
n
a
n
C
r
y
e
t
i
h
P
e
b
n
e
U
c
o
s
u
e
t
e
a
r
n
e
s
r
r
e
t
r
v
r
e
a
a
r
o
e
n
t
l
.
i
t
l
d
e
t
r
e
a
e
g
r
d
“
1
i
s
a
s
”
t
e
.
t
o
.
A
r
a
r
e
“
X
X
X
0
0
0
0
1
”
j
u
s
t
a
f
t
e
r
r
e
s
e
t
r
e
l
e
a
s
e
.
I
n
t
h
e
m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