In System Programming and In Application Programming
In System Programming (ISP)
To develop a good program for ISP function, the user has to understand the architecture of the
embedded flash.
The embedded flash consists of 31 pages. Each page contains 512 bytes.
Dealing with flash, the user must erase it in page unit before writing (programming) data into
it.
Erasing flash means setting the content of that flash to FFh. Two erase modes are available in
this chip. One is mass mode and the other is page mode. The mass mode gets more
performance, but it erases the entire flash. The page mode has less performance, but it is
flexible because it erases flash in page unit.
Unlike RAM’s real-time operation, to erase flash or to write (program) flash often takes longer
time to finish.
Furthermore, it is a quite complex timing procedure to erase/program flash. Fortunately, the
MPC82x54A carried with convenient mechanism to help the user read/change the flash
content. Just filling the target address and data into several SFR, and triggering the built-in
ISP automation, the user can easily erase, read, and program the embedded flash.
There are several SFR designed to help the user implement the ISP functionality.
SFR: IFD (ISP Flash Data register)
Bit-7
Bit-6
Bit-5
Bit-4
Bit-3
Bit-2
Bit-1
Bit-0
Data to be written into flash, or data got from flash
IFD is the data port register for ISP/IAP operation. The data in IFD will be written into the desired
address in operating ISP write and it is the data window of readout in operating ISP read.
SFR: IFADRH (ISP Flash Address High byte)
Bit-7
Must be cleared to 00
IFADRH is the high byte address for all ISP/IAP operation.
Bit-6
Bit-5
Bit-4
Bit-3
Bit-2
Bit-1
Bit-0
ISP/IAP address High byte
Against in advertise effect, if one bit of IFADRH [7:6] is set, the ISP write function must fail.
SFR: IFADRL (ISP Flash Address Low byte)
Bit-7
Bit-6
Bit-5
Bit-4
Bit-3
Bit-2
Bit-1
Bit-0
Bit-0
ISP/IAP address Low byte
IFADRL is the low byte address for all ISP/IAP operation.
SFR: IFMT (ISP Flash-operating Mode Table)
Bit-7
Bit-6
Bit-5
Bit-4
Bit-3
Bit-2
Bit-1
-
-
-
-
-
reserve0
Mode Selection
60
MPC82x54A Data Sheet
MEGAWIN