AN2400 Freescale Semiconductor / Motorola, AN2400 Datasheet - Page 22

no-image

AN2400

Manufacturer Part Number
AN2400
Description
HCS12 NVM Guidelines
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
AN2400/D
Flash Memory
Protection
22
Filling unused Flash with the op-code for the STOP instruction, $183E, does
not give a good solution for two reasons. First, the STOP instruction is disabled
by the ‘S’ bit in the CPU Condition Codes register. If the S bit is set, the STOP
instruction is treated like a 2-cycle NOP and the microcontroller does not stop.
Furthermore, the $3E op-code may read first, and this corresponds to the WAI
instruction. The WAI instruction stops the CPU but not the peripherals, so the
op-code for the next STOP instruction is not executed.
Each Flash block may be protected against accidental erasure or
programming. Flash protection is controlled by a Flash Protection register
(FPROT). On microcontrollers that have multiple Flash blocks, there is a
separate Flash Protection register for each Flash block. In this case the Flash
Protection registers share a common address, with the active register selected
by means of the Bank Select bits within the Flash Configuration register. During
the microcontroller reset sequence, the Flash Protection registers for each
Flash block are loaded from programmed bytes within a Flash block. For
example, for the MC9S12DP256, location $FF0A controls protection for block
three, $FF0B controls protection for block two, $FF0C controls protection for
block one and $FF0D controls protection for block zero, as shown in
Flash Protection and Security Memory Locations for
values of each FPROT register determine whether the entire block or just
subsections are protected from being accidentally erased or programmed.
Software can write to the FPROT registers to increase the amount of protected
Flash by clearing additional bits in the register. It is possible to decrease the
amount of protected Flash by setting bits in the FPROT register only in special
modes.
Each Flash block can be entirely protected, or can have one or two separate
protected areas. One of these areas, known as the lower protected block, starts
at a point 32k bytes below the maximum Flash block address and is extendable
towards higher addresses. The other, known as the upper protected block,
Freescale Semiconductor, Inc.
For More Information On This Product,
Table 4. Flash Protection and Security Memory Locations for
Go to: www.freescale.com
HCS12 NVM Guidelines
$FF00
$FF08
Address
$FF0C
$FF0D
$FF0A
$FF0B
$FF0E
$FF0F
$FF07
$FF09
MC9S12DP256
Flash Block 3 Protection Byte
Flash Block 2 Protection Byte
Flash Block 1 Protection Byte
Flash Block 0 Protection Byte
Security Backdoor Key
Security Byte
Description
Reserved
Reserved
MC9S12DP256. The
MOTOROLA
Table 4.

Related parts for AN2400