
MS51
Nov. 28, 2019
Page
249
of 491
Rev 1.00
MS51
32K
SE
RIES
TE
CHNICAL RE
F
EREN
CE MA
N
UAL
6.3
Flash Memory Control
6.3.1
In-Application-Programming (IAP)
Unl
ike RAM’s real-time operation, to update Flash data often takes long time. Furthermore, it is a quite
complex timing procedure to erase, program, or read Flash data. The MS51 carried out the Flash
operation with convenient mechanism to help user re-programming the Flash content by In-
Application-Programming (IAP). IAP is an in-circuit electrical erasure and programming method
through software.
After IAP enabling by setting IAPEN (CHPCON.0 with TA protected) and setting the enable bit in
IAPUEN that allows the target block to be updated, user can easily fill the 16-bit target address in
IAPAH and IAPAL, data in IAPFD, and command in IAPCN. Then the IAP is ready to begin by setting
a triggering bit IAPGO (IAPTRG.0). Note that IAPTRG is also TA protected. At this moment, the CPU
holds the Program Counter and the built-in IAP automation takes over to control the internal charge-
pump for high voltage and the detail signal timing. The erase and program time is internally controlled
disregard of the operating voltage and frequency. Nominally, a page-erase time is 5 ms and a byte-
program time is 23.5
μs. After IAP action completed, the Program Counter continues to run the
following instructions. The IAPGO bit will be automatically cleared. An IAP failure flag, IAPFF
(CHPCON.6), can be check whether the previous IAP operation was successful or not. Through this
progress, user can easily erase, program, and verify the Flash Memory by just taking care of pure
software.
IAP Commands
6.3.1.1
The MS51 provides a wide range of applications to perform IAP to APROM, LDROM, or CONFIG
bytes. The IAP action mode and the destination of the Flash block are defined by IAP control register
IAPCN.
IAP Mode
IAPCN
IAPA[15:0]
{IAPAH, IAPAL}
IAPFD[7:0]
IAPB
[1:0]
FOEN
FCEN
FCTRL
[3:0]
Company ID read
XX
[1]
0
0
1011
X
DAH
Device ID read
XX
0
0
1100
Low-byte DID: 0000H
High-byte DID: 0001H
Low-byte DID
High-byte DID
96-bit Unique Code read
XX
0
0
0100
0000H to 000BH
Data out
APROM page-erase
00
1
0
0010
Address in
[2]
FFH
LDROM page-erase
01
1
0
0010
Address in
[2]
FFH
APROM byte-program
00
1
0
0001
Address in
Data in
LDROM byte-program
01
1
0
0001
Address in
Data in
APROM byte-read
00
0
0
0000
Address in
Data out
LDROM byte-read
01
0
0
0000
Address in
Data out
All CONFIG bytes erase
11
1
0
0010
0000H
FFH