Hardware Reference
In-Depth Information
Step 2
Write the program or erase command to the command buffer.
Step 3
Clear the CBEIF flag by writing a 1 to it to launch the command. The clearing of the CBEIF
flag indicates that the command was successfully launched. The CBEIF flag will be set
again, indicating that the address, data, and command buffers are ready for a new command
sequence to begin. A summary of the programming algorithm is shown in Figure 14.17.
Start
No
Is FDIVLD bit set?
Write FCLKDIV register
Ye s
Write array address and
program data
Write program command $20
to the FCMD register
Write $80 to register FSTAT
to clear the CBEIF bit
Ye s
Protection
violation check
Write $20 to FSTAT
to clear the PVIOL bit
Bit PVIOL
set?
No
Ye s
Write $10 to FSTAT to
clear the ACCERR bit
Access
error check
Bit ACCERR
set?
No
Address, data,
command buffer
empty check
Ye s
Ye s
Next
write?
Bit CBEIF
set?
No
No
Command
completion check
No
Bit CCIF
set?
Ye s
Stop
Figure 14.17 HCS12 flash memory program algorithm
If an HCS12 device has multiple flash memory blocks, we need to clear the ACCERR and
PVIOL flags in all blocks and also set the BKSEL bits in the FCNFG register properly to select
the desired block for erasure or programming.
 
Search WWH ::




Custom Search