
NuMicro® NUC029LEE/NUC029SEE
32-bit Arm
®
Cortex
®
-M0 Microcontroller
Aug, 2018
Page
151
of
497
Rev 1.00
N
U
MICRO
®
N
UC02
9L
E
E
/N
UC029
S
E
E
T
E
CHN
ICA
L R
E
F
E
R
E
NC
E
M
A
NU
A
L
Power
On
CBS = 11b ?
Fetch code from
AP-ROM
Fetch code from
LD-ROM
YES
NO
Switch to boot from
LDROM?
CBS = 01b ?
Run Application
Switch to boot from
APROM?
Run ISP Loader
NO
NO
Set BS = 1
Set CPU_RST = 1
Unlock
Protected
Registers
Set BS = 0
Set CPU_RST = 1
Unlock
Protected
Registers
Figure 6.4-5 Example Flow of Boot Selection by BS Bit
Updating APROM by software in LDROM or updating LDROM by software in APROM can avoid a
system failure when update fails.
The ISP controller supports to read, erase and program embedded flash memory. Several control
bits of ISP controller are write-protected, thus it is necessary to unlock before we can set them. To
unlock the protected register bits, software needs to write 0x59, 0x16 and 0x88 sequentially to
REGWRPROT. If register is unlocked successfully, the value of REGWRPROT will be 1. The
unlock sequence must not be interrupted by other access; otherwise it may fail to unlock.
After unlocking the protected register bits, user needs to set the ISPCON control register to
decide to update LDROM, User Configuration, APROM and enable ISP controller.
Once the ISPCON register is set properly, user can set ISPCMD for erase, read or programming.
Set ISPADR for target flash memory based on flash memory origination. ISPDAT can be used to
set the data to program or used to return the read data according to ISPCMD.
Finally, set ISPGO bit of ISPTRG control register to perform the relative ISP function. The ISPGO
bit is self-cleared when ISP function has been done. To make sure ISP function has been finished
before CPU goes ahead, ISB instruction is used right after ISPGO setting.
Several error conditions are checked after ISP is completed. If an error condition occurs, ISP
operation is not started and the ISP fail flag will be set instead. ISPFF flag can only be cleared by
software. The next ISP procedure can be started even ISPFF bit is kept as 1. Therefore, it is
recommended to check the ISPFF bit and clear it after each ISP operation if it is set to 1.
When the ISPGO bit is set, CPU will wait for ISP operation to finish during this period; the
peripheral still keeps working as usual. If any interrupt request occurs, CPU will not service it till
ISP operation is finished. When ISP operation is finished, the ISPGO bit will be cleared by