Crystal or ceramic resonator range of 31.25 kHz to
38.4 kHz or 1 MHz to 16 MHz
– Internal Clock Source (ICS) — FLL controlled by
internal or external reference; precision trimming of
internal reference allows 0.2% resolution and 2%
deviation; supports CPU freq. from 2 to 50.33 MHz
• System Protection
– Watchdog computer operating properly (COP) reset
with option to run from dedicated 1-kHz internal clock
source or bus clock
– Low-voltage detection with reset or interrupt; selectable
trip points
– Illegal opcode and illegal address detection with
programmable reset or exception response
– Flash block protection
• Development Support
– Single-wire background debug interface
– 4 PC plus 2 address (optional data) breakpoint registers
with programmable 1- or 2-level trigger response
– 64-entry processor status and debug data trace buffer
with programmable start/stop conditions
• ADC — 24-channel, 12-bit resolution; 2.5 μs conversion
time; automatic compare function; 1.7 mV/°C temperature
sensor; internal bandgap reference channel; operation in
stop3; fully functional from 3.6V to 1.8V
• ACMPx — Two analog comparators with selectable
interrupt on rising, falling, or either edge of comparator
output; compare option to fixed internal bandgap reference
voltage; outputs can be optionally routed to TPM module;
operation in stop3
• SCIx — Two SCIs with full duplex non-return to zero
(NRZ); LIN master extended break generation; LIN slave
extended break detection; wake up on active edge
• SPIx— Two serial peripheral interfaces with Full-duplex
or single-wire bidirectional; Double-buffered transmit and
receive; MSB-first or LSB-first shifting
• IICx — Two IICs with; Up to 100 kbps with maximum bus
loading; Multi-master operation; Programmable slave
address; Interrupt driven byte-by-byte data transfer;
supports broadcast mode and 10 bit addressing
• TPMx — One 6-channel and two 3-channel; Selectable
input capture, output compare, or buffered edge- or
center-aligned PWMs on each channel
• RTC — 8-bit modulus counter with binary or decimal
based prescaler; External clock source for precise time
base, time-of-day, calendar or task scheduling functions;
Free running on-chip low power oscillator (1 kHz) for
cyclic wake-up without external components
• Input/Output
– 70 GPIOs and 1 input-only and 1 output-only pin
– 16 KBI interrupts with selectable polarity
– Hysteresis and configurable pull-up device on all input
pins; Configurable slew rate and drive strength on all
output pins.
– SET/CLR registers on 16 pins (PTC and PTE)
– 16 bits of Rapid GPIO connected to the CPU’s
high-speed local bus with set, clear, and toggle
functionality
Get the latest version from freescale.com
MCF51QE128 Reference Manual
Covers MCF51QE128
MCF51QE64
MCF51QE32
Related Documentation:
• MCF51QE128 (Data Sheet)
Contains pin assignments and diagrams, all electrical
specififications, and mechanical drawing outlines.
Find the most current versions of all documents at:
http://www.freescale.com
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc.
12.4.8 Fixed Frequency Clock ...................................................................................................258
12.4.9 The ICS presents the divided FLL reference clock as ICSFFCLK for use as an additional
clock source. ICSFFCLK frequency must be no more than 1/4 of the ICSOUT frequency to be
valid. Local Clock 258
A.1Changes between Rev. 2 and Rev. 3 .............................................................................................421
MCF51QE128 MCU Series Reference Manual, Rev. 3
22Freescale Semiconductor
Get the latest version from freescale.com
Chapter 1
Device Overview
The MCF51QE128, MCF51QE64, and MCF51QE32 are members of the low-cost, low-power,
high-performance Version 1 (V1) ColdFire family of 32-bit microcontroller units (MCUs). All MCUs in
the family use the enhanced V1 ColdFire core and are available with a variety of modules, memory sizes,
and package types. CPU clock rates on these devices can reach 50.33 MHz. Peripherals operate up to
25.165 MHz.
1.1Devices in the MCF51QE128/64/32 Series
Table 1-1 summarizes the feature set available in the MCF51QE128/64/32 series of MCUs.
t
Flash size (Kbytes)1286432
RAM size (Kbytes)888
Pin quantity80646464
Version 1 ColdFire core with debugyes
ACMP1yes
Table 1-1. MCF51QE128 Series Features by MCU and Package
FeatureMCF51QE128MCF51QE64MCF51QE32
ACMP2yes
ADC channels24202020
ICSyes
IIC1yes
IIC2yes
KBI16
Por t I/O
Rapid GPIOyes
COP yes
RTCyes
SCI1yes
SCI2yes
SPI1yes
SPI2yes
Interrupt Controlleryes
1, 2
MCF51QE128 MCU Series Reference Manual, Rev. 3
70545454
Freescale Semiconductor23
Get the latest version from freescale.com
Chapter 1 Device Overview
Table 1-1. MCF51QE128 Series Features by MCU and Package (continued)
FeatureMCF51QE128MCF51QE64MCF51QE32
External IRQyes
Low-Voltage Detect (LVD)yes
TPM1 channels3
TPM2 channels3
TPM3 channels6
XOSCyes
1
Port I/O count does not include the input-only PTA5/IRQ/TPM1CLK/RESET or the output-only
PTA4/ACMP1O/BKGD/MS.
2
16 bits associated with Ports C and E are shadowed with ColdFire Rapid GPIO module.
1.2MCU Block Diagram
The block diagram in Figure 1-1 shows the structure of the MCF51QE128/64/32 MCU.
Table 1-2 provides the functional version of the on-chip modules
Table 1-2. Module Versions
ModuleVersion
Analog Comparator(ACMP)4
Analog-to-Digital Converter(ADC)1
V1 ColdFire Core(CF1_CORE)1
V1 ColdFire Interrupt Controller(CF1_INTC)1
V1 ColdFire Debug Module(CF1_DEBUG)1
General Purpose I/O(GPIO)2
Inter-Integrated Circuit(IIC)2
Internal Clock Source(ICS)3
Keyboard Interrupt(KBI)2
Low-Power Oscillator(OSCVLP)1
Port Set/Clear(PSC)1
Rapid GPIO(RGPIO)1
Real-Time Counter(RTC)1
Serial Communications Interface(SCI)4
Serial Peripheral Interface(SPI)3
Timer Pulse Width Modulator(TPM)3
Voltage Regulator(PMCx)1
1.3V1 ColdFire Core
The MCF51QE128/64/32 devices contain the Version 1 (V1) ColdFire core optimized for area and
low-power. This CPU implements ColdFire instruction set architecture revision C (ISA_C):
•No hardware support for MAC/EMAC and DIV instructions
1
•Provides upward compatibility to all other ColdFire cores (V2–V5)
For more details on the V1 ColdFire core, see Chapter 7, “ColdFire Core”.
1.4System Clocks
This section discusses on-chip clock generation and distribution for the MCF51QE128/64/32 devices.
1.4.1Internal Clock Source (ICS) Module
Figure 1-2 shows a simplified view of the internal clock source module. For clarity, only one of three
available FLL modules is shown.
1. These operations can be emulated via software functions.
MCF51QE128 MCU Series Reference Manual, Rev. 3
26Freescale Semiconductor
Get the latest version from freescale.com
Chapter 1 Device Overview
DCO
Filter
RDIV
TRIM
/ 2
9
External Reference
IREFS
Clock Source
Block
CLKS
n=0-7
/ 2
n
n=0-3
/ 2
n
Internal
Reference
Clock
BDIV
9
ICSLCLK
ICSOUT
ICSIRCLK
EREFS
RANGE
EREFSTEN
HGO
Optional
IREFSTEN
ICSERCLK
Internal Clock Source Block
LP
ICSFFCLK
ERCLKEN
IRCLKEN
DCOOUT
FLL
RDIV_CLK
RTC
Figure 1-2. Simplified ICS Block Diagram
1.4.2System Clock Distribution
Figure 1-3 shows a simplified clock connection diagram. Some modules in the MCU have selectable clock
inputs as shown. The clock inputs to the modules indicate the clock(s) used to drive the module function.
All memory mapped registers associated with the modules (except RGPIO) are clocked with the peripheral
clock (BUSCLK). The RGPIO registers are clocked with the CPU clock (ICSOUT). With the exception
of the oscillator clock supplied directly to the RTC, the ICS supplies all clock sources:
•ICSOUT — This clock source is used throughout the core including the CPU. For consistency, it
is known simply as the CPU clock. It is divided by two to generate the peripheral bus clock. Control
bits in the ICS control registers determine which of three clock sources is connected:
— Internal reference clock
— External reference clock
— Frequency-locked loop (FLL) output
See Chapter 12, “Internal Clock Source (S08ICSV3),” for details on configuring the ICSOUT
clock.
•ICSLCLK — This clock source is derived from the 10/20 MHz DCO (digitally controlled
oscillator) of the ICS when the ICS is configured to run off of the internal or external reference
clock. Development tools can select this internal self-clocked source (~10 MHz) to speed up BDC
communications in systems where the bus clock is slow.
Freescale Semiconductor27
MCF51QE128 MCU Series Reference Manual, Rev. 3
Get the latest version from freescale.com
Chapter 1 Device Overview
TPM1TPM2TPM3
SCI1 &
SPI1 &
RAM
CPU &
ADCFLASHGPIO
ICS
ICSOUT
÷2
BUSCLK
ICSLCLK
ICSERCLK
COP
* The fixed frequency clock (FFCLK) is internally
synchronized to the bus clock and must not
exceed one half of the bus clock frequency.
Flash has frequency
requirements for program
and erase operation.
See the MCF51QE128 Data Sheet for details.
ADC has min and max
frequency requirements.
See the ADC chapter
and the MCF51QE128 Data Sheet for details.
XOSC
EXTAL
XTAL
ACMP1 &
FFCLK*
ICSFFCLK
RTC
TPM1CLK
ICSIRCLK
÷2
PMC
IIC1 &
TPM3CLK
TPM2CLK
SYNC*
LPOCLK
BDC
1KHz LPO
OSCOUT
Debug
SCI2
SPI2ACMP2
IIC2
INTC
RGPIO
Figure 1-3. System Clock Distribution Diagram
•OSCOUT — This is the direct output of the external oscillator module and can be selected as the
real-time counter clock source. See Chapter 14, “Real-Time Counter (S08RTCV1),” for more
information.
•ICSERCLK — This is the external reference clock and can be selected as the real-time counter
clock source or the alternate clock for the ADC module. Section 11.4.7, “External Reference
Clock,” explains the ICSERCLK in more detail. See Chapter 11, “Analog-to-Digital Converter
(S08ADC12V1),” for more information regarding the use of ICSERCLK with this module.
•ICSIRCLK — This is the internal reference clock and can be selected as the real-time counter clock
source. Section 11.4.6, “Internal Reference Clock,” explains the ICSIRCLK in more detail. See
Chapter 14, “Real-Time Counter (S08RTCV1),” for more information regarding the use of
ICSIRCLK.
•ICSFFCLK — This generates the fixed frequency clock (FFCLK) after being synchronized to the
bus clock. It can be selected as clock source for the TPM modules. The frequency of the
ICSFFCLK is determined by the settings of the ICS. See Section 11.4.8, “Fixed Frequency Clock,”
for details.
•LPOCLK — This clock is generated from an internal low-power oscillator that is completely
independent of the ICS module. The LPOCLK can be selected as the clock source to the RTC or
COP modules. See Chapter 14, “Real-Time Counter (S08RTCV1),” and Section 5.3.1, “Computer
Operating Properly (COP) Watchdog,” for details on using the LPOCLK with these modules.
•TPMxCLK — TPMxCLKs are optional external clock sources for the TPM modules. The
TPMxCLK must be limited to 1/4 the frequency of the bus clock for synchronization. See
Section 16.2.1, “External TPM Clock Sources,” for more details.
28Freescale Semiconductor
MCF51QE128 MCU Series Reference Manual, Rev. 3
Get the latest version from freescale.com
Chapter 1 Device Overview
The ADC module also has an internally generated asynchronous clock that allows it to run in stop mode
(ADACK). This signal is not available externally and is not shown in this figure.
1.4.3ICS Modes of Operation
There are seven modes of operation for the internal clock source (ICS) module: FEI, FEE, FBI, FBILP,
FBE, FBELP, and stop. These are shown in Figure 1-4. The IREFS and CLKS fields are contained within
the ICS module definition. The LP bit is part of the on-chip power management controller (PMC) block.
It is the responsibility of the software to ensure that the system bus frequency is less than 125 kHz and the
FLLs are disengaged prior to enabling switching the LP bit to enable FBELP and FBILP modes of
operation.
The clock source for the BDC is controlled by the debug CLKSW bit, discussed later in this document.
Choices for the BDC clock are ICSOUT and the output from the 10MHz bus / 20 MHz CPU clock FLL.
1.4.3.1FLL Engaged Internal (FEI)
In FLL engaged internal mode, which is the default mode, the ICS supplies a clock derived from one of
three on chip FLLs, which are controlled by the internal reference clock. Upon exiting reset, the default
FLL generates the 10 MHz bus/20 MHz CPU clocks.
1.4.3.2FLL Engaged External (FEE)
In FLL engaged external mode, the ICS supplies a clock derived from one of the three FLLs, which are
controlled by an external reference clock.
1.4.3.3FLL Bypassed Internal (FBI)
In FLL bypassed internal mode, the FLLs are enabled and controlled by the internal reference clock, but
are bypassed. The ICS supplies a clock derived from the internal reference clock.
1.4.3.4FLL Bypassed Internal Low-Power (FBILP)
In FLL bypassed internal low-power mode, the FLLs are disabled and bypassed, and the ICS supplies a
clock derived from the internal reference clock.
1.4.3.5FLL Bypassed External (FBE)
In FLL bypassed external mode, the FLLs are enabled and controlled by an external reference clock, but
are bypassed. The ICS supplies a clock derived from the external reference clock. The external reference
clock can be an external crystal/resonator supplied by an OSC controlled by the ICS, or it can be another
external clock source.
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor29
Get the latest version from freescale.com
Chapter 1 Device Overview
FLL Bypassed
Internal LowPower(FBILP)
IREFS=1
CLKS=00
LP=0
Entered from any state when
MCU enters stop with
ENBDM=0.
FLL Engaged
Internal (FEI)
FLL Bypassed
Internal (FBI)
FLL Bypassed
External (FBE)
FLL Engaged
External (FEE)
FLL Bypassed
External LowPower(FBELP)
IREFS=0
CLKS=00
LP=0
IREFS=0
CLKS=10
LP=0
Returns to state that was active
before MCU entered stop, unless
reset occurs while in stop.
IREFS=0
CLKS=10
LP=1
IREFS=1
CLKS=01
LP=0
IREFS=1
CLKS=01
LP=1
Stop
1.4.3.6FLL Bypassed External Low-Power (FBELP)
In FLL bypassed external low-power mode, the FLLs are disabled and bypassed, and the ICS supplies a
clock derived from the external reference clock. The external reference clock can be an external
crystal/resonator supplied by an OSC controlled by the ICS, or it can be another external clock source.
1.4.3.7Stop (STOP)
In stop mode, the FLLs are disabled and the internal or external reference clocks can be selected to be
enabled or disabled. The ICS does not provide an MCU clock source unless the debug ENBDM bit is set.
Figure 1-4. ICS Modes of Operation
MCF51QE128 MCU Series Reference Manual, Rev. 3
30Freescale Semiconductor
Get the latest version from freescale.com
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor31
Get the latest version from freescale.com
Chapter 1 Device Overview
MCF51QE128 MCU Series Reference Manual, Rev. 3
32Freescale Semiconductor
Get the latest version from freescale.com
Chapter 2
Pins and Connections
This section describes signals that connect to package pins. It includes pinout diagrams, recommended
system connections, and detailed discussions of signals.
2.1Device Pin Assignment
Figure 2-1 shows the 80-pin assignments for the MCF51QE128 devices. Figure 2-2 shows the 64-pin
assignments for the MCF51QE128/64/32 devices.
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor33
Get the latest version from freescale.com
Chapter 2 Pins and Connections
V
REFH
V
SSAD
V
DD
V
REFL
V
DDAD
V
SS
PTB7/SCL1/EXTAL
PTH7/SDA2
PTD0/KBI2P0/SPSCK2
PTD1/KBI2P1/MOSI2
PTE6/RGPIO6
PTB6/SDA1/XTAL
PTH6/SCL2
PTE7/RGPIO7/TPM3CLK
PTH1
PTH0
PTH3
PTH2
PTH5
PTH4
PTC2/RGPIO10/TPM3CH2
PTB4/TPM2CH1/MISO1
PTB5/TPM1CH1/SS1
PTC3/RGPIO11/TPM3CH3
PTD7/KBI2P7
PTC0/RGPIO8/TPM3CH0
PTC1/RGPIO9/TPM3CH1
PTD6/KBI2P6
PTD5/KBI2P5
PTB3/KBI1P7/MOSI1/ADP7
PTB2/KBI1P6/SPSCK1/ADP6
PTE5/RGPIO5
PTF7/ADP17
PTF6/ADP16
PTF5/ADP15
PTF4/ADP14
PTD4/KBI2P4
V
DD
V
SS
PTA7/TPM2CH2/ADP9
PTB1/KBI1P5/TxD1/ADP5
PTB0/KBI1P4/RxD1/ADP4
PTA2/KBI1P2/SDA1/ADP2
PTA3/KBI1P3/SCL1/ADP3
PTA6/TPM1CH2/ADP8
PTD3/KBI2P3/SS2
PTD2/KBI2P2/MISO2
PTE4/RGPIO4
PTF0/ADP10
PTF1/ADP11
PTF2/ADP12
PTF3/ADP13
PTE2/RGPIO2/MISO1
PTA5/IRQ/TPM1CLK/RESE
T
PTA4/ACMP1O/BKGD/MS
PTA0/KBI1P0/TPM1CH0/ADP0/ACMP1+
PTC7/RGPIO15 /TxD2/ACMP2-
PTC5/RGPIO13/TPM3CH5/ACMP2O
PTC4/RGPIO12/TPM3CH4/RSTO
PTC6/RGPIO14/RxD2/ACMP2+
PTE0/RGPIO0/TPM2CLK/SPSCK1
PTE1/RGPIO1/MOSI1
PTE3/RGPIO3/SS1
PTG3/ADP19
PTG2/ADP18
PTG1
PTG0
PTG7/ADP23
PTG6/ADP22
PTG5/ADP21
PTG4/ADP20
PTJ4
PTJ5
PTJ6
PTJ7
PTJ1
PTJ0
PTJ3
PTJ2
PTA1/KBI1P1/TPM2CH0/ADP1/ACMP1-
Pins in bold are added from the next smaller package.
RESET pin can only be used to reset into user mode; it cannot be used to enter BDM. Entry into BDM is accomplished by holding BGKD low during
POR or setting CSR2[BDFR] with BGKD held low after issuing the BDM write command.
2
RESET/IRQ features have optional internal pullup device.
3
RC filter on RESET/IRQ pin recommended for noisy environments.
(NOTE 3)
(NOTE 1)
(NOTE 2)
36Freescale Semiconductor
Figure 2-3. Basic System Connections
MCF51QE128 MCU Series Reference Manual, Rev. 3
Get the latest version from freescale.com
Chapter 2 Pins and Connections
2.2.1Power
VDD and VSS are the primary power supply pins for the MCU. This voltage source supplies power to all
I/O buffer circuitry and to an internal voltage regulator. The internal voltage regulator provides regulated
lower-voltage source to the CPU and other internal circuitry of the MCU.
Typically, application systems have two separate capacitors across the power pins. In this case, there
should be a bulk electrolytic capacitor, such as a 10μF tantalum capacitor , to provide bulk charge storage
for the overall system and a 0.1μF ceramic bypass capacitor located as close to the MCU power pins as
practical to suppress high-frequency noise. The MCF51QE128/64/32has two VDD pins. Each pin must
have a bypass capacitor for best noise suppression.
V
DDAD
and V
are the analog power supply pins for the MCU. This voltage source supplies power to
SSAD
the ADC module. A 0.1μF ceramic bypass capacitor should be located as close to the MCU power pins as
practical to suppress high-frequency noise.
2.2.2Oscillator
Immediately after reset, the MCU uses an internally generated clock provided by the internal clock source
(ICS) module. For more information on the ICS, see Chapter 12, “Internal Clock Source (S08ICSV3)”.
The oscillator (XOSC) in this MCU is a Pierce oscillator that can accommodate a crystal or ceramic
resonator. Optionally, an external clock source can be connected to the EXTAL input pin.
Refer to Figure 2-3 for the following discussion. RS (when used) and RF should be low-inductance
resistors such as carbon composition resistors. Wire-wound resistors, and some metal film resistors, have
too much inductance. C1 and C2 normally should be high-quality ceramic capacitors specifically designed
for high-frequency applications.
RF is used to provide a bias path to keep the EXT AL input in its linear range during crystal startup; its value
is not generally critical. T ypical systems use 1 MΩ to 10 MΩ . Higher values are sensitive to humidity and
lower values reduce gain and (in extreme cases) could prevent startup.
C1 and C2 are typically in the 5pF to 25pF range and are chosen to match the requirements of a specific
crystal or resonator. Be sure to take into account printed circuit board (PCB) capacitance and MCU pin
capacitance when selecting C1 and C2. The crystal manufacturer typically specifies a load capacitance that
is the series combination of C1 and C2 (which are usually the same size). As a first-order approximation,
use 10pF as an estimate of combined pin and PCB capacitance for each oscillator pin (EXT AL and XTAL).
2.2.3RESET and RSTO
After a power-on reset (POR), the PTA5/IRQ/TPM1CLK/RESET pin defaults to a general-purpose input
port pin, PTA5. Setting RSTPE in SOPT1 configures the pin to be the RESET
RESET, the pin remains RESET until the next POR. The RESET pin can be used to reset the MCU from
an external source when the pin is driven low. When enabled as the RESET
configured as an input with an internal pullup device automatically enabled.
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor37
Get the latest version from freescale.com
pin. After configured as
pin (RSTPE = 1), the pin is
Chapter 2 Pins and Connections
NOTE
The RESET pin does not contain a clamp diode to VDD and should not be
driven above VDD.
NOTE
In EMC-sensitive applications, an external RC filter is recommended on the
RESET pin, if enabled. See Figure 2-3 for an example.
After a power-on reset (POR), the PTC4/RGPIO12/TPM3CH4/RSTO pin defaults to a general-purpose
port pin, P TC4. Setting RSTOPE in SOPT1 configures the pin as an open drain with internal pullup acting
as reset out (RSTO). The RSTO pin reflects the current state of the internal MCU reset signal. As long as
the MCU is not in a reset state, the RSTO pin is driven high. When an internal reset occurs and RSTPE is
set, the RSTO pin is pulled low for as long as the internal reset signal is low. This allows other devices in
the system to detect the MCU’s reset state.
When enabled as the RSTO pin (RSTOPE = 1), the pin is automatically configured as an output only . The
RSTO pin can be enabled independently of the RESET pin. After being configured as RSTO, the pin
remains in this mode until the next POR.
NOTE
The RSTO pullup should not be used as a pullup for components external to
the MCU. Inputs to internal gates connected to this pin are resistively pulled
high, but VDD is not seen at the pin itself.
2.2.4Background / Mode Select (BKGD/MS)
During a power-on-reset (POR) or background debug force reset (see the BDFR bit in Section 18.3.3,
“Configuration/Status Register 2 (CSR2),” for more information), the PTA4/ACMP1O/BKGD/MS pin
functions as a mode select pin. Immediately after any reset, the pin functions as the background data pin
and can be used for background debug communication.
The debug communication function is enabled when SOPT1[BKGDPE] is set. When enabled as the
BKGD/MS pin (BKGDPE = 1), an internal pullup device is automatically enabled. BKGDPE is set
following any reset of the MCU and must be cleared to use the PTA4/ACMP1O/BKGD/MS pin’s
alternative pin functions.
If this pin is unconnected, the MCU enters normal operating mode at the rising edge of the internal reset
after a POR or forced BDC reset. If a debug system is connected to the 6-pin standard background debug
header, it can hold BKGD/MS low during a POR or immediately after issuing a background debug force
1
, which forces the MCU to halt mode.
reset
The BKGD/MS pin is used primarily for background debug controller (BDC) communications using a
custom protocol that uses 16 clock cycles of the target MCU’s BDC clock per bit time. The target MCU’s
BDC clock can be as fast as the bus clock rate, so there should never be any significant capacitance
connected to the BKGD/MS pin that could interfere with background serial communications.
1. Specifically, BKGD must be held low through the first 16 cycles after deassertion of the internal reset.
MCF51QE128 MCU Series Reference Manual, Rev. 3
38Freescale Semiconductor
Get the latest version from freescale.com
Chapter 2 Pins and Connections
Although the BKGD/MS pin is a pseudo open-drain pin, the background debug communication protocol
provides brief, actively driven, high speed-up pulses to ensure fast rise times. Small capacitances from
cables and the absolute value of the internal pullup device play almost no role in determining rise and fall
times on the BKGD/MS pin.
2.2.5ADC Reference Pins (V
The V
REFH
and V
pins are the voltage reference high and voltage reference low inputs, respectively ,
REFL
REFH
, V
REFL
)
for the ADC module.
2.2.6General-Purpose I/O and Peripheral Ports
The MCF51QE128/64/32series of MCUs support up to 70 general-purpose I/O pins, 1 input-only pin, and
1 output-only pin, which are shared with on-chip peripheral functions (timers, serial I/O, ADC, ACMP,
etc.).
When a port pin is configured as a general-purpose output or a peripheral uses the port pin as an output,
software can select one of two drive strengths and enable or disable slew rate control. When a port pin is
configured as a general-purpose input or a peripheral uses the port pin as an input, software can enable a
pull-up device. Immediately after reset, all of these pins are configured as high-impedance
general-purpose inputs with internal pull-up devices enabled.
PTC4 is a special case I/O pin. When the PTC4/RGPIO12/TPM3CH4/RSTO pin is configured as RSTO,
it is an open drain output with an internal pullup. The voltage observed on the pin is not pulled to VDD,
and an external pullup resistor is recommended if this pin must drive off-chip signals.
PTA5/IRQ/TPM1CLK/RESET is also a special case I/O pin. It can only be configured as an input.
When an on-chip peripheral system is controlling a pin, data direction control bits still determine what is
read from the port data registers, even though the peripheral controls the pin direction via the pin’ s output
buffer enable. For information about controlling these pins as general-purpose I/O pins, see Chapter 6,
“Parallel Input/Output Control”.
NOTE
T o avoid extra current drain from floating input pins, the reset initialization
routine in the application program should enable on-chip pullup devices or
change the direction of unused or non-bonded pins to outputs so they do not
float.
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor39
Get the latest version from freescale.com
Chapter 2 Pins and Connections
Table 2-1. Pin Assignment by Package and Pin Sharing Priority
Pin
Number
Lowest←⎯Priority⎯→Highest
8064Port PinAlt 1Alt 2Alt 3Alt 4
11PTD1KBI2P1MOSI2
22PTD0KBI2P0SPSCK2
33PTH7SDA2
44 PTH6SCL2
5— PTH5
6— PTH4
75PTE7RGPIO7TPM3CLK
86V
97V
108V
119V
1210V
1311V
1412PTB7SCL1EXTAL
1513PTB6SDA1XTAL
16—PTH3
17—PTH2
1814PTH1
1915PTH0
2016PTE6RGPIO6
2117PTE5RGPIO5
2218PTB5TPM1CH1SS1
2319PTB4TPM2CH1MISO1
2420PTC3RGPIO11TPM3CH3
2521PTC2RGPIO10TPM3CH2
2622PTD7KBI2P7
2723PTD6KBI2P6
2824PTD5KBI2P5
29—PTJ7
30—PTJ6
31—PTJ5
32—PTJ4
3325PTC1RGPIO9TPM3CH1
3426PTC0RGPIO8TPM3CH0
3527PTF7ADP17
3628PTF6ADP16
3729PTF5ADP15
3830PTF4ADP14
3931PTB3KBI1P7MOSI1
1
4032PTB2KBI1P6SPSCK1ADP6
4133PTB1KBI1P5TxD1ADP5
4234PTB0KBI1P4RxD1ADP4
43—PTJ3
DD
DDAD
REFH
REFL
SSAD
SS
ADP7
MCF51QE128 MCU Series Reference Manual, Rev. 3
40Freescale Semiconductor
Get the latest version from freescale.com
Table 2-1. Pin Assignment by Package and Pin Sharing Priority (continued)
Pin
Number
Lowest←⎯Priority⎯→Highest
8064Port PinAlt 1Alt 2Alt 3Alt 4
44—PTJ2
4535PTF3ADP13
4636PTF2ADP12
4737PTA7TPM2CH2ADP9
4838PTA6TPM1CH2ADP8
4939PTE4RGPIO4
5040VDD
5141VSS
5242PTF1ADP11
5343PTF0ADP10
54—PTJ1
55—PTJ0
5644PTD4KBI2P4
5745PTD3KBI2P3SS2
5846PTD2KBI2P2MISO2
5947PTA3KBI1P3SCL1
6048PTA2KBI1P2SDA1ADP2
6149PTA1KBI1P1TPM2CH0ADP1ACMP1-
6250PTA0KBI1P0TPM1CH0ADP0ACMP1+
6351PTC7RGPIO15TxD2ACMP2-
6452PTC6RGPIO14RxD2ACMP2+
65—PTG7ADP23
66—PTG6ADP22
67—PTG5ADP21
68—PTG4ADP20
6953PTE3RGPIO3SS1
7054PTE2RGPIO2MISO1
7155PTG3ADP19
7256PTG2ADP18
7357PTG1
7458PTG0
7559PTE1RGPIO1MOSI1
7660PTE0RGPIO0TPM2CLKSPSCK1
7761PTC5RGPIO13TPM3CH5ACMP2O
7862PTC4RGPIO12TPM3CH4RSTO
7963PTA5IRQTPM1CLKRESET
8064PTA4
1
SPI1 pins (SS1, MISO1, MOSI1, and SPSCK2) can be repositioned using
3
ACMP1OBKGDMS
2
ADP3
SOPT2[SPI1PS]. Default locations are PTB5, PTB4, PTB3, and PTB2, respectively.
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor41
Get the latest version from freescale.com
Chapter 2 Pins and Connections
2
IIC1 pins (SCL1 and SDA1) can be repositioned using SOPT2[IIC1PS]. Default
locations are PTA3 and PTA2, respectively.
3
PTA4/ACMP1O/BKGD/MS is limited to output-only for the port I/O function.
MCF51QE128 MCU Series Reference Manual, Rev. 3
42Freescale Semiconductor
Get the latest version from freescale.com
Chapter 3
Modes of Operation
3.1Introduction
The operating modes of the MCF51QE128/64/32 are described in this chapter . Entry into each mode, exit
from each mode, and functionality while in each of the modes are described.
The overall system mode is generally a function of a number of separate, but inter-related variables: debug
mode, security mode, power mode, and clock mode. Clock modes were discussed in Section 1.4.3, “ICS
Modes of Operation”. This chapter explores the other dimensions of the system operating mode.
3.2Features
•Debug mode for code development. For V1 ColdFire devices, such as MCF51QE128/64/32 ,
debug mode is mutually exclusive with use of secure mode (next item).
•Secure mode — BDC access to CPU resources is extremely restricted. It is possible to tell that the
device has been secured, and to clear security, which involves mass erasing the on-chip flash
memory. No other CPU access is allowed. Secure mode can be used in conjunction with each of
the power modes below.
•Run mode — CPU clocks can be run at full speed and the internal supply is fully regulated.
•LPrun mode — CPU and peripheral clocks are restricted to 250 kHz CPU clock and 125 kHz bus
clock maximum and the internal supply is in soft regulation.
•Wait mode — CPU shuts down to conserve power; peripheral clocks are running and full
regulation is maintained.
•LPwait mode — CPU shuts down to conserve power; peripheral clocks are running at reduced
speed (125 kHz maximum) and the internal voltage regulator is running in loose regulation mode.
•Stop modes — System (CPU and peripheral) clocks are stopped.
— Stop4 — All internal circuits are powered (full regulation mode) and internal clock sources still
at max frequency for fastest recovery.
— Stop3 — All internal circuits are loosely regulated and clocks sources are at minimal values
(125 kHz maximum), providing a good compromise between power utilization and speed of
recovery.
— Stop2 — Partial power-down of internal circuits; RAM content is retained. The lowest power
mode for this device. A reset is required to return from stop2 mode.
On the MCF51QE128/64/32 , wait, stop2, stop3, and stop4 are all entered via the CPU STOP instruction.
See Table 3-1, Figure 3-2, and subsequent sections of this chapter for details.
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor43
Get the latest version from freescale.com
Chapter 3 Modes of Operation
STOP
SOPT1[STOPE]
SOPT1[WAITE]
SPMSC1[LVDE]
SPMSC1[LVDSE]
SPMSC2[PPDC]
In Stop Mode
Partial Power Down
Standby Enable
CSR2[ENBDM]
SPMSC2[LPR]
LVD O f f
Standby
3.3Overview
The ColdFire CPU has two primary user modes of operation, run and stop. (The CPU also supports a halt
mode that is used strictly for debug operations.) The STOP instruction is used to invoke stop and wait
modes for this family of devices.
If the WAITE control bit is set when STOP is executed, the wait mode is entered. Otherwise, if the STOPE
bit is set, the CPU enters one of the stop modes. It is illegal to execute a STOP instruction if neither STOPE
or WAITE are set. This results in reset assertion if CPUCR[IRD] is cleared or an illegal instruction
exception if CPUCR[IRD] is set.
The MCF51QE128/64/32 devices augment stop, wait, and run in a number of ways. The power
management controller (PMC) can run the device in fully-regulated mode, standby mode, and partial
power-down mode. Standby (loose regulation) or partial power-down can be programmed to occur
naturally as a result of a STOP instruction. Additionally, standby mode can be explicitly invoked via the
LPR (low-power) bit in the PMC. Use of standby is limited to bus frequencies less than 125 kHz; and
neither standby nor partial power-down are allowed when the ENBDM bit is set to enable debugging in
stop and wait modes.
During partial power-down mode, the regulator is in standby mode and much of the digital logic on the
chip is switched off. These interactions can be seen schematically in Figure 3-1. This figure is for
conceptual purposes only. It does not reflect any sequence or time dependencies between the PMC and
other parts of the device, nor does it represent any actual design partitioning.
It is illegal for the software to have PPDC and LPR asserted concurrently. This restriction arises because
the sequence of events from normal to low-power modes involves use of both bits. After entering a
low-power mode, it is not possible to switch to another low-power mode.
44Freescale Semiconductor
Figure 3-1. MCF51QE128/64/32 Power Modes - Conceptual Drawing
MCF51QE128 MCU Series Reference Manual, Rev. 3
Get the latest version from freescale.com
Table 3-1. CPU / Power Mode Selections
Chapter 3 Modes of Operation
SOPT1
SIM
Mode of Operation
STOPE
Run mode - processor and peripherals clocked
normally.
LPrun mode with low voltage detect disabled processor and peripherals clocked at low
2
frequency
Low voltage detects are not active.
Wait mode - processor clock nominally inactive, but
peripherals are clocked.
LPwait mode - processor clock is inactive,
peripherals are clocked at low frequency and the
PMC is loosely regulating.
Low voltage detects are not active.
Stop modes disabled; Illegal opcode reset if STOP
instruction executed and CPUCR[IRD] is cleared,
else illegal instruction exception is generated.
Stop4 - Either low-power modes have not been
requested, or low voltage detects are enabled or
ENBDM = 1.
Stop3 - Low voltage detect in stop is not enabled.
Clocks must be at low frequency and are gated. The
regulator is in loose regulation.
Stop2 - Low voltage detects are not active. If BDC is
enabled, stop4 is invoked rather than stop2.
1
.
ENBDM is located in the upper byte of the XCSR register which is write-accessible only through BDC commands, see
xx
xx
x
x
00
10
100
10
CSR2
BDC
WAITE
1
10
Function
of BKGD/
MS at
reset
SPMSC1
PMC
1
LV DE
ENBDM
xxx
11xx
1 xxxx
0x
0
01
xxx
11xx
1 xxxxOn
0x
1
⇒1⇒1⇒0⇒0⇒On
xxx
1110
x
1101
x
1 xxxx
1
0x
10
0x
SPMSC2
PMC
LPR
LV DS E
0x
10
0
0x
10
0
00
0
10
01N/AN/A Off
CPU and
Peripheral Clocks
PPDC
On. ICS in any
mode
Low freq required.
ICS in FBELP
mode.
Periph clocks on.
CPU clock on if
ENBDM=1.
CPU clock is off.
Periph clocks at
low speed.
ICS in FBELP.
Peripheral clocks
off. CPU clock on if
ENBDM=1.
CPU clock on.
Periph clocks off.
Low freq required.
ICS in FBELP
mode. CPU and
peripheral clocks
are gated off.
Effects on Sub-System
BDC Clock
On
Note: When not
needed, the BDC
clock can be gated
off at the discretion
250 kHz maximum CPU frequency in LPrun; 125 kHz maximum peripheral clock frequency.
Switched
Power
Onx
Loose Reg
Onx
Loose Reg
⇒On
On
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor45
Get the latest version from freescale.com
Chapter 3 Modes of Operation
ModeRegulator State
RunFull On
WaitFull On
Stop4Full On
LPrunStandby
LPwaitStandby
Stop3Standby
Stop2Partial Power Off
Stop3
Stop2
LPwait
Stop4
Wait
RunLPrun
Figure 3-2. Allowable Power Mode Transitions for Mission Mode MCF51QE128/64/32
Figure 3-2 illustrates mission mode state transitions allowed between the legal states shown in Table 3-1.
PTA5/IRQ/TPM1CLK/RESET must be asserted low to exit stop2. Only interrupt assertion is necessary to
exit the other stop and wait modes.
Figure 3-3 takes the same set of states and transitions shown in Figure 3-2 and adds the BDM halt mode
for development purposes. If BDM is enabled, the chip automatically shifts LP modes into their fully
regulated equivalents. If software or debugger set the LPR bit in SPMSC2 while BDM is enabled, the
LPRS bit reflects the fact that the regulator is not in standby. Similarly, the PPDF does not indicate a
recovery from stop2 if ENBDM forced stop4 to occur in its place.
1
Stated another way , if ENBDM has been set via the BDM interface, then the power management controller
keeps (or puts) the regulator in full regulation despite other settings in the contrary. The states shown in
Figure 3-3 then map as follows:
•LPrun ⇒ Run
•LPwait ⇒ Wait
•Stop3 ⇒ Stop4
•Stop2 ⇒ Stop4
From a software perspective (and disregarding PMC status bits), the system remains in the appropriate
low-power state, and can be debugged as such.
See Section 3.7, “Wait Modes,” for a description of the various ways to enter halt mode.
1. This can have subtle impacts on recovery from stop. The IRQ input can wake the device from stop4 if it has been enabled for
that purpose. That same pin wakes the device from stop2 even when the IRQ is not enabled (there is an asynchronous path to
the power management controller in that state).
46Freescale Semiconductor
MCF51QE128 MCU Series Reference Manual, Rev. 3
Get the latest version from freescale.com
Figure 3-3. All Allowable Power Mode Transitions for MCF51QE128/64/32
Stop3
1
Stop2
LPwait
Stop4
Wait
RunLPrun
48
7
6
2
53
Halt
9
11
10
Table 3-2 defines triggers for the various state transitions shown in Figure 3-2.
Table 3-2 . Tr i g g ers fo r Transiti o n s Shown in Figure 3-2
Transition #FromToTrigger
Chapter 3 Modes of Operation
RunLPrun
1
LPrunRun
RunStop2
2
Stop2Run
3
4
5
6
7
LPrunLPwait
LPwaitLPrunInterrupt when LPWUI=0
LPrunStop3Execute STOP instruction
Stop3LPrunInterrupt when LPWUI=0
LPwaitRunInterrupt when LPWUI=1
RunLPwaitNot supported.
RunWait
WaitRunInterrupt
RunStop4
Stop4RunInterrupt
Configure settings shown in Ta bl e 3 - 1, switch
LPR=1 last
Clear LPR
Interrupt when LPWUI=1
Negative transition on enabled BKGD/MS pin.
Pre-configure settings shown in Ta bl e 3 - 1, execute
STOP instruction
1
Assert zero on PTA5/IRQ/TPM1CLK/RESET
RTC timeout. Reload environment from RAM
Pre-configure settings shown in Ta bl e 3 - 1, execute
STOP instruction
Pre-configure settings shown in Ta bl e 3 - 1, execute
STOP instruction
Pre-configure settings shown in Ta bl e 3 - 1, execute
STOP instruction
or
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor47
Get the latest version from freescale.com
Chapter 3 Modes of Operation
Table 3-2. Triggers for Transitions Shown in Figure 3-2 (continued)
Transition #FromToTrigger
Stop3RunInterrupt when LPWUI=1
8
RunStop3
Stop4Halt
9
HaltStop4Not supported.
HaltRunGO instruction issued via BDM
Pre-configure settings shown in Ta bl e 3 - 1, execute
STOP instruction
When a BACKGROUND command is received
through the BKGD/MS pin (ENBDM must equal
one).
10
11
1
An analog connection from this pin to the on-chip regulator wakes up the regulator, which then initiates a
power-on-reset sequence.
RunHalt
WaitHalt
HaltWaitNot supported.
When a BACKGROUND command is received
through the BKGD/MS pin OR
When a HALT instruction is executed OR
When encountering a BDM breakpoint
When a BACKGROUND command is received
through the BKGD/MS pin (ENBDM must equal
one).
Individual power states are discussed in more detail in the following sections.
3.4Debug Mode
Debug mode functions are managed through the background debug controller (BDC) in the Version 1
ColdFire core. The BDC provides the means for analyzing MCU operation during software development.
The debug interface is used to program a bootloader or user application program into the flash program
memory before the MCU is operated in run mode for the first time. When the MCF51QE128/64/32 is
shipped from the Freescale Semiconductor factory , the flash program memory is erased by default unless
specifically noted, so there is no program that could be executed in run mode until the flash memory is
initially programmed. The debug interface can also be used to erase and reprogram the flash memory after
it has been previously programmed.
See Chapter 18, “Version 1 ColdFire Debug (CF1_DEBUG),” for more details regarding the debug
interface.
3.5Secure Mode
While the MCU is in secure mode, there are severe restrictions on which debug commands can be used.
In this mode, only the upper byte of the core’s XCSR, CSR2, and CSR3 registers can be accessed. See
Chapter 18, “Version 1 ColdFire Debug (CF1_DEBUG),” for details.
MCF51QE128 MCU Series Reference Manual, Rev. 3
48Freescale Semiconductor
Get the latest version from freescale.com
Chapter 3 Modes of Operation
3.6Run Modes
3.6.1Run Mode
Run mode is the normal operating mode for the MCF51QE128/64/32. This mode is selected when the
BKGD/MS pin is high at the rising edge of the internal reset signal. Upon exiting reset, the CPU fetches
the supervisor SR and initial PC from locations 0x(00)00_0000 and 0x(00)00_0004 in the memory map
and executes code starting at the newly set value of the PC.
3.6.2Low-Power Run Mode (LPrun)
In the low-power run mode, the on-chip voltage regulator is put into its standby (or loose regulation) state.
In this state, the power consumption is reduced to a minimum that allows CPU functionality. Power
consumption is reduced the most by disabling the clocks to all unused peripherals by clearing the
corresponding bits in the SCGC1 and SCGC2 registers1.
Before entering this mode, the following conditions must be met:
•FBELP2 is the selected clock mode for the ICS. See Section 12.1.5.6, “FLL Bypassed External
Low Power (FBELP),” for more details.
•ICSC2[HGO] is cleared.
•The bus frequency is less than 125 kHz.
•The ADC must be in low-power mode (ADLPC=1) or disabled.
•Low-voltage detect must be disabled. The LVDE and/or LVDSE bit in SPMSC1 register must be
cleared.
•Flash programming/erasing is not allowed
After these conditions are met, low-power run mode can be entered by setting SPMSC2[LPR].
T o re-enter standard run mode, clear the LPR bit. SPMSC2[LPRS] is a read-only status bit that can be used
to determine if the regulator is in full-regulation mode or not. When LPRS is cleared, the regulator is in
full-regulation mode and the MCU can run at full speed in any clock mode.
Assuming that SOP T1[BKGDPE] is set to enable BKGD/MS, the device also switches from LPrun to run
mode when it detects a negative transition on the BKGD/MS pin.
Low-power run mode also provides the option to return to full regulation if any interrupt occurs. This is
done by setting SPMSC2[LPWUI]. The ICS can then be set for full speed immediately in the interrupt
service routine.
3.6.2.1BDM in Low-Power Run Mode
Low-power run mode cannot be entered when the MCU is in active background debug mode.
If a device is in low-power run mode, a falling edge on an active BKGD/MS pin exits low-power run mode,
clears the LPR and LPRS bits, and returns the device to normal run mode.
1. System clock gating control registers 1 and 2
2. FLL bypassed external low-power
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor49
Get the latest version from freescale.com
Chapter 3 Modes of Operation
3.7Wait Modes
3.7.1Wait Mode
W ait mode is entered by executing a ST OP instruction after configuring the device as per Table 3-1. Upon
execution of the STOP instruction, the CPU enters a low-power state in which it is not clocked.
The V1 ColdFire core does not differentiate between stop and wait modes. Both are stop from the core’s
perspective. The difference between the two is at the device level. In stop mode, most peripheral clocks
are shut down. In wait mode, they continue to run.
XCSR[ENBDM] must be set prior to entering wait mode if the device is required to respond to BDM
commands once in wait.
When an interrupt request occurs, the CPU exits wait mode and resumes with exception processing,
beginning with the stacking operations leading to the interrupt service routine.
3.7.2Low-Power Wait Mode (LPwait)
Low-power wait mode is entered by executing a STOP instruction while the MCU is in low-power run
mode and configured per Table 3-1. In the low-power wait mode, the on-chip voltage regulator remains in
its standby state as in the low-power run mode. In this state, the power consumption is reduced to a
minimum that allows most modules to maintain funtionality. Power consumption is reduced the most by
disabling the clocks to all unused peripherals by clearing the corresponding bits in the SCGC registers.
Low-power run mode restrictions also apply to low-power wait mode.
If the LPWUI bit is set when the STOP instruction is executed, the voltage regulator returns to full
regulation when wait mode is exited. The ICS can be set for full speed immediately in the interrupt service
routine.
If the LPWUI bit is cleared when the STOP instruction is executed, the device returns to low-power run
mode.
Any reset exits low-power wait mode, clears the LPR bit, and returns the device to normal run mode.
3.7.2.1BDM in Low-Power Wait Mode
If a device is in low-power wait mode, a falling edge on an active BKGD/MS pin exits low-power wait
mode, clears the LPR and LPRS bits, and returns the device to normal run mode.
3.8Stop Modes
One of three stop modes is entered upon execution of a STOP instruction when SOP T1[STOPE] is set. The
SOP T1[WAITE] bit must be clear, else wait mode is entered. In stop3 mode, the bus and CPU clocks are
halted. If the ENBDM bit is set prior to entering stop4, only the peripheral clocks are halted. The ICS
module can be configured to leave the reference clocks running. See Chapter 12, “Internal Clock Source
(S08ICSV3),” for more information.
MCF51QE128 MCU Series Reference Manual, Rev. 3
50Freescale Semiconductor
Get the latest version from freescale.com
NOTE
If neither the WAITE nor STOPE bit is set when the CPU executes a STOP
instruction, the MCU does not enter either of the stop modes. Instead, the
MCU initiates an illegal opcode reset if CPUCR[IRD] is cleared or an
illegal instruction exception if CPUCR[IRD] is set.
The stop modes are selected by setting the appropriate bits in the system power management status and
control 2 (SPMSC2) register. Table 3-1 shows all of the control bits that affect mode selection under
various conditions. The selected mode is entered following the execution of a STOP instruction.
Most background commands are not available in stop mode. The memory-access-with-status commands
do not allow memory access, but they report an error indicating that the MCU is in either stop or wait
mode. The BACKGROUND command can be used to wake the MCU from stop4 and enter halt mode if
the ENBDM bit was set prior to entering stop. After entering halt mode, all background commands are
available.
3.8.1Stop2 Mode
Stop2 mode is entered by executing a STOP instruction under the conditions as shown in Table 3-1.
Most of the internal circuitry of the MCU is powered off in stop2 with the exception of the RAM and
optionally the R TC. Upon entering stop2, all I/O pin control signals are latched so that the pins retain their
states during stop2.
Exit from stop2 is performed by driving the wake-up pin (P TA5/IRQ/TPM1CLK/RESET) on the MCU to
zero.
NOTE
PTA5/IRQ/TPM1CLK/RESET
functions as an active-low wakeup input
when the MCU is in stop2, as long as the pin is configured as an input before
entering stop2. The pullup on this pin is not automatically enabled in stop2.
To enable the internal pullup, set PTAPE[PTAPE5].
In addition, the real-time counter (RTC) can wake the MCU from stop2, if enabled.
Upon wake-up from stop2 mode, the MCU starts up as from a power-on reset (POR):
•All module control and status registers are reset, with the exception of the power management
controller (SPMSC1/2/3), R TC, and debug trace buffer . Refer to the individual module chapters for
more information on which other registers are unaffected by wake-up from stop2 mode.
•The L VD reset function is enabled and the MCU remains in the reset state if V
is below the L VD
DD
trip point (low trip point selected due to POR).
•The CPU initiates reset exception processing by fetching the vectors at 0x(00)00_0000 and
0x(00)00_0004.
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor51
Get the latest version from freescale.com
Chapter 3 Modes of Operation
In addition to the above, upon waking up from stop2, SPMSC2[PPDF] is set. This flag is used to direct
user code to go to a stop2 recovery routine. PPDF remains set and the I/O pin states remain latched until
a 1 is written to SPMSC2[PPDACK].
Wakeup from stop2 can be initiated with an RTC interrupt. Unlike most other modules on the chip, the
RTC is not reset as a result of exiting stop2. This implies that the RTC interrupt is asserted (although
masked) upon exit from stop2.
To maintain I/O states for pins configured as general-purpose I/O before entering stop2, restore the
contents of the I/O port registers, which have been saved in RAM, to the port registers before writing to
the PPDACK bit. If the port registers are not restored from RAM before writing to PPDACK, the pins
switch to their reset states when PPDACK is written.
For pins that were configured as peripheral I/O, reconfigure the peripheral module that interfaces to the
pin before writing to PPDACK. If the peripheral module is not enabled before writing to PPDACK, the
pins are controlled by their associated port control registers when the I/O latches are opened.
3.8.1.1Low-Range Oscillator Considerations for Stop2
If using a low-range oscillator during stop2, reconfigure the ICSC2 register before PPDACK is written.
The low-range oscillator (ICSC2[RANGE] = 0) can operate in stop2 as the clock source for the RTC
module. If the low-range oscillator is active when entering stop2, it remains active in stop2 regardless of
the value of ICSC2[EREFSTEN]. T o disable the oscillator in stop2, switch the ICS into FBI or FEI mode
before executing the STOP instruction.
3.8.2Stop3 Mode
Stop3 mode is entered by executing a STOP instruction under the conditions as shown in Table 3-1. The
states of all of the internal registers and logic, RAM contents, and I/O pin states are maintained. The
on-chip regulator is placed in standby state.
Stop3 can be exited by asserting RESET or by an interrupt from one of the following sources: the RTC,
ADC, ACMP, IRQ, SCI, or KBI.
If stop3 is exited by the RESET
pin, the MCU is reset and operation resumes after taking the reset vector .
Exit by one of the internal interrupt sources results in the MCU taking the appropriate interrupt vector.
3.8.3Stop4: Low Voltage Detect or BDM Enabled in Stop Mode
Stop4 is differentiated from stop2 and stop3 in that the on-chip regulator is fully engaged.
Entry into halt mode from run mode is enabled if the XCSR[ENBDM] bit is set. This register is described
in Chapter 18, “Version 1 ColdFire Debug (CF1_DEBUG)”. If ENBDM is set when the CPU executes a
STOP instruction, the system clocks to the background debug logic remain active when the MCU enters
stop mode. Because of this, background debug communication remains possible. If you attempt to enter
stop2 or stop3 with ENBDM set, the MCU enters stop4 instead (see Table 3-1 for details).
MCF51QE128 MCU Series Reference Manual, Rev. 3
52Freescale Semiconductor
Get the latest version from freescale.com
Chapter 3 Modes of Operation
Stop4 is also entered if SPMSC1[LVDE, LVDSE] are set, enabling low voltage detect when the STOP
instruction is executed. The LVD may only be used when the on-chip regulator is in full regulation mode.
Thus, stop3 and stop2 modes are not compatible with use of the LVD.
The LVD system is capable of generating an interrupt or a reset when the supply voltage drops below the
LVD voltage.
Stop4 can be exited by asserting RESET or by an interrupt from one of the following sources: the RTC,
LVD, LVW, ADC, ACMPx, IRQ, SCI or the KBI.
3.9On-Chip Peripheral Modules in Stop and Low-Power Modes
When the MCU enters any stop mode (wait not included), system clocks to the internal peripheral modules
are stopped. Even in the exception case (ENBDM = 1), where clocks to the background debug logic
continue to operate, clocks to the peripheral systems are halted to reduce power consumption. Refer to
Section 3.8.1, “Stop2 Mode,” and Section 3.8.2, “Stop3 Mode,” for specific information on system
behavior in stop modes.
When the MCU enters LPwait or LPrun modes, system clocks to the internal peripheral modules continue
based on the settings of the clock gating control registers (SCGC1 and SCGC2).
Table 3-3 defines terms used in Table 3-4 to describe operation of components on the chip in the various
low-power modes.
Table 3-3. Abbreviations used in Tab l e 3- 4
Voltage RegulatorClocked
Full RegulationFullOnFullNoClk
Soft RegulationSoftOn
OffN/AOff
1
Subject to module enables and settings of System Clock Gating Control Registers 1 and 2 (SCGC1 and
SCGC2).
2
This ADC-specific mode defines the case where the device is fully regulated and the normal peripheral clock
is stopped. In this case, the ADC can run using its internally generated asynchronous ADACK clock.
3
Analog modules must be in their low-power mode when the device is operated in this state.
4
This ADC-specific mode defines the case where the device is in soft regulation and the normal peripheral
clock is stopped. In this case, the ADC can only be run using its low-power mode and internally generated
asynchronous ADACK clock.
LP mode for the ADC is invoked by setting ADLPC=1. ADACK is selected via the ADCCFG[ADICLK] field in the ADC. See
Chapter 11, “Analog-to-Digital Converter (S08ADC12V1),” for details.
2
LVD must be enabled to run in stop if converting the bandgap channel.
MCF51QE128 MCU Series Reference Manual, Rev. 3
54Freescale Semiconductor
Get the latest version from freescale.com
Chapter 3 Modes of Operation
3
FBELP refers to the ICS FLL bypassed external low-power state. See Chapter 12, “Internal Clock Source (S08ICSV3),” for
more details.
4
The PTA5/IRQ/TPM1CLK/RESET pin also has a direct connection to the on-chip regulator wakeup input. Asserting this pin
low while in stop2 triggers the PMC to wakeup. As a result, the device undergoes a power-on-reset sequence.
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor55
Get the latest version from freescale.com
Chapter 3 Modes of Operation
MCF51QE128 MCU Series Reference Manual, Rev. 3
56Freescale Semiconductor
Get the latest version from freescale.com
Chapter 4
0x(00)02_0000
0x(00)00_0000
0x(00)01_FFFF
CPU Address
0x(00)7F_FFFF
0x(00)80_0000
0x(00)80_1FFF
0x(00)80_2000
0x(00)BF_FFFF
0x(FF)FF_8000
0x(FF)FF_FFFF
MCF51QE128
Slave
0x(00)01_0000
Peripherals
64 Kbytes
Flash
0x(00)00_0000
0x(00)00_FFFF
CPU Address
0x(00)7F_FFFF
0x(00)80_0000
Unimplemented
0x(00)BF_FFFF
0x(FF)FF_8000
0x(FF)FF_FFFF
MCF51QE64
0x(00)C0_0000
0x(00)C0_000F
ColdFire
Rapid GPIO
0x(00)C0_0000
0x(00)C0_000F
0x(00)C0_0010
0x(FF)FF_7FFF
0x(00)C0_0010
0x(FF)FF_7FFF
Unimplemented
Slave
RAM
8 Kbytes
Peripherals
128 Kbytes
Flash
Unimplemented
Unimplemented
ColdFire
Rapid GPIO
Unimplemented
Slave
RAM
8 Kbytes
0x(00)00_8000
Peripherals
32 Kbytes
Flash
0x(00)00_0000
0x(00)00_7FFF
CPU Address
0x(00)7F_FFFF
0x(00)80_0000
0x(00)80_1FFF
Unimplemented
0x(00)80_2000
0x(00)BF_FFFF
Unimplemented
0x(FF)FF_8000
0x(FF)FF_FFFF
MCF51QE32
ColdFire
Rapid GPIO
0x(00)C0_0000
0x(00)C0_000F
0x(00)C0_0010
0x(FF)FF_7FFF
Unimplemented
0x(00)80_1FFF
0x(00)80_2000
RAM
8 Kbytes
Unimplemented
Memory
4.1MCF51QE128/64/32 Memory Map
As shown in Figure 4-1, on-chip memory in the MCF51QE128/64/32 series of MCUs consists of RAM
and flash program memory for nonvolatile code and data storage, plus I/O and control/status registers.
NOTE
Version 1 ColdFire devices contain 24-bit internal address buses, while
previous ColdFire cores have 32-bit internal address buses. Because there
may be some resources that use a 32-bit address, this chapter shows 24-bit
and 32-bit addresses by indicating the extra upper byte in parentheses.
Freescale Semiconductor57
Figure 4-1. MCF51QE128/64/32 Memory Maps
MCF51QE128 MCU Series Reference Manual, Rev. 3
Get the latest version from freescale.com
Chapter 4 Memory
Regions within the memory map are subject to restrictions with regard to the types of allowable accesses.
These are outlined in Table 4-1. Non-supported access types terminate the bus cycle with an error and
would typically generate a system reset in response to the error termination.
Table 4-1. CPU Access Type Allowed by Region
ReadWrite
Base AddressRegion
ByteWordLongByteWordLong
0x(00)00_0000
0x(00)80_0000
0x(00)C0_0000
0x(FF)FF_8000
Flash
RAM
Rapid GPIO
Peripherals
xxx——x
xxxxxx
xxxxxx
xx—xx—
Consistent with past ColdFire devices, flash configuration data is located at 0x400.
The slave peripherals section of the memory map is further broken into the following sub-sections:
The section of memory at 0x(00)C0_0000 is assigned for use by the ColdFire Rapid GPIO module. See
Section 4.2.2, “ColdFire Rapid GPIO Memory Map,” for the rapid GPIO memory map and Section 6.4,
“V1 ColdFire Rapid GPIO Functionality,” for further details on the module.
The MCF51QE128/64/32 devices utilize an 8-bit peripheral bus. The bus bridge from the ColdFire system
bus to the peripheral bus is capable of serializing 16-bit accesses into two 8-bit accesses. This can be used
to speed access to properly aligned peripheral registers. Note, not all peripheral registers are aligned to take
advantage of this feature.
CPU accesses to those parts of the memory map marked as unimplemented in Figure 4-1 result in an illegal
address reset if CPUCR[ARD] is cleared or an address error exception if CPUCR[ARD] is set.
The lower 32K of flash memory and slave peripherals sections of the memory map are most efficiently
accessed using the ColdFire absolute short addressing mode. RAM is most efficiently accessed using the
A5-relative addressing mode (address register indirect with displacement mode).
4.2Register Addresses and Bit Assignments
Peripheral registers in the MCF51QE128/64/32 are divided into two groups:
•Direct-page registers are located at 0x(FF)FF_8000 in the memory map.
•High-page registers are located at 0x(FF)FF_9800 in the memory map.
There is no functional advantage to locating peripherals in the direct page versus the high page
peripheral space for the MCF51QE128/64/32. Both sets of registers may be efficiently accessed
using the ColdFire absolute short addressing mode. The areas are differentiated to maintain
documentation compatibility with the MC9S08QE128/64/32, where there are significant
performance issues.
Peripheral register locations for MCF51QE128/64/32 are shifted
0x(FF)FF_8000 compared with the MC9S08QE128/64/32 devices.
•The ColdFire interrupt controller module is mapped in the peripheral space and occupies a 64-byte
space at the upper end of memory. Accordingly, its address decode is defined as
0x(FF)FF_FFC0–0x(FF)FF_FFFF. This 64-byte space includes the program-visible registers as
well as the space used for interrupt acknowledge (IACK) cycles.
•There is a nonvolatile register area consisting of a 16-byte block locted in flash memory at
0x(00)00_0400–0x(00)00_040F. Nonvolatile register locations include:
— NVPROT and NVOPT are loaded into working registers at reset
— An 8-byte backdoor comparison key that optionally allows a user to gain controlled access to
secure memory
Because the nonvolatile register locations are flash memory , they must be erased and programmed
like other flash memory locations.
Table 4-2 is a summary of all user-accessible direct-page registers and control bits.
The register names in column two in Table 4-2, Table 4-3, Table 4-6, and Table 4-7 are shown in bold to
set them apart from the bit names to the right. Cells not associated with named bits are shaded. A shaded
cell with a 0 indicates this unused bit always reads as a 0. Shaded cells with dashes indicate unused or
reserved bit locations that could read as 1s or 0s. When writing to these bits, write a 0 unless otherwise
specified.
Recall that ColdFire uses a big-endian, byte-addressable memory architecture. The most significant byte
of each address is the lowest numbered as shown in Figure 4-2. Multi-byte operands (16-bit words and
32-bit longwords) are referenced using an address pointing to the most significant (first) byte.
Figure 4-2. ColdFire Memory Organization
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor59
Get the latest version from freescale.com
Chapter 4 Memory
Table 4-2. Direct-Page Register Summary (Sheet 1 of 4)
Several reserved flash memory locations, shown in Table 4-4, are used for storing values used by
corresponding peripheral registers. These registers include an 8-byte backdoor key that can be used to gain
access to secure memory resources. During reset events, the contents of the flash protection byte
(NVPROT) and flash nonvolatile byte (NVOPT) in the reserved flash memory are transferred into the
corresponding FPROT and FOPT registers in the high-page register area to control security and block
protection options.
Table 4-4. Reserved Flash Memory Addresses
Address
0x(00)00_03FC
0x(00)00_0400
0x(00)00_0404
1
MSB
(0x0)(0x1)(0x2)
Reserved
FTRIM
(bit 0)
Backdoor comparison key bytes 0–3
byte0byte1byte2byte3
Backdoor comparison key bytes 4–7
byte4byte5byte6byte7
LSB
(0x3)
TRIM
2
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor67
Get the latest version from freescale.com
Chapter 4 Memory
Address
Table 4-4. Reserved Flash Memory Addresses
1
MSB
(0x0)(0x1)(0x2)
LSB
(0x3)
2
0x(00)00_0408
0x(00)00_040C
1
MSB = most significant byte
2
LSB = least significant byte
ReservedNVPROTReservedNVOPT
Reserved
Table 4-5. Reserved Flash Memory Addresses
Address Register76543210
0x(00)00_03FC–
0x(00)00_03FD
0x(00)00_03FE
0x(00)00_03FF
Reserved
Storage of
FTRIM
Storage of
ICSTRM
0x(00)00_0400–
0x(00)00_0407
0x(00)00_0408–
0x(00)00_040C
Reserved
0x(00)00_040DNVPROT
————————
0000000FTRIM
TRIM
8-Byte Backdoor Comparison Key
————————
FPSFPOPEN
0x(00)00_040E
0x(00)00_040F
Reserved————————
NVOPTKEYEN0000SEC
The factory trim values are stored in the flash information row (IFR)1 and are automatically loaded into
the ICSTRM and ICSSC registers after any reset. The oscillator trim values stored in TRIM and FTRIM
can be reprogrammed by third party programmers and must be copied into the corresponding ICS registers
(ICSTRM and ICSSC) by user code to override the factory trim.
NOTE
When the MCU is in active BDM, the trim value in the IFR is not loaded.
Instead, the ICSTRM register resets to 0x80 and ICSSC[FTRIM] resets to
zero.
Provided the key enable (KEYEN) bit is set, the 8-byte comparison key can be used to temporarily
disengage memory security . This key mechanism can be accessed only through user code running in secure
memory (A security key cannot be entered directly through background debug commands).This security
key can be disabled completely by clearing the KEYEN bit. If the security key is disabled, the only way
1.IFR — Nonvolatile information memory that can only be accessed during production test. During production test, system
initialization, configuration, and test information is stored in the IFR. This information cannot be read or modified in normal
user or background debug modes.
MCF51QE128 MCU Series Reference Manual, Rev. 3
68Freescale Semiconductor
Get the latest version from freescale.com
Chapter 4 Memory
to disengage security is by mass-erasing the flash (normally through the background debug interface) and
verifying the flash is blank.
4.2.2ColdFire Rapid GPIO Memory Map
The rapid GPIO module is mapped into a 16-byte area starting at location 0x(00)C0_0000. Its memory
map is shown below in Table 4-6.
Table 4-6. V1 ColdFire Rapid GPIO Memory Map
Address
0x(00)C0_0000
0x(00)C0_000176543210
0x(00)C0_0002
0x(00)C0_000376543210
0x(00)C0_0004
0x(00)C0_000576543210
0x(00)C0_0006
0x(00)C0_000776543210
0x(00)C0_0008
0x(00)C0_0009————————
0x(00)C0_000A
0x(00)C0_000B76543210
0x(00)C0_000C
0x(00)C0_000D
0x(00)C0_000E
0x(00)C0_000F76543210
Register
Name
RGPIO_DIR
RGPIO_DATA
RGPIO_ENB
RGPIO_CLR
Reserved
RGPIO_SET
Reserved
RGPIO_TOG
Bit 7654321Bit 0
15141312111098
15141312111098
15141312111098
15141312111098
————————
15141312111098
————————
————————
15141312111098
4.2.3ColdFire Interrupt Controller Memory Map
The V1 ColdFire interrupt controller (CF1_INTC) register map is sparsely-populated, but retains
compatibility with earlier ColdFire interrupt controller definitions. The CF1_INTC occupies the upper
64 bytes of the device memory map and all memory locations are accessed as 8-bit (byte) operands.
The MCF51QE128/64/32 includes up to 8 Kbytes of static RAM. RAM is most efficiently accessed using
the A5-relative addressing mode (address register indirect with displacement mode). Any single bit in this
area can be accessed with the bit manipulation instructions (BCLR, BSET,etc.).
At power-on, the contents of RAM are uninitialized. RAM data is unaffected by any reset provided that
the supply voltage does not drop below the minimum value for RAM retention (V
RAM
).
4.4Flash
The flash memory is intended primarily for program storage and read-only data. In-circuit programming
allows the operating program to be loaded into the flash memory after final assembly of the application
product. It is possible to program the entire array through the single-wire background debug interface.
Because no special voltages are needed for flash erase and programming operations, in-application
programming is also possible through other software-controlled communication paths.
MCF51QE128 MCU Series Reference Manual, Rev. 3
70Freescale Semiconductor
Get the latest version from freescale.com
Chapter 4 Memory
Flash memory is ideal for single-supply applications allowing for field reprogramming without requiring
external high voltage sources for program or erase operations. The flash module includes a memory
controller that executes commands to modify flash memory contents.
Array read access time is one bus cycle for bytes, aligned words, and aligned longwords. Multiple accesses
are needed for misaligned words and longword operands. For flash memory, an erased bit reads 1 and a
programmed bit reads 0. It is not possible to read from a flash block while any command is executing on
that specific flash block.
CAUTION
A flash block address must be in the erased state before being programmed.
Cumulative programming of bits within a flash block address is not allowed
except for status field updates required in EEPROM emulation applications.
Flash memory on MCF51QE128/64/32 must be programmed 32-bits at a time when the low-voltage detect
flag (LVDF) in the system power management status and control 1 register (SPMSC1) is clear. If
SPMSC1[LVDF] is set, the programming sequence must be modified such that odd and even bytes are
written separately. The MCF51QE128/64/32 flash memory is organized as two 16-bit wide blocks
interleaved to yield a 32-bit data path. When programming flash when LVDF is set, alternate bytes must
be set to 0xFF as shown in Table 4-8. Failure to adhere to these guidelines may result in a partially
programmed flash array.
Table 4-8. Lov-Voltage Programming Sequence Example
•Burst program command for faster flash array program times
•Single power supply program and erase
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor71
Get the latest version from freescale.com
Chapter 4 Memory
•Command interface for fast program and erase operation
•Up to 100,000 program/erase cycles at typical voltage and temperature
•Flexible block protection (on any 2-Kbyte memory boundary)
•Security feature to prevent unauthorized access to on-chip memory and resources
•Auto power-down for low-frequency read accesses
4.4.2Register Descriptions
The flash module contains a set of 16 control and status registers located between 0x(00)00_0000 and
0x(00)00_000F. Detailed descriptions of each register bit are provided in the following sections.
4.4.2.1Flash Clock Divider Register (FCDIV)
The FCDIV register controls the length of timed events in program and erase algorithms executed by the
flash memory controller. All bits in the FCDIV register are readable and writable with restrictions as
determined by the value of FDIVLD when writing to the FCDIV register.
76543210
R
FDIVLDPRDIV8FDIV
W
Reset00000000
Figure 4-3. Flash Clock Divider Register (FCDIV)
Table 4-9. FCDIV Field Descriptions
FieldDescription
7
FDIVLD
6
PRDIV8
5–0
FDIV
Clock Divider Load Control. When writing to the FCDIV register for the first time after a reset, the value of the
FDIVLD bit written controls the future ability to write to the FCDIV register:
0 Writing a 0 to FDIVLD locks the FCDIV register contents; all future writes to FCDIV are ignored.
1 Writing a 1 to FDIVLD keeps the FCDIV register writable; next write to FCDIV is allowed.
When reading the FCDIV register, the value of the FDIVLD bit read indicates the following:
0 FCDIV register has not been written to since the last reset.
1 FCDIV register has been written to since the last reset.
Enable Prescalar by 8
0 The bus clock is directly fed into the clock divider.
1 The bus clock is divided by 8 before feeding into the clock divider.
Clock Divider Bits. The combination of PRDIV8 and FDIV[5:0] must divide the bus clock down to a frequency
of 150 kHz–200 kHz. The minimum divide ratio is 2 (PRDIV8=0, FDIV=0x01) and the maximum divide ratio is
512 (PRDIV8=1, FDIV=0x3F). Refer to Section 4.5.1.1, “Writing the FCDIV Register” for more information.
.
4.4.2.2Flash Options Register (FOPT and NVOPT)
The FOP T register holds all bits associated with the security of the MCU and flash module. All bits in the
FOPT register are readable but are not writable.
MCF51QE128 MCU Series Reference Manual, Rev. 3
72Freescale Semiconductor
Get the latest version from freescale.com
Chapter 4 Memory
The FOPT register is loaded from the flash configuration field (see Section 4.2.1) during the reset
sequence, indicated by F in Figure 4-4.
The security feature in the flash module is described in Section 4.5.5, “Security”.
76543210
RKEYEN0000SEC
W
ResetFF0000FF
Figure 4-4. Flash Options Register (FOPT)
Table 4-10. FOPT Field Descriptions
FieldDescription
7–6
KEYEN
5–2Reserved, should be cleared.
1–0
SEC
Backdoor Key Security Enable Bits. The KEYEN[1:0] bits define the enabling of backdoor key access to the
flash module.
00 Disabled
01 Disabled (Preferred KEYEN state to disable Backdoor Key Access)
10 Enabled
11 Disabled
Flash Security Bits. The SEC[1:0] bits define the security state of the MCU. If the flash module is unsecured
using backdoor key access, the SEC[1:0] bits are forced to the unsecured state.
00 Unsecured
01 Unsecured
10 Secured
11 Unsecured
4.4.2.3Flash Configuration Register (FCNFG)
The FCNFG register gates the security backdoor writes.
KEYACC is readable and writable while all remaining bits read 0 and are not writable. KEYACC is only
writable if KEYEN is set to the enabled state (see Section 4.4.2.2, “Flash Options Register (FOPT and
NVOPT)”).
NOTE
Flash array reads are allowed while KEYACC is set.
76543210
R00
KEYACC
W
Reset00000000
00000
Figure 4-5. Flash Configuration Register (FCNFG)
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor73
Get the latest version from freescale.com
Chapter 4 Memory
Table 4-11. FCNFG Field Descriptions
FieldDescription
7–6Reserved, should be cleared.
5
KEYACC
4–0Reserved, should be cleared.
Enable Security Key Writing
0 Writes to the flash block are interpreted as the start of a command write sequence.
1 Writes to the flash block are interpreted as keys to open the backdoor.
4.4.2.4Flash Protection Register (FPROT and NVPROT)
The FPROT register defines which flash sectors are protected against program or erase operations. FPROT
bits are readable and writable as long as the size of the protected flash memory is being increased. Any
write to FPROT that attempts to decrease the size of the protected flash memory is ignored.
During the reset sequence, the FPROT register is loaded from the flash protection byte in the flash
configuration field (see Section 4.2.1), indicated by F in Table 4-6. To change the flash protection loaded
during the reset sequence, the flash sector containing the flash configuration field must be unprotected.
Then, the flash protection byte must be reprogrammed.
Trying to alter data in any protected area in the flash memory results in a protection violation error and
FSTAT[FPVIOL] is set. The mass erase of the flash array is not possible if any of the flash sectors
contained in the flash array are protected.
76543210
R
W
ResetFFFFFFFF
Figure 4-6. Flash Protection Register (FPROT)
Table 4-12. FPROT Field Descriptions
FieldDescription
7–1
FPS
0
FPOPEN
Flash Protection Size. With FPOPEN set, the FPS bits determine the size of the protected flash address range
as shown in Ta bl e 4 - 13 .
Flash Protection Open
0 Flash array fully protected.
1 Flash array protected address range determined by FPS bits.
Table 4-13. Flash Protection Address Range
FPSFPOPEN
FPSFPOPEN
Protected Address Range
Relative to Flash Array Base
Protected
Size
—00x0_0000–0x1_FFFF128 Kbytes
MCF51QE128 MCU Series Reference Manual, Rev. 3
74Freescale Semiconductor
Get the latest version from freescale.com
Table 4-13. Flash Protection Address Range (continued)
FPSFPOPEN
0x00–0x3F
0x400x0_0000–0x1_F7FF126 Kbytes
0x410x0_0000–0x1_EFFF124 Kbytes
0x420x0_0000–0x1_E7FF122 Kbytes
1
0x430x0_0000–0x1_DFFF120 Kbytes
0x440x0_0000–0x1_D7FF118 Kbytes
0x450x0_0000–0x1_CFFF116 Kbytes
0x460x0_0000-0x1_C7FF114 Kbytes
0x47
.........
0x5B0x0_0000–0x1_1FFF72 Kbytes
0x5C0x0_0000–0x1_17FF70 Kbytes
0x5D0x0_0000–0x1_0FFF68 Kbytes
0x5E0x0_0000–0x1_07FF66 Kbytes
0x5F0x0_0000–0x0_FFFF64 Kbytes
Protected Address Range
Relative to Flash Array Base
0x0_0000–0x1_FFFF128 Kbytes
0x0_0000–0x1_BFFF112 Kbytes
Protected
Size
0x600x0_0000–0x0_F7FF62 Kbytes
0x610x0_0000–0x0_EFFF60 Kbytes
0x620x0_0000–0x0_E7FF58 Kbytes
0x630x0_0000–0x0_DFFF56 Kbytes
.........
0x770x0_0000–0x0_3FFF16 Kbytes
0x780x0_0000–0x0_37FF14 Kbytes
0x790x0_0000–0x0_2FFF12 Kbytes
0x7A0x0_0000–0x0_27FF10 Kbytes
0x7B0x0_0000–0x0_1FFF8 Kbytes
0x7C0x0_0000–0x0_17FF6 Kbytes
0x7D0x0_0000–0x0_0FFF4 Kbytes
0x7E0x0_0000–0x0_07FF2 Kbytes
0x7FNo Protection0 Kbytes
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor75
1
Get the latest version from freescale.com
Chapter 4 Memory
4.4.2.5Flash Status Register (FSTAT)
The FSTAT register defines the operational status of the flash module. FCBEF, FPVIOL and FACCERR
are readable and writable. FBLANK is readable and not writable. The remaining bits read 0 and are not
writable.
76543210
RFCBEFFCCFFPVIOLFACCERR0FBLANK00
Ww1c
Reset11000000
FieldDescription
w1cw1c
Figure 4-7. Flash Status Register (FSTAT)
Table 4-14. FSTAT Field Descriptions
7
FCBEF
6
FCCF
5
FPVIOL
4
FACCERR
3Reserved, should be cleared.
Command Buffer Empty Flag. The FCBEF flag indicates that the command buffer is empty so that a new
command write sequence can be started when performing burst programming. Writing a 0 to the FCBEF flag has
no effect on FCBEF. Writing a 0 to FCBEF after writing an aligned address to the flash array memory, but before
FCBEF is cleared, aborts a command write sequence and causes the FACCERR flag to be set. Writing a 0 to
FCBEF outside of a command write sequence does not set the FACCERR flag. Writing a 1 to this bit clears it.
0 Command buffers are full.
1 Command buffers are ready to accept a new command.
Command Complete Flag. The FCCF flag indicates that there are no more commands pending. The FCCF flag
is cleared when FCBEF is cleared and sets automatically upon completion of all active and pending commands.
The FCCF flag does not set when an active program command completes and a pending burst program
command is fetched from the command buffer. Writing to the FCCF flag has no effect on FCCF.
0 Command in progress.
1 All commands are completed.
Protection Violation Flag. The FPVIOL flag indicates an attempt was made to program or erase an address in
a protected area of the flash memory during a command write sequence. Writing a 0 to the FPVIOL flag has no
effect on FPVIOL. Writing a 1 to this bit clears it. While FPVIOL is set, it is not possible to launch a command or
start a command write sequence.
0 No protection violation detected.
1 Protection violation has occurred.
Access Error Flag. The FACCERR flag indicates an illegal access has occurred to the flash memory caused by
either a violation of the command write sequence (see Section 4.5.1.2, “Command Write Sequence”), issuing an
illegal flash command (see Section 4.4.2.6, “Flash Command Register (FCMD)”), or the execution of a CPU
STOP instruction while a command is executing (FCCF = 0). Writing a 0 to the FACCERR flag has no effect on
FACCERR. Writing a 1 to this bit clears it. While FACCERR is set, it is not possible to launch a command or start
a command write sequence.
0 No access error detected.
1 Access error has occurred.
MCF51QE128 MCU Series Reference Manual, Rev. 3
76Freescale Semiconductor
Get the latest version from freescale.com
Table 4-14. FSTAT Field Descriptions (continued)
FieldDescription
Chapter 4 Memory
2
FBLANK
1–0Reserved, should be cleared.
Flag Indicating the Erase Verify Operation Status. When the FCCF flag is set after completion of an erase
verify command, the FBLANK flag indicates the result of the erase verify operation. The FBLANK flag is cleared
by the flash module when FCBEF is cleared as part of a new valid command write sequence. Writing to the
FBLANK flag has no effect on FBLANK.
0 Flash block verified as not erased.
1 Flash block verified as erased.
4.4.2.6Flash Command Register (FCMD)
The FCMD register is the flash command register. All FCMD bits are readable and writable during a
command write sequence while bit 7 reads 0 and is not writable.
76543210
R0
W
Reset00000000
Figure 4-8. Flash Command Register (FCMD)
Table 4-15. FCMD Field Descriptions
FieldDescription
FCMD
7Reserved, should be cleared.
6–0
FCMD
Flash Command. Valid flash commands are shown below. Writing any command other than those listed sets
the FACCERR flag in the FSTAT register.
0x05 Erase Verify
0x20 Program
0x25 Burst Program
0x40 Sector Erase
0x41 Mass Erase
4.5Function Description
4.5.1Flash Command Operations
Flash command operations execute program, erase, and erase verify algorithms described in this section.
The program and erase algorithms are controlled by the flash memory controller whose time base, FCLK,
is derived from the bus clock via a programmable divider.
The next sections describe:
1. How to write the FCDIV register to set FCLK
2. Command write sequences to program, erase, and erase verify operations on the flash memory
3. Valid flash commands
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor77
Get the latest version from freescale.com
Chapter 4 Memory
4. Effects resulting from illegal flash command write sequences or aborting flash operations
4.5.1.1Writing the FCDIV Register
Prior to issuing any flash command after a reset, write the FCDIV register to divide the bus clock down to
150–200 kHz. The FCDIV[PRDIV8, FDIV] bits must be set as described in Figure 4-9.
For example, if the bus clock frequency is 25 MHz, FCDIV[FDIV] should be set to 0x0F (0011 1 1) and the
FCDIV[PRDIV8] bit set to 1. The resulting FCLK frequency is then 195 kHz. In this case, the flash
program and erase algorithm timings are increased over the optimum target by:
(200 - 195) ÷ 200 = 3%Eqn. 4-1
CAUTION
Program and erase command execution time increase proportionally with
the period of FCLK. Programming or erasing the flash memory with
FCLK less than 150 kHz should be avoided. Setting FCDIV to a value such
that FCLK is less than 150 kHz can destroy the flash memory due to
overstress. Setting FCDIV to a value where FCLK is greater than 200 kHz
can result in incomplete programming or erasure of the flash memory cells.
If the FCDIV register is written, the FDIVLD bit is automatically set. If the FDIVLD bit is 0, the FCDIV
register has not been written since the last reset. If the FCDIV register has not been written to, the flash
command loaded during a command write sequence does not execute and FSTAT[FACCERR] is set.
MCF51QE128 MCU Series Reference Manual, Rev. 3
78Freescale Semiconductor
Get the latest version from freescale.com
Chapter 4 Memory
set PRDIV8 = 1
yes
no
PRDIV8 = 0 (reset)
≥ 12.8MHz?
FCLK = (PRDCLK)/(1+FDIV[5:0])
PRDCLK = bus_clock
PRDCLK = bus_clock/8
PRDCLK[kHz]/200
no
set FDIV[5:0] = PRDCLK[kHz]/200-1
yes
START
an integer?
set FDIV[5:0] = INT(PRDCLK[kHz]/200)
END
bus_clock
no
yes
0.3MHz?
bus_clock
ALL PROGRAM AND ERASE
COMMANDS IMPOSSIBLE
Note:
• FCLK is the clock of the flash timing control block
• INT(x) is the integer part of x (e.g. INT(4.323) = 4)
4.5.1.2Command Write Sequence
The flash command controller supervises the command write sequence to execute program, erase, and
Figure 4-9. Determination Procedure for PRDIV8 and FDIV Bits
erase verify algorithms.
Before starting a command write sequence, the F ACCERR and FPVIOL flags in the FSTAT register must
be clear and the FCBEF flag must be set (see Section 4.4.2.5).
A command write sequence consists of three steps that must be strictly adhered to with writes to the flash
module not permitted between the steps. However, flash register and array reads are allowed during a
command write sequence. The basic command write sequence is as follows:
1. Write to a valid address in the flash array memory.
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor79
Get the latest version from freescale.com
Chapter 4 Memory
2. Write a valid command to the FCMD register.
3. Clear the FCBEF flag in the FSTAT register by writing a 1 to FCBEF to launch the command.
After a command is launched, the completion of the command operation is indicated by the setting of
FSTAT[FCCF]. The FCCF flag sets upon completion of all active and buffered burst program commands.
4.5.2Flash Commands
Table 4-16 summarizes the valid flash commands along with the effects of the commands on the flash
block.
Table 4-16. Flash Command Description
FCMD
0x05Erase VerifyVerify all memory bytes in the flash array memory are erased.
0x20ProgramProgram an address in the flash array.
0x25Burst ProgramProgram an address in the flash array with the internal address incrementing after the
0x40Sector EraseErase all memory bytes in a sector of the flash array.
0x41Mass EraseErase all memory bytes in the flash array.
NVM
Command
Function on Flash Memory
If the flash array memory is erased, FSTAT[FBLANK] sets upon command completion.
program operation.
A mass erase of the full flash array is only possible when no protection is enabled prior
to launching the command.
CAUTION
A flash block address must be in the erased state before being programmed.
Cumulative programming of bits within a flash block address is not allowed
except for status field updates required in EEPROM emulation applications.
4.5.2.1Erase Verify Command
The erase verify operation verifies that the entire flash array memory is erased.
An example flow to execute the erase verify operation is shown in Figure 4-10. The erase verify command
write sequence is as follows:
1. Write to an aligned flash block address to start the command write sequence for the erase verify
command. The address and data written are ignored.
2. Write the erase verify command, 0x05, to the FCMD register.
3. Clear the FCBEF flag in the FSTAT register by writing a 1 to FCBEF to launch the erase verify
command.
After launching the erase verify command, FSTAT[FCCF] sets after the operation has completed. The
number of bus cycles required to execute the erase verify operation is equal to the number of addresses in
the flash array memory plus several bus cycles as measured from the time the FCBEF flag is cleared until
the FCCF flag is set. Upon completion of the erase verify operation, FSTAT[FBLANK] is set if all
addresses in the flash array memory are verified to be erased. If any address in the flash array memory is
not erased, the erase verify operation terminates and FSTAT[FBLANK] remains cleared.
MCF51QE128 MCU Series Reference Manual, Rev. 3
80Freescale Semiconductor
Get the latest version from freescale.com
Chapter 4 Memory
Write: Flash Block Address
Write: FCMD register
Write: FSTAT register
1.
2.
3.
Write: FSTAT register
yes
no
Access Error and
no
Bit Polling for
Read: FSTAT register
yes
Read: FSTAT register
no
START
yes
FCBEF
Set?
Command
FCCF
Set?
FACCERR/FPVIOL
Set?
no
Erase Verify
yes
EXIT
Flash Block
FBLANK
Set?
Write: FCDIV register
Read: FCDIV register
yes
no
Clock Register
FDIVLD
Set?
Note: FCDIV needs to
Written
Check
Protection Violation
Check
Buffer Empty Check
and Dummy Data
Erase Verify Command 0x05
Clear FCBEF 0x80
Clear FACCERR/FPVIOL 0x30
Command Completion
Check
Status
Erased
Flash Block
Not Erased
EXIT
be set after each reset
4.5.2.2Program Command
The program operation programs a previously erased address in the flash memory using an embedded
algorithm. An example flow to execute the program operation is shown in Figure 4-11. The program
command write sequence is as follows:
1. Write to an aligned flash block address to start the command write sequence for the program
2. Write the program command, 0x20, to the FCMD register.
3. Clear the FCBEF flag in the FSTAT register by writing a 1 to FCBEF to launch the program
Freescale Semiconductor81
command. The data written is programmed to the address written.
command.
Figure 4-10. Example Erase Verify Command Flow
MCF51QE128 MCU Series Reference Manual, Rev. 3
Get the latest version from freescale.com
Chapter 4 Memory
Write: Flash Array Address
Write: FCMD register
Write: FSTAT register
1.
2.
3.
Write: FSTAT register
yes
no
Access Error and
no
Bit Polling for
Read: FSTAT register
yes
Read: FSTAT register
no
START
yes
FCBEF
Set?
Command
FCCF
Set?
FACCERR/FPVIOL
Set?
Write: FCDIV register
Read: FCDIV register
yes
no
Clock Register
FDIVLD
Set?
Note: FCDIV needs to
Written
Check
Protection Violation
Check
Buffer Empty Check
and Program Data
Program Command 0x20
Clear FCBEF 0x80
Clear FACCERR/FPVIOL 0x30
Command Completion
Check
EXIT
be set after each reset
If an address to be programmed is in a protected area of the flash block, FSTAT[FPVIOL] sets and the
program command does not launch. After the program command has successfully launched and the
program operation has completed, FSTAT[FCCF] is set.
Figure 4-11. Example Program Command Flow
82Freescale Semiconductor
MCF51QE128 MCU Series Reference Manual, Rev. 3
Get the latest version from freescale.com
Chapter 4 Memory
4.5.2.3Burst Program Command
The burst program operation programs previously erased data in the flash memory using an embedded
algorithm.
While burst programming, two internal data registers operate as a buffer and a register (2-stage FIFO) so
that a second burst programming command along with the necessary data can be stored to the buffers while
the first burst programming command remains in progress. This pipelined operation allows a time
optimization when programming more than one consecutive address on a specific row in the flash array as
the high voltage generation can be kept active in between two programming commands.
An example flow to execute the burst program operation is shown in Figure 4-12. The burst program
command write sequence is as follows:
1. Write to an aligned flash block address to start the command write sequence for the burst program
command. The data written is programmed to the address written.
2. Write the program burst command, 0x25, to the FCMD register.
3. Clear the FCBEF flag in the FSTAT register by writing a 1 to FCBEF to launch the program burst
command.
4. After the FCBEF flag in the FSTAT register returns to a 1, repeat steps 1 through 3. The address
written is ignored but is incremented internally.
The burst program procedure can be used to program the entire flash memory even while crossing row
boundaries within the flash array . If data to be burst programmed falls within a protected area of the flash
array, FSTAT[FPVIOL] is set and the burst program command does not launch. After the burst program
command has successfully launched and the burst program operation has completed, FST AT[FCCF] is set
unless a new burst program command write sequence has been buffered. By executing a new burst
program command write sequence on sequential addresses after the FCBEF flag in the FST AT register has
been set, a greater than 50% faster programming time for the entire flash array can be effectively achieved
when compared to using the basic program command.
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor83
Get the latest version from freescale.com
Chapter 4 Memory
Write: Flash Array Address
Write: FCMD register
Write: FSTAT register
1.
2.
3.
Write: FSTAT register
yes
no
Access Error and
no
Bit Polling for
Read: FSTAT register
yes
Read: FSTAT register
no
START
yes
FCBEF
Set?
Command
FCCF
Set?
FACCERR/FPVIOL
Set?
Write: FCDIV register
Read: FCDIV register
yes
no
Clock Register
FDIVLD
Set?
Note: FCDIV needs to
Written
Check
Protection Violation
Check
Buffer Empty Check
and Program Data
Burst Program Command 0x25
Clear FCBEF 0x80
Clear FACCERR/FPVIOL 0x30
Command Completion
Check
EXIT
be set after each reset
no
Bit Polling for
Read: FSTAT register
yes
FCBEF
Set?
Command Buffer Empty
Check
yes
Sequential
no
Next
Address?
Programming
Decision
4.5.2.4Sector Erase Command
The sector erase operation erases all addresses in a 1 Kbyte sector of flash memory using an embedded
algorithm.
Figure 4-12. Example Burst Program Command Flow
84Freescale Semiconductor
MCF51QE128 MCU Series Reference Manual, Rev. 3
Get the latest version from freescale.com
Chapter 4 Memory
Write: Flash Sector Address
Write: FCMD register
Write: FSTAT register
1.
2.
3.
Write: FSTAT register
yes
no
Access Error and
no
Bit Polling for
Read: FSTAT register
yes
Read: FSTAT register
no
START
yes
FCBEF
Set?
Command
FCCF
Set?
FACCERR/FPVIOL
Set?
Write: FCDIV register
Read: FCDIV register
yes
no
Clock Register
FDIVLD
Set?
Note: FCDIV needs to
Written
Check
Protection Violation
Check
Buffer Empty Check
and Dummy Data
Sector Erase Command 0x40
Clear FCBEF 0x80
Clear FACCERR/FPVIOL 0x30
Command Completion
Check
EXIT
be set after each reset
An example flow to execute the sector erase operation is shown in Figure 4-13. The sector erase command
write sequence is as follows:
1. Write to an aligned flash block address to start the command write sequence for the sector erase
command. The flash address written determines the sector to be erased while the data written is
ignored.
2. Write the sector erase command, 0x40, to the FCMD register.
3. Clear the FCBEF flag in the FSTAT register by writing a 1 to FCBEF to launch the sector erase
command.
If a flash sector to be erased is in a protected area of the flash block, FSTAT[FPVIOL] is set and the sector
erase command does not launch. After the sector erase command has successfully launched and the sector
erase operation has completed, FSTAT[FCCF] is set.
Figure 4-13. Example Sector Erase Command Flow
Freescale Semiconductor85
MCF51QE128 MCU Series Reference Manual, Rev. 3
Get the latest version from freescale.com
Chapter 4 Memory
Write: Flash Memory Address
Write: FCMD register
Write: FSTAT register
1.
2.
3.
Write: FSTAT register
yes
no
Access Error and
no
Bit Polling for
Read: FSTAT register
yes
Read: FSTAT register
no
START
yes
FCBEF
Set?
Command
FCCF
Set?
FACCERR/FPVIOL
Set?
Write: FCDIV register
Read: FCDIV register
yes
no
Clock Register
FDIVLD
Set?
Note: FCDIV needs to
Written
Check
Protection Violation
Check
Buffer Empty Check
and Dummy Data
Mass Erase Command 0x41
Clear FCBEF 0x80
Clear FACCERR/FPVIOL 0x30
Command Completion
Check
EXIT
be set after each reset
4.5.2.5Mass Erase Command
The mass erase operation erases the entire flash array memory using an embedded algorithm. An example
flow to execute the mass erase operation is shown in Figure 4-14. The mass erase command write sequence
is as follows:
1. Write to an aligned flash block address to start the command write sequence for the mass erase
command. The address and data written is ignored.
2. Write the mass erase command, 0x41, to the FCMD register.
3. Clear the FCBEF flag in the FSTAT register by writing a 1 to FCBEF to launch the mass erase
command.
If the flash array memory to be mass erased contains any protected area, FSTAT[FPVIOL] is set and the
mass erase command does not launch. After the mass erase command has successfully launched and the
mass erase operation has completed, FSTAT[FCCF] is set.
Figure 4-14. Example Mass Erase Command Flow
86Freescale Semiconductor
MCF51QE128 MCU Series Reference Manual, Rev. 3
Get the latest version from freescale.com
NOTE
The BDM can also perform a mass erase and verify command. See
Chapter 18, “Version 1 ColdFire Debug (CF1_DEBUG),” for details.
4.5.3Illegal Flash Operations
4.5.3.1Flash Access Violations
The FACCERR flag is set during the command write sequence if any of the following illegal steps are
performed, causing the command write sequence to immediately abort:
1. Writing to a flash address before initializing the FCDIV register.
2. Writing a byte, word, or misaligned longword to a valid flash address.
3. Writing to any flash register other than FCMD after writing to a flash address.
4. Writing to a second flash address in the same command write sequence.
5. Writing an invalid command to the FCMD register unless the address written was in a protected
area of the flash array.
6. Writing a command other than burst program while FCBEF is set and FCCF is clear.
7. When security is enabled, writing a command other than erase verify or mass erase to the FCMD
register when the write originates from a non-secure memory location or from the background
debug mode.
8. Writing to a flash address after writing to the FCMD register.
9. Writing to any flash register other than FSTAT (to clear FCBEF) after writing to the FCMD
register.
10. Writing a 0 to the FCBEF flag in the FSTAT register to abort a command write sequence.
The F ACCERR flag is also set if the MCU enters stop mode while any command is active (FCCF=0). The
operation is aborted immediately and, if burst programming, any pending burst program command is
purged (see Section 4.5.4.2, “Stop Modes”).
The FACCERR flag does not set if any flash register is read during a valid command write sequence.
If the flash memory is read during execution of an algorithm (FCCF = 0), the read operation returns invalid
data and the FACCERR flag is not set.
If the FACCERR flag is set in the FSTAT register, clear the FACCERR flag before starting another
command write sequence (see Section 4.4.2.5, “Flash Status Register (FSTAT)”).
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor87
Get the latest version from freescale.com
Chapter 4 Memory
4.5.3.2Flash Protection Violations
The FPVIOL flag is set after the command is written to the FCMD register if any of the following illegal
operations are attempted:
1. Writing the program command if the address written in the command write sequence was in a
protected area of the flash array.
2. Writing the sector erase command if the address written in the command write sequence was in a
protected area of the flash array.
3. Writing the mass erase command while any flash protection is enabled.
4. Writing an invalid command if the address written in the command write sequence was in a
protected area of the flash array.
As a result of any of the above, the command write sequence immediately aborts. If FSTAT[FPVIOL] is
set, clear the FPVIOL flag before starting another command write sequence (see Section 4.4.2.5, “Flash
Status Register (FSTAT)”).
4.5.4Operating Modes
4.5.4.1Wait Mode
If a command is active (FCCF = 0) when the MCU enters wait mode, the active command and any buffered
command is completed.
4.5.4.2Stop Modes
If a command is active (FCCF = 0) when the MCU enters any stop mode, the operation is aborted. If the
operation is program or erase, the flash array data being programmed or erased may be corrupted and the
FCCF and FACCERR flags are set. If active, the high voltage circuitry to the flash array is immediately
switched off when entering stop mode. Upon exit from stop mode, the FCBEF flag is set and any buffered
command is not launched. The F ACCERR flag must be cleared before starting a command write sequence
(see Section 4.5.1.2, “Command Write Sequence”).
NOTE
As active commands are immediately aborted when the MCU enters stop
mode, do not use the STOP instruction during program or erase operations.
Active commands continue when the MCU enters wait mode. Use of the
STOP instruction when SOPT1[WAITE] is set is acceptable.
4.5.4.3Background Debug Mode
In background debug mode, the FPROT register is writable without restrictions. If the MCU is unsecured,
all flash commands listed in Table 4-16 can be executed. If the MCU is secured, only a compound mass
erase and erase verify command can be executed. See Chapter 18, “Version 1 ColdFire Debug
(CF1_DEBUG),” for details.
MCF51QE128 MCU Series Reference Manual, Rev. 3
88Freescale Semiconductor
Get the latest version from freescale.com
Chapter 4 Memory
4.5.5Security
The flash module provides the necessary security information to the MCU. During each reset sequence,
the flash module determines the security state of the MCU as defined in Section 4.2.1, “Flash Module
Reserved Memory Locations”.
The contents of the flash security byte in the flash configuration field (see Section 4.4.2.3) must be
changed directly by programming the flash security byte location when the MCU is unsecured and the
sector containing the flash security byte is unprotected. If the flash security byte is left in a secured state,
any reset causes the MCU to initialize into a secure operating mode.
4.5.5.1Unsecuring the MCU using Backdoor Key Access
The MCU may be unsecured by using the backdoor key access feature that requires knowledge of the
contents of the backdoor keys (see Section 4.2.1). If the KEYEN[1:0] bits are in the enabled state (see
Section 4.4.2.2) and the KEY ACC bit is set, a write to a backdoor key address in the flash memory triggers
a comparison between the written data and the backdoor key data stored in the flash memory. If all
backdoor keys are written to the correct addresses in the correct order and the data matches the backdoor
keys stored in the flash memory, the MCU is unsecured. The data must be written to the backdoor keys
sequentially. Values 0x0000_0000 and 0xFFFF_FFFF are not permitted as backdoor keys. While the
KEYACC bit is set, reads of the flash memory return valid data.
The user code stored in the flash memory must have a method of receiving the backdoor keys from an
external stimulus. This external stimulus would typically be through one of the on-chip serial ports.
If the KEYEN[1:0] bits are in the enabled state (see Section 4.4.2.2), the MCU can be unsecured by the
backdoor key access sequence described below:
1. Set FCNFG[KEYACC].
2. Execute three NOP instructions to provide time for the backdoor state machine to load the starting
address and number of keys required into the flash state machine.
3. Sequentially write the correct longwords to the flash address(es) containing the backdoor keys.
4. Clear the KEY A CC bit. Depending on the user code used to write the backdoor keys, a wait cycle
(NOP) may be required before clearing the KEYACC bit.
5. If all data written match the backdoor keys, the MCU is unsecured and the SEC[1:0] bits in the
NVOPT register are forced to an unsecured state.
The backdoor key access sequence is monitored by an internal security state machine. An illegal operation
during the backdoor key access sequence causes the security state machine to lock, leaving the MCU in
the secured state. A reset of the MCU causes the security state machine to exit the lock state and allows a
new backdoor key access sequence to be attempted. The following operations during the backdoor key
access sequence lock the security state machine:
1. If any of the keys written does not match the backdoor keys programmed in the flash array.
2. If the keys are written in the wrong sequence.
3. If any of the keys written are all 0’s or all 1’s.
4. If the KEYACC bit does not remain set while the keys are written.
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor89
Get the latest version from freescale.com
Chapter 4 Memory
5. If any of the keys are written on successive MCU clock cycles.
6. Executing a STOP instruction before all keys have been written.
After the backdoor keys have been correctly matched, the MCU is unsecured. After the MCU is unsecured,
the flash security byte can be programmed to the unsecure state, if desired.
In the unsecure state, you have full control of the contents of the backdoor keys by programming the
associated addresses in the flash configuration field (see Section 4.2.1, “Flash Module Reserved Memory
Locations”).
The security as defined in the flash security byte is not changed by using the backdoor key access sequence
to unsecure. The stored backdoor keys are unaffected by the backdoor key access sequence. After the next
reset of the MCU, the security state of the flash module is determined by the flash security byte. The
backdoor key access sequence has no effect on the program and erase protections defined in the flash
protection register (FPROT).
It is not possible to unsecure the MCU by using the backdoor key access sequence in background debug
mode (BDM).
4.5.6Resets
4.5.6.1Flash Reset Sequence
On each reset, the flash module executes a reset sequence to hold CPU activity while reading the following
resources from the flash block:
•MCU control parameters (see Section 4.2.1)
•Flash protection byte (see Section 4.2.1 and Section 4.4.2.4)
•Flash nonvolatile byte (see Section 4.2.1)
•Flash security byte (see Section 4.2.1 and Section 4.4.2.2)
4.5.6.2Reset While Flash Command Active
If a reset occurs while any flash command is in progress, that command is immediately aborted. The state
of the flash array address being programmed or the sector/block being erased is not guaranteed.
4.5.6.3Program and Erase Times
Before any program or erase command can be accepted, the flash clock divider (FCDIV) must be written
to set the internal clock for the flash module to a frequency (f
If the initial flash event is a mass erase and verify from BDM, then CSR3[31:24] must be loaded before
the XCSR is written to initiate the erase and verify. The data in the XCSR and CSR3 is then loaded into
the flash’s FCDIV register. (See Section 18.3.4, “Configuration/Status Register 3 (CSR3)”). However, if
the first flash event is executed by the processor directly , the flash’ s FCDIV register is written directly , and
the XCSR and CSR3 are not involved.
) between 150 kHz and 200 kHz.
FCLK
MCF51QE128 MCU Series Reference Manual, Rev. 3
90Freescale Semiconductor
Get the latest version from freescale.com
Chapter 4 Memory
One period of the resulting clock (1/f
) is used by the command processor to time program and erase
FCLK
pulses. An integer number of these timing pulses are used by the command processor to complete a
program or erase command.
Program and erase times are given in the MCF51QE128 Data Sheet, order number MCF51QE128DS.
4.6Security
The MCF51QE128/64/32 includes circuitry to prevent unauthorized access to the contents of flash and
RAM memory . When security is engaged, BDM access is restricted to the upper byte of the debug XCSR,
CSR2, and CSR3 registers. RAM, flash memory , peripheral registers, and most of the CPU register set are
not available via BDM. Programs executing from internal memory have normal access to all MCU
memory locations and resources.
Security is engaged or disengaged based on the state of two nonvolatile register bits (SEC01, SEC00) in
the FOPT register. During reset, the contents of the nonvolatile location, NVOPT, are copied from flash
into the working FOP T register in high-page register space. Engage security by programming the NVOP T
location. This can be done at the same time the flash memory is programmed. The 1:1 state disengages
security and the other three combinations engage security . Security is implemented differently than on the
pin-compatible MC9S08QE128/64/32 family of devices. This is a result of differences inherent in the S08
and ColdFire MCU architectures.
Upon exiting reset, the XCSR[SEC] bit in the ColdFire CPU is set if the device is secured, cleared
otherwise.
You can allow or disallow a security unlocking mechanism through an 8-byte backdoor security key. The
security key can be written by the CPU executing from internal memory. It cannot be entered without the
cooperation of a secure user program. The procedure for this is detailed in Section 4.5.5.1, “Unsecuring
the MCU using Backdoor Key Access”.
Development tools unsecure devices via an alternate BDM-based methodology shown in Figure 4-15.
Because RESET and BKGD pins can be reprogrammed via software, a power-on-reset is required to be
absolutely certain of obtaining control of the device via BDM, which is a required prerequisite for clearing
security. Other methods (outlined in red in Figure 4-15) can also be used, but may not work under all
circumstances.
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor91
Get the latest version from freescale.com
Chapter 4 Memory
Write CSR2[25:24]=11 to initiate BDM reset to halt or
write CSR2[25:24]=01 to initiate BDM reset to run
On-chip flash is erased and unsecure
Is XCSR[25] cleared
(erase/verify complete)
?
Ye s
No
Write XCSR[31:24] = 0x87 to initiate
erase/verify of flash memory
Set PRDIV8 and clock divider fields in CSR3
Delay ‘TBD’ cycles
Device is unsecure
1
1. The last three steps are optional, but recommended.
Ways to enter BDM halt mode:
1. BKGD=0 during POR
BKGD=0 during external reset
BKGD=0 during BDM reset
BFHBR=1 during BDM reset
Issue BACKGROUND command
via BDM interface
HALT instruction
BDM breakpoint
ColdFire fault-on-fault
Of these, only method 1 is guaranteed to work under
all circumstances because of the ability to program
2.
3.
4.
5.
6.
7.
8.
XCSR[31:24] = 0x87
N = number of cycles for SIM to release internal
reset. Adder of 16 imposed by ColdFire core.
STOP
XCSR[25] = 0
STOP
Secure state unknown, CPU halted,
FEI 10 MHz clock, synchronized to debugger
SYNC
Secure state unknown, CPU halted,
FEI 10 MHz clock, SYNC required
Hold BKGD=0, apply power, wait N+16 cycles
for POR to deassert
Secure state unknown/unpowered
BKGD=0 during reset ensures that
ENBDM comes up ‘1’.
FLL enabled, internal reference (FEI)
at 10MHz is reset default for the ICS.
Error condition
check code or device.
Already
XCSR[31:24] ≠ 1000_01x1
Read XCSR
unsecured
Note: This write is required
different functions on the BKGD package pin.
Figure 4-15. Procedure for Clearing Security on MCF51QE128/64/32 via the BDM Port
92Freescale Semiconductor
MCF51QE128 MCU Series Reference Manual, Rev. 3
Get the latest version from freescale.com
Chapter 5
Resets, Interrupts, and General System Control
5.1Introduction
This section discusses basic reset and interrupt mechanisms and the various sources of reset and interrupt
on the MCF51QE128/64/32. Some interrupt sources from peripheral modules are discussed in greater
detail within other sections of this document. This section gathers basic information about all reset and
interrupt sources in one place for easy reference. A few reset and interrupt sources, including the computer
operating properly (COP) watchdog, are not part of on-chip peripheral systems with their own chapters.
5.2Features
Reset and interrupt features include:
•Multiple sources of reset for flexible system configuration and reliable operation
•System reset status (SRS) register to indicate source of most recent reset
•Separate interrupt vector for most modules (reduces polling overhead)
5.3Microcontroller Reset
Resetting the MCU provides a way to start processing from a known set of initial conditions. When the
ColdFire processor exits reset, it fetches initial 32-bit values for the supervisor stack pointer and program
counter from locations 0x(00)00_0000 and 0x(00)00_0004 respectively . On-chip pe ripheral modules are
disabled and I/O pins are initially configured as general-purpose high-impedance inputs with pull-up
devices disabled.
The MCF51QE128/64/32 has the following sources for reset:
•Power-on reset (POR)
•External pin reset (PIN)
•Computer operating properly (COP) timer
•Illegal opcode detect (ILOP)
•Illegal address detect (ILAD)
•Low-voltage detect (LVD)
•Background debug forced reset
Each of these sources, with the exception of the background debug forced reset, has an associated bit in
the system reset status register (SRS).
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor93
Get the latest version from freescale.com
Chapter 5 Resets, Interrupts, and General System Control
5.3.1Computer Operating Properly (COP) Watchdog
The COP watchdog forces a system reset when the application software fails to execute as expected. To
prevent a system reset from the COP timer (when it is enabled), application software must reset the COP
counter periodically . If the application program gets lost and fails to reset th e COP counter before it times
out, a system reset is generated to force the system back to a known starting point.
After any reset, the SOPT1[COPE] bit is set enabling the COP watchdog (see Section 5.7.3, “System
Options Register 1 (SOPT1),” for additional information). If the COP watchdog is not used in an
application, it can be disabled by clearing COPE. The COP counter is reset by writing any value to the
address of SRS. This write does not affect the data in the read-only SRS. Instead, the act of writing to this
address is decoded and sends a reset signal to the COP counter.
The SOPT2[COPCLKS] bit selects the clock source used for the COP timer (see Section 5.7.4, “System
Options Register 2 (SOPT2),” for additional information). The clock source options are either the bus
clock or an internal 1-kHz clock source. With each clock source, there is an associated short and long
time-out controlled by the SOP T1[COPT] bit. Table 5-1 summaries the control functions of the COPCLKS
and COP T bits. The COP watchdog defaults to operation from the 1-kHz clock source and the associated
long time-out (28 cycles).
Table 5-1. COP Configuration Options
Control Bits
Clock SourceCOP Overflow Count
COPCLKSCOPT
00~1 kHz2
01~1 kHz2
10Bus 2
11Bus 2
1
Values are shown in this column based on t
LPO
=1ms.
5
cycles (32 ms)
8
cycles (256 ms)
13
cycles
18
cycles
1
1
Write to the write-once SOP T11 and SOP T2 registers during reset initialization to lock in the settings, even
if the application uses the default reset settings of COPE, COPCLKS, and COPT. That way, they cannot
be changed accidentally if the application program gets lost. The initial writes to SOP T1 and SOPT2 reset
the COP counter.
The write to SRS that services (clears) the COP counter must not be placed in an interrupt service routine
(ISR) because the ISR could continue to be executed periodically even if the main application program
fails.
In the CPU halt state, the COP counter does not increment.
When the bus clock source is selected, the COP counter does not increment while the system is in stop
mode. The COP counter resumes as soon as the MCU exits stop mode.
When the 1-kHz clock source is selected, the COP counter is re-initialized to zero upon entry to stop mode.
The COP counter begins from zero after the MCU exits stop mode.
1. The SOPT1[WAITE] bit can be written multiple times. Other bits are write-once.
MCF51QE128 MCU Series Reference Manual, Rev. 3
94Freescale Semiconductor
Get the latest version from freescale.com
Chapter 5 Resets, Interrupts, and General System Control
5.3.2Illegal Operation Reset
By default, the V1 ColdFire core generates a MCU reset when attempting to execute an illegal instruction
(except for the ILLEGAL opcode), illegal line-A instruction, illegal line-F instruction, or a supervisor
instruction while in user mode (privilege violation). The user may set CPUCR[IRD] to generate the
appropriate exception instead of forcing a reset.
NOTE
The attempted execution of the STOP instruction with SOPT[STOPE,
WAITE] cleared is treated as an illegal instruction.
The attempted execution of the HALT instruction with XCSR[ENBDM]
cleared is treated as an illegal instruction.
5.3.3Illegal Address Reset
By default, the V1 ColdFire core generates a MCU reset when detecting an address error, bus error
termination, R TE format error, or fault-on-fault condition. The user may set CPUCR[ARD] to generate the
appropriate exception instead of forcing a reset, or simply halt the processor in response to the
fault-on-fault condition.
5.4Interrupts and Exceptions
The interrupt architecture of ColdFire utilizes a 3-bit encoded interrupt priority level sent from the
interrupt controller to the core, providing seven levels of interrupt requests. Level seven represents the
highest priority interrupt level, while level one is the lowest priority. For more information on exception
processing, see Chapter 8, “Interrupt Controller (CF1_INTC)”.
5.4.1External Interrupt Request (IRQ) Pin
External interrupts are managed by the IRQ status and control register, IRQSC. When the IRQ function is
enabled, synchronous logic monitors the pin for edge-only or edge-and-level events. When the MCU is in
stop mode and system clocks are shut down, a separate asynchronous path is used, so the IRQ pin (if
enabled) can wake the MCU.
5.4.1.1Pin Configuration Options
The IRQ pin enable (IRQPE) control bit in IRQSC must be set for the IRQ pin to act as the interrupt request
(IRQ) input. As an IRQ input, you can choose the polarity of edges or levels detected (IRQEDG), whether
the pin detects edges-only or edges and levels (IRQMOD) and whether an event causes an interrupt or only
sets the IRQF flag that can be polled by software (IRQIE).
The IRQ pin, when enabled, defaults to use an internal pull device (IRQPDD = 0), configured as a pull-up
or pull-down depending on the polarity chosen. If you want to use an external pull-up or pull-down, the
IRQPDD can be set to turn off the internal device.
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor95
Get the latest version from freescale.com
Chapter 5 Resets, Interrupts, and General System Control
NOTE
This pin does not contain a clamp diode to VDD and should not be driven
above VDD.
NOTE
The voltage measured on the internally pulled up RESET pin is not pulled
to VDD. The internal gates connected to this pin are pulled to VDD. The
RESET pullup should not be used to pull up components external to the
MCU.
5.4.1.2Edge and Level Sensitivity
The IRQMOD control bit reconfigures the detection logic so it detects edge events and pin levels. In the
edge and level detection mode, the IRQF status flag becomes set when an edge is detected (when the IRQ
pin changes from the deasserted to the asserted level), but the flag is continuously set (and cannot be
cleared) as long as the IRQ pin remains at the asserted level.
5.4.1.3External Interrupt Initialization
When the IRQ pin is first enabled, it is possible to get a false interrupt flag. To prevent a false interrupt
request during IRQ initialization, the user should do the following:
1. Mask interrupts by clearing IRQSC[IRQIE].
2. Select the pin polarity by setting the appropriate IRQSC[IRQEDG] bits.
3. If using internal pull-up/pull-down device, clear IRQSC[IRQPDD].
4. Enable the IRQ pin by setting IRQSC[IRQPE].
5. Write to IRQSC[IRQACK] to clear any false interrupts.
6. Set IRQSC[IRQIE] to enable interrupts.
5.5Low-Voltage Detect (LVD) System
The MCF51QE128/64/32 includes a system to guard against low voltage conditions to protect memory
contents and control MCU system states during supply voltage variations. The system is comprised of a
power-on reset (POR) circuit and a LVD circuit with a user-selectable trip voltage, high (V
(V
). The LVD circuit is enabled when the SPMSC1[LVDE] bit is set and the trip voltage is selected
LVDL
by the SPMSC3[LVDV] bit. The LVD is disabled upon entering stop2 or stop3 modes unless the L VDSE
bit is set. If LVDE and LVDSE are set when the STOP instruction is processed, the device enters stop4
mode. The LVD can be left enabled in this mode.
5.5.1Power-On Reset Operation
When power is initially applied to the MCU or the supply voltage drops below the power-on reset re-arm
voltage level, V
holds the MCU in reset until the supply has risen above the LVD low threshold, V
SRS[POR,LVD] bits are set following a POR.
, the POR circuit causes a reset condition. As the supply voltage rises, the LVD circuit
POR
. The
LVDL
LVDH
) or low
MCF51QE128 MCU Series Reference Manual, Rev. 3
96Freescale Semiconductor
Get the latest version from freescale.com
Chapter 5 Resets, Interrupts, and General System Control
5.5.2LVD Reset Operation
The LVD can be configured to generate a reset upon detection of a low voltage condition by setting
LVDRE to 1. The low voltage detection threshold is determined by the LVDV bit. After an LVD reset has
occurred, the L VD system holds the MCU in reset until the supply voltage has risen above the low voltage
detection threshold. SRS[LVD] is set following an LVD reset or POR.
5.5.3LVD Interrupt Operation
When a low voltage condition is detected and the LVD circuit is configured using SPMSC1 for interrupt
operation (L VDE set, LVDIE set, and L VDRE clear), SPMSC1[L VDF] is set and an LVD interrupt request
occurs. The LVDF bit is cleared by writing a 1 to the LVDACK bit in SPMSC1.
The LVD system has a low voltage warning flag (LVWF) to indicate the supply voltage is approaching,
but is above, the LVD voltage. The LVW also has an interrupt associated with it, enabled by setting the
SPMSC3[LVWIE] bit. If enabled, an LVW interrupt request occurs when the LVWF is set. LVWF is
cleared by writing a 1 to the SPMSC3[LVWACK] bit. There are two user-selectable trip voltages for the
LVW, one high (V
) and one low (V
LVWH
). The trip voltage is selected by SPMSC3[LVWV] bit.
LVWL
5.6Peripheral Clock Gating
The MCF51QE128/64/32 includes a clock gating system to manage the bus clock sources to the individual
peripherals. Using this system, you can enable or disable the bus clock to each of the peripherals at the
clock source, eliminating unnecessary clocks to peripherals which are not in use. This reduces the overall
run and wait mode currents.
Out of reset, all peripheral clocks are enabled. For lowest possible run or wait currents, software should
disable the clock source to any peripheral not in use. The actual clock is enabled or disabled immediately
following the write to the clock gating control registers (SCGC1, SCGC2). Any peripheral with a gated
clock cannot be used unless its clock is enabled. Writing to the registers of a peripheral with a disabled
clock has no effect.
NOTE
Software should disable the peripheral before disabling the clocks to the
peripheral. After clocks are re-enabled to a peripheral, the peripheral
registers need to be re-initialized by software.
In stop modes, the bus clock is disabled for all gated peripherals, regardless of the settings in the SCGC1
and SCGC2 registers.
5.7Reset, Interrupt, and System Control Registers and Control Bits
One 8-bit register in the direct page register space and eight 8-bit registers in the high-page register space
are related to reset and interrupt systems.
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor97
Get the latest version from freescale.com
Chapter 5 Resets, Interrupts, and General System Control
Refer to Chapter 4, “Memory”, for the absolute address assignments for all registers. This section refers
to registers and control bits only by their names. A Freescale-provided equate or header file is used to
translate these names into the appropriate absolute addresses.
Some control bits in the SOPT1 and SPMSC2registers are related to modes of operation. Although brief
descriptions of these bits are provided here, the related functions are discussed in greater detail in
Chapter 3, “Modes of Operation”.
5.7.1Interrupt Pin Request Status and Control Register (IRQSC)
This direct page register includes status and control bits which are used to configure the IRQ function,
report status, and acknowledge IRQ events.
76543210
R0
IRQPDDIRQEDGIRQPE
WIRQACK
Reset00000000
Figure 5-1. Interrupt Request Status and Control Register (IRQSC)
IRQF0
IRQIEIRQMOD
Table 5-2. IRQSC Register Field Descriptions
FieldDescription
7Reserved, should be cleared.
6
IRQPDD
5
IRQEDG
4
IRQPE
3
IRQF
2
IRQACK
Interrupt Request (IRQ) Pull Device Disable. This read/write control bit is used to disable the internal
pull-up/pull-down device when the IRQ pin is enabled (IRQPE = 1) allowing for an external device to be used.
0 IRQ pull device enabled if IRQPE = 1.
1 IRQ pull device disabled if IRQPE = 1.
Interrupt Request (IRQ) Edge Select. This read/write control bit selects the polarity of edges or levels on the IRQ
pin that cause IRQF to be set. The IRQMOD control bit determines whether the IRQ pin is sensitive to edges and
levels or only edges. When IRQEDG is set and the internal pull device is enabled, the pull-up device is
reconfigured as an optional pull-down device.
0 IRQ is falling edge or falling edge/low-level sensitive.
1 IRQ is rising edge or rising edge/high-level sensitive.
IRQ Pin Enable. This read/write control bit enables the IRQ pin function. When this bit is set, the IRQ pin can be
used as an external interrupt request.
0 IRQ pin function is disabled.
1 IRQ pin function is enabled.
IRQ Flag. This read-only status bit indicates when an interrupt request event has occurred.
0 No IRQ request.
1 IRQ event detected.
IRQ Acknowledge. This write-only bit acknowledges interrupt request events (write 1 to clear IRQF). Writing 0
has no meaning or effect. Reads always return 0. If edge-and-level detection is selected (IRQMOD = 1), IRQF
cannot be cleared while the IRQ pin remains at its asserted level.
MCF51QE128 MCU Series Reference Manual, Rev. 3
98Freescale Semiconductor
Get the latest version from freescale.com
Chapter 5 Resets, Interrupts, and General System Control
Table 5-2. IRQSC Register Field Descriptions (continued)
FieldDescription
1
IRQIE
0
IRQMOD
IRQ Interrupt Enable. This read/write control bit determines whether IRQ events generate an interrupt request.
0 Interrupt request when IRQF set is disabled (use polling).
1 Interrupt requested when IRQF is set.
IRQ Detection Mode. This read/write control bit selects edge-only detection or edge-and-level detection. The
IRQEDG control bit determines the polarity of edges and levels detected as interrupt request events. See
Section 5.4.1.2, “Edge and Level Sensitivity” for more details.
0 IRQ event on falling edges or rising edges only.
1 IRQ event on falling edges and low levels or on rising edges and high levels.
5.7.2System Reset Status Register (SRS)
This high page register includes read-only status flags to indicate the source of the most recent reset. When
a debug host forces reset by setting CSR2[BDFR], none of the status bits in SRS are set. Writing any value
to this register address clears the COP watchdog timer without affecting the contents of this register. The
reset state of these bits depends on what caused the MCU to reset.
76543210
RPORPINCOPILOPILAD0LVD0
WWriting any value to SRS address clears COP watchdog timer.
POR:
LV D:
10000010
u0000010
Any other
reset:
1
Any of these reset sources active at the time of reset entry causes the corresponding bit(s) to be set; bits corresponding to
sources not active at the time of reset entry are cleared.
0Note1Note
1
Note
1
Note
1
000
Figure 5-2. System Reset Status (SRS)
Table 5-3. SRS Register Field Descriptions
FieldDescription
7
POR
6
PIN
5
COP
Power-On Reset. Reset was caused by the power-on detection logic. Because the internal supply voltage was
ramping up at the time, the low-voltage reset (LVD) status bit is also set to indicate that the reset occurred while
the internal supply was below the LVD threshold.
0 Reset not caused by POR.
1 POR caused reset.
External Reset Pin. Reset was caused by an active-low level on the external reset pin.
0 Reset not caused by external reset pin.
1 Reset came from external reset pin.
Computer Operating Properly (COP) Watchdog. Reset was caused by the COP watchdog timer timing out. This
reset source is blocked if COPE is cleared.
0 Reset not caused by COP timeout.
1 Reset caused by COP timeout.
MCF51QE128 MCU Series Reference Manual, Rev. 3
Freescale Semiconductor99
Get the latest version from freescale.com
Chapter 5 Resets, Interrupts, and General System Control
Table 5-3. SRS Register Field Descriptions (continued)
FieldDescription
4
ILOP
3
ILAD
2Reserved, should be cleared.
1
LV D
0Reserved, should be cleared.
Illegal Opcode. Reset was caused by an attempt to execute an unimplemented or illegal opcode. This includes
any illegal instruction (except the ILLEGAL (0x4AFC) opcode) or a privilege violation (execution of a supervisor
instruction in user mode. The STOP instruction is considered illegal if SOPT1[STOPE,WAITE] are cleared. The
HALT instruction is considered illegal if the BDM interface is disabled (XCSR[ENBDM] = 0).
All illegal opcode resets are enabled when CPUCR[IRD] is cleared. If CPUCR[IRD] is set, then the appropriate
processor exception is generated instead of a reset.
0 Reset not caused by an illegal opcode.
1 Reset caused by an illegal opcode.
Illegal Address. Reset was caused by the processor's attempted access of an illegal address in the memory map,
an address error, an RTE format error, or a fault-on-fault condition. All the illegal address resets are enabled when
CPUCR[ARD] is cleared. When CPUCR[ARD] is set, the appropriate processor exception is generated instead
of a reset, or if a fault-on-fault condition is reached, the processor simply halts.
0 Reset not caused by an illegal access.
1 Reset caused by an illegal access.
Low Voltage Detect. If LVDRE is set and the supply drops below the LVD trip voltage, an LVD reset occurs. This
bit is also set by POR.
0 Reset not caused by LVD trip or POR.
1 Reset caused by LVD trip or POR.
5.7.3System Options Register 1 (SOPT1)
All SOP T1 bit fields, except WAITE, are write-once. Therefore for the write-once bits, only the first write
after reset is honored. Any subsequent attempt to write to these bit fields (intentionally or unintentionally)
is ignored to avoid accidental changes to these sensitive settings. All bit fields may be read at any time and
W AITE is write-anytime. SOP T1 should be written during the reset initialization program to set the desired
controls even if the desired settings are the same as the reset settings.
76543210
R
COPECOPTSTOPEWAITE
W
Reset:11010u11u
POR:11010010
LVR:11010010
1
u = unaffected
Figure 5-3. System Options Register 1 (SOPT1)
0
RSTOPEBKGDPERSTPE
1
MCF51QE128 MCU Series Reference Manual, Rev. 3
100Freescale Semiconductor
Get the latest version from freescale.com
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.