FREESCALE MM912J637AM2EP

Freescale Semiconductor
Advance Information
Document Number: MM912_637D1
Rev. 3.0, 1/2012
Xtrinsic Battery Sensor with
LIN for 12 V Lead-acid
Batteries
MM912_637
EP SUFFIX (PB-FREE)
98ASA00343D
48-PIN QFN
Freescale's Xtrinsic MM912_637 battery sensors are fully
integrated battery monitoring devices. The devices allow
simultaneous measurement of battery current and voltage for
precise determination of SOC (State of Charge), SOH (State of
Health), and other parameters.
The integrated temperature sensor combined with the close proximity to the battery allows battery temperature measurement.
Multiple application-specific hardware blocks reduce MCU overhead and related power consumption. Configurable low-power
modes with automated battery state observation and sophisticated wake-up capability further reduce current consumption. The
integrated LIN 2.1 interface allows communication and control of battery monitoring functions.
Features
•
•
•
•
•
•
•
•
•
Battery voltage measurement
Battery current measurement in up to eight ranges
On chip temperature measurement
Normal and two low-power modes
Current threshold detection and current averaging in
standby => wake-up from low-power mode
Triggered wake-up from LIN and periodic wake-up
Signal low pass filtering (current, voltage)
PGA (programmable low-noise gain amplifier) with
automatic gain control feature
Accurate internal oscillator (an external quartz oscillator
may be used for extended accuracy)
• Communication via a LIN 2.1, LIN2.0 bus interface
• S12 microcontroller with 128 kByte flash, 6.0 kByte RAM,
4.0 kByte data flash
• Background debug module
• External temperature sensor option (TSUP, VTEMP)
• Optional 2nd external voltage sense input (VOPT)
• Four x 5.0 V GPIO including one Wake-up capable high
voltage input (PTB3/L0)
• Eight x MCU general purpose I/O including SPI functionality
• Industry standard EMC compliance
MM912_637
VDDA
ADC Supply
2.5 V Supply
5.0 V Supply
Digital Ground
Reset
5.0 V Digital I/O
Debug and External
Oscillator
MCU Test
AGND
ADCGND
VDDL
VDDH
VDDD2D
VDDX
VDDRX
LIN
(optional)
LGND
Internal
Temp
Sense
Module
TSUP
VTEMP
RESET
RESET_A
PA0/MISO
PA1/MOSI
PA2/SCK
PA3/SS
PA4
PA5
PA6
PA7
BKGD/MODC
PE0/EXTAL
PE1/XTAL
TEST
Optional Temp Sense
Input and Supply
Battery
Positive Pole
+
VOPT
VSENSE
DGND
VSSD2D
VSSRX
Voltage sense Module
Power Supply
VSUP
Battery
Negative Pole
_
ISENSEL
Shunt
ISENSEH
Current Sense Module
Chassis
Ground
PTB0
-5.0 V GPI/O shared
with TIMER, SCI and LIN
-PTB3 high voltage
WAKE capable
PTB1
PTB2
PTB3/L0
GNDSUB
LIN Interface
4
TCLK
TEST_A
Figure 1. Simplified Application Diagram
This document contains information on a product under development. Freescale reserves
the right to change or discontinue this product without notice.
© Freescale Semiconductor, Inc., 2010-2012. All rights reserved.
Analog Test
Ordering Information
1
Ordering Information
Table 1. Ordering Information
Device
(Add an R2 suffix for Tape and
Reel orders)
Temperature Range (TA)
MM912I637AM2EP
Maximum Input
Voltage
Package
-40 °C to 125 °C
MM912J637AM2EP
96
128
42 V
-40 °C to 105 °C
MM912J637AV1EP
Flash (kB)
2
48 QFN-EP
MM912I637AV1EP
Analog Option
96
1
128
Table 2. Analog Options
Feature
Analog Option 1
Analog Option 2
Not Characterized or Tested
Fully Characterized and Tested
External Wake-up (PTB3/L0)
No
Yes
External Temperature Sensor Option (VTEMP)
No
Yes
Optional 2nd External Voltage Sense Input (VOPT)
No
Yes
Cranking Mode
2
Part Identification
This section provides an explanation of the part numbers and their alpha numeric breakdown.
2.1
Description
Part numbers for the chips have fields that identify the specific part configuration. You can use the values of these fields to
determine the specific part you have received.
2.2
Format and Examples
Part numbers for a given device have the following format, followed by a device example:
Table 3 - Part Numbering - Analog EMBEDDED MCU + POWER:
MM 9 cc f xxx r v PPP RR - MM912I637AM2EP
2.3
Fields
These tables list the possible values for each field in the part number (not all combinations are valid).
MM912_637, Rev. 3.0
Freescale Semiconductor
2
Part Identification
Table 3. Part Numbering - Analog EMBEDDED MCU + POWER
FIELD
DESCRIPTION
MM
Product Category
9
Memory Type
cc
Micro Core
f
Memory Size
xxx
Analog Core/Target
r
Revision
t
Temperature Range
v
Variation
PPP
Package Designator
RR
Tape and Reel Indicator
VALUES
• MM- Qualified Standard
• SM- Custom Device
• PM- Prototype Device
• 9 = Flash, OTP
• Blank = ROM
• 08 = HC08
• 12 = HC12
•
•
•
•
•
•
•
•
•
•
A1k
B2k
C4k
D8k
E 16 k
F 32 k
G 48 k
H 64 k
I 96 k
J 128 k
• Assigned by Marketing
• (default A)
•
•
•
•
I = 0 °C to 85 °C
C = -40 °C to 85 °C
V = -40 °C to 105 °C
M = -40 °C to 125 °C
• (default blank)
• Assigned by Packaging
MM912_637, Rev. 3.0
Freescale Semiconductor
3
Table of Contents
1
2
3
4
5
6
7
8
Ordering Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Part Identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.2 Format and Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.3 Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Pin Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.1 MM912_637 Pin Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.2 Recommended External Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.3 Pin Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Electrical Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.2 Absolute Maximum Ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.3 Operating Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.4 Supply Currents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.5 Static Electrical Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.6 Dynamic Electrical Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.7 Thermal Protection Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.8 Electromagnetic Compatibility (EMC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Functional Description and Application Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.1 MM912_637 - Analog Die Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
5.2 Analog Die - Power, Clock and Resets - PCR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.3 Interrupt Module - IRQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
5.4 Current Measurement - ISENSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
5.5 Voltage Measurement - VSENSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
5.6 Temperature Measurement - TSENSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
5.7 Channel Acquisition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
5.8 Window Watchdog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
5.9 Basic Timer Module - TIM (TIM16B4C) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
5.10 General Purpose I/O - GPIO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
5.11 LIN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
5.12 Serial Communication Interface (S08SCIV4) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
5.13 Life Time Counter (LTC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
5.14 Die to Die Interface - Target . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
5.15 Embedded Microcontroller - Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
5.16 MCU - Port Integration Module (9S12I128PIMV1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
5.17 MCU - Interrupt Module (S12SINTV1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
5.18 Memory Map Control (S12PMMCV1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
5.19 MCU - Debug Module (S12SDBG) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
5.20 MCU - Security (S12XS9SECV2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
5.21 Background Debug Module (S12SBDMV1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
5.22 S12 Clock, Reset, and Power Management Unit (S12CPMU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
5.23 MCU - Serial Peripheral Interface (S12SPIV5) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
5.24 128 kByte Flash Module (S12FTMRC128K1V1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
5.25 MCU - Die-to-Die Initiator (D2DIV1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
MM912_637 - Trimming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
6.2 IFR Trimming Content and Location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
6.3 Memory Map and Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
Packaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
7.1 Package dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
MM912_637, Rev. 3.0
4
Freescale Semiconductor
Freescale Semiconductor
ALU
MISO
MOSI
SCK
SS
RAM 6k Byte
SPI
Dataflash 4k Bytes with ECC
Flash 128k Bytes with ECC
CPU
Register
M68HCS12 CPU
Reset Generation and
Test Entry
VREG
1.8V Core
2.7V Flash
Internal Bus
PA0
PA1
PA2
PA3
PA4
PA5
Amplitude Controlled
Low Power Pierce Osc.
BKGD/MODC
PLL with Freq. Modulation option
OSC Clock Monitor
PTE
[1:0]
RESET
TEST
PTE1 / XTAL
PTE0 / EXTAL
D2DI
PC1
PD0
PD4
PD1
PD5
PD2
PD6
PD3
PD7
PC0
MCU Die
Debug Module
include 64 byte Trace Buffer RAM
Interrupt Module
Periodic Interrupt
COP Watchdog
Single-Wire Background Debug
Module
D2DCLK
D2DINT
D2DDAT0
D2DDAT4
D2DDAT1
D2DDAT5
D2DDAT2
D2DDAT6
D2DDAT3
D2DDAT7
Test
Interface
TEST_A
Analog Die
RESET_A
BIAS
Cascaded
Voltage Regulators
VDDH = 2.5V
(D2D Buffer)
VDDL = 2.5V
(Internal Digital)
VDDX = 5V
(MCU Core)
Die To Die
Interface
Interrupt
Control Module
Trimming /
Calibration
Reset
Control Module
TCLK
PTA
DDRA
PA6
16 Bit
- ADC
16 Bit
- ADC
LIN
Physical
Layer
SCI
4 Channel Timer
Wake Up Control Module
(with Current Threshold and
Current Averaging)
Internal Chip Temp Sense
with optional external input
Current Sense Module
(PGA with auto Gain Control)
Low Pass Filter
And
Control
VBAT / VOPT Sense Module
Temp Sense Supply
GPIO
16 Bit
ADC
ADC
Regulator
GNDSUB
GNDSUB
GNDSUB
GNDSUB
LGND
LIN
Internal Bus
VSUP
DGND
VDDL
VDDX
VDDH
VDDD2D
VSSD2D
VDDRX
VSSRX
PA7
Figure 2. Sample Block Diagram
MM912_637, Rev. 3.0
5
PTB0
PTB1
PTB2
PTB3 (L0)
VTEMP
ISENSEL
ISENSEH
ADCGND
AGND
VDDA
VSENSE
VOPT
TSUP
Pin Assignment
BKGD/MODC
RESET
RESET_A
DGND
TEST_A
VDDL
GNDSUB
TCLK
PTB0
PTB1
PTB2
Pin Assignment
PA7
3
48
47
46
45
44
43
42
41
40
39
38
37
PA6
1
36
PTB3 / L0
PTE0/EXTAL
2
35
VOPT
PTE1/XTAL
3
34
VSENSE
TEST
4
33
ADCGND
PA5
5
32
ISENSEH
PA4
6
31
ISENSEL
EP
PA3/SS
7
30
GNDSUB
PA2/SCK
8
29
TSUP
PA1/MOSI
9
28
VTEMP
PA0/MISO
10
27
AGND
VSSRX
11
26
VDDA
VDDRX
12
25
NC
16
17
18
19
20
21
22
23
24
GNDSUB
VDDX
DGND
VDDH
GNDSUB
VSUP
LIN
LGND
NC (VFUSE)
VDDD2D
NC
14
VSSD2D
15
13
Figure 3. MM912_637 Pin Connections
3.1
MM912_637 Pin Description
The following table gives a brief description of all available pins on the MM912_637 device. Refer to the highlighted chapter for
detailed information
Table 4. MM912_637 Pin Description
Pin #
Pin Name
1
PA6
2
PE0/EXTAL
Formal Name
Description
MCU PA6
General purpose port A input or output pin 6. See Section 5.16, “MCU - Port
Integration Module (9S12I128PIMV1)".
MCU Oscillator
EXTAL in one of the optional crystal/resonator drivers and external clock pins, and
the PE0 port may be used as a general purpose I/O. On reset, all the device
clocks are derived from the internal reference clock. See Section 5.22, “S12
Clock, Reset, and Power Management Unit (S12CPMU)".
MM912_637, Rev. 3.0
Freescale Semiconductor
6
Pin Assignment
Table 4. MM912_637 Pin Description
Pin #
Pin Name
3
PE1/XTAL
4
TEST
5
PA5
6
PA4
7
PA3
8
PA2
9
PA1
10
PA0
11
VSSRX
12
VDDRX
Formal Name
Description
MCU Oscillator
XTAL is one of the optional crystal/resonator drivers and external clock pins, and
the PE1 port may be used as a general purpose I/O. On reset all the device clocks
are derived from the internal reference clock. See Section 5.22, “S12 Clock,
Reset, and Power Management Unit (S12CPMU)".
MCU Test
This input only pin is reserved for test. This pin has a pull-down device. The TEST
pin must be tied to VSSRX in user mode.
MCU PA5
General purpose port A input or output pin 5. See Section 5.16, “MCU - Port
Integration Module (9S12I128PIMV1)".
MCU PA4
General purpose port A input or output pin 4. See Section 5.16, “MCU - Port
Integration Module (9S12I128PIMV1)".
MCU PA3 / SS
General purpose port A input or output pin 3, shared with the SS signal of the
integrated SPI interface. See Section 5.16, “MCU - Port Integration Module
(9S12I128PIMV1)".
MCU PA2 / SCK
General purpose port A input or output pin 2, shared with the SCLK signal of the
integrated SPI interface. See Section 5.16, “MCU - Port Integration Module
(9S12I128PIMV1)".
MCU PA1 / MOSI
General purpose port A input or output pin 1, shared with the MOSI signal of the
integrated SPI interface. See Section 5.16, “MCU - Port Integration Module
(9S12I128PIMV1)".
MCU PA0 / MISO
General purpose port A input or output pin 0, shared with the MISO signal of the
integrated SPI interface. See Section 5.16, “MCU - Port Integration Module
(9S12I128PIMV1)".
MCU 5.0 V Ground
External ground for the MCU - VDDRX return path.
MCU 5.0 V Supply
5.0 V MCU power supply. MCU core- (internal 1.8 V regulator) and flash (internal
2.7 V regulator) supply.
13
VSSD2D
MCU 2.5 V Ground
External ground for the MCU - VDDD2D return path.
14
VDDD2D
MCU 2.5 V Supply
2.5 V MCU power supply. Die to die buffer supply.
Not connected
This pin must be grounded in the application.
Substrate Ground
Substrate ground connection to improve EMC behavior.
Voltage Regulator Output
5.0 V
5.0 V main voltage regulator output pin. An external capacitor (CVDDX) is needed.
See Section 5.2, “Analog Die - Power, Clock and Resets - PCR".
Digital Ground
This pin is the device digital ground connection. See Section 5.2, “Analog Die Power, Clock and Resets - PCR".
Voltage Regulator Output
2.5 V
2.5 V high power main voltage regulator output pin to be connected with the
VDDD2D MCU pin. An external capacitor (CVDDH) is needed. See Section 5.2,
“Analog Die - Power, Clock and Resets - PCR".
Substrate Ground
Substrate ground connection to improve EMC behavior.
Power Supply
This pin is the device power supply pin. A reverse battery protection diode is
required. See Section 5.2, “Analog Die - Power, Clock and Resets - PCR".
LIN Bus I/O
This pin represents the single-wire bus transmitter and receiver. See
Section 5.11, “LIN".
LIN Ground Pin
This pin is the device LIN ground connection. See Section 5.2, “Analog Die Power, Clock and Resets - PCR".
15
NC
16
GNDSUB
17
VDDX
18
DGND
19
VDDH
20
GNDSUB
21
VSUP
22
LIN
23
LGND
24
NC
Not connected (reserved)
This pin must be grounded in the application.
25
NC
Not connected
This pin must be grounded in the application.
26
VDDA
Analog Voltage Regulator
Output
Low power analog voltage regulator output pin, permanently supplies the analog
front end. An external capacitor (CVDDA) is needed. See Section 5.2, “Analog Die
- Power, Clock and Resets - PCR".
27
AGND
Analog Ground
This pin is the device analog voltage regulator and LP oscillator ground
connection. See Section 5.2, “Analog Die - Power, Clock and Resets - PCR".
MM912_637, Rev. 3.0
Freescale Semiconductor
7
Pin Assignment
Table 4. MM912_637 Pin Description
Pin #
Pin Name
28
VTEMP
29
TSUP
30
GNDSUB
31
ISENSEL
32
ISENSEH
33
ADCGND
34
VSENSE
35
VOPT
36
37
38
39
Formal Name
Temperature Sensor Input
External temperature sensor input. See Section 5.6, “Temperature Measurement
- TSENSE".
Temperature Sensor Supply
Output
Supply for the external temperature sensor. TSUP frequency compensation
option to allow capacitor CTSUP. See Section 5.6, “Temperature Measurement TSENSE".
Substrate Ground
Substrate ground connection to improve EMC behavior.
Current Sense L
Current sense input “Low”. This pin is used in combination with ISENSEH to
measure the voltage drop across a shunt resistor. See Section 5.4, “Current
Measurement - ISENSE".
Current Sense H
Current sense input “high”. This pin is used in combination with ISENSEL to
measure the voltage drop across a shunt resistor. See Section 5.4, “Current
Measurement - ISENSE".
Analog Digital Converter
Ground
Analog digital converter ground connection. See Section 5.2, “Analog Die Power, Clock and Resets - PCR".
Voltage Sense
Precision battery voltage measurement input. This pin can be connected directly
to the battery line for voltage measurements. The voltage preset at this input is
scaled down by an internal voltage divider. The pin is self protected against
reverse battery connections. An external resistor (RVSENSE) is needed for
protection. See Section 5.5, “Voltage Measurement - VSENSE".
Optional Voltage Sense
Optional voltage measurement input. See Section 5.5, “Voltage Measurement VSENSE".
General Purpose Input 3 High Voltage Input 0
This is the high voltage general purpose input pin 3, based on VDDX with the
following shared functions:
• Internal clamping structure to operate as a high voltage input (L0). When used
as high voltage input, a series resistor (RL0) and capacitor to GND (CL0) must
be used to protect against automotive transients, when used to connect
outside the PCB.
• 5.0 V (VDDX) digital port input
• Selectable internal pull-down resistor
• Selectable wake-up input during low power mode.
• Selectable timer channel input
• Selectable connection to the LIN / SCI (Input only)
See Section 5.10, “General Purpose I/O - GPIO".
General Purpose I/O 2
This is the general purpose I/O pin 2 based on VDDX with the following shared
functions:
• Bidirectional 5.0 V (VDDX) digital port I/O
• Selectable internal pull-up resistor
• Selectable timer channel input/output
• Selectable connection to the LIN / SCI
See Section 5.10, “General Purpose I/O - GPIO".
General Purpose I/O 1
This is the general purpose I/O pin 1, based on VDDX with the following shared
functions:
• Bidirectional 5.0 V (VDDX) digital port I/O
• Selectable internal pull-up resistor
• Selectable timer channel input/output
• Selectable connection to the LIN / SCI
See Section 5.10, “General Purpose I/O - GPIO".
General Purpose I/O 0
This is the general purpose I/O pin 0 based on VDDX with the following shared
functions:
• Bidirectional 5.0 V (VDDX) digital port I/O
• Selectable internal pull-up resistor
• Selectable timer channel input/output
• Selectable connection to the LIN / SCI
See Section 5.10, “General Purpose I/O - GPIO".
PTB3 / L0
PTB2
PTB1
PTB0
Description
MM912_637, Rev. 3.0
Freescale Semiconductor
8
Pin Assignment
Table 4. MM912_637 Pin Description
Pin #
Pin Name
40
TCLK
41
GNDSUB
42
VDDL
43
TEST_A
44
DGND
45
RESET_A
46
RESET
47
BKGD
48
PA7
Formal Name
Description
Test Clock Input
Test mode clock input pin for Test mode only. This pin must be grounded in user
mode.
Substrate Ground
Substrate ground connection to improve EMC behavior.
Low Power Voltage
Regulator Output
2.5 V low power voltage regulator output pin. See Section 5.2, “Analog Die Power, Clock and Resets - PCR".
Test Mode
Analog die Test mode pin for Test mode only. This pin must be grounded in user
mode.
Digital Ground
This pin is the device digital ground connection. See Section 5.2, “Analog Die Power, Clock and Resets - PCR".
Reset I/O
Reset output pin of the analog die. Active low signal with internal pull-up. VDDX
based. See Section 5.2, “Analog Die - Power, Clock and Resets - PCR".
MCU Reset
Bidirectional reset I/O pin of the MCU die. Active low signal with internal pull-up.
VDDRX based. See Section 5.2, “Analog Die - Power, Clock and Resets - PCR".
MCU Background Debug
and Mode
The BKGD/MODC pin is used as a pseudo-open-drain pin for the background
debug communication. It is used as an MCU operating mode select pin during
reset. The state of this pin is latched to the MODC bit at the rising edge of RESET.
The BKGD pin has a pull-up device. See Section 5.19, “MCU - Debug Module
(S12SDBG)".
MCU PA7
General purpose port A input or output pin 7. See Section 5.16, “MCU - Port
Integration Module (9S12I128PIMV1)".
MM912_637, Rev. 3.0
Freescale Semiconductor
9
Pin Assignment
3.2
Recommended External Components
Figure 4 and Table 5 list the required / recommended / optional external components for the application.
Battery
Plus Pole
D1
RVOPT
CVBAT
VDDL
VSUP
VSENSE
VOPT
Battery
Minus Pole
RVSENSE
VDDD2D
VDDH
RISENSEL
CISENSEL
RSHUNT
VDDRX
ISENSEL
VDDX
CISENSEHL
RISENSEH
CVDDX
DGND
ISENSEH
CVDDH
VSSD2D
CISENSEH
VSSRX
Chassis
Ground
VTEMP
GNDSUB
PTB3 / L0
GNDSUB
LGND
GNDSUB
CLIN
GNDSUB
LIN
Exposed Pad (EP)
RVTEMP
LIN
TSUP
VDDA
CVDDA
CTSUP
AGND
ADCGND
RL0
CL0
Note: Module GND connected to Battery Minus or Chassis Ground – based on configuration.
Figure 4. Required / Recommended External Components
Table 5. Required / Recommended External Components
Name
Description
Value
Connection
D1
Reverse Battery Diode
n.a.
VSUP-VBAT
CVBAT
Battery Blocking Capacitor
4.7 µF/100 nF
VSUP-GND
RVSENSE
VSENSE Current Limitation
2.2 k
VSENSE-VBAT
RVOPT
VOPT Current Limitation
2.2 k
VOPT-signal
ISENSEH-ISENSEL
Comment
Ceramic
optional(1)
RSHUNT
Current Shunt Resistor
100 µ
RISENSEL
EMC Resistor
500  max
select for best EMC
performance
RISENSEH
EMC Resistor
500  max
select for best EMC
performance
CISENSEL
EMC Capacitor
TBD
select for best EMC
performance
CISENSEHL
EMC Capacitor
TBD
select for best EMC
performance
CISENSEH
EMC Capacitor
TBD
select for best EMC
performance
MM912_637, Rev. 3.0
Freescale Semiconductor
10
Pin Assignment
Table 5. Required / Recommended External Components
Name
Description
Value
Connection
Comment
CVDDH
Blocking Capacitor
1.0 µF
VDDH-GND
CVDDX
Blocking Capacitor
220 nF
VDDX-GND
CVDDA
Blocking Capacitor
47 nF
VDDA-GND
CVDDL
Blocking Capacitor
n.a.
VDDL-GND
not required
CLIN
LIN Bus Filter
n.a.
LIN-LGND
not required
RL0
PTB3 / L0 Current Limitation
47 k
L0
CL0
PTB3 / L0 ESD Protection
47 nF
L0-GND
CTSUP
Blocking Capacitor
220 pF
TSUP-GND
not required(2)
RVTEMP
VTEMP Current Limitation
20 k
VTEMP-signal
optional(1)
Notes
1.Required if extended EMC protection is needed
2.If an external temperature sensor is used, EMC compliance may require the addition of CTSUP. In this case the ECAP bit must be set to
ensure the stability of the TSUP power supply circuit. See Section 5.6.1.2, “Block Diagram".
3.3
Pin Structure
Table 6 documents the individual pin characteristic.
Table 6. Pin Type / Structure
Pin #
Pin Name
Alternative
Pin Function
Power
Supply
Structure
1
PA6
n.a.
VDDRX
n.a.
2
PE0
EXTAL
VDDRX
PUPEE / OSCPINS_EN
3
PE1
XTAL
VDDRX
PUPEE / OSCPINS_EN
4
TEST
n.a.
n.a.
n.a.
5
PA5
n.a.
VDDRX
n.a.
6
PA4
n.a.
VDDRX
n.a.
7
PA3
SS
VDDRX
n.a.
8
PA2
SCK
VDDRX
n.a.
9
PA1
MOSI
VDDRX
n.a.
10
PA0
MISO
VDDRX
n.a.
11
VSSRX
n.a.
12
VDDRX
n.a.
13
VSSD2D
n.a.
14
VDDD2D
n.a.
15
NC
n.a.
16
GNDSUB
n.a.
GND
GND
GND
17
VDDX
n.a.
VDDX
18
DGND
n.a.
GND
B2B-Diode to GNDSUB
19
VDDH
n.a.
VDDH
Negative Clamp Diode, Dynamic ESD (transient protection)
20
GNDSUB
n.a.
GND
GNDSUB
21
VSUP
n.a.
VSUP
Negative Clamp Diode, >42 V ESD
22
LIN
n.a.
VSUP
No Negative Clamping Diode (-40 V), >42 V ESD
23
LGND
n.a.
GND
B2B-Diode to GNDSUB
MM912_637, Rev. 3.0
Freescale Semiconductor
11
Pin Assignment
Table 6. Pin Type / Structure
Pin #
Pin Name
Alternative
Pin Function
Power
Supply
Structure
24
NC
n.a.
n.a.
Negative Clamp Diode, >15 V ESD
25
NC
n.a.
n.a.
n.a.
26
VDDA
n.a.
VDDA
Negative Clamp Diode, Dynamic ESD (transient protection)
27
AGND
n.a.
GND
B2B-Diode to GNDSUB
28
VTEMP
VDDA
Negative Clamp Diode, >6.0 V ESD
29
TSUP
TSUP
Negative Clamp Diode, Dynamic ESD (transient protection)
30
GNDSUB
GND
GND
31
ISENSEL
n.a.
Negative Clamp Diode, 2nd Clamp Diode to VDDA
32
ISENSEH
n.a.
Negative Clamp Diode, 2nd Clamp Diode to VDDA
33
ADCGND
GND
B2B-Diode to GNDSUB
34
VSENSE
n.a.
No Negative Clamping Diode (-40 V), >42 V ESD
35
VOPT
n.a.
No Negative Clamping Diode (-40 V), >42 V ESD
36
PTB3 / L0
VDDRX
Negative Clamp Diode, >6.0 V ESD
37
PTB2
VDDRX
Negative Clamp, Dynamic 5.5 V ESD
38
PTB1
VDDRX
Negative Clamp, Dynamic 5.5 V ESD
39
PTB0
VDDRX
Negative Clamp, Dynamic 5.5 V ESD
40
TCLK
VDDRX
Negative Clamp, Dynamic 5.5 V ESD
41
GNDSUB
GND
GND
42
VDDL
VDDL
Negative Clamp Diode, Dynamic ESD (transient protection)
43
TEST_A
VDDRX
Negative Clamp, positive 10 V Clamp
44
DGND
GND
B2B-Diode to GNDSUB
45
RESET_A
VDDRX
Negative Clamp, positive 10 V Clamp
46
RESET
47
BKGD
48
PA7
MODC
VDDRX
Pull-up
VDDRX
BKPUE
VDDRX
n.a.
MM912_637, Rev. 3.0
Freescale Semiconductor
12
Electrical Characteristics
4
Electrical Characteristics
4.1
General
This section contains electrical information for the microcontroller, as well as the MM912_637 analog die.
4.2
Absolute Maximum Ratings
Absolute maximum ratings are stress ratings only. A functional operation under or outside these maximums is not guaranteed.
Stress beyond these limits may affect the reliability, or cause permanent damage of the device.
This device contains circuitry protecting against damage due to high static voltage or electrical fields. However, it is advised that
normal precautions be taken to avoid application of any voltages higher than maximum rated voltages to this high-impedance
circuit. Reliability of operation is enhanced if unused inputs are tied to an appropriate voltage level. All voltages are with respect
to ground, unless otherwise noted.
Table 7. Absolute Maximum Electrical Ratings - Analog Die
Ratings
Symbol
Value
Unit
VVSUP
-0.3 to 42
V
VVSENSE
-16 to 42
V
VSUP pin voltage
VSENSE pin voltage(3)
VOPT pin voltage
VVOPT
-16 to 42
V
VTEMP pin voltage
VVTEMP
-0.3 to VDDA+0.25
V
ISENSEH and ISENSEL pin voltage
VISENSE
-0.5 to VDDA+0.25
V
ISENSEH and ISENSEL pin current
IISENSE
-1 to 1
mA
LIN pin voltage
LIN pin current (internally limited)
VBUS
-33 to 42
V
IBUSLIM
on page 18
mA
L0 pin voltage with RPTB3
VPTB3
-0.3 to 42 max.
V
Input / Output pins PTB[0:2] voltage
VPTB0-2
-0.3 to VDDX+0.5
V
Pin voltage at VDDX
VDDX
-0.3 to 5.75
V
Pin voltage at VDDH
VDDH
-0.3 to 2.75
V
VDDH output current
IVDDH
internally limited
A
VDDX output current
IVDDX
internally limited
A
TCLK pin voltage
VTCLK
-0.3 to VDDX+0.5
V
VIN
-0.3 to VDDX+0.5
V
RESET_A pin voltage
Notes
3.It has to be assured by the application circuit that these limits will not be exceeded, e.g. by ISO pulse 1.
Table 8. Maximum Electrical Ratings - MCU Die
Ratings
Symbol
Value
Unit
5.0 V supply voltage
VDDRX
-0.3 to 6.0
V
2.5 V supply voltage
VDDD2D
-0.3 to 3.6
V
Digital I/O input voltage (PTA0...7)
VIN
-0.3 to 6.0
V
EXTAL, XTAL
VIN
-0.3 to 2.16
V
Instantaneous maximum current single pin limit for all digital I/O pins(4)
ID
-25 to 25
mA
Instantaneous maximum current single pin limit for EXTAL, XTAL
I
-25 to 25
mA
DL
Notes
4.All digital I/O pins are internally clamped to VSSRX and VDDRX.
MM912_637, Rev. 3.0
Freescale Semiconductor
13
Electrical Characteristics
Table 9. Maximum Thermal Ratings
Ratings
Symbol
Value
Unit
Storage temperature
TSTG
-55 to 150
C
Package thermal resistance (5)
RJA
25 typ.
C/W
Notes
5.RJA value is derived using a JEDEC 2s2p test board
4.3
Operating Conditions
This section describes the operating conditions of the device. Conditions apply to all the following data, unless otherwise noted.
Table 10. Operating Conditions
Ratings
Symbol
Value
Unit
Functional operating supply voltage - Device is fully functional. All features
are operating.
VSUP
3.5 to 28
V
Extended range for RAM Content is guaranteed. Other device functionary is
limited. With cranking mode enabled (seeSection 5.2.3.4, “Low Voltage
Operation - Cranking Mode Device Option").
VSUPL
2.5 to 3.5
V
VSENSE
0 to 28
V
VOPT
0 to 28
V
VTEMP
0 to 1.25
V
VVSUP_LIN
7 to 18
V
Functional operating VSENSE voltage(6)
Functional operating VOPT voltage
External temperature sense input - VTEMP
LIN output voltage range
ISENSEH / ISENSEL terminal voltage
VISENSE
-0.5 to 0.5
V
MCU 5.0 V supply voltage
VDDRX
3.13 to 5.5
V
MCU 2.5 V supply voltage
VDDD2D
2.25 to 3.6
V
MCU oscillator
fOSC
4 to 16
MHz
MCU bus frequency
fBUS
max. 32.768
MHz
TA
-40 to 125
C
Operating junction temperature - analog die
TJ_A
-40 to 150
C
Operating junction temperature - MCU die
TJ_M
-40 to 150
C
Operating ambient temperature
Notes
6.Values VSENSE > 28 V are flagged in the VSENSE
4.4
Supply Currents
This section describes the current consumption characteristics of the device, as well as the conditions for the measurements.
4.4.1
Measurement Conditions
All measurements are without output loads. The currents are measured in MCU special single chip mode, and the CPU code is
executed from RAM, unless otherwise noted.
For Run and Wait current measurements, PLL is on and the reference clock is the IRC1M, trimmed to 1.024 MHz. The bus
frequency is 32.768 MHz and the CPU frequency is 65.536 MHz. Table 11 and Table 12 show the configuration of the CPMU
module for Run, Wait, and Stop current measurements. Table 13 shows the configuration of the peripherals for run current
measurements
MM912_637, Rev. 3.0
Freescale Semiconductor
14
Electrical Characteristics
Table 11. CPUM Configuration for Run/Wait and Full Stop Current Measurement
CPMU REGISTER
Bit settings/Conditions
CPMUSYNR
VCOFRQ[1:0]=01,SYNDIV[5:0] = 32.768 MHz
CPMUPOSTDIV
POSTDIV[4:0]=0,
CPMUCLKS
PLLSEL=1
CPMUOSC
OSCE=0, Reference clock for PLL is fREF=fIRC1M trimmed to 1.024 MHz
Table 12. CPMU Configuration for Pseudo Stop Current Measurements
CPMU REGISTER
Bit settings/Conditions
CPMUCLKS
PLLSEL=0, PSTP=1, PRE=PCE=RTIOSCSEL=COPOSCSEL=1
CPMUOSC
OSCE=1, External square wave on EXTAL fEXTAL=16 MHz, VIH= 1.8 V, VIL=0 V
CPMURTI
RTDEC=0, RTR[6:4]=111, RTR[3:0]=1111;
CPMUCOP
WCOP=1, CR[2:0]=111
Table 13. MCU Peripheral Configurations for Run Supply Current Measurements
Peripheral
Configuration
SPI
configured to master mode, continuously transmit data (0x55 or 0xAA) at 1.0 Mbit/s
D2DI
continuously transmit data (0x55 or 0xAA)
COP
COP Watchdog Rate 224
RTI
enabled, RTI Control Register (RTICTL) set to $FF
DBG
The module is enabled and the comparators are configured to trigger in outside range. The range covers all the
code executed by the core.
Table 14. Analog Die Configurations for Normal Mode Supply Current Measurements
Peripheral
Configuration
D2D
maximum frequency
LIN
enabled, recessive state
TIMER
enabled
LTC
enabled
Channels
Current, voltage, and temperature measurement enabled, LPF and Auto Gain enabled
MM912_637, Rev. 3.0
Freescale Semiconductor
15
Electrical Characteristics
Table 15. Supply Currents(7)
Ratings
Symbol
Min
Typ.(8)
Max
Unit
25
35
mA
MM912_637 COMBINED CONSUMPTION
Normal mode current both dice.
IRUN
ANALOG DIE CONTRIBUTION - EXCLUDING MCU AND EXTERNAL LOAD CURRENT, (3.5 V  VSUP  28 V; -40 °C  TA  125 °C)
Normal mode current measured at VSUP
INORMAL
Stop mode current measured at VSUP
1.5
4.0
mA
ISTOP
Continuous base current(9)
Stop current during cranking mode
Current adder during current trigger event - (typ. 10 ms duration(10),
temperature measurement = OFF)
Sleep mode measured at VSUP
75
100
107
130
1500
1750
µA
ISLEEP
Continuous base current(9)
Current adder during current trigger event - (typ. 10 ms duration(10),
temperature measurement = OFF)
52
85
1500
1750
µA
MCU DIE CONTRIBUTION, VDDRX = 5.5 V
Run Current, TA  125 °C
IRUN
13.5
18.8
mA
Wait current, TA  125 °C
IWAIT
7.0
8.8
mA
Stop current
ISTP
TA = 125 °C
90
200
TA = 25 °C
25
40
TA = -40 °C
15
25
TA = 150 °C
450
520
TA = 25 °C
350
500
TA = -40 °C
330
410
Pseudo stop current, RTI and COP enabled
µA
ISTP
µA
Notes
7.See Table 11, Table 12, Table 13, and Table 14 for conditions. Currents measured in Test mode with external loads (100 pF) and the external
clock at 64 MHz.
8.Typical values noted reflect the approximate parameter mean at TA = 25 °C.
9.From VSUP 6.0 to 28 V
10.Duration based on channel configuration. 10ms typical for Decimation Factor = 512, Chopper = ON.
4.5
Static Electrical Characteristics
All characteristics noted under conditions 3.5 V VSUP28 V, -40 C TA125 C, unless otherwise noted. Typical values noted
reflect the approximate parameter mean at TA = 25 °C under nominal conditions, unless otherwise noted.
4.5.1
Static Electrical Characteristics Analog Die
Table 16. Static Electrical Characteristics - Power Supply
Ratings
Symbol
Low Voltage Reset L (POR) Assert (measured on VDDL)
Min
Typ
Max
1.75
1.9
2.1
1.85
2.1
2.35
V
PORL
Cranking Mode Disabled
Low Voltage Reset L (POR) Deassert (measured on VDDL)
V
PORH
Cranking Mode Disabled
Unit
V
V
MM912_637, Rev. 3.0
Freescale Semiconductor
16
Electrical Characteristics
Table 16. Static Electrical Characteristics - Power Supply
Ratings
Symbol
Low Voltage Reset L (POR) Assert (measured on VDDL)
V
Cranking Mode Enabled(11)
Min
Typ
Max
1.0
1.3
1.7
PORCL
Unit
V
Low Voltage Reset A (LVRA) Assert (measured on VDDA)
V
1.9
2.05
2.2
V
Low Voltage Reset A (LVRA) Deassert (measured on VDDA)
VLVRAH
2.0
2.15
2.3
V
Low Voltage Reset X (LVRX) Assert (measured on VDDX)
V
2.5
2.75
3.0
V
Low Voltage Reset X (LVRX) Deassert (measured on VDDX)
V
2.7
2.95
3.25
V
LVRAL
LVRXL
LVRXH
Low Voltage Reset H (LVRH) Assert (measured on VDDH)
VLVRHL
1.95
2.075
2.2
V
Low Voltage Reset H (LVRH) Deassert (measured on VDDH)
V
2.05
2.175
2.3
V
UVIL
4.65
5.2
6.1
V
UVIH
4.9
5.4
6.2
V
UVCIL
3.4
3.6
4.0
V
UVCIH
3.5
3.8
4.1
V
LVRHH
Under-voltage Interrupt (UVI) Assert (measured on VSUP), Cranking Mode
Disabled
V
Under-voltage Interrupt (UVI) Deassert (measured on VSUP), Cranking
Mode Disabled
V
Under-voltage Cranking Interrupt (UVI) Assert (measured on VSUP)
Cranking Mode Enabled
V
Under-voltage Cranking Interrupt (UVI) Deassert (measured on VSUP)
Cranking Mode Enabled
V
VSENSE/VOPT High Voltage Warning Threshold Assert(12)
Notes
11.Deassert with Cranking off = V
V
28
TH
V
PORH
12.5.0 V < VSUP < 28 V, Digital Threshold at the end of channel chain (incl. compensation)
Table 17. Static Electrical Characteristics - Resets
Ratings
Low-state Output Voltage IOUT = 2.0 mA
Pull-up Resistor
Low-state Input Voltage
High-state Input Voltage
Symbol
Min
Typ
VOL
RRPU
25
VIL
VIH
0.7VDDX
Reset Release Voltage (VDDX)
VRSTRV
0
RESET_A pin Current Limitation
ILIMRST
Max
Unit
0.8
V
50
kOhm
0.3VDDX
V
V
0.02
1.0
V
10
mA
MM912_637, Rev. 3.0
Freescale Semiconductor
17
Electrical Characteristics
Table 18. Static Electrical Characteristics - Voltage Regulator Outputs
Ratings
Symbol
Min
Typ
Max
Unit
Output Voltage 1.0 mA  IVDDA  1.5 mA
VDDA
2.25
2.5
2.75
V
Output Current Limitation
IVDDA
10
mA
V
Analog Voltage Regulator - VDDA
(13)
Low Power Digital Voltage Regulator - VDDL(13)
Output Voltage
VDDL
2.25
2.5
2.75
Output Voltage 1.0 mA  IVDDH  30 mA
VDDH
2.4
2.5
2.75
V
Output Current Limitation
IVDDH
65
mA
High Power Digital Voltage Regulator - VDDH(14)
5.0 V Voltage Regulator - VDDX(14)
Output Voltage 1.0 mA  IVDDX  30 mA
VDDX
3.15
5.0
5.9
V
Output Current Limitation
IVDDX
45
60
80
mA
Notes
13.No additional current must be taken from those outputs.
14.The specified current ranges does include the current for the MCU die. No external loads recommended.
Table 19. Static Electrical Characteristics - LIN Physical Layer Interface - LIN
Ratings
Current Limitation for Driver dominant state. VBUS = 18 V
Symbol
Min
Typ
Max
Unit
120
200
mA
IBUSLIM
40
Input Leakage Current at the Receiver incl. Pull-up Resistor RSLAVE;
Driver OFF; VBUS = 0 V; VBAT = 12 V
IBUS_PAS_DOM
-1.0
Input Leakage Current at the Receiver incl. Pull-up Resistor RSLAVE;
Driver OFF; 8.0 V VBAT  18 V; 8.0 V VBUS  18 V; VBUS  VBAT
IBUS_PAS_REC
Input Leakage Current; GND Disconnected; GNDDEVICE = VSUP;
0 < VBUS < 18 V; VBAT = 12 V
IBUS_NO_GND
Input Leakage Current; VBAT disconnected; VSUP_DEVICE = GND;
0 < VBUS < 18 V
Receiver Input Voltage; Receiver Dominant State
mA
20
µA
1.0
mA
IBUS_NO_BAT
100
µA
VBUSDOM
0.4
VSUP
-1.0
Receiver Input Voltage; Receiver Recessive State
VBUSREC
0.6
Receiver Threshold Center (VTH_DOM + VTH_REC)/2
VBUS_CNT
0.475
0.5
Receiver Threshold Hysteresis (VTH_REC - VTH_DOM)
VBUS_HYS
Voltage Drop at the serial Diode
DSER_INT
0.3
0.7
RSLAVE
20
30
LIN Pull-up Resistor
Low Level Output Voltage, IBUS=40 mA
High Level Output Voltage, IBUS=-10 µA, RL=33 kOhm
J2602 Detection Deassert Threshold for VSUP level
J2602 Detection Assert Threshold for VSUP level
J2602 Detection Hysteresis
BUS Wake-up Threshold
VSUP
VDOM
VREC
VSUP-1
VJ2602H
5.9
0.525
VSUP
0.175
VSUP
1.0
V
60
kOhm
0.3
VSUP
V
6.3
6.7
V
VJ2602L
5.8
6.2
6.6
V
VJ2602HYS
70
190
250
mV
VLINWUP
4.0
5.25
6.0
V
MM912_637, Rev. 3.0
Freescale Semiconductor
18
Electrical Characteristics
Table 20. Static Electrical Characteristics - High Voltage Input - PTB3 / L0
Ratings
Symbol
Wake-up Threshold - Rising Edge
Input High Voltage (digital Input)
Input Low Voltage (digital Input)
Input Hysteresis
Internal Clamp Voltage
Input Current PTB3 / L0 (VIN = 42 V; RL0=47 kOhm)
Min
Typ
VWTHR
1.3
2.6
VIH
0.7VDDX
PTB3 / L0 Series Resistor
PTB3 / L0 Capacitor
Unit
3.4
V
VDDX+0.3
V
VIL
VSS-0.3
0.35VDDX
V
VHYS
50
140
200
mV
VL0CLMP
4.9
6.0
7.0
V
1.1
mA
IIN
Internal pull-down resistance(15)
Max
RPD
50
100
200
kOhm
RPTB3
42.3
47
51.7
kOhm
CL0
42.3
47
51.7
nF
Max
Unit
Notes
15.Disabled by default.
Table 21. Static Electrical Characteristics - General Purpose I/O - PTB[0...2]
Ratings
Symbol
Min
Input High Voltage
VIH
0.7VDDX
VDDX+0.3
V
Input Low Voltage
VIL
VSS-0.3
0.35VDDX
V
VHYS
50
200
mV
IIN
-1.0
1.0
µA
VOH
VDDX-0.8
Input Hysteresis
Input Leakage Current (pins in high-impedance input mode)
(VIN = VDDX or VSSX)
Output High Voltage (pins in output mode) Full drive IOH = –5.0 mA
Output Low Voltage (pins in output mode) Full drive IOL = 5.0 mA
VOL
Internal Pull-up Resistance (VIH min. > Input voltage > VIL max)(16)
RPUL
Input Capacitance
25
CIN
Maximum Current All PTB Combined(17)
IBMAX
Output Drive strength at 10 MHz
COUT
Typ
140
V
37.5
0.8
V
50
kOhm
17
mA
100
pF
6.0
-17
pF
Notes
16.Disabled by default.
17.Overall VDDR Regulator capability to be considered.
MM912_637, Rev. 3.0
Freescale Semiconductor
19
Electrical Characteristics
Table 22. Static Electrical Characteristics - Current Sense Module(18)
Ratings
Symbol
Gain Error
Min
Typ
Max
Unit
0.5
%
IGAINERR
with temperature based gain compensation adjustment(19), (20)
-0.5
with default gain compensation
-1.0
Offset Error(21),(22)
+/-0.1
IOFFSETERR
Resolution
1.0
0.5
IRES
0.1
µV
µV
ISENSEH, ISENSEL
VINC
VIND
terminal voltage
differential signal voltage range
Differential Leakage Current: differential voltage between ISENSEH/
ISENSEL, 200 mV
ISENSE_DLC
Wake-up Current Threshold Resolution
IRESWAKE
Resistor Threshold for OPEN Detection
ROPEN
-300
300
-200
200
-2.0
2.0
nA
1.8
MOhm
Unit
0.2
0.8
1.25
mV
µV
Notes
18.3.5 V  VSUP  28 V, after applying default trimming values - see Section 6, “MM912_637 - Trimming".
19.Gain Compensation adjustment on calibration request interrupt with TCALSTEP
20.0.65%, including lifetime drift for gain 256 and 512
21.Chopper Mode = ON, Gain with automatic gain control enabled
22.Parameter not tested. Guaranteed by design and characterization
Table 23. Static Electrical Characteristics - Voltage Sense Module(23)
Ratings
Min
Typ
Max
-0.5
0.1
0.5
3.5 V  VIN  18 V
-0.4
0.1
0.4
3.5 V  VIN  5.0 V(25)
-0.25
0.1
0.25
-0.15
0.1
0.15
Gain Error(24)
Symbol
VGAINERR
18 V  VIN  28 V
5.0 V  VIN  18 V(25),(27)
Offset Error(26),(28)
VOFFSETERR
Resolution with RVSENSE = 2.2 kOhm
-1.5
VRES
%
1.5
mV
0.5
mV
Max
Unit
Notes
23.3.5 V  VSUP  28 V, after applying default trimming values - see Section 6, “MM912_637 - Trimming".
24.Including resistor mismatch drift
25.Gain Compensation adjustment on calibration request interrupt with TCALSTEP
26.Chopper Mode = ON.
27.0.2%, including lifetime drift
28.Parameter not tested. Guaranteed by design and characterization.
Table 24. Static Electrical Characteristics - Temperature Sense Module(29)
Ratings
Symbol
Min
TRANGE
-40
150
°C
-40 °C  TA 60 °C(30)
-2.0
2.0
K
-40 °C  TA 50 °C
-3.0
3.0
Measurement Range
Accuracy
Resolution
Typ
TACC
TRES
8.0
mK
TSUP Voltage Output, 10 µA  ITSUP  100 µA
VTSUP
1.1875
1.25
1.3125
V
TSUP Capacitor with ECAP = 1
CTSUP
209
220
231
pF
MM912_637, Rev. 3.0
Freescale Semiconductor
20
Electrical Characteristics
Table 24. Static Electrical Characteristics - Temperature Sense Module(29)
Ratings
Max Calibration Request Interrupt Temperature Step
Symbol
Min
TCALSTEP
-25
Typ
Max
Unit
25
K
Max
Unit
Notes
29.3.5 V  VSUP  28 V, after applying default trimming values - see Section 6, “MM912_637 - Trimming".
30.Temperature not tested in production. Guaranteed by design and characterization.
4.5.2
Static Electrical Characteristics MCU Die
Table 25. Static Electrical Characteristics - MCU
Ratings
Symbol
Min
Typ
Power On Reset Assert (measured on VDDRX)
V
0.6
0.9
-
V
Power On Reset Deassert (measured on VDDRX)
V
-
0.95
1.6
V
2.97
3.06
-
V
-
3.09
3.3
V
4.06
4.21
4.36
V
4.19
4.34
4.49
V
PORA
PORD
Low Voltage Reset Assert (measured on VDDD2D)
VLVRA
Low Voltage Reset Deassert (measured on VDDD2D)
V
LVRD
Low Voltage Interrupt Assert (measured on VDDD2D)
V
Low Voltage Interrupt Deassert (measured on VDDD2D)
VLVID
LVIA
Table 26. Static Electrical Characteristics - Oscillator (OSCLCP)
Ratings
Symbol
Min
iOSC
100
Startup Current
Input Capacitance (EXTAL, XTAL pins)
CIN
EXTAL Pin Input Hysteresis
EXTAL Pin oscillation amplitude (loop controlled Pierce)
Typ
Max
Unit
A
7.0
pF
VHYS,EXTAL
—
180
—
mV
VPP,EXTAL
—
0.9
—
V
Table 27. 5.0 V I/O Characteristics for all I/O pins except EXTAL, XTAL, TEST, D2DI, and supply pins
(4.5 V < VDDRX < 5.5 V; TJ: –40 °C to +150 °C, unless otherwise noted)
Ratings
Symbol
Min
Typ
Max
Unit
Input High Voltage
VIH
0.65*VDDRX
—
—
V
Input High Voltage
VIH
—
—
VDDRX+0.3
V
Input Low Voltage
VIL
—
—
0.35*VDDRX
V
VIL
VSSRX–0.3
Input Low Voltage
Input Hysteresis
VHYS
Input Leakage Current (pins in high-impedance input mode)(31) 
VIN = VDDRX or VSSRX
I
IN
–1.00
—
—
V
250
—
mV
—
1.00
A
MM912_637, Rev. 3.0
Freescale Semiconductor
21
Electrical Characteristics
Table 27. 5.0 V I/O Characteristics for all I/O pins except EXTAL, XTAL, TEST, D2DI, and supply pins
(4.5 V < VDDRX < 5.5 V; TJ: –40 °C to +150 °C, unless otherwise noted)
Ratings
Symbol
(32)
Input Leakage Current (pins in high-impedance input mode)
VIN = VDDX or VSSX
Min
Typ
1.0
1.0
TA = 25 C
8.0
TA = 70 C
14
26
IIN
TA = 105 C
Unit

TA = –40 C
TA = 85 C
Max
nA
32
TA = 110 C
40
TA = 120 C
60
TA = 125 C
74
TA = 130 C
92
TA = 150 C
240
Output High Voltage (pins in output mode), IOH = –4.0 mA
V
OH
VDDRX – 0.8
—
—
V
Output Low Voltage (pins in output mode), IOL = 4.0 mA
VOL
—
—
0.8
V
Internal Pull-up Current, VIH min > input voltage > VIL max
IPUL
-10
—
-130
A
Internal Pull-down Current, VIH min > input voltage > VIL max
IPDH
10
—
130
A
Cin
—
7
—
pF
Single pin limit
IICS
–2.5
—
2.5
mA
Total device Limit, sum of all injected currents
IICP
–25
Input Capacitance
Injection
Current(33)
25
Notes
31.Maximum leakage current occurs at maximum operating temperature. Current decreases by approximately one-half for each 8.0 C to 12 C
in the temperature range from 50 C to 125 C.
32.Maximum leakage current occurs at maximum operating temperature. Current decreases by approximately one-half for each 8.0 C to 12 C
in the temperature range from 50 C to 125 C.
33.Refer to Section 4.5.2.1, “Current Injection" for more details
4.5.2.1
Current Injection
The power supply must maintain regulation within the VDDX operating range during instantaneous and operating maximum
current conditions. If positive injection current (VIN > VDDX) is greater than IDDX, the injection current may flow out of VDDX and
could result in the external power supply going out of regulation. Ensure that the external VDDX load will shunt current greater
than the maximum injection current. This will be the greatest risk when the MCU is not consuming power; e.g., if no system clock
is present, or if the clock rate is very low, which would reduce overall power consumption.
MM912_637, Rev. 3.0
Freescale Semiconductor
22
Electrical Characteristics
4.6
Dynamic Electrical Characteristics
Dynamic characteristics noted under conditions 3.5 V VSUP28 V, -40 C TA125 C, unless otherwise noted. Typical values
noted reflect the approximate parameter mean at TA = 25 °C under nominal conditions, unless otherwise noted.
4.6.1
Dynamic Electrical Characteristics Analog Die
Table 28. Dynamic Electrical Characteristics - Modes of Operation
Ratings
Symbol
Min
Typ
Max
Unit
Low Power Oscillator Frequency
fOSCL
—
512
—
kHz
Low Power Oscillator Tolerance over full temperature range
fTOL_A
Analog Option 2
-4.0
—
4.0
%
Analog Option 1
-5.0
—
5.0
Low Power Oscillator Tolerance - synchronized ALFCLK(34)
fTOLC_A
ALF clock cycle = 1.0 ms
fTOL-0.2
ALF clock cycle = 2.0 ms
fTOL-0.1
ALF clock cycle = 4.0 ms
fTOL-0.05
ALF clock cycle = 8.0 ms
fTOL-0.025
fTOL+0.2
fTOL+0.1
fTOL
%
fTOL+0.05
fTOL+0.025
Notes
34.Parameter not tested. Guaranteed by design and characterization.
Table 29. Dynamic Electrical Characteristics - Die to Die Interface - D2D
Ratings
Operating Frequency (D2DCLK, D2D[0:3])
Symbol
Min
Typ
Max
Unit
fD2D
—
—
32.768
MHz
Table 30. Dynamic Electrical Characteristics - Resets
Ratings
Symbol
Min
Typ
Max
Unit
Reset Deglitch Filter Time
tRSTDF
1.0
2.0
3.2
µs
Reset Release Time for WDR and HWR
tRSTRT
—
32
—
µs
Table 31. Dynamic Electrical Characteristics - Wake-up / Cyclic Sense
Ratings
Cyclic Wake-up Time
(35)
Cyclic Current Measurement Step Width(36)
Symbol
Min
Typ
Max
Unit
tWAKEUP
ALFCLK
—
TIM4CH
ms
tSTEP
ALFCLK
—
16Bit
ms
Max
Unit
Notes
35.Cyclic wake-up on ALFCLK clock based 16 Bit TIMER with maximum 128x prescaler (min 1x)
36.Cyclic wake-up on ALFCLK clock with 16 Bit programmable counter
Table 32. Dynamic Electrical Characteristics - Window Watchdog
Ratings
Initial Non-window Watchdog Timeout
Symbol
tIWDTO
Min
Typ
see Figure 2
ms
MM912_637, Rev. 3.0
Freescale Semiconductor
23
Electrical Characteristics
Table 33. Dynamic Electrical Characteristics - LIN Physical Layer Interface - LIN
Ratings
Symbol
Min
Typ
Max
Bus Wake-up Deglitcher (Sleep and Stop Mode)
tPROPWL
60
80
100
µs
Fast Bit Rate (Programming Mode)
BRFAST
—
—
100
kBit/s
tRX_PD
—
—
6.0
µs
tRX_SYM
-2.0
—
2.0
µs
Propagation delay of receiver
Symmetry of receiver propagation delay rising edge w.r.t. falling edge
Unit
LIN DRIVER - 20.0 KBIT/S; BUS LOAD CONDITIONS (CBUS; RBUS): 1.0 NF; 1.0 K / 6,8 NF;660  / 10 NF;500 
Duty Cycle 1:
D1
THREC(MAX) = 0.744 x VSUP
THDOM(MAX) = 0.581 x VSUP
0.396
—
—
—
—
0.581
7.0 V VSUP18 V; tBIT = 50 µs;
D1 = tBUS_REC(MIN)/(2 x tBIT)
Duty Cycle 2:
D2
THREC(MIN) = 0.422 x VSUP
THDOM(MIN) = 0.284 x VSUP
7.6 V VSUP18 V; tBit = 50 µs
D2 = tBUS_REC(MAX)/(2 x tBIT)
LIN DRIVER - 10.0 KBIT/S; BUS LOAD CONDITIONS (CBUS; RBUS): 1.0 NF; 1.0 K / 6,8 NF;660  / 10 NF;500 
Duty Cycle 3:
D3
THREC(MAX) = 0.778 x VSUP
THDOM(MAX) = 0.616 x VSUP
0.417
—
—
—
—
0.590
-7.25
0
7.25
7.0 V VSUP18 V; tBit = 96 µs
D3 = tBUS_REC(MIN)/(2 x tBIT)
Duty Cycle 4:
D4
THREC(MIN) = 0.389 x VSUP
THDOM(MIN) = 0.251 x VSUP
7.6 V VSUP18 V; tBIT = 96 µs
D4 = tBUS_REC(MAX)/(2 x tBIT)
LIN Transmitter Timing, (VSUP from 7.0 to 18 V) - See Figure 5
Transmitter Symmetry
tTRAN_SYM
tTRAN_SYM < MAX(ttran_sym60%, tTRAN_SYM40%)
tTRAN_SYM60% = tTRAN_PDF60% - tTRAN_PDR60%
µs
tTRAN_SYM40% = tTRAN_PDF40% - tTRAN_PDR40%
TX
BUS
60%
40%
ttran_pdf60%
ttran_pdr40%
ttran_pdf40%
ttran_pdr60%
Figure 5. LIN Transmitter Timing
MM912_637, Rev. 3.0
Freescale Semiconductor
24
Electrical Characteristics
Table 34. Dynamic Electrical Characteristics - General Purpose I/O - PTB3 / L0]
Ratings
Symbol
Wake-up Glitch Filter Time
Min
tWUPF
Typ
Max
20
Unit
µs
Table 35. Dynamic Electrical Characteristics - General Purpose I/O - PTB[0...2]
Ratings
Symbol
Min
Typ
Max
Unit
GPIO Digital Frequency
fPTB
10
MHz
Propagation Delay - Rising Edge(37)
tPDr
20
ns
tRISE
17.5
ns
tPDf
20
ns
tFALL
17.5
ns
Max
Unit
Rise Time - Rising Edge
(37)
Propagation Delay - Falling Edge(37)
Rise Time - Falling
Edge(37)
Notes
37.Load PTBx = 100 pF
Table 36. Dynamic Electrical Characteristics - Current Sense Module
Ratings
Frequency
Symbol
Min
Typ
Attenuation(38),(39)
<100 Hz (fPASS)
3.0
40
>500 Hz (fSTOP)
Signal Update Rate(40)
fIUPDATE
Signal Path Match with Voltage Channel
fIVMATCH
Gain Change Duration (Automatic GCB
active)(41)
0.5
8.0
2.0
tGC
dB
kHz
µs
14
µs
Max
Unit
Notes
38.Characteristics identical to Voltage Sense Module
39.With default LPF coefficients
40.After passing decimation filter
41.Parameter not tested. Guaranteed by design and characterization.
Table 37. Dynamic Electrical Characteristics - Voltage Sense Module
Ratings
Frequency attenuation
95...105 Hz (fPASS)
>500 Hz (fSTOP)
Symbol
Min
Typ
(42),(43)
3.0
40
Signal update rate(44)
fVUPDATE
Signal path match with Current Channel(45)
fIVMATCH
0.5
8.0
2.0
dB
kHz
µs
Notes
42.Characteristics identical to Voltage Sense Module
43.With default LPF coefficients
44.After passing decimation filter
45.Parameter not tested. Guaranteed by design and characterization.
MM912_637, Rev. 3.0
Freescale Semiconductor
25
Electrical Characteristics
Table 38. Dynamic Electrical Characteristics - Temperature Sense Module
Ratings
Signal Update
Rate(46)
Symbol
Min
fTUPDATE
1.0
Typ
Max
Unit
4.0
kHz
Notes
46.1.0 kHz with Chopper Enabled, 4.0 kHz with Chopper Disabled (fixed decimeter = 128)
4.6.2
4.6.2.1
4.6.2.1.1
Dynamic Electrical Characteristics MCU Die
NVM
Timing Parameters
The time base for all NVM program or erase operations is derived from the bus clock using the FCLKDIV register. The frequency
of this derived clock must be set within the limits specified as fNVMOP. The NVM module does not have any means to monitor the
frequency, and will not prevent program or erase operations at frequencies above or below the specified minimum. When
attempting to program or erase the NVM module at a lower frequency, a full program or erase transition is not assured.
The following sections provide equations which can be used to determine the time required to execute specific flash commands.
All timing parameters are a function of the bus clock frequency, fNVMBUS. All program and erase times are also a function of the
NVM operating frequency, fNVMOP. A summary of key timing parameters can be found in Table 39.
4.6.2.1.1.1
Erase Verify All Blocks (Blank Check) (FCMD=0x01)
The time required to perform a blank check on all blocks is dependent on the location of the first non-blank word starting at relative
address zero. It takes one bus cycle per phrase to verify, plus a setup of the command. Assuming that no non-blank location is
found, then the time to erase verify all blocks is given by:
1
t check = 35500  --------------------f NVMBUS
4.6.2.1.1.2
Erase Verify Block (Blank Check) (FCMD=0x02)
The time required to perform a blank check is dependent on the location of the first non-blank word starting at relative address
zero. It takes one bus cycle per phrase to verify, plus a setup of the command.
Assuming that no non-blank location is found, then the time to erase verify a P-Flash block is given by:
1
t pcheck = 33500  --------------------f NVMBUS
Assuming that no non-blank location is found, then the time to erase verify a D-Flash block is given by:
1
t dcheck = 2800  --------------------f NVMBUS
4.6.2.1.1.3
Erase Verify P-Flash Section (FCMD=0x03)
The maximum time to erase verify a section of P-Flash depends on the number of phrases being verified (NVP) and is given by:
1
t   450 + N VP   --------------------f NVMBUS
4.6.2.1.1.4
Read Once (FCMD=0x04)
The maximum read once time is given by:
MM912_637, Rev. 3.0
Freescale Semiconductor
26
Electrical Characteristics
1
t = 400  --------------------f NVMBUS
4.6.2.1.1.5
Program P-Flash (FCMD=0x06)
The programming time for a single phrase of four P-Flash words and the two seven-bit ECC fields is dependent on the bus
frequency, fNVMBUS, as well as on the NVM operating frequency, fNVMOP.
The typical phrase programming time is given by:
1
1
t ppgm  164  ------------------ + 2000  --------------------f NVMOP
f NVMBUS
The maximum phrase programming time is given by:
1
1
t ppgm  164  ------------------ + 2500  --------------------f NVMOP
f NVMBUS
4.6.2.1.1.6
Program Once (FCMD=0x07)
The maximum time required to program a P-Flash Program Once field is given by:
1
1
t  164  ------------------ + 2150  --------------------f NVMOP
f NVMBUS
4.6.2.1.1.7
Erase All Blocks (FCMD=0x08)
The time required to erase all blocks is given by:
1
1
t mass  100100  ------------------ + 70000  --------------------f NVMOP
f NVMBUS
4.6.2.1.1.8
Erase P-Flash Block (FCMD=0x09)
The time required to erase the P-Flash block is given by:
1
1
t pmass  100100  ------------------ + 67000  --------------------f NVMOP
f NVMBUS
4.6.2.1.1.9
Erase P-Flash Sector (FCMD=0x0A)
The typical time to erase a 512-byte P-Flash sector is given by:
1
1
t pera  20020  ------------------ + 700  --------------------f NVMOP
f NVMBUS
The maximum time to erase a 512-byte P-Flash sector is given by:
1
1
t pera  20020  ------------------ + 1400  --------------------f NVMOP
f NVMBUS
4.6.2.1.1.10 Unsecure Flash (FCMD=0x0B)
The maximum time required to erase and unsecure the Flash is given by:
(for 128 kByte P-Flash and 4.0 kByte D-Flash)
1
1
t uns  100100  ------------------ + 70000  --------------------f NVMOP
f NVMBUS
MM912_637, Rev. 3.0
Freescale Semiconductor
27
Electrical Characteristics
4.6.2.1.1.11 Verify Backdoor Access Key (FCMD=0x0C)
The maximum verify back door access key time is given by:
1
t = 400  --------------------f NVMBUS
4.6.2.1.1.12 Set User Margin Level (FCMD=0x0D)
The maximum set user margin level time is given by:
1
t = 350  --------------------f NVMBUS
4.6.2.1.1.13 Set Field Margin Level (FCMD=0x0E)
The maximum set field margin level time is given by:
1
t = 350  --------------------f NVMBUS
4.6.2.1.1.14 Erase Verify D-Flash Section (FCMD=0x10)
The time required to Erase Verify D-Flash for a given number of words NW is given by:
1
t dcheck   450 + N W   --------------------f NVMBUS
4.6.2.1.1.15 Program D-Flash (FCMD=0x11)
D-Flash programming time is dependent on the number of words being programmed and their location with respect to a row
boundary, since programming across a row boundary requires extra steps. The D-Flash programming time is specified for
different cases: 1,2,3,4 words and 4 words across a row boundary.
The typical D-Flash programming time is given by the following equation, where NW denotes the number of words; BC=0 if no
row boundary is crossed and BC=1, if a row boundary is crossed:
1
1
t dpgm    14 +  54  N W  +  14  BC    ------------------  +   500 +  525  N W  +  100  BC    --------------------- 

f NVMOP  
f NVMBUS 
The maximum D-Flash programming time is given by:
1
1
t dpgm    14 +  54  N W  +  14  BC    ------------------  +   500 +  750  N W  +  100  BC    --------------------- 

f NVMOP  
f NVMBUS 
4.6.2.1.1.16 Erase D-Flash Sector (FCMD=0x12)
Typical D-Flash sector erase times, expected on a new device where no margin verify fails occur, is given by:
1
1
t dera  5025  ------------------ + 700  --------------------f NVMOP
f NVMBUS
Maximum D-Flash sector erase times is given by:
1
1
t dera  20100  ------------------ + 3400  --------------------f NVMOP
f NVMBUS
The D-Flash sector erase time is ~5.0 ms on a new device and can extend to ~20 ms as the flash is cycled.
MM912_637, Rev. 3.0
Freescale Semiconductor
28
Electrical Characteristics
Table 39. NVM Timing Characteristics (FTMRC)
Rating
Typ(47)
Max(48)
Unit(49)
1.0
—
32.768
MHz
0.8
1.0
1.05
MHz
tMASS
—
100
130
ms
tCHECK
—
—
35500
tCYC
Symbol
Min
Bus Frequency
fNVMBUS
Operating Frequency
fNVMOP
Erase All Blocks (mass erase) Time
Erase Verify All Blocks (blank check) Time
Unsecure Flash Time
tUNS
—
100
130
ms
P-flash Block Erase Time
tPMASS
—
100
130
ms
P-flash Erase Verify (blank check) Time
tPCHECK
—
—
33500
tCYC
P-flash Sector Erase Time
tPERA
—
20
26
ms
P-flash Phrase Programming Time
tPPGM
—
226
285
s
D-flash Sector Erase Time
tDERA
—
5(50)
26
ms
D-flash Erase Verify (blank check) Time
tDCHECK
—
—
2800
tCYC
D-flash One Word Programming Time
tDPGM1
—
100
107
s
D-flash Two Word Programming Time
tDPGM2
—
170
185
s
D-flash Three Word Programming Time
tDPGM3
—
241
262
s
D-flash Four Word Programming Time
tDPGM4
—
311
339
s
D-flash Four Word Programming Time Crossing Row Boundary
tDPGM4C
—
328
357
s
Notes
47.Typical program and erase times are based on typical fNVMOP and maximum fNVMBUS
48.Maximum program and erase times are based on minimum fNVMOP and maximum fNVMBUS
49.tCYC = 1 / fNVMBUS
50.Typical value for a new device
4.6.2.1.2
NVM Reliability Parameters
The reliability of the NVM blocks is guaranteed by stress test during qualification, constant process monitors, and burn-in to
screen early life failures.
The data retention and program/erase cycling failure rates are specified at the operating conditions noted. The program/erase
cycle count on the sector is incremented every time a sector or mass erase event is executed.
Table 40. NVM Reliability Characteristics(51)
Rating
Data retention at an average junction temperature of TJAVG = 85
to 10,000 program/erase cycles
C(51)
after up
Program Flash number of program/erase cycles (-40 C  TJ  150 C
Symbol
Min
Typ
Max
Unit
tNVMRET
20
100(53)
—
Years
—
Cycles
nFLPE
10 K
tNVMRET
5.0
100(53)
—
Years
Data retention at an average junction temperature of TJAVG = 85 C(51) after up
to 10,000 program/erase cycles
tNVMRET
10
100(53)
—
Years
Data retention at an average junction temperature of TJAVG = 85 C(51) after less
than 100 program/erase cycles
tNVMRET
20
100(53)
—
Years
Data retention at an average junction temperature of TJAVG = 85
to 50,000 program/erase cycles
C(51)
after up
100 K
(54)
MM912_637, Rev. 3.0
Freescale Semiconductor
29
Electrical Characteristics
Table 40. NVM Reliability Characteristics(51)
Data Flash number of program/erase cycles (-40 C  TJ  150C
nFLPE
50 K
500 K(54)
—
Cycles
Notes
51.Conditions are shown in Table 10, unless otherwise noted
52.TJAVG does not exceed 85 C in a typical temperature profile over the lifetime of a consumer, industrial, or automotive application.
53.Typical data retention values are based on intrinsic capability of the technology measured at high temperature and de-rated to 25C using
the Arrhenius equation. For additional information on how Freescale defines Typical Data Retention, refer to Engineering Bulletin
EB618
54.Spec table quotes typical endurance evaluated at 25C for this product family. For additional information on how Freescale defines Typical
Endurance, refer to Engineering Bulletin EB619.
4.6.2.2
Phase Locked Loop
4.6.2.2.1
Jitter Definitions
With each transition of the feedback clock, the deviation from the reference clock is measured and input voltage to the VCO is
adjusted accordingly.The adjustment is done continuously with no abrupt changes in the VCOCLK frequency. Noise, voltage,
temperature, and other factors, cause slight variations in the control loop resulting in a clock jitter. This jitter affects the real
minimum and maximum clock periods as illustrated in Figure 6.
1
0
2
3
N-1
N
tmin1
tnom
tmax1
tminN
tmaxN
Figure 6. Jitter Definitions
The relative deviation of tNOM is at its maximum for one clock period, and decreases towards zero for larger number of clock
periods (N).
Defining the jitter as:
t
N
t
N 

max
min
J  N  = max  1 – ----------------------- , 1 – ----------------------- 
Nt
Nt

nom
nom 
For N < 100, the following equation is a good fit for the maximum jitter:
j
1
J  N  = -------N
MM912_637, Rev. 3.0
Freescale Semiconductor
30
Electrical Characteristics
J(N)
1
5
10
20
Figure 7. Maximum Bus Clock Jitter Approximation
N
NOTE
On timers and serial modules a prescaler will eliminate the effect of the jitter to a large extent.
4.6.2.2.2
Electrical Characteristics for the PLL
Table 41. PLL Characteristics
Rating
VCO Frequency During System Reset
VCO Locking Range
Symbol
Min
fVCORST
Typ
Max
Unit
8
32
MHz
fVCO
32.768
65.536
MHz
Lock Detection
LOCK|
0
1.5
%(55)
Un-lock Detection
UNL|
0.5
2.5
%(55)
tLOCK
150 + 256/fREF
s
j1
1.2
%
Time to Lock
Jitter Fit Parameter
1(56)
Notes
55.% deviation from target frequency
56.fREF = 1.024 MHz, fBUS = 32.768 MHz equivalent fPLL = 65.536 MHz, REFRQ=00, SYNDIV=$1F, VCOFRQ=01, POSTDIV=$00
4.6.2.3
Reset, Oscillator and Internal Clock Generation
Table 42. Dynamic Electrical Characteristics - MCU Clock Generator
Ratings
Bus Frequency
Internal Reference Frequency
Internal Clock Frequency Tolerance
(57),(58)
Symbol
Min
Typ
Max
Unit
fBUS
fIRC1M_TRIM
—
—
32.768
MHz
—
1.024
—
MHz
-1.0
—
1.0
-1.2
—
1.2
fTOL
Analog Option 2
Analog Option 1
(59)
Clock Frequency Tolerance with External Oscillator
%
tTOLEXT
-0.5
0.5
%
fOSC
4.0
16
MHz
Oscillator Start-up Time (LCP, 4.0 MHz)(60)
tUPOSC
—
2.0
10
ms
Oscillator Start-up Time (LCP, 8.0 MHz)(60)
tUPOSC
—
1.6
8.0
ms
tUPOSC
—
1.0
5.0
ms
Crystal Oscillator Range
Oscillator Start-up Time (LCP, 16 MHz)
(60)
MM912_637, Rev. 3.0
Freescale Semiconductor
31
Electrical Characteristics
Table 42. Dynamic Electrical Characteristics - MCU Clock Generator
Ratings
Clock Monitor Failure Assert Frequency
Symbol
Min
Typ
Max
Unit
fCMFA
200
400
1000
kHz
Notes
57.-40 C TA125 C
58.1.3%, including lifetime drift
59.Dependent on the external OSC
60.These values apply for carefully designed PCB layouts with capacitors that match the crystal/resonator requirements
4.6.2.4
Reset Characteristics
Table 43. Reset and Stop Characteristics(61)
Rating
Reset Input Pulse Width, minimum input time
Startup from Reset
STOP Recovery Time
Symbol
Min
PWRSTL
2.0
Typ
Max
Unit
tVCORST
nRST
768
tVCORST
tSTP_REC
50
s
Notes
61.Conditions are shown in Table 10 unless otherwise noted
4.6.2.5
SPI Timing
This section provides electrical parameters and ratings for the SPI. The measurement conditions are listed in Table 44.
Table 44. Measurement Conditions
Description
Drive mode
Load capacitance CLOAD
(62)
, on
all outputs
Value
Unit
Full drive mode
—
50
pF
Notes
62.Conditions are shown in Table 10 unless otherwise noted
MM912_637, Rev. 3.0
Freescale Semiconductor
32
Electrical Characteristics
4.6.2.5.1
Master Mode
The timing diagram for master mode with transmission format CPHA = 0 is depicted in Figure 8.
SS
(Output)
2
1
SCK
(CPOL = 0)
(Output)
12
13
12
13
3
4
4
SCK
(CPOL = 1)
(Output)
5
MISO
(Input)
6
Bit MSB-1... 1
MSB IN2
10
MOSI
(Output)
LSB IN
9
11
Bit MSB-1... 1
MSB OUT2
LSB OUT
1. If configured as an output.
2. LSBF = 0. For LSBF = 1, bit order is LSB, bit 1, bit 2... MSB.
Figure 8. SPI Master Timing (CPHA = 0)
The timing diagram for master mode with transmission format CPHA=1 is depicted in Figure 9.
SS
(Output)
1
2
12
13
12
13
3
SCK
(CPOL = 0)
(Output)
4
4
SCK
(CPOL = 1)
(Output)
5
MISO
(Input)
6
MSB IN2
Port Data
LSB IN
11
9
MOSI
(Output)
Bit MSB-1... 1
Master MSB OUT2
Bit MSB-1... 1
Master LSB OUT
Port Data
1.If configured as output
2. LSBF = 0. For LSBF = 1, bit order is LSB, bit 1,bit 2... MSB.
Figure 9. SPI Master Timing (CPHA = 1)
The timing characteristics for master mode are listed in Table 45.
MM912_637, Rev. 3.0
Freescale Semiconductor
33
Electrical Characteristics
Table 45. SPI Master Mode Timing Characteristics
Num
C
1
D
1
D
2
3
Symbol
Min
Typ
SCK Frequency
fSCK
1/2048
SCK Period
tSCK
2.0
D
Enable Lead Time
tLEAD
D
Enable Lag Time
tLAG
4
D
Clock (SCK) High or Low Time
5
D
Data Setup Time (inputs)
6
D
Data Hold Time (inputs)
9
D
Data Valid After SCK Edge
10
D
Data Valid After SS Fall (CPHA = 0)
11
D
Data Hold Time (outputs)
12
D
13
D
4.6.2.5.2
Characteristic
Max
Unit
—
12
fBUS
—
2048
tBUS
—
1/2
—
tSCK
—
1/2
—
tSCK
tWSCK
—
1/2
—
tSCK
tSU
8.0
—
—
ns
tHI
8.0
—
—
ns
tVSCK
—
—
29
ns
tVSS
—
—
15
ns
tHO
20
—
—
ns
Rise and Fall Time Inputs
tRFI
—
—
8.0
ns
Rise and Fall Time Outputs
tRFO
—
—
8.0
ns
Slave Mode
The timing diagram for slave mode with transmission format CPHA = 0 is depicted in Figure 10.
SS
(Input)
1
12
13 3
12
13
SCK
(CPOL = 0)
(Input)
4
2
4
SCK
(CPOL = 1)
(Input) 10
8
7
MISO
(Output)
9
See
Note
Slave MSB
5
MOSI
(Input)
11
Bit MSB-1... 1
11
Slave LSB OUT
See
Note
6
MSB IN
Bit MSB-1... 1
LSB IN
NOTE: Not defined
Figure 10. SPI Slave Timing (CPHA = 0)
The timing diagram for slave mode with transmission format CPHA = 1 is depicted in Figure 11.
MM912_637, Rev. 3.0
Freescale Semiconductor
34
Electrical Characteristics
SS
(Input)
3
1
2
12
13
12
13
SCK
(CPOL = 0)
(Input)
4
4
SCK
(CPOL = 1)
(Input)
11
9
MISO
(Output)
See
Note
7
MOSI
(Input)
Slave
MSB OUT
5
8
Bit MSB-1... 1
Slave LSB OUT
6
MSB IN
Bit MSB-1... 1
LSB IN
NOTE: Not defined
Figure 11. SPI Slave Timing (CPHA = 1)
The timing characteristics for slave mode are listed in Table 46.
Table 46. SPI Slave Mode Timing Characteristics
Num
C
Characteristic
Symbol
Min
Typ
Max
Unit
1
D
SCK Frequency
fSCK
DC
—
14
fBUS
1
D
2
D
SCK Period
tSCK
4.0
—

fBUS
Enable Lead Time
tLEAD
4.0
—
—
fBUS
3
D
Enable Lag Time
4
D
Clock (SCK) High or Low Time
5
D
6
D
7
D
Slave Access Time (time to data active)
8
D
Slave MISO Disable Time
tLAG
4.0
—
—
fBUS
tWSCK
4.0
—
—
fBUS
Data Setup Time (inputs)
tSU
8.0
—
—
ns
Data Hold Time (inputs)
tHI
8.0
—
—
ns
tA
—
—
20
ns
tDIS
—
—
22
ns
9
D
Data Valid After SCK Edge
tVSCK
—
—
29 + 0.5  tBUS
10
D
Data Valid After SS Fall
tVSS
—
—
29 + 0.5  tBUS(63)
ns
(63)
ns
11
D
Data Hold Time (outputs)
tHO
20
—
—
ns
12
D
Rise and Fall Time Inputs
tRFI
—
—
8.0
ns
13
D
Rise and Fall Time Outputs
tRFO
—
—
8.0
ns
Notes
63.0.5 tBUS added due to internal synchronization delay
MM912_637, Rev. 3.0
Freescale Semiconductor
35
Electrical Characteristics
4.7
Thermal Protection Characteristics
Characteristics noted under conditions 3.5 V VSUP28 V, -40 C TA125 C, unless otherwise noted. Typical values noted
reflect the approximate parameter mean at TA = 25 °C under nominal conditions, unless otherwise noted.
Table 47. Thermal Characteristics
Ratings
Symbol
Min
Typ
Max
Unit
THTI
THTI_H
110
125
140
°C
TSD
TSD_H
155
180
°C
TLINSD
150
180
°C
VDDH/VDDA/VDDX High Temperature Warning (HTI)
Threshold
Hysteresis
10
VDDH/VDDA/VDDX Over-temperature Shutdown
Threshold
Hysteresis
LIN Over-temperature Shutdown
LIN Over-temperature Shutdown Hysteresis
TLINSD_HYS
165
10
165
20
°C
MM912_637, Rev. 3.0
Freescale Semiconductor
36
4.8
Electromagnetic Compatibility (EMC)
All ESD testing is in conformity with the CDF-AEC-Q100 stress test qualification for automotive grade integrated circuits. During
the device qualification, ESD stresses are performed for the Human Body Model (HBM), Machine Model (MM), Charge Device
Model (CDM), as well as LIN transceiver specific specifications.
A device will be defined as a failure, if after exposure to ESD pulses, the device no longer meets the device specification.
Complete DC parametric and functional testing is performed per the applicable device specification at room temperature,
followed by hot temperature, unless specified otherwise in the device specification.
The immunity against transients for the LIN, PTB3/L0, VSENSE, ISENSEH, ISENSEL, and VSUP, is specified according to the
LIN Conformance Test Specification - Section LIN EMC Test Specification (ISO7637-2), refer to the LIN Conformance Test
Certification Report - available as separate document.
Table 48. Electromagnetic Compatibility
Ratings
Symbol
ESD - Human Body Model (HBM) following AEC-Q100 / JESD22-A114 
(CZAP = 100 pF, RZAP = 1500 )
- LIN (all GNDs shorted)
VHBM
- All other Pins
Value / Limit
±8.0
Unit
kV
±2.0
ESD - Charged Device Model (CDM) following AEC-Q100
VCDM
Corner Pins
±750
V
±500
All other Pins
ESD - Machine Model (MM) following AEC-Q100 (CZAP = 200 pF, RZAP = 0 ), All
Pins
VMM
±200
V
Latch-up current at TA = 125 C(64)
ILAT
±100
mA
ESD GUN - LIN Conformance Test Specification(65), unpowered, contact discharge.
(CZAP= 150 pF, RZAP = 330 ); LIN (no bus filter CBUS); VSENSE with serial
RVSENSE; VSUP with CVSUP; PTB3 with serial RPTB3
± 6000
V
ESD GUN - IEC 61000-4-2 Test Specification(66), unpowered, contact discharge.
(CZAP= 150 pF, RZAP = 330 ); LIN (no bus filter CBUS); VSENSE with serial
RVSENSE; VSUP with CVSUP; PTB3 with serial RPTB3
± 6000
V
ESD GUN - ISO10605(66), unpowered, contact discharge, CZAP= 150 pF, 
RZAP = 2.0 kLIN (no bus filter CBUS); VSENSE with serial RVSENSE; VSUP with
CVSUP; PTB3 with serial RPTB3
± 8000
V
ESD GUN - ISO10605(66), powered, contact discharge, CZAP= 330 pF, RZAP =
2.0 kLIN (no bus filter CBUS); VSENSE with serial RVSENSE; VSUP with CVSUP;
PTB3 with serial RPTB3
± 8000
V
Notes
64.Input Voltage Limit = -2.5 to 7.5 V
65.Certification available on request
66.Tested internally only, following the reference document test procedure.
MM912_637, Rev. 3.0
Freescale Semiconductor
37
Functional Description and Application Information
5
Functional Description and Application Information
This chapter describes the MM912_637 dual die device functions on a block by block base. The following symbols are shown on
all module cover pages to distinguish between the module location being the MCU die or the analog die:
The documented module is physically located on the Analog die. This applies to Section 5.1, “MM912_637 - Analog
Die Overview" through Section 5.14, “Die to Die Interface - Target".
MCU
ANALOG
The documented module is physically located on the Microcontroller die. This applies to Section 5.1, “MM912_637
- Analog Die Overview" through Section 5.25, “MCU - Die-to-Die Initiator (D2DIV1)".
Sections concerning both die or the complete device will not have a specific indication (e.g. Section 6, “MM912_637 - Trimming").
5.0.1
Introduction
Many types of electronic control units (ECUs) are connected to and supplied from the main car battery in modern cars. Depending
on the cars mode of operation (drive, start, stop, standby), the battery must deliver different currents to the different ECUs. The
vehicle power management has several sub-functions, like control of the set-point value of the power generator, dynamic load
management during drive, start, stop, and standby mode.
The Application Specific Integrated Circuit (ASIC) allows for two application circuits, depending on whether the bias current of
the MM912_637 itself shall be included into the current measurement.
Battery Plus Pole
CBAT
RSENSE
RSHUNT
ISENSEH
VSUP
LIN
LIN
GND
ISENSEL
VSENSE
Battery Minus Pole
CLIN
Chassis Ground
Figure 12. Typical IBS Application (Device GND = Chassis GND)
MM912_637, Rev. 3.0
Freescale Semiconductor
38
Functional Description and Application Information
Battery Plus Pole
CBAT
RSENSE
RSHUNT
ISENSEH
VSUP
LIN
LIN
GND
ISENSEL
VSENSE
Battery Minus Pole
CLIN
Chassis Ground
Figure 13. Typical IBS Application (Device GND = Battery Minus)
The vehicle power system needs actual measurement data from the battery, mainly voltage, current, and temperature. Out of
these measurement data, it needs calculated characteristics, such as dynamic internal battery resistance. Therefore, an
intelligent battery sensor (IBS) module is required.
To efficiently measure the battery voltage, current, and temperature, the IBS module is directly connected to and supplied from
the battery. It is located directly on the negative pole of the battery; the supply of the IBS module comes from 'KL30'. The battery
current is measured via a low-ohmic shunt resistor, connected between the negative pole of the battery and the chassis ground
of the car. The battery voltage is measured at 'KL30'.
The data communication between the IBS module and the higher level ECU is done via a LIN interface.
The MM912_637 is able to measure its junction temperature. That temperature is the basis for a model in software that calculates
the battery temperature out of the junction temperature. An optional external temperature sense input is provided as well.
5.0.2
Device Register Map
Table 49 shows the device register memory map overview.
Table 49. Device Register Memory Map Overview
Address
Module
Size (Bytes)
0x0000–0x0003
PIM (port integration module)
4
0x0004–0x0009
Reserved
6
0x000A–0x000B
MMC (memory map control)
2
0x000C–0x000D
PIM (port integration module)
2
0x000E–0x000F
Reserved
2
0x0010–0x0015
MMC (memory map control)
8
0x0016–0x0019
Reserved
2
0x001A–0x001B
Device ID register
2
0x001C–0x001E
Reserved
4
0x001F
INT (interrupt module)
1
0x0020–0x002F
DBG (debug module)
16
0x0030–0x0033
Reserved
4
0x0034–0x003F
CPMU (clock and power management)
12
0x0040–0x00D7
Reserved
152
0x00D8–0x00DF
D2DI (die 2 die initiator)
8
MM912_637, Rev. 3.0
Freescale Semiconductor
39
Functional Description and Application Information
Table 49. Device Register Memory Map Overview (continued)
Address
Module
Size (Bytes)
0x00E0–0x00E7
Reserved
32
0x00E8–0x00EF
SPI (serial peripheral interface)
8
0x00F0–0x00FF
Reserved
32
0x0100–0x0113
FTMRC control registers
20
0x0114–0x011F
Reserved
12
0x0120–0x017F
PIM (port integration module)
96
0x0180–0x01EF
Reserved
112
0x01F0–0x01FC
CPMU (clock and power management)
13
0x01FD–0x01FF
Reserved
3
0x0200-0x02FF
D2DI (die 2 die initiator, blocking access window)
256
0x0300–0x03FF
D2DI (die 2 die initiator, non-blocking write window)
256
NOTE
The reserved register space shown in Table 49 is not allocated to any module. This register
space is reserved for future use. Writing to these locations has no effect. Read access to
these locations returns a zero.
5.0.3
Detailed Module Register Map
Table 50 to Table 63 show the detailed module maps of the MM912_637.
Table 50. 0x0000–0x0009 Port Integration Module (PIM) 1 of 3
Address
Name
0x0000
PTA
0x0001
PTE
0x0002
DDRA
0x0003
DDRE
0x0004-0
x0009
Reserved
R
W
R
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
PA7
PA6
PA5
PA4
PA3
PA2
PA1
PA0
0
0
0
0
0
0
PE1
PE0
DDRA7
DDRA6
DDRA5
DDRA4
DDRA3
DDRA2
DDRA1
DDRA0
0
0
0
0
0
0
DDRE1
DDRE0
0
0
0
0
0
0
0
0
W
R
W
R
W
R
W
Table 51. 0x000A–0x000B Memory Map Control (MMC) 1 of 2
Address
Name
0x000A
Reserved
0x000B
MODE
R
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
R
W
MODC
MM912_637, Rev. 3.0
Freescale Semiconductor
40
Functional Description and Application Information
Table 52. 0x000C–0x000F Port Integration Module (PIM) Map 2 of 3
Address
Name
0x000C
PUCR
0x000D
RDRIV
0x000E-0
x000F
Reserved
Bit 7
R
0
W
R
Bit 6
BKPUE
Bit 5
Bit 4
Bit 3
Bit 2
0
0
0
0
RDRD
RDRC
0
0
0
0
0
0
0
0
0
W
R
Bit 1
Bit 0
0
PDPEE
0
0
0
0
0
W
Table 53. 0x0010–0x0019 Memory Map Control (MMC) 2 of 2
Address
Name
0x0010
Reserved
0x0011
DIRECT
0x0012-0x
0014
Reserved
0x0015
PPAGE
0x0016-0x
0019
Reserved
R
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
0
0
0
0
0
0
0
0
DP15
DP14
DP13
DP12
DP11
DP10
DP9
DP8
0
0
0
0
0
0
0
0
0
0
0
0
PIX3
PIX2
PIX1
PIX0
0
0
0
0
0
0
0
0
Bit 2
Bit 1
Bit 0
0
0
0
Bit 2
Bit 1
Bit 0
W
R
W
R
W
R
W
R
W
Table 54. 0x001A–0x001E Miscellaneous Peripheral
Address
Name
0x001A
PARTIDH
0x001B
PARTIDL
0x001C-0
x001E
Reserved
Bit 7
Bit 6
Bit 5
Bit 4
R
Bit 3
PARTIDH
W
R
PARTIDL
W
R
0
0
0
0
0
W
Table 55. 0x001F Interrupt Module (S12SINT)
0x001F
IVBR
R
IVB_ADDR[7:0]
W
Table 56. 0x0020–0x002F Debug Module (S12XDBG)
Address
Name
0x0020
DBGC1
0x0021
DBGSR
0x0022
DBGTCR
Bit 7
R
W
R
ARM
TBF(67)
Bit 6
Bit 5
Bit 4
Bit 3
0
0
BDM
DBGBRK
0
0
0
0
0
TRIG
0
0
SSF2
COMRV
SSF1
SSF0
W
R
W
0
TSOURCE
TRCMOD
0
TALIGN
MM912_637, Rev. 3.0
Freescale Semiconductor
41
Functional Description and Application Information
Table 56. 0x0020–0x002F Debug Module (S12XDBG)
Address
Name
0x0023
DBGC2
0x0024
DBGTBH
0x0025
DBGTBL
0x0026
DBGCNT
0x0027
DBGSCRX
0x0027
DBGMFR
0x0028(68)
DBGACTL
0x0028(69)
DBGBCTL
0x0028(70)
DBGCCTL
0x0029
DBGXAH
0x002A
DBGXAM
0x002B
DBGXAL
0x002C
DBGADH
0x002D
DBGADL
0x002E
DBGADHM
0x002F
DBGADLM
R
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
0
0
0
0
0
0
Bit 15
Bit 14
Bit 13
Bit 12
Bit 11
Bit 10
Bit 9
Bit 8
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
TBF(67)
0
0
0
0
0
SC3
SC2
SC1
SC0
0
0
0
0
0
MC2
MC1
MC0
SZE
SZ
TAG
BRK
RW
RWE
NDB
COMPE
SZE
SZ
TAG
BRK
RW
RWE
0
0
TAG
BRK
RW
RWE
0
0
0
0
0
0
Bit 15
14
13
12
11
Bit 7
6
5
4
Bit 15
14
13
Bit 7
6
Bit 15
Bit 7
ABCM
W
R
Bit 0
W
R
W
R
CNT
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
0
COMPE
COMPE
Bit 17
Bit 16
10
9
Bit 8
3
2
1
Bit 0
12
11
10
9
Bit 8
5
4
3
2
1
Bit 0
14
13
12
11
10
9
Bit 8
6
5
4
3
2
1
Bit 0
W
R
0
Notes
67.This bit is visible at DBGCNT[7] and DBGSR[7]
68.This represents the contents if the Comparator A control register is blended into this address.
69.This represents the contents if the Comparator B control register is blended into this address.
70.This represents the contents if the Comparator C control register is blended into this address.
MM912_637, Rev. 3.0
Freescale Semiconductor
42
Functional Description and Application Information
Table 57. 0x0034–0x003F Clock and Power Management (CPMU) 1 of 2
Address
0x0034
0x0035
0x0036
Name
CPMU
R
SYNR
W
CPMU
R
REFDIV
W
CPMU
R
POSTDIV
W
0x0037
CPMUFLG
0x0038
CPMUINT
0x0039
CPMUCLKS
0x003A
CPMUPLL
0x003B
CPMURTI
0x003C
CPMUCOP
0x003D
Reserved
0x003E
Reserved
0x003F
Bit 7
R
W
R
W
R
W
R
Bit 6
W
R
W
R
Bit 4
Bit 3
VCOFRQ[1:0]
REFFRQ[1:0]
0
0
0
RTIF
PORF
LVRF
0
0
RTIE
PLLSEL
PSTP
0
0
RTDEC
RTR6
WCOP
RSBCK
0
0
0
Bit 2
Bit 1
Bit 0
SYNDIV[5:0]
0
0
0
REFDIV[3:0]
POSTDIV[4:0]
LOCKIF
LOCK
0
0
PRE
PCE
0
LOCKIE
0
ILAF
OSCIF
OSCIE
UPOSC
0
RTI
COP
OSCSEL
OSCSEL
0
0
0
RTR2
RTR1
RTR0
CR2
CR1
CR0
FM1
FM0
RTR5
RTR4
RTR3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
R
Bit 5
WRTMASK
W
R
W
CPMU
R
0
0
0
0
0
0
0
0
ARMCOP
W
Bit 7
6
5
4
3
2
1
Bit 0
Bit 1
Bit 0
Table 58. 0x00D8–0x00DF Die 2 Die Initiator (D2DI) 1 of 3
Address
Name
0x00D8
D2DCTL0
0x00D9
D2DCTL1
0x00DA
D2DSTAT0
0x00DB
D2DSTAT1
0x00DC
D2DADRHI
0x000D
D2DADRLO
0x00DE
D2DDATAHI
0x00DF
D2DDATALO
R
W
R
W
R
W
R
Bit 7
Bit 6
Bit 5
D2DEN
D2DCW
D2DSWAI
0
0
0
ACKERF
CNCLF
TIMEF
TERRF
PARF
PAR1
PAR0
D2DIF
D2DBSY
0
0
0
0
0
0
RWB
SZ8
0
NBLK
0
0
0
0
D2DIE
ERRIF
Bit 4
Bit 3
Bit 2
0
0
0
D2DCLKDIV[1:0]
TIMOUT[3:0]
W
R
W
R
ADR[7:0]
W
R
DATA[15:8]
W
R
DATA[7:0]
W
MM912_637, Rev. 3.0
Freescale Semiconductor
43
Functional Description and Application Information
Table 59. 0x00E8–0x00EF Serial Peripheral Interface (SPI)
Address
Name
0x00E8
SPICR1
0x00E9
SPICR2
0x00EA
SPIBR
0x00EB
SPISR
0x00EC
SPIDRH
0x00ED
SPIDRL
0x00EE
Reserved
0x00EF
Reserved
R
W
R
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
SPIE
SPE
SPTIE
MSTR
CPOL
CPHA
SSOE
LSBFE
MODFEN
BIDIROE
SPISWAI
SPC0
SPR2
SPR1
SPR0
0
W
R
0
XFRW
0
0
0
SPPR2
SPPR1
SPPR0
SPIF
0
SPTEF
MODF
0
0
0
0
R
R15
R14
R13
R12
R11
R10
R9
R8
W
T15
T14
T13
T12
T11
T10
T9
T8
R
R7
R6
R5
R4
R3
R2
R1
R0
W
T7
T6
T5
T4
T3
T2
T1
T0
R
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
R
W
W
R
W
Table 60. 0x0100–0x0113 Flash Control & Status Register FTMRC
Address
Name
0x0100
FCLKDIV
0x0101
FSEC
0x0102
FCCOBIX
0x0103
Reserved
0x0104
FCNFG
0x0105
FERCNFG
0x0106
FSTAT
0x0107
FERSTAT
0x0108
FPROT
0x0109
DFPROT
0x010A
FCCOBHI
Bit 7
R
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
FDIVLCK
FDIV5
FDIV4
FDIV3
FDIV2
FDIV1
FDIV0
KEYEN1
KEYEN0
RNV5
RNV4
RNV3
RNV2
SEC1
SEC0
0
0
0
0
0
CCOBIX2
CCOBIX1
CCOBIX0
0
0
0
0
0
0
0
0
0
0
0
0
FDFD
FSFD
0
0
0
0
0
DFDIE
SFDIE
ACCERR
FPVIOL
MGBUSY
RSVD
MGSTAT1
MGSTAT0
0
0
0
0
DFDIF
SFDIF
FPHDIS
FPHS1
FPHS0
FPLDIS
FPLS1
FPLS0
0
0
0
DPS3
DPS2
DPS1
DPS0
CCOB14
CCOB13
CCOB12
CCOB11
CCOB10
CCOB9
CCOB8
FDIVLD
W
R
W
R
W
R
W
R
W
R
CCIE
0
IGNSF
W
R
W
R
CCIF
0
0
0
W
R
W
R
W
R
W
FPOPEN
DPOPEN
CCOB15
RNV6
MM912_637, Rev. 3.0
Freescale Semiconductor
44
Functional Description and Application Information
Table 60. 0x0100–0x0113 Flash Control & Status Register FTMRC
0x010B
FCCOBLO
0x010C-0
x010F
Reserved
0x0110
FOPT
0x01110x0113
Reserved
R
W
R
CCOB7
CCOB6
CCOB5
CCOB4
CCOB3
CCOB2
CCOB1
CCOB0
0
0
0
0
0
0
0
0
NV7
NV6
NV5
NV4
NV3
NV2
NV1
NV0
0
0
0
0
0
0
0
0
W
R
W
R
W
Table 61. 0x0120 Port Integration Module (PIM) 2 of 2
Address
Name
0x0120
PTIA
0x0121
PTIE
0x01220x017F
Reserved
R
W
R
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
PTIA7
PTIA6
PTIA5
PTIA4
PTIA3
PTIA2
PTIA1
PTIA0
0
0
0
0
0
0
PTIE1
PTIE0
0
0
0
0
0
0
0
0
W
R
W
Table 62. 0x01F0–0x01FF Clock and Power Management (CPMU) 2of 2
Address
Name
0x01F0
Reserved
0x01F1
CPMU
LVCTL
0x01F20x01F7
0x01F8
0x01F9
0x01FA
Reserved
R
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
0
0
0
0
0
0
0
0
0
0
0
0
0
LVDS
LVIE
LVIF
0
0
0
0
0
0
0
0
0
0
W
R
W
R
W
CPMU
R
IRCTRIMH
W
CPMU
R
IRCTRIML
W
CPMUOSC
Bit 7
R
TCTRIM[3:0]
IRCTRIM[9:8]
IRCTRIM[7:0]
OSCE
OSCBW
OSCPINS_
EN
0
0
0
0
0
0
0
0
0
0
0
0
0
0
OSCFILT[4:0]
W
0x01FB
CPMUPROT
0x01FC
Reserved
R
W
R
PROT
0
W
MM912_637, Rev. 3.0
Freescale Semiconductor
45
Functional Description and Application Information
Table 63. Analog die Registers - 0x0200–0x02FF D2D Blocking Access (D2DI) 2 of 3/
0x0300–0x03FF D2D Non Blocking Access (D2DI) 3 of 3
Offset(71)
0x00
15
7
14
6
13
5
12
4
11
3
10
2
9
1
8
0
R
0
0
0
0
0
0
0
0
PCR_CTL
W
HTIEM
UVIEM
HWRM
0
PCR Control Register
R
0
0
HWR
0
HWRF
WDRF
Name
W
0x02
0x03
PCR_SR (hi)
R
PCR Status Register
W
PCR_SR (lo)
HTIE
UVIE
HTF
UVF
W
PCR_PRESC
W
PCR 1.0 ms prescaler
R
OPMM[1:0]
PF[1:0]
OPM[1:0]
HVRF
LVRF
WULTCF
WLPMF
WUPTB2
F
WUPTB1
F
WUPTB0
F
Write 1 will clear the flags
WUAHTH
R
WUCTHF WUCALF
F
PCR Status Register
PFM[1:0]
WULINF
WUPTB3
F
Write 1 will clear the flags
R
0x04
PRESC[15:0]
W
0x06
0x07
0x08
0x09
0x0A
0x0B
0x0C
0x0D
0x0E
0x0F
PCR_WUE (hi)
R
Wake-up Enable Register
W
PCR_WUE (lo)
R
Wake-up Enable Register
W
INT_SRC (hi)
R
Interrupt source register
W
INT_SRC (lo)
R
Interrupt source register
W
INT_VECT
R
Interrupt vector register
W
Reserved
R
INT_MSK (hi)
R
Interrupt mask register
W
INT_MSK (lo)
R
Interrupt mask register
W
TRIM_ALF (hi)
R
Trim for accurate 1.0 ms low
freq clock
W
TRIM_ALF (lo)
R
Trim for accurate 1.0 ms low
freq clock
W
WD_CTL
Watchdog control register
WUCAL
WULIN
WUPTB3
WUPTB2
WUPTB1
WUPTB0
0
0
0
0
0
0
0
TOV
CH3
CH2
CH1
CH0
LTI
HTI
UVI
0
0
CAL
LTC
CVMI
RX
TX
ERR
0
0
0
0
0
0
0
0
0
0
0
0
TOVM
CH3M
CH2M
CH1M
CH0M
LTIM
HTIM
UVIM
0
0
CALM
LTCM
CVMM
RXM
TXM
ERRM
PRDF
0
0
0
WULTC
IRQ[3:0]
0
APRESC[12:8]
APRESC[7:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W WDTSTM
R
W
0x12
WUCTH
W
R
0x10
WUAHTH
WD_SR
R
Watchdog status register
W
WDTST
0
WDTOM[2:0]
WDTO[2:0]
0
WDOFF
WDWO
MM912_637, Rev. 3.0
Freescale Semiconductor
46
Functional Description and Application Information
Table 63. Analog die Registers - 0x0200–0x02FF D2D Blocking Access (D2DI) 2 of 3/
0x0300–0x03FF D2D Non Blocking Access (D2DI) 3 of 3
Offset(71)
Name
0x13
Reserved
0x14
WD_RR
R
W
Reserved
0x16
Reserved
0x17
Reserved
0x19
0x1A
0x1B
0x1C
0x1D
0x1E
0x1F
0x20
0x21
0x22
0x23
0x24
0x25
14
6
13
5
12
4
11
3
10
2
9
1
8
0
0
0
0
0
0
0
0
0
W
Watchdog rearm register
0x15
0x18
R
15
7
R
WDR[7:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
LBKDIE
RXEDGI
E
0
SBR12
SBR11
SBR10
SBR9
SBR8
SBR7
SBR6
SBR5
SBR4
SBR3
SBR2
SBR1
SBR0
RSRC
M
ILT
PE
PT
W
R
W
R
W
SCIBD (hi)
R
SCI Baud Rate Register
W
SCIBD (lo)
R
SCI Baud Rate Register
W
SCIC1
R
SCI Control Register 1
W
SCIC2
R
SCI Control Register 2
W
SCIS1
R
SCI Status Register 1
W
SCIS2
R
SCI Status Register 2
W
SCIC3
R
SCI Control Register 3
W
LOOPS
0
0
TIE
TCIE
RIE
ILIE
TE
RE
RWU
SBK
TDRE
TC
RDRF
IDLE
OR
NF
FE
PF
LBKDIF
RXEDGIF
RXINV
RWUID
BRK13
LBKDE
R8
0
RAF
T8
TXDIR
TXINV
ORIE
NEIE
FEIE
PEIE
SCID
R
R7
R6
R5
R4
R3
R2
R1
R0
SCI Data Register
W
T7
T6
T5
T4
T3
T2
T1
T0
0
0
0
0
IOS3
IOS2
IOS1
IOS0
TIOS
R
Timer Input Capture/Output
Compare Select
W
CFORC
R
0
0
0
0
Timer Compare Force Register W
OC3M
R
Output Compare 3 Mask
Register
W
OC3D
R
Output Compare 3 Data
Register
W
TCNT (hi)
R
Timer Count Register
W
TCNT (lo)
R
Timer Count Register
W
0
0
0
0
0
0
0
0
0
0
FOC3
FOC2
FOC1
FOC0
OC3M3
OC3M2
OC3M1
OC3M0
OC3D3
OC3D2
OC3D1
OC3D0
0
0
TCNT[15:0]
MM912_637, Rev. 3.0
Freescale Semiconductor
47
Functional Description and Application Information
Table 63. Analog die Registers - 0x0200–0x02FF D2D Blocking Access (D2DI) 2 of 3/
0x0300–0x03FF D2D Non Blocking Access (D2DI) 3 of 3
Offset(71)
Name
0x26
Timer System Control Register
1
W
TTOV
R
TSCR1
0x27
0x28
0x29
0x2A
R
TCTL1
R
Timer Control Register 1
W
TCTL2
R
Timer Control Register 2
W
TIE
R
TFLG1
R
Main Timer Interrupt Flag 1
W
TFLG2
R
Main Timer Interrupt Flag 2
W
TC0 (hi)
R
Timer Input Capture/Output
Compare Register 0
W
TC0 (lo)
R
0x2F
Timer Input Capture/Output
Compare Register 0
W
TC1 (hi)
R
0x30
Timer Input Capture/Output
Compare Register 1
W
TC1 (lo)
R
0x31
Timer Input Capture/Output
Compare Register 1
W
TC2 (hi)
R
0x32
Timer Input Capture/Output
Compare Register 2
W
TC2 (lo)
R
Timer Input Capture/Output
Compare Register 2
W
TC3 (hi)
R
Timer Input Capture/Output
Compare Register 3
W
TC3 (lo)
R
Timer Input Capture/Output
Compare Register 3
W
0x2E
0x33
0x34
0x35
0x36
0
0
TEN
12
4
TIMTST
R
Timer Test Register
W
11
3
10
2
9
1
8
0
0
0
0
0
TOV3
TOV2
TOV1
TOV0
TFFCA
0
0
0
0
OM3
OL3
OM2
OL2
OM1
OL1
OM0
OL0
EDG3B
EDG3A
EDG2B
EDG2A
EDG1B
EDG1A
EDG0B
EDG0A
0
0
0
0
C3I
C2I
C1I
C0I
0
0
0
TCRE
PR2
PR1
PR0
C3F
C2F
C1F
C0F
0
0
0
0
0
0
R
W
0x2D
13
5
Timer Interrupt Enable Register W
Timer System Control Register
2
0x2C
14
6
Timer Toggle Overflow Register W
TSCR2
0x2B
15
7
TOI
0
TOF
0
0
0
0
0
0
TC0[15:0]
TC1[15:0]
TC2[15:0]
TC3[15:0]
0
0
0
0
TCBYP
0
MM912_637, Rev. 3.0
Freescale Semiconductor
48
Functional Description and Application Information
Table 63. Analog die Registers - 0x0200–0x02FF D2D Blocking Access (D2DI) 2 of 3/
0x0300–0x03FF D2D Non Blocking Access (D2DI) 3 of 3
Offset(71)
Name
0x37
Reserved
LTC_CTL (hi)
0x38
Life Time Counter control
register
LTC_CTL (lo)
R
0x39
Life Time Counter control
register
W
15
7
14
6
13
5
12
4
11
3
10
2
9
1
8
0
0
0
0
0
0
0
0
0
R
0
0
0
0
0
0
0
0
W
LTCIEM
R
W
LTCEM
0
0
0
0
0
0
LTCIE
LTCE
LTC_SR
R
LTCOF
0x3A
Life Time Counter status
register
W
1 will clr
0x3B
Reserved
R
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
R
0x3C
LTC_CNT1
W
Life Time Counter Register
R
LTC[31:16]
W
R
0x3E
LTC_CNT0
W
Life Time Counter Register
R
LTC[15:0]
W
R
0x40
GPIO_CTL
GPIO control register
0
W
R
0
W
0x42
0x43
0x44
0x45
0x46
0x47
0x48
0x49
GPIO_PUC
R
GPIO pull up/down
configuration
W
GPIO_DATA
R
GPIO port data register
W
GPIO_IN0
R
Port 0 input configuration
W
GPIO_OUT0
R
Port 0 output configuration
W
GPIO_IN1
R
Port 1 input configuration
W
GPIO_OUT1
R
Port 1 output configuration
W
GPIO_IN2
R
Port 2 input configuration
W
GPIO_OUT2
R
Port 2 output configuration
W
0
0
0
WKUP
0
WKUP
0
WKUP
0
0
0
0
0
0
0
DIR2M
DIR1M
DIR0M
PE3M
PE2M
PE1M
PE0M
DIR2
DIR1
DIR0
PE3
PE2
PE1
PE0
0
0
0
PDE3
PUE2
PUE1
PUE0
PD0
0
0
0
PD3
PD2
PD1
TCAP3
TCAP2
TCAP1
TCAP0
SCIRX
LINTX
TCOMP3
TCOMP2
TCOMP1
TCOMP0
SCITX
LINRX
TCAP3
TCAP2
TCAP1
TCAP0
SCIRX
LINTX
TCOMP3
TCOMP2
TCOMP1
TCOMP0
SCITX
LINRX
TCAP3
TCAP2
TCAP1
TCAP0
SCIRX
LINTX
TCOMP3
TCOMP2
TCOMP1
TCOMP0
SCITX
LINRX
0
0
PTBX0
0
0
PTBX1
0
0
PTBX2
MM912_637, Rev. 3.0
Freescale Semiconductor
49
Functional Description and Application Information
Table 63. Analog die Registers - 0x0200–0x02FF D2D Blocking Access (D2DI) 2 of 3/
0x0300–0x03FF D2D Non Blocking Access (D2DI) 3 of 3
Offset(71)
0x4A
14
6
13
5
12
4
11
3
10
2
PTWU
PTWU
TCAP3
TCAP2
TCAP1
TCAP0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
R
0
W
OTIEM
GPIO_IN3
R
Port 3 input configuration
W
0x4B
Reserved
0x4C
Reserved
0x4D
Reserved
0x4E
Reserved
0x4F
Reserved
0x50
15
7
Name
LIN_CTL
LIN control register
R
0x53
0x54
0x55
R
R
R
R
R
LIN_SR (lo)
R
LIN status register
W
LIN_TX
R
LIN transmit line definition
W
LIN_RX
R
LIN receive line definition
W
0x58
0x5A
0x5B
ACQ_CTL
Acquisition control register
R
OTIE
OT
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
HF
0
0
0
TXDM
LVSDM
ENM
SRSM[1:0]
TXD
LVSD
EN
SRS[1:0]
0
UV
0
0
0
RX
TX
RDY
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
FROMPT FROMSC
B
I
TOPTB
TOSCI
0
0
0
R
0
0
0
W
R
0
0
0
0
0
0
0
0
W
AHCRM
OPTEM
OPENEM
CVMIEM
ETMENM
ITMENM
VMENM
CMENM
OPTE
OPENE
CVMIE
ETMEN
ITMEN
VMEN
CMEN
PGAG
VMOW
CMOW
ETM
ITM
VM
CM
ITCHOP
VCHOP
CCHOP
R
0
AHCR
ACQ_SR (hi)
R
AVRF
Acquisition status register
W
ACQ_SR (lo)
R
Acquisition status register
W
Acquisition chain control 1
0
Write 1 will clear the flags
W
ACQ_ACC1
0
W
R
0x5C
0
W
R
Reserved
0
W
W
0x57
0
W
LIN_SR (hi)
Reserved
0
W
LIN status register
0x56
8
0
W
W
0x52
9
1
Write 1 will clear the flags
OPEN
0
0
W TCOMPM
R
W
TCOMP
0
VTH
ETCHOP
0
0
0
0
0
0
0
VCOMP
M
CCOMP
M
LPFENM
ETCHOP
M
ITCHOP
M
CVCHOP
M
AGENM
VCOMP
CCOMP
LPFEN
ETCHOP
ITCHOP
CVCHOP
AGEN
MM912_637, Rev. 3.0
Freescale Semiconductor
50
Functional Description and Application Information
Table 63. Analog die Registers - 0x0200–0x02FF D2D Blocking Access (D2DI) 2 of 3/
0x0300–0x03FF D2D Non Blocking Access (D2DI) 3 of 3
Offset(71)
0x5E
15
7
Name
ACQ_ACC0
Acquisition chain control 0
0x61
0x62
0x63
12
4
11
3
0
0
0
R
0
0
ZEROM
ECAPM
ZERO
ECAP
TADCG
VADCG
CADCG
0
0
0
0
0
0
0
0
0
R
ACQ_DEC
R
Decimation rate
W
ACQ_BGC
R
BandGap control
W
ACQ_GAIN
R
PGA gain
W
ACQ_GCB
R
GCB threshold
W
ACQ_ITEMP (hi)
R
0x64
Internal temperature
measurement
W
ACQ_ITEMP (lo)
R
0x65
Internal temperature
measurement
W
ACQ_ETEMP (hi)
R
0x66
External temperature
measurement
W
ACQ_ETEMP (lo)
R
0x67
External temperature
measurement
W
0x68
Reserved
0x69
13
5
W
W
0x60
14
6
R
TADCGM VADCGM CADCGM
BGADC[1:0]
0
8
0
0
0
0
TDENM
VDENM
CDENM
TDEN
VDEN
CDEN
DEC[2:0]
BG3EN
0
BG2EN
BG1EN
IGAIN[2:0]
ITEMP[15:8]
ITEMP[7:0]
EEMP[15:8]
EEMP[7:0]
0
0
0
0
0
0
0
0
0
0
W
ACQ_CURR1
R
Current measurement
W
ACQ_CURR0
W
Current measurement
0
9
1
D[7:0]
CURR[23:16]
R
0x6A
BGLDO
10
2
CURR[15:8]
R
CURR[7:0]
W
R
0x6C
ACQ_VOLT
Voltage measurement
VOLT[15:8]
W
R
VOLT[7:0]
W
ACQ_LPFC
R
0x6E
Low pass filter coefficient
number
W
0x6F
Reserved
R
0
0
0
0
LPFC[3:0]
0
0
0
0
0
0
W
MM912_637, Rev. 3.0
Freescale Semiconductor
51
Functional Description and Application Information
Table 63. Analog die Registers - 0x0200–0x02FF D2D Blocking Access (D2DI) 2 of 3/
0x0300–0x03FF D2D Non Blocking Access (D2DI) 3 of 3
Offset(71)
15
7
Name
14
6
13
5
12
4
11
3
10
2
9
1
8
0
0
0
0
0
0
R
0x70
ACQ_TCMP
W
Low power trigger current
measurement period
R
TCMP[15:0]
W
ACQ_THF
R
0x72
Low power current threshold
filtering period
W
0x73
Reserved
0x74
0x75
0x76
ACQ_CVCR (hi)
R
R
ACQ_CVCR (lo)
R
ACQ_CTH
R
Low power current threshold
W
R
ACQ_AHTH1 (hi)
R
Low power Ah counter
threshold
W
ACQ_AHTH1 (lo)
R
0x79
Low power Ah counter
threshold
W
ACQ_AHTH0 (hi)
R
0x7A
Low power Ah counter
threshold
W
ACQ_AHTH0 (lo)
R
Low power Ah counter
threshold
W
ACQ_AHC1 (hi)
R
Low power Ah counter
W
ACQ_AHC1 (lo)
R
Low power Ah counter
W
ACQ_AHC0 (hi)
R
Low power Ah counter
W
ACQ_AHC0 (lo)
R
Low power Ah counter
W
LPF_A0 (hi)
R
A0 filter coefficient
W
LPF_A0 (lo)
R
A0 filter coefficient
W
0x7E
0x7F
0x80
0x81
0
0
0
0
0
0
0
0
0
0
DBTM[1:0]
IIRCM[2:0]
PGAFM
DBT[1:0]
IIRC[2:0]
PGAF
0
I and V chopper control register W
0x78
0x7D
0
I and V chopper control register W
Reserved
0x7C
0
W
0x77
0x7B
THF[7:0]
CTH[7:0]
0
0
0
0
0
0
0
0
W
0
AHTH[30:16]
AHTH[15:0]
AHC[31:24]
AHC[23:16]
AHC[15:8]
AHC[7:0]
A0[15:0]
MM912_637, Rev. 3.0
Freescale Semiconductor
52
Functional Description and Application Information
Table 63. Analog die Registers - 0x0200–0x02FF D2D Blocking Access (D2DI) 2 of 3/
0x0300–0x03FF D2D Non Blocking Access (D2DI) 3 of 3
Offset(71)
0x82
0x83
0x84
0x85
0x86
0x87
0x88
0x89
0x8A
0x8B
0x8C
0x8D
0x8E
0x8F
0x90
0x91
0x92
0x93
0x94
0x95
15
7
Name
LPF_A1 (hi)
R
A1 filter coefficient
W
LPF_A1 (lo)
R
A1 filter coefficient
W
LPF_A2 (hi)
R
A2 filter coefficient
W
LPF_A2 (lo)
R
A2 filter coefficient
W
LPF_A3 (hi)
R
A3 filter coefficient
W
LPF_A3 (lo)
R
A3 filter coefficient
W
LPF_A4 (hi)
R
A4 filter coefficient
W
LPF_A4 (lo)
R
A4 filter coefficient
W
LPF_A5 (hi)
R
A5 filter coefficient
W
LPF_A5 (lo)
R
A5 filter coefficient
W
LPF_A6 (hi)
R
A6 filter coefficient
W
LPF_A6 (lo)
R
A6 filter coefficient
W
LPF_A7 (hi)
R
A7 filter coefficient
W
LPF_A7 (lo)
R
A7 filter coefficient
W
LPF_A8 (hi)
R
A8 filter coefficient
W
LPF_A8 (lo)
R
A8 filter coefficient
W
LPF_A9 (hi)
R
A9 filter coefficient
W
LPF_A9 (lo)
R
A9 filter coefficient
W
LPF_A10 (hi)
R
A10 filter coefficient
W
LPF_A10 (lo)
R
A10 filter coefficient
W
14
6
13
5
12
4
11
3
10
2
9
1
8
0
A1[15:0]
A2[15:0]
A3[15:0]
A4[15:0]
A5[15:0]
A6[15:0]
A7[15:0]
A8[15:0]
A9[15:0]
A10[15:0]
MM912_637, Rev. 3.0
Freescale Semiconductor
53
Functional Description and Application Information
Table 63. Analog die Registers - 0x0200–0x02FF D2D Blocking Access (D2DI) 2 of 3/
0x0300–0x03FF D2D Non Blocking Access (D2DI) 3 of 3
Offset(71)
0x96
0x97
0x98
0x99
0x9A
0x9B
0x9C
0x9D
0x9E
0x9F
0xA0
15
7
Name
LPF_A11 (hi)
R
A11 filter coefficient
W
LPF_A11 (lo)
R
A11 filter coefficient
W
LPF_A12 (hi)
R
A12 filter coefficient
W
LPF_A12 (lo)
R
A12 filter coefficient
W
LPF_A13 (hi)
R
A13 filter coefficient
W
LPF_A13 (lo)
R
A13 filter coefficient
W
LPF_A14 (hi)
R
A14 filter coefficient
W
LPF_A14 (lo)
R
A14 filter coefficient
W
0xA3
13
5
12
4
11
3
10
2
9
1
8
0
A11[15:0]
A12[15:0]
A13[15:0]
A14[15:0]
LPF_A15 (hi)
R
A15 filter coefficient
W
LPF_A15 (lo)
R
A15 filter coefficient
W
R
0
0
0
0
0
0
COMP_CTL
W
BGCALM[1:0]
PGAZM
PGAOM
DIAGVM
DIAGIM
CALIEM
BGCAL[1:0]
PGAZ
PGAO
DIAGV
DIAGI
PGAOF
0
0
Compensation control register
R
W
0xA2
14
6
COMP_SR
R
Compensation status register
W
COMP_TF
R
Temperature filtering period
W
COMP_TMAX
W
Max temp before recalibration
R
A15[15:0]
0
0
BGRF
0
CALIE
0
CALF
Write 1 will clear the flags
0
0
0
0
0
TMF[2:0]
R
0xA4
TCMAX[15:0]
W
R
0xA6
COMP_TMIN
W
Min temp before recalibration
R
TCMIN[15:0]
W
0xA8
Reserved
0xA9
Reserved
0xAA
R
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
R
W
COMP_VO
R
Offset voltage compensation
W
VOC[7:0]
MM912_637, Rev. 3.0
Freescale Semiconductor
54
Functional Description and Application Information
Table 63. Analog die Registers - 0x0200–0x02FF D2D Blocking Access (D2DI) 2 of 3/
0x0300–0x03FF D2D Non Blocking Access (D2DI) 3 of 3
Offset(71)
0xAB
15
7
Name
COMP_IO
R
Offset current compensation
W
COMP_VSG
W
R
0xAC
Gain voltage compensation
vsense channel
14
6
13
5
Reserved
0
0
0
R
0xAF
Reserved
R
0xB0
Gain current compensation 4
0
Gain current compensation 8
R
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
R
Gain current compensation 16
0
0
0
0
R
0
0
0
0xB6
Gain current compensation 32
R
0
0
0
0xB8
Gain current compensation 64
R
0
0
0
R
0
0
0
0
0
0
R
IGC64[9:8]
0
0
0
IGC128[9:8]
0
0
0
IGC256[9:8]
IGC256[7:0]
W
0xBE
0
W
Gain current compensation 256 R
COMP_IG512
0
IGC128[7:0]
W
0xBC
0
W
R
IGC32[9:8]
IGC64[7:0]
Gain current compensation 128 R
COMP_IG256
0
W
R
0xBA
0
IGC32[7:0]
W
COMP_IG128
0
W
R
IGC16[9:8]
IGC16[7:0]
W
COMP_IG64
0
W
R
IGC8[9:8]
IGC8[7:0]
W
COMP_IG32
IGC4[9:8]
IGC4[7:0]
W
R
0xB4
VSGC[9:8]
0
W
COMP_IG16
0
8
0
W
R
0xB2
0
9
1
VSGC[7:0]
W
COMP_IG8
10
2
W
R
COMP_IG4
11
3
COC[7:0]
W
0xAE
12
4
0
0
0
0
0
W
Gain current compensation 512 R
0
IGC512[9:8]
IGC512[7:0]
W
MM912_637, Rev. 3.0
Freescale Semiconductor
55
Functional Description and Application Information
Table 63. Analog die Registers - 0x0200–0x02FF D2D Blocking Access (D2DI) 2 of 3/
0x0300–0x03FF D2D Non Blocking Access (D2DI) 3 of 3
Offset(71)
Name
R
0xC0
COMP_PGAO4
Offset PGA compensation 4
15
7
14
6
13
5
12
4
11
3
0
0
0
0
0
W
R
R
0xC2
Offset PGA compensation 8
0
0
0
R
R
0xC4
Offset PGA compensation 16
0xC6
Offset PGA compensation 32
0
0
0
R
0xC8
Offset PGA compensation 64
0
0
0
R
0xCA
Offset PGA compensation 128
0
0
0
R
0xCC
Offset PGA compensation 256
0
0
0
R
Offset PGA compensation 512
0
0
0
R
0
0
0
0
0
0
0
0
0
0
W
R
COMP_ITO
R
0xD0
Internal temp. offset
compensation
W
COMP_ITG
R
0xD1
Internal temp. gain
compensation
W
COMP_ETO
R
External temp. offset
compensation
W
PGAOC32[10:8]
PGAOC64[10:8]
PGAOC128[10:8]
PGAOC256[10:8]
PGAOC256[7:0]
PGAOC512[10:8]
PGAOC512[7:0]
W
0xD2
0
W
R
0xCE
0
PGAOC128[7:0]
W
COMP_PGAO512
0
W
R
PGAOC16[10:8]
PGAOC64[7:0]
W
COMP_PGAO256
0
W
R
PGAOC8[10:8]
PGAOC32[7:0]
W
COMP_PGAO128
0
W
R
PGAOC4[10:8]
PGAOC16[7:0]
W
COMP_PGAO64
0
W
R
8
0
PGAOC8[7:0]
W
COMP_PGAO32
0
W
W
COMP_PGAO16
9
1
PGAOC4[7:0]
W
COMP_PGAO8
10
2
ITOC[7:0]
ITGC[7:0]
ETOC[7:0]
MM912_637, Rev. 3.0
Freescale Semiconductor
56
Functional Description and Application Information
Table 63. Analog die Registers - 0x0200–0x02FF D2D Blocking Access (D2DI) 2 of 3/
0x0300–0x03FF D2D Non Blocking Access (D2DI) 3 of 3
Offset(71)
Name
COMP_ETG
R
0xD3
External temp. gain
compensation
W
0xD4
Reserved
0xD5
Reserved
0xD6
Reserved
0xD7
Reserved
0xD8
Reserved
0xD9
Reserved
0xDA
Reserved
0xDB
Reserved
0xDC
Reserved
0xDD
Reserved
0xDE
Reserved
0xDF
Reserved
0xE0
0xE1
0xE2
0xE3
0xE4
0xE5
0xE6
15
7
R
14
6
13
5
12
4
11
3
10
2
9
1
8
0
ETGC[7:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
UBG3
DBG3
0
0
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
TRIM_BG0 (hi)
R
Trim bandgap 0
W
TRIM_BG0 (lo)
R
Trim bandgap 0
W
TRIM_BG1 (hi)
R
Trim bandgap 1
W
TRIM_BG1 (lo)
R
Trim bandgap 1
W
TRIM_BG2 (hi)
R
Trim bandgap 2
W
TRIM_BG2 (lo)
R
Trim bandgap 2
W
TRIM_LIN
R
Trim LIN
W
0
0
TCIBG2[2:0]
TCIBG1[2:0]
IBG2[2:0]
IBG1[2:0]
TCBG2[2:0]
TCBG1[2:0]
0
0
SLPBG[2:0]
V1P2BG2[3:0]
V1P2BG1[3:0]
V2P5BG2[3:0]
V2P5BG1[3:0]
0
0
0
0
0
0
LIN
MM912_637, Rev. 3.0
Freescale Semiconductor
57
Functional Description and Application Information
Table 63. Analog die Registers - 0x0200–0x02FF D2D Blocking Access (D2DI) 2 of 3/
0x0300–0x03FF D2D Non Blocking Access (D2DI) 3 of 3
Offset(71)
0xE7
0xE8
0xE9
Name
TRIM_LVT
R
Trim low voltage threshold
W
TRIM_OSC (hi)
R
Trim LP oscillator
W
TRIM_OSC (lo)
R
Trim LP oscillator
W
0xEA
Reserved
0xEB
Reserved
0xEC
Reserved
0xED
Reserved
0xEE
Reserved
0xEF
Reserved
0xF0
Reserved
0xF1
Reserved
0xF2
Reserved
0xF3
Reserved
0xF4
Reserved
0xF5
Reserved
0xF6
Reserved
0xF7
Reserved
0xF8
Reserved
0xF9
Reserved
0xFA
Reserved
0xFB
Reserved
R
15
7
14
6
13
5
12
4
11
3
10
2
9
1
0
0
0
0
0
0
0
8
0
LVT
LPOSC[12:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
MM912_637, Rev. 3.0
Freescale Semiconductor
58
Functional Description and Application Information
Table 63. Analog die Registers - 0x0200–0x02FF D2D Blocking Access (D2DI) 2 of 3/
0x0300–0x03FF D2D Non Blocking Access (D2DI) 3 of 3
Offset(71)
Name
0xFC
Reserved
0xFD
Reserved
0xFE
Reserved
0xFF
Reserved
R
15
7
14
6
13
5
12
4
11
3
10
2
9
1
8
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
R
W
R
W
R
W
Notes
71.Register Offset with the “lo” address value not shown have to be accessed in 16-Bit mode. 8-Bit access will not function.
MM912_637, Rev. 3.0
Freescale Semiconductor
59
MM912_637 - Analog Die Overview
5.1
MM912_637 - Analog Die Overview
MCU
5.1.1
ANALOG
Introduction
VDDL
DGND
VDDH
VDDX
PTB3
PTB2
PTB1
PTB0
The MM912_637 analog die implements all system base functionality to operate the integrated microcontroller, and delivers
application specific input capturing.
Analog
VSUP
Watchdog
GPIO
Bias
Regulator(s)
Digital
VDDA
GNDA
MMC
Oscillator
SCI
LIN
D2D
Interface
Internal Bus
MCU
Die
D2DDAT0..7
D2DCLK
D2DINT
Timer
Wake Up /
Power Down
Fuse
Box
LIN
LGND
VFUSE
GNDSUB
Interrupt
Control
Gain and offset compensation
Prog. Low pass filter
DECV
DECC
Gain and offset
compensation
Battery Voltage Battery Current
Measurement
Measurement
Temperature
Measurement
ADCGND
TSUP
VTEMP
ISENSEH
VSENSE
TEST_A
Test
Interface
ISENSEL
TCLK
VOPT
RESET_A
Figure 14. Analog Die Block Overview
The following chapters describe the analog die functionality on a module by module basis.
5.1.2
Analog Die Options
NOTE
This document describes the features and functions of Analog Option 2 (all modules
available and tested). Beyond this chapter, there will be no additional note or differentiation
between the different implementations.
The following section describes the differences between analog die options 1 and 2.
MM912_637, Rev. 3.0
Freescale Semiconductor
60
Table 64. Analog Options (continued)
Feature
Cranking Mode
Analog Option 1
Analog Option 2
Not Characterized or Tested
Fully Characterized and Tested
External Wake-up (PTB3/L0)
No
Yes
External Temperature Sensor Option (VTEMP)
No
Yes
Optional 2nd External Voltage Sense Input (VOPT)
No
Yes
5.1.2.1
Cranking Mode
For devices with Analog Option 1 (Cranking mode not characterized), the following considerations are to be made:
5.1.2.1.1
Data Sheet Considerations
In Analog Option 1 devices, Operation in Cranking mode is neither characterized not tested. All data sheet parameters and
descriptions relating to Cranking mode operation apply to Analog Option 2 devices only.
5.1.2.2
External Wake-up (PTB3/L0)
For devices with Analog Option 1 (External Wake-up not available), the following considerations are to be made:
5.1.2.2.1
Register considerations
Table 65. Wake-up Enable Register (PCR_WUE (hi))
Offset
(72)
0x06
R
W
Reset
Access: User read/write
7
6
5
4
3
2
1
0
WUAHTH
WUCTH
WUCAL
WULIN
WUPTB3
WUPTB2
WUPTB1
WUPTB0
0
0
0
0
0
0
0
0
Notes
72.Offset related to 0x0200 for blocking access and 0x300 for non-blocking access within the global address space.
For Analog Option 1 devices, WUPTB3 must be set to 0 (wake-up on a GPIO 3 event disabled).
5.1.2.3
External Temperature Sensor Option (VTEMP)
For devices with Analog Option 1 (External Temperature Sensor Option not available), the following considerations are to be
made:
5.1.2.3.1
Pinout Considerations
Pin
Pin Name for Option 2 Pin Name for Option 1
Comment
28
VTEMP
NC
NC pin should be
connected to GND
29
TSUP
NC
Pin should be left
unconnected
MM912_637, Rev. 3.0
Freescale Semiconductor
61
5.1.2.3.2
Register Considerations
Table 66. Acquisition Control Register (ACQ_CTL)
Offset
(73),(74)
0x58
Access: User read/write
15
14
13
12
11
10
9
8
R
0
0
0
0
0
0
0
0
W
AHCRM
OPTEM
OPENEM
CVMIEM
ETMENM
ITMENM
VMENM
CMENM
Reset
0
0
0
0
0
0
0
0
7
6
5
4
3
2
1
0
OPTE
OPENE
CVMIE
ETMEN
ITMEN
VMEN
CMEN
0
0
0
0
0
0
0
R
0
W
AHCR
Reset
0
Notes
73.Offset related to 0x0200 for blocking access and 0x300 for non-blocking access within the global address space.
74.This register is 16-bit access only.
For Analog Option 1 devices, ETMEN must be set to 0 (external temperature measurement disabled).
5.1.2.4
Optional 2nd External Voltage Sense Input (VOPT)
For devices with Analog Option 1 (Optional 2nd External Voltage Sense Input not available), the following considerations are to
be made:
5.1.2.4.1
Pinout Considerations
Pin
Pin Name for Option 2 Pin Name for Option 1
28
5.1.2.4.2
VOPT
Comment
NC pin should be
connected to GND
NC
Register Considerations
Table 67. Acquisition Control Register (ACQ_CTL)
Offset
(75),(76)
0x58
Access: User read/write
15
14
13
12
11
10
9
8
R
0
0
0
0
0
0
0
0
W
AHCRM
OPTEM
OPENEM
CVMIEM
ETMENM
ITMENM
VMENM
CMENM
Reset
0
0
0
0
0
0
0
0
7
6
5
4
3
2
1
0
OPTE
OPENE
CVMIE
ETMEN
ITMEN
VMEN
CMEN
0
0
0
0
0
0
0
R
0
W
AHCR
Reset
0
Notes
75.Offset related to 0x0200 for blocking access and 0x300 for non-blocking access within the global address space.
76.This register is 16-bit access only.
For Analog Option 1 devices, OPTE must be set to 0 (VSENSE routed to ADC).
MM912_637, Rev. 3.0
Freescale Semiconductor
62
Analog Die - Power, Clock and Resets - PCR
5.2
Analog Die - Power, Clock and Resets - PCR
MCU
5.2.1
ANALOG
Introduction
The following chapter describes the MM912_637’s system base functionality primary location on the analog die. The chapter is
divided in the following sections:
1. 5.2.2, “Device Operating Modes"
2. 5.2.3, “Power Management"
3. 5.2.4, “Wake-up Sources"
4. 5.2.5, “Device Clock Tree"
5. 5.2.6, “System Resets"
6. 5.2.7, “PCR - Memory Map and Registers"
5.2.2
Device Operating Modes
The MM912_637 features three main operation modes: normal operation, stop mode, and sleep mode.
The full signal conditioning and measurements are permanently running in normal operation mode. The total current consumption
of the MM912_637 is reduced in the two low power modes.
The analog die of the MM912_637 is still partially active and able to monitor the battery current, temperature, activities on the
LIN interface and L0 terminal, during both low power modes.
5.2.2.1
•
•
•
•
•
Operating Mode Overview
Normal Mode
— All device modules active
— Microcontroller fully supplied
— D2DCLK active analog die clock source
— Window watchdog clocked by the low power oscillator (LPCLK) to operate on independent clock
Stop Mode
— MCU in low power mode, MCU regulator supply (VDDX) with reduced current capability
— D2D interface supply disabled (VDDH=OFF)
— Unused analog blocks disabled
— Watchdogs = OFF
— LIN wake-up, calibration request wake-up, cyclic wake-up, external wake-up, current threshold wake-up, and
lifetime counter wake-up optional
— Current Measurement / current averaging and temperature measurement optional
Sleep Mode
— MCU powered down (VDDH and VDDX = OFF)
— Unused Analog Blocks disabled
— Watchdogs = OFF
— LIN wake-up, calibration request wake-up, cyclic wake-up, external wake-up, current threshold wake-up, and
lifetime counter wake-up optional
— Current measurement / current averaging and temperature measurement optional
Intermediate Mode
— Every transition from Stop or Sleep into Normal mode will go through an intermediate mode where the analog die
clock is not yet switched to the D2D clock. If required, the MM912_637 analog die can be put back to low power
mode without changing the frequency domain.
Reset Mode
— Every reset source within the analog die will bring the system into a Reset state
MM912_637, Rev. 3.0
Freescale Semiconductor
63
Analog Die - Power, Clock and Resets - PCR
•
•
Power On Reset Mode
— For both low voltage thresholds are defined to indicate a loss of internal state.
Cranking Mode(77)
— Special Mode implemented to guarantee the RAM content being valid though very low power conditions.
Notes
77.Not available on all device derivatives
5.2.2.2
Operating Mode Transitions
The device operating modes are controlled by the microcontroller, as well as external and internal wake-up sources. Figure 15
shows the basic principal.
POR
ANALOG: VDDL > VPORH
MCU: VDDRX>VPORD
ANALOG: VDDL < VPORL
MCU: VDDRX<VPORA
ANALOG: VDDL < VPORL
MCU: VDDRX<VPORA
RESET
Cranking
Event
RESET
Event
Reset Event Reset Event
gone
Cranking
Event
Cranking Mode1
MCU
Intermediate
Mode
Intermediate
Mode
Wake-up
Event
MCU IRQ
RESET
Event
Cranking Event
gone
Cranking
Event
Intermediate
Mode
Wake-up
Event
(MCU
Power On)
Normal Mode
MCU
MCU
MCU
MCU
Stop Mode
Sleep Mode
1
) Cranking Mode not available on all device derivatives
Figure 15. Modes of Operation - Transitions
5.2.2.3
Power On Reset - POR
During system startup, or in any other case when MCU_VDD drops below VPORA (MCU), or VDDL drops below VPORL (analog
die), a Power On Reset (POR) condition is reached. The MCU (PORF) / analog die (LVRF) will indicate this state, setting the
corresponding power on reset flag. The primary consequence of entering POR is that the RAM or analog register content can no
longer be guaranteed.
MM912_637, Rev. 3.0
Freescale Semiconductor
64
Analog Die - Power, Clock and Resets - PCR
5.2.2.4
RESET - Mode
If any of the analog die reset conditions are present, the MM912_637 analog die will enter Reset mode. During that mode, the
analog die will issue the RESET_A pin to be pulled down to reset the microcontroller die. Entering Reset mode will reset the
analog die registers to their default values.
The cause of the last reset is flagged in the PCR Status Register (PCR_SR (hi)).
5.2.2.5
Normal Mode
During Normal mode operation, all modules are operating and the microcontroller is fully supplied.
5.2.2.6
Cranking Mode(78)
A specific power down behavior has been implemented to allow the MCU memory (RAM) content to be guaranteed during very
low supply voltage conditions. The difference between the device behavior, with or without the cranking mode feature enabled,
is described in Section 5.2.3.3, “Power Up / Power Down Behavior".
Notes
78.Not available on all device derivatives
5.2.2.7
Intermediate Mode
As the channel acquisition and the timer modules are switched to the LPCKL, while the MM912_637 is operating in one of the
two low power modes, the Intermediate mode has been implemented, to be able to go back to low power mode without the
transition into the D2D Clock domain.
NOTE
The flag indicating the last wake-up source must be cleared before re-entering low power
mode!
Once awakened, the MCU instructs the analog die to transit to Normal mode by writing “00” to the OPM bits in the PCR Control
Register. See Figure 16 for details.
MM912_637, Rev. 3.0
Freescale Semiconductor
65
Analog Die - Power, Clock and Resets - PCR
“01”
STOP MODE
VDDH = OFF
VDDX = Limited
TIM / AQ = LPCLK
MCU = STOP
SLEEP MODE
VDDH & VDDX = OFF
TIM / AQ = LPCLK
MCU = OFF
Wake-up
Event
Wake-up
Event
INTERMEDIATE MODE
1. VDDH = ON
2. VDDX = Full
3. MCU => IRQ
INTERMEDIATE MODE
1. VDDH & VDDX = ON
2. MCU => Power On
“10”
MCU can access D2D
TIM / AQ are still on LPCLK domain
(e.g. check Wake-up source)
Write OPM[1:0] Bits in the PCR Control Register
“00”
NORMAL MODE
TIM / AQ = based on D2D Clock
Figure 16. Low Power Mode to Normal Mode Transition through the Intermediate Mode
5.2.2.8
Low Power Modes
In low power mode, the MM912_637 is still active to monitor the battery current (triggered current measurement for current
threshold detection and current accumulator function), and activities on the LIN interface and wake-up inputs. A cyclic wake-up
using timer module is implemented for timed wake-up. Temperature measurements are optional to detect an out of calibration
condition.
The Life Time counter is also incremented during Low Power mode, to issue a Wake-up on overflow. See Section 5.13, “Life Time
Counter (LTC)" for additional details.
The average current consumption is reduced, and based on the actual low power mode, the active modules, and the wake-up
timing.
NOTE
To avoid any lock condition, no analog die interrupt should be enabled or pending when
entering LPM. To accomplish that condition, the analog die interrupts should be masked and
served before writing the PCR_CTL register.
The MCU interrupts should be enabled right before the STOP command, to avoid any
interrupt to be handled in between.
A wake-up from any of the low power modes will reset the window watchdog equal to a
standard reset.
5.2.2.8.1
Sleep Mode
Writing the PCR Control Register (PCR_CTL) with OPM=10, the MM912_637 will enter Sleep mode with the configured wake-up
sources (see Section 5.2.4, “Wake-up Sources").
NOTE
The power supply to the MCU will be turned off during Sleep mode. To safely approach this
condition, the MCU should be put into a safe state (e.g STOP).
MM912_637, Rev. 3.0
Freescale Semiconductor
66
Analog Die - Power, Clock and Resets - PCR
During Sleep mode, the only active voltage regulator is VDDL, supplying the low power oscillator (LPOSC), and the permanently
supplied digital blocks.
When an enabled wake-up condition occurs, the shutdown voltage regulators are re-enabled, and once their outputs are above
reset threshold, the RESET_A signal is released, and the microcontroller will start its normal operation. The wake-up source is
flagged in the PCR Status Register (PCR_SR (hi)).
The microcontroller has to acknowledge the Normal mode, by writing the OPM=00, to allow a controlled transition into the D2D
Clock domain. If the clock domain transition is not required, the microcontroller may issue a sleep / stop mode entry instead (see
Section 5.2.5, “Device Clock Tree" for details on the limitations during the intermediate state).
5.2.2.8.2
Stop Mode
Writing the PCR Control Register (PCR_CTL) with OPM=01, the MM912_637 analog die will enter Stop mode with the configured
wake-up sources (see Section 5.2.4, “Wake-up Sources"), after the D2DCLK signal has been stopped by the MCU die entering
Stop.
NOTE
After writing the PCR Control Register (PCR_CTL) with OPM=01, the register content of the
SCI (S08SCIV4) and TIMER (TIM16B4C) module registers are only read until Normal mode
is entered again. This is important in case the MCU does not effectively enter STOP, due to
an IRQ pending from one of the two blocks. (Having any analog die IRQ allowed when
entering Low Power mode is not recommended).
During Stop mode, the MM912_637 has the same behavior as during Sleep mode, except VDDX is still powered by the internal
Clamp_5v, to supply the MCU STOP mode current. As this current is limited, the MCU die must be switched into STOP mode
after sending the Stop command for the analog die.
If any enabled wake up condition occurs, the shutdown voltage regulators are re-enabled, and once their outputs are above the
reset threshold, VDDX is switched to the main regulator, an D2D interrupt (D2DINT) is issued to wake-up the MCU, and the
microcontroller will continue its normal operation. The wake-up source is flagged in the PCR Status Register (PCR_SR (hi)).
The microcontroller has to acknowledge the Normal mode by writing the OPM=00. This allows a controlled transition into the D2D
Clock domain. If the clock domain transition is not required, the microcontroller may issue a sleep / stop mode entry instead (see
Section 5.2.5, “Device Clock Tree" for details on the limitations during the intermediate state).
NOTE
After writing the PCR Control Register (PCR_CTL) with OPM=01, writing OPM=00 (Normal
mode) is allowed to wake-up the analog die. The reduced current capability of the MCU
regulator supply (VDDX) has to be considered.
MM912_637, Rev. 3.0
Freescale Semiconductor
67
Analog Die - Power, Clock and Resets - PCR
5.2.3
Power Management
To support the various operating modes and modules in the MM912_637, the following power management architecture has been
implemented.
POR
VPORH / VPORL
VDDL
VDDL
Flash
LVRA
VLVRAH / VLVRAL
Clamp5v
VDDF
VDDA
VDDA
VDDX
VDDX
LVR
VLVRA / VLVRD
VDDRX
LVI
VLVIA / VLVID
VLVRXH / VLVRXL
VDD
POR
VSUP
LVRX
D2D
VDDD2D
VDDH
VDDH
UVI
VUVIH / VUVIL
VPORA / VPORD
LVRH
Core
VLVRHH / VLVRHL
MCU
Analog Die
Figure 17. System Voltage Monitoring
5.2.3.1
Detailed Power Block Description
See recommended external components under Section 3.2, “Recommended External Components"”.
5.2.3.1.1
VSUP
VSUP is the system power supply input, and must be reverse battery protected by an external diode. VSUP is monitored for
under-voltage conditions (UVI). Once VSUP drops below VUVIL an under-voltage interrupt (LVI) is issued.
NOTE
If the device has the cranking mode feature enabled, the under-voltage threshold would be
VUVCIL instead of VUVIL.
5.2.3.1.2
VDDL
VDDL is the low power 2.5 V digital supply voltage, supplying the permanently active blocks. It is based on the internal Clamp5v
voltage and always on. It is available externally, but must not be connected to any load.
5.2.3.1.3
VDDX
VDDX is the Normal mode 5.0 V regulator output, suppling the LIN block and the microcontroller via the VDDX pin. During STOP
and SLEEP mode operation, the VDDX regulator is shut down (Clamp5v does supply the MCU during STOP mode).
5.2.3.1.4
VDDH
VDDH is the Normal mode 2.5 V regulator output, suppling only active blocks during Normal mode and the MCU Die to Die
Interface, via the VDDH terminal. The VDDH regulator is shut down during both low power modes.
5.2.3.1.5
VDDA
VDDA is the 2.5 V analog supply voltage, active during Normal mode and I/T acquisitions. No external load must be connected
to the VDDA terminal.
MM912_637, Rev. 3.0
Freescale Semiconductor
68
Analog Die - Power, Clock and Resets - PCR
5.2.3.2
Power Supply by Module
The following table summarized the active regulators vs. module for the different operating modes.
Table 68. Power Supply by Module
Module / Block
Gain Control Block (GCB)(79)
VDDH
VDDA
X
X
(80)
Programmable Gain Amplifier (PGA)
X
I/T - ADC Converters(80)
X
Converters(79)
X
Temperature Sensor(80)
X
V - ADC
LIN(79)
D2D(79)
VDDX
X
X
X
LPOSC(81)
X
Permanent Digital(81)
Normal Mode
VDDL
Digital(79)
X
X
Notes
79.Enabled in Normal Mode only
80.Enabled when a measuring in Low Power mode and always in Normal mode
81.Permanently enabled
5.2.3.3
Power Up / Power Down Behavior
Several system voltage monitors have been implemented in both die, to guarantee a defined power up and power down system
behavior. See Figure 17 for the various sensing points. The individual threshold levels are specified in Table 16 for the analog
die, and Table 25 for the microcontroller.
NOTE
To differentiate between the MCU and analog die thresholds, the following symbol scheme
is defined:
VxxxxA - MCU Assert Level (lower threshold for low voltage events)
VxxxxD - MCU Deassert Level (higher threshold for low voltage events)
VxxxxH - Analog Die High Threshold Level (deassert threshold for low voltage events)
VxxxxL - Analog Die Low Threshold Level (assert threshold for low voltage events)
5.2.3.4
Low Voltage Operation - Cranking Mode Device Option
Based on the device option (“Cranking” or “Non-cranking”), the MM912_637 will behave different during “Loss of Power”
conditions. The “Cranking” option is an option, allowing lower voltage operations to guarantee the MCU memory content during
a standard cranking situation.
As illustrated in Figure 18, the cranking mode is introduced to maintain both die in a STOP mode alike state. The MCU die will
remain in STOP with the RAM content being guaranteed until the PORA level is reached for the VDDRX supply.
The analog die will enter “Cranking Mode” upon the MCU command out of Normal Mode, or when it reaches VUVCIL during STOP
Mode, with the LVT bit set in the TRIM_LVT register.
NOTE
Executing STOP with VSUP < VUVCIL and LVT = 1, the MM912_637 will immediately enter
Cranking Mode.
During Cranking Mode, the analog die will gate its internal oscillator to stop all ongoing acquisitions during the low power
condition. Returning from Cranking mode will appear as a wake-up from under-voltage interrupt (UVI=1). The analog die will be
in Intermediate mode after wake-up, and could be sent into Normal mode (Stop, Sleep), by writing the OPM bits.
MM912_637, Rev. 3.0
Freescale Semiconductor
69
Analog Die - Power, Clock and Resets - PCR
Device with Cranking Mode Enabled
Stop / Sleep
Mode
Normal /
Intermediate
Mode
Stop / Sleep
Mode
High Precision
Comparator always on
in Normal /
Intermediate Mode
High Precision
Comparator => ON
VUVIL
Under Voltage IRQ
(UVI) issued.
Inactive during Stop /
Sleep
Handle IRQ, prepare
for Cranking Mode
Inactive during Stop /
Sleep
VLVIA
Handle IRQ, prepare
for Cranking Mode
Inactive during Stop /
Sleep
Under Voltage IRQ
(UVI) issued.
Cranking Mode Entry
without MCU
interaction. MCU will
stay in STOP mode or
turned off.
VUVCIL
Inactive for Non
Cranking Mode Device
Option
Inactive for Non
Cranking Mode Device
Option
MCU in LVR, Analog
Die remains in Low
Power Mode
Inactive during Stop /
Sleep
MCU initiates rapid shutdown
to Cranking Mode (OPM=11) and
enters STOP.
CRANKING MODE
(MCU = Stop or Off,
Analog = Cranking Mode
LPOSC gated => operation stopped)
VSUP Decrease
Normal /
Intermediate
Mode
Device with Cranking Mode Disabled
Inactive during Cranking Mode
VLVRA
Inactive during Cranking Mode
VLVRXL
LOW VOLTAGE RESET at VDDX
=> Analog Die + MCU in Reset Mode
Inactive during Cranking Mode
VLVRHL
VLVRAL
System remains in Reset
Mode
MCU POR, RAM invalid,
Analog Die Remains in
Cranking Mode
VPORA
MCU POR, RAM invalid, Both
Dice Remain in Reset Mode
Inactive for Cranking Mode
Device Option
VPORL
Analog Die Power On Reset
Analog Die Power On Reset
VPORCL
Inactive for Non - Cranking
Mode Device Option
Figure 18. Power Down Sequence
MM912_637, Rev. 3.0
Freescale Semiconductor
70
Analog Die - Power, Clock and Resets - PCR
5.2.4
Wake-up Sources
Several wake-up sources have been implemented in the MM912_637, to exit from Sleep or Stop mode.
Figure 19 shows the wake-up sources and the corresponding configuration and status bits.
To indicate the internal wake-up signal, a routing of the internal wake-up signal to the PTBx output (WKIP) is implemented. See
Section 5.10, “General Purpose I/O - GPIO", for additional details on the required configuration.
GPIO
TIM4CH
WKUP
TCOMP3..0
PTB0
I/O
Output Compare CH3
WUPTB0
TCOMP3..0
Output Compare CH2
PTB1
I/O
Output Compare CH1
Output Compare CH0
Sytem
Wake
Up
WUPTB1
TCOMP3..0
PTB2
I/O
WUPTB2
=1
WLPMF
WUPTB0F
PTB3
I/O
PTWU
WUPTB1F
L0
WUPTB2F
WUPTB3
WUPTB3F
WULINF
LIN
WULIN
WUAHTHF
WUCTHF
LIN Wake Up detected
WUCALF
Current Trigger
Current Accumulator
Threshold reached
Current
Threshold reached
Calibration Request
Life Time Counter
WUAHTH
WULTCF
WUCTH
WUCAL
WULTC
Life Time Counter
Overflow
Figure 19. Wake-up Sources
5.2.4.1
5.2.4.1.1
Wake-up Source Details
Cyclic Current Acquisition / Calibration Temperature Check
A configurable (ACQ_TCMP) independent low power mode counter/trigger, based on the ALFCLK, has been implemented to
trigger a cyclic current measurement during the low power modes. To validate that the temperature is still within the calibration
range, the temperature measurement can be enabled during this event as well.
As a result of the cyclic conversions, three wake-up conditions are implemented.
•
Current Threshold Wake-up
•
Current Averaging Wake-up
•
Calibration Request Wake-up
The configuration of the counter and the cyclic measurements is part of the acquisition paragraph (see Section 5.7, “Channel
Acquisition"). The actual cyclic measurement does not wake-up the microcontroller unless one of the three wake-up conditions
become valid.
MM912_637, Rev. 3.0
Freescale Semiconductor
71
Analog Die - Power, Clock and Resets - PCR
5.2.4.1.1.1
Current Threshold Wake-up
Every cyclic current measurement result (absolute content of the ADC result I_CURR register) is compared with a programmable
unsigned current threshold (CTH in the ACQ_CTH register).
The comparison is done with the CTH content left - shifted by 1, as shown in Figure 69.
Table 69. Current Threshold Comparison
2
3
2
2
2
1
2
0
1
9
1
8
1
7
1
6
1
5
1
4
1
3
1
2
1
1
1
0
9
CTH[7:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
ABS(CURR[23:0])
X
8
7
6
5
4
CTH[7:0]
3
2
1
0
0
ABS(CURR[23:0])
If the absolute result is greater or equal to the programmed and shifted threshold, a filter counter is incremented (decremented
if below). If the filter counter (8-Bit) reaches the programmable low power current threshold filtering period (ACQ_THF), a
wake-up initiated if the Current Threshold Wake-up is enabled (WUCTH). The filter counter is reset every time a low power mode
is entered. The implementation is shown in Figure 20.
The wake-up source is flagged with the WUCTHF Bit.
Figure 20. Current Threshold - Wake-up Counter
5.2.4.1.1.2
Current Ampere Hour Threshold Wake-up
As shown in Figure 21, every cyclic current measurement (signed content of the ADC result ACQ_CURR register) is added to
the 32-Bit (signed) current accumulator (ACQ_AHC) (both in two’s complement format). If the absolute accumulator value
reaches (|ACQ_AHC|  ACQ_AHTH), the absolute programmable 31-Bit current threshold (ACQ_AHTH), a wake-up is initiated
if the Current AH Threshold Wake-up is enabled (WUAHTH). The accumulator is reset on every low power mode entry.
The wake-up source is flagged with the WUAHTHF Bit.
MM912_637, Rev. 3.0
Freescale Semiconductor
72
Analog Die - Power, Clock and Resets - PCR
Ah counter
Accu
threshold
(progr.)
actual
measured
current
measurement
interval
uC
wake-up
t
start low-power mode = reset of
Ah counter
Figure 21. Ah Counter Function
5.2.4.1.1.3
Calibration Request Wake-up
Once the temperature measured during the cyclic sense is indicating a potential “out of calibration” situation, a wake-up is issued
if the Calibration Request Wake-up is enabled (WUCAL). For additional details, refer to Section 5.7.5, “Calibration".
The wake-up source is flagged with the WUCALF Bit.
5.2.4.1.2
Timed Wake-up
To generate a programmable wake-up timer, the integrated 4 Channel Timer Module is supplied, during both low power modes
and running on the ALFCLK clock. To wake-up from one of the low power modes, the output compare signal (OC) of any of the
4 channels can be routed to the PTB[2:0] logic (standard feature also in Normal mode). Enabling the corresponding Wake-up
Enable Bit (WUPTBx) will generate the wake up, once the timer output compare becomes active.
NOTE
Only the internal GPIO logic is active during the low power modes. The Port I/O structures
will not be active.
To allow an accurate wake-up configuration during the clock transition, the timer should be configured before entering one of the
low power modes, without the Timer Enable Bit (TEN) being set. Setting the Timer Wake-up Enable Bit (WUPTB) will enable the
TIMER interrupts as wake-up sources, and cause the Timer Enable Bit (TEN) to be set, once the timer clock domain was changed
to the LPOSC clock.
During low-power mode, only current and temperature measurements are performed, so only the current measurement channel
is active with the temperature channel being optional - the voltage measurement channel is inactive. To reduce further the power
consumption, only triggered current measurements are done. For this purpose, an independent Timer Module is used to
periodically start a current measurement after a programmable time (ACQ_TCMP).
5.2.4.1.3
Wake-up from LIN
During Low Power mode, operation of the transmitter of the physical layer is disabled. The receiver remain, active and able to
detect wake-up events on the LIN bus line. For further details, refer to Section 5.11, “LIN".
A dominant level longer than tWUPF followed by a rising edge, will generate a wake-up event if the WULIN is enabled.
The wake-up source is flagged with the WULINF Bit.
MM912_637, Rev. 3.0
Freescale Semiconductor
73
Analog Die - Power, Clock and Resets - PCR
NOTE
If the LIN module is disabled (LIN_CTL:EN=0), no wake-up will be issued after the dominant
to recessive transition, when the device goes to low power mode, while the LIN bus is in the
DOMINANT STATE.
If the LIN module is enabled (LIN_CTL:EN=1), the device will wake-up after the dominant to
recessive transition, when the device goes to low power mode, while the LIN bus is in the
DOMINANT STATE.
A full dominant -> recessive -> dominant sequence, during low power mode, will wake-up
the device in both cases.
5.2.4.1.4
Wake-up on Wake-up pin high level
Once a Wake-up signal (high level) is detected on the PTB3/L0 input, with the Wake-up Enable Bit (WUPTB3) and the port
configuration bit (PTWU) set, a wake-up is issued. The wake-up source is flagged with the WUPTB3F Bit.
5.2.4.1.5
Wake-up on Life Time Counter Overflow
The life time counter continues to run during low power mode, if configured. Once the counter overflows with the life time counter
wake-up enabled (WULTC=1), a wake-up is issued. The wake-up source is flagged with the WULTC Bit.
5.2.4.1.6
General Wake-up Indicator
To indicate the system has been awakened after power up, the WLPMF flag will be set.
5.2.5
5.2.5.1
Device Clock Tree
Clock Scheme Overview
There are two system oscillators implemented. The low power oscillator is located on the analog die, and is supplied permanently
and has a nominal frequency of fOSCL, providing a LPCLK clock signal. It is primarily used in low power mode, and as an
independent clock source for the watchdog during Normal mode.
The high power oscillator is basically the internal or external microcontroller oscillator (active only during normal mode). The high
power oscillator is distributed to the analog die via the D2DCLK (via configurable MCU prescalers), and there it’s divided into two
clocks (D2DSCLK and D2DFCLK), based on the PRESC[15:0] prescaler. For the D2DSCLK, an additional 2 Bit divider PF[1:0]
is implemented(82). During Normal mode, D2DSCLK is continuously synchronizing the LPCLK, to create the accurate ALFCLK
(See Section 5.2.5.2, “ALFCLK Calibration"), it’s clock source of the TIM16B4C (Timer), and S08SCIV4 (SCI) module with a fixed
by 4 divider.
Notes
82.PF[1:0] is not implemented as a simple divider. To accomplish a D2DSCLK period ranging from 1.0 ms to 8.0 ms, the following scheme is
used: 00 - 1; 01 - 2; 10 - 4; 11 - 8.
D2DSCLK - D2D Slow Clock (1... 0.125 kHz)
Eqn. 1
D2DCLK
 D2DSCLK = ----------------------------------------------------------------------------
PF  1 0 


2
   PRESC  15 0  
D2DFCLK - D2D Fast Clock (512 kHz)
Eqn. 2
D2DCLK
 D2DFCLK = ----------------------------------------------------------------------------------------------

2   PRESC  15 10  + PRESC  9  
During low power mode, D2DCLK is not available. The low power oscillator is the only system clock.
MM912_637, Rev. 3.0
Freescale Semiconductor
74
Analog Die - Power, Clock and Resets - PCR
Figure 22 and Figure 23 show the different clock sources for normal and low power mode.
NOTE
D2DFCLK has to be set to match 512 kHz, resulting in D2DSCLK being 1.0, 2.0, 4.0, or
8.0 kHz, based on PF[1:0]
The minimum value for PRESC[15:0] has to be 0x0400. Any value lower than 0x0400 will
result in faulty behavior and is not recommended. Values of 0x0003 or less are not stored
by the internal logic.
LPOSC
(fOSCL)
LP CLK Synch
LPCLK
D2DSCLK
trim_lposc
WDTO[2:0]=100
tIWDTO
WDTO[2:0]
tWDTO
ALFCLK
Window
Watchdog
Life Time Counter
PF[1:0]
D2DFCLK
Channel
Acquisition
PRESC[15:0]
D2D Interface
D2DCLK
[15:10]
TIM16B4C
(Timer)
[9:0]
DIV4
S08SCIV4
(SCI)
Figure 22. Clock Tree Overview - Normal Mode
LPOSC
LPCLK
LP CLK Synch
ALFCLK
Life Time Counter
TIM16B4C
(Timer)
trim_lposc
Current Trigger
Channel
Acquisition
Figure 23. Clock Tree Overview - Low Power Modes
5.2.5.2
ALFCLK Calibration
To increase the accuracy of the 1.0 kHz (or 2.0, 4.0, 8.0 7kHz based on PF[1:0]) system clock (ALFCLK), the low power oscillator
(LPCLK) is synchronized to the more precise D2DCLK, via the D2DSCLK signal. The “Calibrated Low Power Clock” (ALFCLK)
could be trimmed to the D2DCLK accuracy plus a maximum error adder of 1 LPCLK period, by internally counting the number of
periods of the LPCLK (512 kHz) during a D2DSCLK period. The APRESC[12:0] register will represent the calculated internal
prescaler. The PRDF bit (Prescaler Ready flag) will indicate the synchronization complete after a power up or prescaler
(PRESC/PF) change.
The adjustment is continuously performed during Normal mode. During low power mode (STOP or SLEEP), the last adjustment
factor would be used.
MM912_637, Rev. 3.0
Freescale Semiconductor
75
Analog Die - Power, Clock and Resets - PCR
D2DCLK
PRESC[15:0]+PF[1:0] Counter based ms clock (D2DSCLK) period
LPCLK
1
2
3
4
5
6
7
APRESC[12:0]
0x0200 (512d) default
PRDF
0
8
9
0x0009 (9d)
1
Synch
Start
Synch
Finished
Figure 24. ALF Clock Calibration Procedure During Normal Mode
1
2
3
4
5
6
7
8
9
1
2
3
4
5
6
7
8
9
1
2
3
4
5
LPCLK
PRDF
APRESC[12:0]
0
1
?
0x0009 (9d)
ALFCLK
Figure 25. ALFCLK After Calibration
5.2.5.3
Recommended Clock Settings
Considering the system is running on the internal oscillator, Table 70 shows the recommended clock settings to achieve the
optimal 512 kHz D2DFCLK. For details on the MCU divider settings, including POSTDIV and SYNDIV, see Section 5.22, “S12
Clock, Reset, and Power Management Unit (S12CPMU)". The D2D initiator module includes D2DCLKDIV see Section 5.25,
“MCU - Die-to-Die Initiator (D2DIV1)".
30.720
0
14.336
7.168
0
15=32.768
16=34.816
17=36.864
18=38.912
19=40.960
20=43.008
21=45.056
22=47.104
23=49.152
24=51.200
25=53.248
26=55.296
0
29.696
28.672
27=57.344
0
15.360 10.240
PRESC[15:9]
(dec)(83)
31.744
28=59.392
0
29=61.440
8.192
30=63.488
31=65.536
16.384
POSTDIV for (SYNDIV=fVCO in MHz)
D2DCLKDIV=4
D2DCLKDIV=2
32.768
D2DCLKDIV=3
D2DCLKDIV=1
(fBUS)
fD2D / MHz
Divider for(83)
D2DFCLK=512kHz
Table 70. Recommended Clock Settings
64
63;64
62
61;62
60
59;60
58
57;58
56
55;56
MM912_637, Rev. 3.0
Freescale Semiconductor
76
Analog Die - Power, Clock and Resets - PCR
26.624
13.312
12.288
8.192
6.144
11.264
0
7.168
10.240
0
5.120
0
0
9.216
6.144
0
0
8.192
15.360
14.336
4.096
1
5.120
0
1
7.168
1
13.312
12.288
1
6.144
4.096
3.072
1
11.264
10.240
1
5.120
9.216
8.192
2
1
3.072
4.096
2
2.048
2
1
3
3.072
2.048
2
4
5.120
4.096
1
3
7.168
6.144
15=32.768
0
17.408
16.384
16=34.816
17=36.864
0
19.456
18.432
18=38.912
19=40.960
20=43.008
0
21.504
20.480
21=45.056
0
23.552
22.528
22=47.104
23=49.152
0
25.600
24.576
24=51.200
25=53.248
26=55.296
27=57.344
28=59.392
29=61.440
30=63.488
31=65.536
9.216
3
5
2.048
7
3.072
6
9
2.048
15
14
2
4
5
8
13
3
4
7
12
11
6
10
3
5
9
8
7
PRESC[15:9]
(dec)(83)
27.648
POSTDIV for (SYNDIV=fVCO in MHz)
D2DCLKDIV=4
D2DCLKDIV=3
D2DCLKDIV=2
D2DCLKDIV=1
(fBUS)
fD2D / MHz
Divider for(83)
D2DFCLK=512kHz
Table 70. Recommended Clock Settings
54
53;54
52
51;52
50
49;50
48
47;48
46
45;46
44
43;44
42
41;42
40
39;40
48
47;48
36
35;36
34
33;34
32
31;32
30
29;30
28
27;28
26
25;26
24
23;24
22
21;22
20
19;20
18
17;18
16
15;16
14
13;14
12
11;12
10
9;10
8
7;8
6
5;6
4
4
Notes
83.For D2DCLKDIV=1
5.2.6
System Resets
To guarantee safe operation, several RESET sources have been implemented in the MM912_637 device. Both the MCU and the
analog die are designed to initiate reset events on internal sources and the MCU is capable of being reset by external events
including the analog die reset output. The analog die is capable of being reset by the MCU in stop and cranking mode only.
5.2.6.1
Device Reset Overview
The MM912_637 reset concept includes two external reset signals, RESET (MCU) and RESET_A (analog Die). Figure 26
illustrates the general configuration.
MM912_637, Rev. 3.0
Freescale Semiconductor
77
RESET
RESET_A
Analog Die - Power, Clock and Resets - PCR
Reset Module
Low Voltage
Reset (LVR)
Reset Module
Power-On Reset
(POR)
External pin
RESET
Illegal Address
Reset
Clock monitor
reset
Hardware Reset
Watchdog Reset
Low Voltage
Reset
Thermal
Shutdown Reset
COP watchdog
reset
MCU
Analog Die
Figure 26. Device Reset Overview
Both RESET and RESET_A signals are low active I/Os, based on the 5.0 V supply (VDDRX for RESET and VDDX for
RESET_A).
5.2.6.2
Analog Die Reset Implementation
There are 7 internal reset sources implemented in the analog die of the MM912_637 that causing the internal analog die status
to be reset to default (Internal analog RST), and to trigger an external reset, activating the RESET_A pin. In addition, during stop
and cranking mode, an external reset at the RESET_A pin will also reset the analog die.
VDDLR
VDDHR
1
RESET_A
0
0
1
WDR
16
LP
HWR
LPM
Cranking
Mode
TSDR
VDDXR
VDDAR
1
0
Measure
during LPM
LPM = Low Power Mode
Figure 27. Analog Die Reset Implementation
MM912_637, Rev. 3.0
Freescale Semiconductor
78
With the exception of the WDR, HWR, and TSDR, the RESET_A pin is driven active as long the condition is pending. The WDR,
HWR, and TSDR will issue a 2 x LPCLK cycle active at the pin. During cranking mode(84), only the VDDLR is active. During Low
Power modes, only VDDXR and VDDAR are active reset sources. VDDAR is only active during active measurement in LPM.
VDDXR and VDDAR are not active in Normal mode.
Notes
84.Not available on all device derivatives
5.2.6.3
•
•
•
•
•
Reset Source Summary
HWR - Hardware Reset
— Forced internal reset caused by writing the HWR bin in the PCR_CTL register. The source will be indicated by the
HWRF bit.
WDR - Watchdog Reset
— Window watchdog failure. The source will be indicated by the WDRF bit.
LVR - Low Voltage Reset
— The Voltage at the VDDL, VDDH, VDDX, or VDDA has dropped below its reset threshold level. The source will be
indicated for the VDDL by the LVRF + HVRF, for the VDDA by the AVRF, and for the VDDH by the HVRF bit. VDDX
resets are not indicated via individual reset flags. See Figure 27 for dependencies.
TSDR - Temperature Shutdown Reset
— The critical shutdown temperature threshold has been reached. VDDA, VDDX, and VDDH will be disabled as long
as the over-temperature condition is pending(85) and the reset source is indicated by the HTF bit.
External Reset
— During stop and cranking(85) mode, a low signal at the RESET_A pin will reset the analog die. Since this condition
can only be initiated by the microcontroller, no specific indicator flag is implemented.
Notes
85.Resulting in a VDDH Low Voltage Reset taking over the reset after the 2 LPCLK reset pulse
TSDR
HTF
WDR
WDRF
HWR
HWRF
VDDHR
HVRF
VDDLR
LVRF
VDDAR
AVRF
VDDXR
No Flag Indicator
Figure 28. Reset Status Information
5.2.7
5.2.7.1
PCR - Memory Map and Registers
Overview
This section provides a detailed description of the memory map and registers.
5.2.7.2
Module Memory Map
The memory map for the Analog Die - Power, Clock and Resets - PCR module is given in Table 71
MM912_637, Rev. 3.0
Freescale Semiconductor
79
Table 71. Module Memory Map
Offset
(86),(87)
0x00
Name
PCR_CTL
PCR Control Register
7
6
5
4
3
2
1
0
R
0
0
0
0
0
0
0
0
W
HTIEM
UVIEM
HWRM
0
0
0
HWR
0
HWRF
WDRF
R
HTIE
UVIE
W
PCR_SR (hi)
R
PCR Status Register
W
HTF
UVF
PFM[1:0]
OPMM[1:0]
PF[1:0]
OPM[1:0]
HVRF
LVRF
WULTCF
WLPMF
0x02
PCR_SR (lo)
R
PCR Status Register
W
0x03
Write 1 will clear the flags
WUAHTH
F
WUCTHF
WUCALF
WULINF
WUPTB3F WUPTB2F WUPTB1F WUPTB0F
Write 1 will clear the flags
R
0x04
PCR_PRESC
PCR 1.0 ms prescaler
W
PRESC[15:0]
R
W
PCR_WUE (hi)
R
Wake-up Enable Register
W
0x06
WUAHTH
PCR_WUE (lo)
R
Wake-up Enable Register
W
0x07
0x0E
0x0F
WUCTH
WUCAL
WULIN
WUPTB3
WUPTB2
WUPTB1
WUPTB0
0
0
0
0
0
0
0
0
0
WULTC
TRIM_ALF (hi)
R
Trim for accurate 1.0 ms low freq
clock
W
TRIM_ALF (lo)
R
Trim for accurate 1.0 ms low freq
clock
W
PRDF
APRESC[12:8]
APRESC[7:0]
Notes
86.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
87.Register Offset with the “lo” address value not shown have to be accessed in 16-Bit mode. 8-Bit access will not function.
5.2.7.3
Register Descriptions
This section consists of register descriptions in address order. Each description includes a standard register diagram with an
associated figure number. Details of register bit and field function follow the register diagrams, in bit order.
MM912_637, Rev. 3.0
Freescale Semiconductor
80
5.2.7.3.1
PCR Control Register (PCR_CTL)
Table 72. PCR Control Register (PCR_CTL)
Offset
0x00
(88), (89)
15
14
Access: User read/write
13
12
11
0
10
9
0
0
8
R
0
0
0
0
W
HTIEM
UVIEM
HWRM
0
Reset
0
0
0
0
0
0
0
0
7
6
5
4
3
2
1
0
HTIE
UVIE
0
0
R
W
Reset
0
0
HWR
0
0
0
PFM[1:0]
PF[1:0]
0
0
OPMM[1:0]
OPM[1:0]
0
0
0
Notes
88.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
89.Register Offset with the “lo” address value not shown have to be accessed in 16-Bit mode. 8-Bit access will not function.
Table 73. PCR Control Register (PCR_CTL) - Register Field Descriptions
Field
15
HTIEM
14
UVIEM
13
HWRM
12
Description
High temperature interrupt enable mask
0 - writing the HTIE bit will have no effect
1 - writing the HTIE bit will be effective
Supply under-voltage interrupt enable mask
0 - writing the UVIE bit will have no effect
1 - writing the UVIE bit will be effective
Hardware reset mask
0 - writing the HWR bit will have no effect
1 - writing the HWR bit will be effective
Reserved. Must remain “0”
Reserved
11-10
PFM[1:0]
9-8
OPMM[1:0]
7
HTIE
6
UVIE
5
HWR
4
Prescaler factor mask
00,01,10 - writing the PF bits will have no effect
1 - writing the PF bits will be effective
Operation mode mask
00,01,10 - writing the OPM bits will have no effect
11 - writing the OPM bits will be effective
High Temperature Interrupt enable. Writing only effective with corresponding mask bit HTIEM set.
0 - High temperature interrupt (HTI) enabled
1 - High temperature interrupt (HTI) disabled
Low supply voltage interrupt enable. Writing only effective with corresponding mask bit UVIEM set.
0 - Low supply voltage interrupt (UVI) enabled
1 - Low supply voltage interrupt (UVI) disabled
Hardware Reset. Writing only effective with corresponding mask bit HWRM set. Write only.
0 - No effect
1 - All analog die digital logic is reset and external reset (RESET_A) is set to reset the MCU.
Reserved. Must remain “0”
Reserved
MM912_637, Rev. 3.0
Freescale Semiconductor
81
Table 73. PCR Control Register (PCR_CTL) - Register Field Descriptions
Field
Description
1.0 ms Prescaler. Writing only effective with corresponding mask bits PFM set to 11.
00 - 1
01 - 2
10 - 4
11 - 8
3-2
PF[1:0]
1-0
OPM[1:0]
5.2.7.3.2
Operation mode select. Writing only effective with “11” mask bits OPMM set to 11.
00 - Normal mode
01 - Stop mode
10 - Sleep mode
11 with Cranking feature disabled - same effect as 01 (STOP mode)
11 with Cranking feature enabled - Cranking mode
PCR Status Register (PCR_SR (hi))
Table 74. PCR Status Register (PCR_SR (hi))
(90)
Offset
R
0x02
Access: User read/write
7
6
5
4
3
2
1
0
HTF
UVF
HWRF
WDRF
HVRF
LVRF
WULTCF
WLPMF
0
0
0
Write 1 will clear the flags(91)
W
Reset
0
0
0
0
0
Notes
90.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
91.HTF and UVF represent the current status and cannot be cleared. Writing 1 to HTF / UVF will clear the Interrupt flag in the Interrupt Source
Register and Interrupt Vector Register instead.
Table 75. PCR Status Register (PCR_SR (hi)) - Register Field Descriptions
Field
7
HTF
6
UVF
5
HWRF
4
WDRF
3
HVRF
2
LVRF
Description
High Temperature Condition Flag. This bit is set once a temperature warning is detected, or the last reset being caused by a
temperature shutdown event (TSDR). Writing HTF=1 will clear the flag and the interrupt flag in the Interrupt Source Register
and Interrupt Vector Register, if the condition is gone.
0 - No High Temperature condition detected.
1 - High Temperature condition detected or last reset = TSDR.
Supply Under-voltage Condition Flag. This bit is set once a under-voltage warning is detected. Writing UVF=1 will clear the
flag and the Interrupt flag in the Interrupt Source Register and Interrupt Vector Register, if the condition is gone (UVF=0).
0 - No under-voltage condition detected.
1 - Under-voltage condition detected.
Hardware Reset Flag. Writing this bit to logic 1 will clear the flag.
0 - n.a.
1 - Last reset was caused by a HWR command.
Watchdog Reset Flag. Writing this bit to logic 1 will clear the flag.
0 - n.a.
1 - Last reset was caused by the analog die window watchdog.
VDDH Low Voltage Reset Flag. Writing this bit to logic 1 will clear the flag.
0 - n.a.
1 - Last reset was caused by a low voltage condition at the VDDH regulator. (LVRF = 0)
1 - Last reset was caused by a low voltage condition at the VDDL regulator. (LVRF = 1)
VDDL Low Voltage (POR) Reset Flag. Writing this bit to logic 1 will clear the flag.
0 - n.a.
1 - Last reset was caused by a low voltage condition at the VDDL regulator. (Power on Reset - POR)
MM912_637, Rev. 3.0
Freescale Semiconductor
82
Table 75. PCR Status Register (PCR_SR (hi)) - Register Field Descriptions
Field
Description
Life Time Counter Wake-up Flag. Writing this bit to logic 1 will clear the flag.
0 - n.a.
1 - Last Wake-up was caused by a life time counter overflow
1
WULTCF
Wake-up after Low Power Mode Flag. Writing this bit to logic 1 will clear the flag.
0 - n.a.
1 - Indicates wake-up after Low Power mode.
0
WLPMF
5.2.7.3.3
PCR Status Register (PCR_SR (lo))
Table 76. PCR Status Register (PCR_SR (lo))
Offset(92)
0x03
R
Access: User read/write
7
6
5
4
3
2
1
0
WUAHTHF
WUCTHF
WUCALF
WULINF
WUPTB3F
WUPTB2F
WUPTB1F
WUPTB0F
0
0
0
W
Reset
Write 1 will clear the flags
0
0
0
0
0
Notes
92.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 77. PCR Status Register (PCR_SR (lo)) - Register Field Descriptions
Field
7
WUAHTHF
6
WUCTHF
5
WUCALF
4
WULINF
3
WUPTB3F
2
WUPTB2F
1
WUPTB1F
0
WUPTB0F
Description
Wake-up on Ah counter threshold Flag. Writing this bit to logic 1 will clear the flag.
0 - n.a.
1 - Indicates wake-up after Ah counter threshold reached.
Wake-up on current threshold Flag. Writing this bit to logic 1 will clear the flag.
0 - n.a.
1 - Indicates wake-up after current threshold reached.
Wake-up on calibration request flag. Writing this bit to logic 1 will clear the flag.
0 - n.a.
1 - Indicates wake-up after calibration request.
Wake-up on LIN flag. Writing this bit to logic 1 will clear the flag.
0 - n.a.
1 - Indicates wake-up after LIN wake-up detected
Wake-up on GPIO 3 event (L0 external wake-up) flag. Writing this bit to logic 1 will clear the flag.
0 - n.a.
1 - Indicates wake-up after GPIO 3 event
Wake-up on GPIO 2 event (TIMER output compare) flag. Writing this bit to logic 1 will clear the flag.
0 - n.a.
1 - Indicates wake-up after GPIO 2 event
Wake-up on GPIO 1 event (TIMER output compare) flag. Writing this bit to logic 1 will clear the flag.
0 - n.a.
1 - Indicates wake-up after GPIO 1 event
Wake-up on GPIO 0 event (TIMER output compare) flag. Writing this bit to logic 1 will clear the flag.
0 - n.a.
1 - Indicates wake-up after GPIO 0 event
MM912_637, Rev. 3.0
Freescale Semiconductor
83
5.2.7.3.4
PCR 1.0 ms Prescaler (PCR_PRESC)
Table 78. PCR 1.0 ms Prescaler (PCR_PRESC)
Offset
0x04
Access: User read/write
(93),(94)
15
14
13
12
R
11
10
9
8
PRESC[15:8]
W
Reset
0
1
1
1
1
1
0
1
7
6
5
4
3
2
1
0
0
0
0
0
R
PRESC[7:0]
W
Reset
0
0
0
0
Notes
93.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
94.This Register is 16 Bit access only.
Table 79. PCR 1.0 ms Prescaler (PCR_PRESC) - Register Field Descriptions
Field
Description
15-0
PRESC[15:0]
5.2.7.3.5
1.0 ms Prescaler, used to derive D2DSCLK and D2DFCLK from the D2DCLK signal. See 5.2.5, “Device Clock Tree" for
details.
Wake-up Enable Register (PCR_WUE (hi))
Table 80. Wake-up Enable Register (PCR_WUE (hi))
Offset(95)
0x06
R
W
Reset
Access: User read/write
7
6
5
4
3
2
1
0
WUAHTH
WUCTH
WUCAL
WULIN
WUPTB3
WUPTB2
WUPTB1
WUPTB0
0
0
0
0
0
0
0
0
Notes
95.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 81. Wake-up Enable Register (PCR_WUE (hi)) - Register Field Descriptions
Field
7
WUAHTH
6
WUCTH
5
WUCAL
4
WULIN
3
WUPTB3
Description
0 - Wake-up on Ah counter disabled
1 - Wake-up on Ah counter enabled
0 - Wake-up on current threshold disabled
1 - Wake-up on current threshold enabled
0 - Wake-up on calibration request disabled
1 - Wake-up on calibration request enabled
0 - Wake-up on LIN disabled
1 - Wake-up on LIN enabled
0 - Wake-up on GPIO 3 event disabled
1 - Wake-up on GPIO 3 event enabled
MM912_637, Rev. 3.0
Freescale Semiconductor
84
Table 81. Wake-up Enable Register (PCR_WUE (hi)) - Register Field Descriptions
Field
Description
2
0 - Wake-up on GPIO 2 event disabled
1 - Wake-up on GPIO 2 event enabled
WUPTB2
1
0 - Wake-up on GPIO 1 event disabled
1 - Wake-up on GPIO 1 event enabled
WUPTB1
0
0 - Wake-up on GPIO 0 event disabled
1 - Wake-up on GPIO 0 event enabled
WUPTB0
5.2.7.3.6
Wake-up Enable Register (PCR_WUE (lo))
Table 82. Wake-up Enable Register (PCR_WUE (lo))
Offset(96) 0x07
Access: User read/write
7
R
WULTC
W
Reset
0
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Notes
96.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 83. Wake-up Enable Register (PCR_WUE (lo)) - Register Field Descriptions
Field
Description
7
0 - Wake-up on Life Timer Counter Overflow disabled
1 - Wake-up on Life Timer Counter Overflow enabled
WULTC
5.2.7.3.7
Trim for accurate 1ms low freq clock (TRIM_ALF (hi))
Table 84. Trim for accurate 1ms low freq clock (TRIM_ALF (hi))
Offset(97)
0x0E
R
Access: User read
15
14
13
PRDF
0
0
12
11
10
9
8
APRESC[12:8]
W
Notes
97.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
5.2.7.3.8
Trim for Accurate 1.0 ms Low Freq Clock (TRIM_ALF (lo))
Table 85. Trim for Accurate 1.0 ms Low Freq Clock (TRIM_ALF (lo))
Offset(98) 0x0F
Access: User read
7
R
6
5
4
3
2
1
0
APRESC[7:0]
W
Notes
98.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
MM912_637, Rev. 3.0
Freescale Semiconductor
85
Table 86. Trim for Accurate 1.0 ms Low Freq Clock (TRIM_ALF (lo)) - Register Field Descriptions
Field
15
PRDF
12-0
APRESC[12:0]
Description
ALFCLK Prescaler ready Flag
0 - The ALFCLK synchronization after power up or PRESC[15:0] / PF[1:0] change is not completed.
1 - The ALFCLK synchronization is complete. The ALFCLK signal is synchronized to the D2DCLK.
ALFCLK Prescaler
This read only value represents the current ALFCLK prescaler value. With the synchronization complete (PRDF=1), the
prescaler is used to create the calibrated clock for the Life Time Counter (Normal mode and Low Power mode), and Timer
and Current trigger (Low Power Mode only), based on the low power oscillator.
After Power Up, the APRESC register is reset to 0x0200 (512dec) until the first synchronization is complete. This will
initialize the ALFCLK to 1.0 kHz.
MM912_637, Rev. 3.0
Freescale Semiconductor
86
Interrupt Module - IRQ
5.3
Interrupt Module - IRQ
MCU
5.3.1
ANALOG
Introduction
Several interrupt sources are implemented on the analog die to indicate important system conditions. Those Interrupt events are
signalized via the D2DINT signal to the microcontroller. See Section 5.17, “MCU - Interrupt Module (S12SINTV1)".
5.3.2
Interrupt Source Identification
Once an Interrupt is signalized, there are two options to identify the corresponding source(s).
NOTE
The following Interrupt source registers (Interrupt Source Mirror and Interrupt Vector
Emulation by Priority) are indicators only. After identifying the interrupt source, the
acknowledgement of the interrupt has to be performed in the corresponding block.
5.3.2.1
Interrupt Source Mirror
All Interrupt sources in the MM912_637 analog die are mirrored to a special Interrupt Source Register (INT_SRC). This register
is read only and will indicate all currently pending Interrupts. Reading this register will not acknowledge any interrupt. An
additional D2D access is necessary to serve the specific module.
5.3.2.2
Interrupt Vector Emulation by Priority
To allow a vector based interrupt handling by the MCU, the number of the highest prioritized interrupt pending is returned in the
Interrupt Vector Register (INT_VECT). Reading this register will not acknowledge an interrupt. An additional D2D access is
necessary to serve the specific module.
5.3.3
Interrupt Global Mask
The Global Interrupt mask registers INT_MSK (hi) and INT_MSK (lo) are implemented to allow a global enable / disable of all
analog die Interrupt sources. The individual blocks mask registers should be used to control the individual sources.
5.3.4
Interrupt Sources
The following Interrupt sources are implemented on the analog die.
Table 87. Interrupt Sources
IRQ
Description
UVI
Under-voltage Interrupt (or wake-up from Cranking mode)
HTI
High Temperature Interrupt
LTI
LIN Driver Over-temperature Interrupt
CH0
TIM Channel 0 Interrupt
CH1
TIM Channel 1 Interrupt
CH2
TIM Channel 2 Interrupt
CH3
TIM Channel 3 Interrupt
TOV
TIM Timer Overflow Interrupt
ERR
SCI Error Interrupt
TX
SCI Transmit Interrupt
RX
SCI Receive Interrupt
MM912_637, Rev. 3.0
Freescale Semiconductor
87
Interrupt Module - IRQ
Table 87. Interrupt Sources
IRQ
CVMI
5.3.4.1
Description
Current / Voltage Measurement Interrupt
LTC
Lifetime Counter Interrupt
CAL
Calibration Request Interrupt
Under-voltage Interrupt (UVI)
This maskable interrupt signalizes a under-voltage condition on the VSUP supply input.
Acknowledge the interrupt by writing a 1 into the UVF Bit in the PCR Status Register (PCR_SR (hi)). The flag cannot be cleared
as long as the condition is present. To issue a new interrupt, the condition has to vanish and occur again. The UVF Bit represents
the current condition, and might not be set after an interrupt was signalized by the interrupt source registers.
See Section 5.2, “Analog Die - Power, Clock and Resets - PCR" for details on the PCR Status Register (PCR_SR (hi)), including
masking information.
NOTE
The under-voltage interrupt is not active in devices with the Cranking mode enabled. For
those devices, the under-voltage threshold is used to enable the high precision low voltage
threshold during Stop/Sleep mode.
Once the device wakes up from cranking mode, the UVI flag is indicating the wake-up
source.
5.3.4.2
High Temperature Interrupt (HTI)
This maskable interrupt signalizes a high temperature condition on the analog die. The sensing element is located close to the
major thermal contributors, the system voltage regulators.
Acknowledge the interrupt by writing a 1 into the HTF Bit in the PCR Status Register (PCR_SR (hi)). The flag cannot be cleared
as long as the condition is present. To issue a new interrupt, the condition has to vanish and occur again. The HTF Bit represents
the current condition and might not be set after an interrupt was signalized by the interrupt source registers.
See Section 5.2, “Analog Die - Power, Clock and Resets - PCR" for details on the PCR Status Register (PCR_SR (hi)), including
masking information.
5.3.4.3
LIN Driver Over-temperature Interrupt (LTI)
Acknowledge the interrupt by reading the LIN Register - LINR. The flag cannot be cleared as long as the condition is present. To
issue a new interrupt, the condition has to vanish and occur again. See Section 5.11, “LIN" for details on the LIN Register,
including masking information.
5.3.4.4
TIM Channel 0 Interrupt (CH0)
See Section 5.9, “Basic Timer Module - TIM (TIM16B4C)".
5.3.4.5
TIM Channel 1 Interrupt (CH1)
See Section 5.9, “Basic Timer Module - TIM (TIM16B4C)".
5.3.4.6
TIM Channel 2 Interrupt (CH2)
See Section 5.9, “Basic Timer Module - TIM (TIM16B4C)".
MM912_637, Rev. 3.0
Freescale Semiconductor
88
Interrupt Module - IRQ
5.3.4.7
TIM Channel 3 Interrupt (CH3)
See Section 5.9, “Basic Timer Module - TIM (TIM16B4C)".
5.3.4.8
TIM Timer Overflow Interrupt (TOV)
See Section 5.9, “Basic Timer Module - TIM (TIM16B4C)".
5.3.4.9
SCI Error Interrupt (ERR)
See Section 5.12, “Serial Communication Interface (S08SCIV4)".
5.3.4.10
SCI Transmit Interrupt (TX)
See Section 5.12, “Serial Communication Interface (S08SCIV4)".
5.3.4.11
SCI Receive Interrupt (RX)
See Section 5.12, “Serial Communication Interface (S08SCIV4)".
5.3.4.12
Current / Voltage Measurement Interrupt (CVMI)
Indicates the current or voltage measurement finished (VM or CM bit set). See Section 5.7, “Channel Acquisition".
5.3.4.13
Life Time Counter Interrupt (LTC)
In case a Life Time Counter overflow occurs with the corresponding interrupt enabled, the LTC interrupt is issued. See
Section 5.13, “Life Time Counter (LTC)".
5.3.4.14
Calibration Request Interrupt (CAL)
Once a request for re-calibration is present (Temperature out of pre-set range), the Calibration Interrupt is issued. See full
documentation on the interrupt source inSection 5.7, “Channel Acquisition".
5.3.5
5.3.5.1
IRQ - Memory Map and Registers
Overview
This section provides a detailed description of the memory map and registers.
5.3.5.2
Module Memory Map
The memory map for the IRQ module is given in Table 88
Table 88. Module Memory Map
Offset(99)
0x08
0x09
0x0A
Name
7
INT_SRC (hi)
R
Interrupt source register
W
INT_SRC (lo)
R
Interrupt source register
W
INT_VECT
R
Interrupt vector register
W
6
5
4
3
2
1
0
TOV
CH3
CH2
CH1
CH0
LTI
HTI
UVI
0
0
CAL
LTC
CVMI
RX
TX
ERR
0
0
0
0
IRQ[3:0]
MM912_637, Rev. 3.0
Freescale Semiconductor
89
Interrupt Module - IRQ
Table 88. Module Memory Map
Offset(99)
Name
7
0x0B
R
Reserved
0x0C
0x0D
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
TOVM
CH3M
CH2M
CH1M
CH0M
LTIM
HTIM
UVIM
0
0
CALM
LTCM
CVMM
RXM
TXM
ERRM
W
INT_MSK (hi)
R
Interrupt mask register
W
INT_MSK (lo)
R
Interrupt mask register
W
Notes
99.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
5.3.5.3
Register Descriptions
This section consists of register descriptions in address order. Each description includes a standard register diagram with an
associated figure number. Details of register bit and field function follow the register diagrams, in bit order.
5.3.5.3.1
Interrupt Source Register (INT_SRC (hi))
Table 89. Interrupt Source Register (INT_SRC (hi))
Offset(100
0x08
Access: User read
)
R
7
6
5
4
3
2
1
0
TOV
CH3
CH2
CH1
CH0
LTI
HTI
UVI
W
Notes
100.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 90. Interrupt Source Register (INT_SRC (hi)) - Register Field Descriptions
Field
7
TOV
6
CH3
5
CH2
4
CH1
3
CH0
2
LTI
Description
TIM16B4C - Timer overflow interrupt status
0 - No timer overflow interrupt pending
1 - Timer overflow interrupt pending
TIM16B4C - TIM channel 3 interrupt status
0 - No channel 3 interrupt pending
1 - Channel 3 interrupt pending
TIM16B4C - TIM channel 2 interrupt status
0 - No channel 2 interrupt pending
1 - Channel 2 interrupt pending
TIM16B4C - TIM channel 1 interrupt status
0 - No channel 1 interrupt pending
1 - Channel 1 interrupt pending
TIM16B4C - TIM channel 0 interrupt status
0 - No channel 0 interrupt pending
1 - Channel 0 interrupt pending
LIN Driver over-temperature interrupt status
0 - No LIN driver over-temperature interrupt
1 - LIN driver over-temperature interrupt
MM912_637, Rev. 3.0
Freescale Semiconductor
90
Interrupt Module - IRQ
Table 90. Interrupt Source Register (INT_SRC (hi)) - Register Field Descriptions
Field
Description
High temperature interrupt status
0 - No high temperature interrupt pending
1 - High temperature interrupt pending
1
HTI
Under-voltage interrupt pending or wake-up from Cranking mode status
0 - No under-voltage Interrupt pending or wake-up from Cranking mode
1 - Under-voltage interrupt pending or wake-up from Cranking mode
0
UVI
5.3.5.3.2
Interrupt Source Register (INT_SRC (lo))
Table 91. Interrupt Source Register (INT_SRC (lo))
Offset(101
0x09
Access: User read
)
R
7
6
5
4
3
2
1
0
0
0
CAL
LTC
CVMI
RX
TX
ERR
W
Notes
101.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 92. Interrupt Source Register (INT_SRC (lo)) - Register Field Descriptions
Field
5
CAL
4
LTC
3
CVMI
2
RX
1
TX
0
ERR
Description
Calibration request interrupt status
0 - No calibration request interrupt pending
1 - Calibration request interrupt pending
Life time counter interrupt status
0 - No life time counter interrupt pending
1 - Life time counter interrupt pending
Current / Voltage measurement interrupt status
0 - No Current / Voltage measurement interrupt pending
1 - Current / Voltage measurement interrupt pending
SCI receive interrupt status
0 - No SCI receive interrupt pending
1 - SCI receive interrupt pending
SCI transmit interrupt status
0 - No SCI transmit interrupt pending
1 - SCI transmit interrupt pending
SCI error interrupt status
0 - No SCI transmit interrupt pending
1 - SCI transmit interrupt pending
MM912_637, Rev. 3.0
Freescale Semiconductor
91
Interrupt Module - IRQ
5.3.5.3.3
Interrupt Vector Register (INT_VECT)
Table 93. Interrupt Vector Register (INT_VECT)
Offset(102
0x0A
Access: User read
)
R
7
6
5
4
0
0
0
0
3
2
1
0
IRQ
W
Notes
102.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 94. Interrupt Vector Register (INT_VECT) - Register Field Descriptions
Field
Description
4-0
Represents the highest prioritized interrupt pending. See Table 95. If no interrupt is pending, the result will be 0.
IRQ
Table 95. Interrupt Vector / Priority
IRQ
Description
-
IRQ
Priority
No interrupt pending or wake-up from Stop mode
0x00
-
UVI
Under-voltage interrupt or wake-up from Cranking mode
0x01
1 (highest)
HTI
High temperature interrupt
0x02
2
LTI
LIN driver over-temperature interrupt
0x03
3
CH0
TIM channel 0 interrupt
0x04
4
CH1
TIM channel 1 interrupt
0x05
5
CH2
TIM channel 2 interrupt
0x06
6
CH3
TIM channel 3 interrupt
0x07
7
TOV
TIM timer overflow interrupt
0x08
8
ERR
SCI error interrupt
0x09
9
TX
SCI transmit interrupt
0x0A
10
RX
SCI receive interrupt
0x0B
11
CVMI
Acquisition interrupt
0x0C
12
LTC
Life time counter interrupt
0x0D
13
CAL
Calibration request interrupt
0x0E
14 (lowest)
5.3.5.3.4
Interrupt Mask Register (INT_MSK (hi))
Table 96. Interrupt Mask Register (INT_MSK (hi))
(103
Offset
0x0C
Access: User read/write
)
R
W
Reset
7
6
5
4
3
2
1
0
TOVM
CH3M
CH2M
CH1M
CH0M
LTIM
HTIM
UVIM
0
0
0
0
0
0
0
0
Notes
103.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
MM912_637, Rev. 3.0
Freescale Semiconductor
92
Table 97. Interrupt Mask Register (INT_MSK (hi)) - Register Field Descriptions
Field
7
TOVM
6
CH3M
5
CH2M
4
CH1M
3
CH0M
2
LTIM
1
HTIM
0
UVIM
Description
Timer overflow interrupt mask
0 - Interrupt enabled
1 - Interrupt disabled
Timer channel 3 interrupt mask
0 - Interrupt enabled
1 - Interrupt disabled
Timer channel 2 interrupt mask
0 - Interrupt enabled
1 - Interrupt disabled
Timer channel 1 interrupt mask
0 - Interrupt enabled
1 - Interrupt disabled
Timer channel 1 interrupt mask
0 - Interrupt enabled
1 - Interrupt disabled
LIN driver over-temperature interrupt mask
0 - Interrupt enabled
1 - Interrupt disabled
High temperature interrupt mask
0 - Interrupt enabled
1 - Interrupt disabled
Under-voltage interrupt mask
0 - Interrupt enabled
1 - Interrupt disabled
5.3.5.3.5
Interrupt Mask Register (INT_MSK (lo))
Table 98. Interrupt mask register (INT_MSK (lo))
Offset(104) 0x0D
R
Access: User read/write
7
6
0
0
0
0
W
Reset
5
4
3
2
1
0
CALM
LTCM
CVMM
RXM
TXM
ERRM
0
0
0
0
0
0
Notes
104.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 99. Interrupt Mask Register (INT_MSK (lo)) - Register Field Descriptions
Field
5
CALM
4
LTCM
3
CVMM
Description
Calibration request interrupt mask
0 - Interrupt enabled
1 - Interrupt disabled
Life time counter interrupt mask
0 - Interrupt enabled
1 - Interrupt disabled
Current / Voltage measurement interrupt mask
0 - Interrupt enabled
1 - Interrupt disabled
MM912_637, Rev. 3.0
Freescale Semiconductor
93
Table 99. Interrupt Mask Register (INT_MSK (lo)) - Register Field Descriptions
Field
2
RXM
1
TXM
0
ERRM
Description
SCI receive interrupt mask
0 - Interrupt enabled
1 - Interrupt disabled
SCI transmit interrupt mask
0 - Interrupt enabled
1 - Interrupt disabled
SCI error interrupt mask
0 - Interrupt enabled
1 - Interrupt disabled
MM912_637, Rev. 3.0
Freescale Semiconductor
94
Current Measurement - ISENSE
5.4
Current Measurement - ISENSE
MCU
5.4.1
ANALOG
Introduction
This chapter only gives a summary of the current sense module. Refer to Section 5.7, “Channel Acquisition" for the complete
description of all acquisition channels, including the current measurement channel.
5.4.1.1
•
•
•
•
•
•
•
•
•
•
•
Features
Dedicated 16 Bit Sigma Delta () ADC
Programmable Gain Amplifier (PGA) with 8 programmable gain factors
Gain Control Block (GCB) for automatic gain adjustment
Simultaneous Sampling with Voltage Channel
Programmable Gain and Offset Compensation
Optional Chopper Mode with moving average
SINC3 + IIR Stage
Calibration mode to compute compensation buffers
Programmable Low Pass Filter (LPF), configuration shared with the Voltage Measurement Channel
Optional Shunt resistor sensing feature
Triggered Sampling during Low Power Mode with programmable wake-up conditions
5.4.1.2
Block Diagram
PGA
Auto
Zero
Battery
Minus
Pole
ESD
Input
Swap
ISENSEL
RSHUNT
PGA
Compensation
Decimation
with IIR
LPF
24Bit
ESD
ISENSEH
Chassis
Ground
GCB
Vref
Digital Chopper
Figure 29. Current Measurement Channel
The battery current is measured by measuring the voltage drop VDROP over an external shunt resistor, connected to ISENSEH
and ISENSEL. VDROP, and is defined as the differential voltage between the ISENSEL and ISENSEH inputs
(VDROP=ISENSEL-ISENSEH). A positive voltage drop means a positive current is flowing, and vice versa.
If the GND pin of the module is connected to ISENSEH, the measured current includes the supply current of the MM912_637
(current flows back to negative battery pole). If the GND pin is connected to the ISENSEL input, the supply current of the
MM912_637 is not measured. However, the voltage at the ISENSEH input could go below GND (see max ratings). In this case,
the current measurement still functions as specified.
MM912_637, Rev. 3.0
Freescale Semiconductor
95
Voltage Measurement - VSENSE
5.5
Voltage Measurement - VSENSE
MCU
5.5.1
ANALOG
Introduction
This chapter only gives a summary of the voltage sense module. Refer to Section 5.7, “Channel Acquisition" for the complete
description of all acquisition channels, including the voltage measurement channel.
5.5.1.1
•
•
•
•
•
•
•
•
•
Dedicated 16 Bit Sigma Delta () ADC
Fixed High Precision Divider
Optional External Voltage Input “VOPT”
Simultaneous Sampling with Current Channel
Programmable Gain and Offset Compensation
Calibration mode to compute compensation buffers
Optional Chopper mode with moving average
SINC3 + IIR Stage
Programmable Low Pass Filter (LPF), Configuration shared with Current Measurement Channel
5.5.1.2
VOPT
Features
Block Diagram
Input
Swap
ESD
DIV28
MUX
Compensation
DIV28
VSENSE
Decimator
with IIR
LPF
16Bit
ESD
Vref
Digital Chopper
Figure 30. Voltage Measurement Channel
The battery voltage is measured by default, via the VSENSE input. A high precision divider stage scales down the battery voltage
by a fixed factor K =1/28, to a voltage below the internal reference voltage of the Sigma Delta ADC (VSENSE*K < VREF).
If an optional external voltage is measured, the multiplexer (MUX) is selected to feed the VOPT input to the buffer.
MM912_637, Rev. 3.0
Freescale Semiconductor
96
Temperature Measurement - TSENSE
5.6
Temperature Measurement - TSENSE
MCU
5.6.1
ANALOG
Introduction
This chapter only gives a summary of the temperature sense module. Refer to Section 5.7, “Channel Acquisition" for the complete
description of all acquisition channels, including the temperature measurement channel.
5.6.1.1
•
•
•
•
•
•
Features
Internal on chip Temperature Sensor
Optional External Temperature Sensor Input (VTEMP)
Dedicated 16-Bit Sigma Delta ADC
Programmable Gain and Offset Compensation
Optional External Sensor Supply (TSUP) with selectable capacitor
Optional Measurement during Low Power mode to trigger recalibration
5.6.1.2
Block Diagram
TSUP
internal
TempSense
R1
Input
Swap
TSUP
MUX
Compensation
Decimation
16Bit
VTEMP
ESD
CTSUP
RVTEMP
Vref
R2
Digital Chopper
AGND
Figure 31. Temperature Measurement Channel
NOTE
To minimize ground shift effects while using the external sensor option, R2 must be placed
as close to the AGND pin as possible.
CTSUP is optional. The supply output must be configured to operate with the capacitor.
MM912_637, Rev. 3.0
Freescale Semiconductor
97
Channel Acquisition
5.7
Channel Acquisition
MCU
5.7.1
ANALOG
Introduction
This chapter documents the current, voltage, and temperature acquisition flow. The chapter is structured in the following sections.
•
Section 5.7.2, “Channel Structure Overview"
•
Section 5.7.3, “Current and Voltage Measurement"
— Section 5.7.3.1, “Shunt Sense, PGA, and GCB (Current Channel only)"
— Section 5.7.3.2, “Voltage Sense Multiplexer (Voltage Channel only)"
— Section 5.7.3.3, “Sigma Delta Converter"
— Section 5.7.3.4, “Compensation"
— Section 5.7.3.5, “IIR / Decimation / Chopping Stage"
— Section 5.7.3.6, “Low Pass Filter"
— Section 5.7.3.7, “Format and Clamping"
•
Section 5.7.4, “Temperature Measurement Channel"
— Section 5.7.4.1, “Compensation"
•
Section 5.7.5, “Calibration"
•
Section 5.7.6, “Memory Map and Registers"
5.7.2
Channel Structure Overview
The MM912_637 offers three parallel measurement channels. Current, Voltage, and Temperature. The Voltage Channel is
shared between the VSENSE and VOPT voltage source, the Temperature channel between ETEMP and ITEMP.
I
PGA
V
T
SD
SD
SD
1
10
8
Gain
(IGCx)
Offset
(COC)
1
10
8
Gain
(VSGC)
Offset
(VOC)
1
SINC3
+IIR
SINC1
LPF
Format &
Clamp
SINC3
+IIR
SINC1
LPF
Format &
Clamp
SINC1
Format &
Clamp
SINC3
8
Gain
(ITGC/
ETGC)
24
16
16
8
Offset
(ITOC/
ETOC)
Figure 32. Simplified Measurement Channel
Figure 33 shows an overview of the detailed dependencies between the control and status registers and the channels. Refer to
the following sections of this chapter for details.
MM912_637, Rev. 3.0
Freescale Semiconductor
98
ESD
ESD
ESD
ESD
VOPT
VSENSE
VTEMP
TSUP
ESD
ISENSEH
ECAP(M)
Internal
TEMP
Sensor
DIAGI(M)
VMEN(M)
TSUP
ETEMP
ITEMP
OPTE(M)
DIV28
DIV28
PGAO(M)
PGAZ(M)
OPEN
OPENE(M)
Open
Test
PGAF(M)
R/W
R
R/W
R/W
R/W R/W R/W
R/W
ITMEN(M)
ETMEN(M)
PGA
Offset
Cal.
Cal Ref
Diag
R/W
PGAG
CDEN(M)
CADCG(M)
R
MUX
MUX
R/W R/W
Cal
Ref
ITCHOP(M)
ETCHOP(M)
TDEN(M)
TADCG(M)
DIAGV(M)
VDEN(M)
VADCG(M)
ZERO(M)
PGAOF
PGAOC4..512[10:0]
PGA
000
R
ESD
G
C
B
R/W
R/W R/W
D
Diag
ISENSEL
R/W
Chopper Control
ADC
Ref
Chopper Control
ADC Ref
1 Bit
R/W
00
200
80
80
Temperature Measurement Control
00
00
R/W
R/W R/W
ITCHOP
Voltage Measurement Control
00
R/W
R/W
Gain and Offset Compensation and Sinc 3 Filter
200
IIRC(M)[2:0]
DBT(M)[1:0]
SINC1
L=2
16 Bit
DEC[2:0]
R/W
SINC1
L=4
ITM
Calibration
Request
ITEMP[15:0]
SINC1
L=4
ETEMP[15:0]
ETM
TMF[2:0]
TCMIN[15:0]
TCMAX[15:0]
Format &
Clamp
Gain and Offset Compensation, Sinc 3 Filter, and IIR Filter Block
R/W
R/W
R/W
Gain and Offset Compensation, Sinc 3 Filter, and IIR Filter Block
R/W R/W
VCHOP
ETCHOP
1 Bit
CVCHOP(M)
R
1 Bit
R/W
R
R/W
Short
R/W
R/W
R/W R/W
R/W R/W
AGEN(M)
ITOC[7:0]
A7[15:0]
A6[15:0]
A5[15:0]
A4[15:0]
A3[15:0]
A2[15:0]
A1[15:0]
A0[15:0]
LPFEN(M)
0
1
R/W
LPF
R/W
24 Bit
16 Bit
PRESC[15:0]
PF[1:0]
Clock Control
BGCAL(M)[1:0]
BGLDO
BGADC[1:0]
VM
AHTH[30:0]
TCMP[15:0]
Low Power Current
measurement result
AHCR(M)
THF[7:0]
CTH[7:0]
AHC[31:0]
Current
Threshold
Wake Up
AH Threshold
Wake Up
Calibration
Wake Up
PRDF
AVRF
BGRF
BG1EN
BG2EN
BG3EN
=1
APRESC[12:0]
VMOW
VTH
VOLT[15:0]
=?
CMOW
CM
CURR[23:0]
BG Control
Format &
Clamp
0xDAC0
Format &
Clamp
R
Wake Up Control (low power mode only)
Cal
Ref
ADC
Ref
A15[15:0]
A14[15:0]
A13[15:0]
A12[15:0]
A11[15:0]
A10[15:0]
A9[15:0]
A8[15:0]
LPFC[3:0]
Calibration
Interrupt
CALF
LPF
R/W R/W R/W R/W R/W R/W R/W R/W
00B
041
0A4 0E3
0212
0812
1021
5
B
4
5
IGAIN[2:0]
ITGC[7:0]
R
ETGC[7:0]
R
VOC[7:0]
R/W
IGC4..512[9:0]
VSGC[9:0]
ETOC[7:0]
Short
Short
R/W R/W
COC4..512[7:0]
TCOMP(M)
R/W
R/W R/W
CCOMP(M)
VCOMP(M)
0A4
041
00B
0812
0212
4
B
5
10E
0E3
1021
4
5
CCHOP
0000 0000
R
R
CALIE(M)
Chopper Control
R
R
0000
W
R/W
R/W
R/W R/W R/W
R
R
R/W
R/W R/W R/W R/W R/W R/W R/W R/W
R
R
R
R/W
R/W
R
R
R/W
R
R
R
R
R
R
R
R
R/W R/W
R/W R/W
Current Measurement Control
0
1
CVMIE(M)
Freescale Semiconductor
R/W
CMEN(M)
CVMI
Interrupt
Channel Acquisition
Figure 33. Channel Complete Overview
MM912_637, Rev. 3.0
99
Channel Acquisition
5.7.3
Current and Voltage Measurement
To guarantee synchronous voltage and current acquisition, both channels are implemented equal in terms of digital signal
conditioning and timing. The analog signal conditioning, before the Sigma Delta Converter, is different to match the different
sources.
5.7.3.1
Shunt Sense, PGA, and GCB (Current Channel only)
Current Channel specific analog signal conditioning.
5.7.3.1.1
Shunt Sense
An optional current sense feature is implemented to sense the presence of the current shunt resistor. Setting the OPEN bit
(ACQ_CTL register), will activate the feature. The OPEN bit (ACQ_SR register) will indicate the shunt resistor open.
The sense feature will detect an open condition for a shunt resistance RSHUNT > ROPEN.
5.7.3.1.2
Programmable Gain Amplifier (PGA)
To allow a wide range of current levels to be measured, a programmable gain amplifier is implemented. Following the input
chopper (see Section 5.7.3.5, “IIR / Decimation / Chopping Stage"), the differential voltage is amplified by one of the 8 gains
controlled by the Gain Control Block.
The PGA has an internal offset compensation feature - see Section 5.7.4.1, “Compensation" and Section 5.7.5, “Calibration" for
details.
5.7.3.1.3
Gain Control Block (GCB)
To allow a transparent Gain adjustment with minimum MCU load, an automatic gain control has been implemented. The absolute
output of the PGA is constantly compared with a programmable up and down threshold (ACQ_GCB register). The threshold is a
D/A output according Table 100.
Table 100. Gain Control Block - Register
ACQ_GCB D[7:0]
GCB High (up) Threshold
ACQ_GCB D[7:0]
GCB Low (down) Threshold
0000xxxx
1/16 VREF
xxxx0000
0
0001xxxx
2/16 VREF
xxxx0001
1/16 VREF
0010xxxx
3/16 VREF
xxxx0010
2/16 VREF
0011xxxx
4/16 VREF
xxxx0011
3/16 VREF
0100xxxx
5/16 VREF
xxxx0100
4/16 VREF
0101xxxx
6/16 VREF
xxxx0101
5/16 VREF
0110xxxx
7/16 VREF
xxxx0110
6/16 VREF
0111xxxx
8/16 VREF
xxxx0111
7/16 VREF
1000xxxx
9/16 VREF
xxxx1000
8/16 VREF
1001xxxx
10/16 VREF
xxxx1001
9/16 VREF
1010xxxx
11/16 VREF
xxxx1010
10/16 VREF
1011xxxx
12/16 VREF
xxxx1011
11/16 VREF
1100xxxx
13/16 VREF
xxxx1100
12/16 VREF
1101xxxx
14/16 VREF
xxxx1101
13/16 VREF
1110xxxx
15/16 VREF
xxxx1110
14/16 VREF
1111xxxx
16/16 VREF
xxxx1111
15/16 VREF
Once the programmed threshold is reached, the gain is adjusted to the next level. The currently active gain setting can be read
in the IGAIN[2:0] register. Once the gain has been adjusted by the GCB, the PGAG bit will be set.
MM912_637, Rev. 3.0
Freescale Semiconductor
100
Channel Acquisition
The automatic Gain Control can be disabled by clearing the AGEN bit. In this case, writing the IGAIN[2:0] register will allow
manual gain control.
NOTE
The IGAIN[2:0] register content does determine the offset compensation register access, as
there are 8 individual offset register buffers implemented, accessed through the same
COC[7:0] register.
5.7.3.2
Voltage Sense Multiplexer (Voltage Channel only)
A multiplexer has been implemented to select between the VSENSE or VOPT voltage input. The OPTE bit controls the
multiplexer. Both input signals are divided by a fixed DIV28 divider.
NOTE
There is no further state machine separation of the two voltage channels. The software has
to assure all compensation registers are configured properly after changing the multiplexer.
Both voltage source conversion results will be stored in the same result register.
The divided and multiplexed voltages will be routed through the optional chopper (see Section 5.7.3.5, “IIR / Decimation /
Chopping Stage") before entering the Sigma Delta converter stage.
5.7.3.3
5.7.3.3.1
Sigma Delta Converter
Overview
A high resolution ADC is needed for current and battery voltage measurements of the MM912_637. A second order sigma delta
modulator based architecture is chosen.
5.7.3.4
Compensation
Following the optional chopper stage, the sigma delta bit stream is first gain and then offset compensated using the compensation
registers.
The compensation stages for both channels can be completely bypassed by clearing the CCOMP / VCOMP bits.
5.7.3.4.1
Gain Compensation
Table 101 shows the gain compensation register for the current and voltage channel. At system startup, the factory trimmed
values have to be copied into the VSGC and IGCx registers (see Section 6.2, “IFR Trimming Content and Location").
NOTE
There are 8 individual Gain compensation registers for the current measurement channels
different PGA gains with 8 individual gain trim values present in the IFR trimming flash.
Based on the voltage channel multiplexer configuration, a different trim gain compensation
value has to be used in the compensation register. The compensation register content has
to be updated when changing the multiplexer setting.
Table 101. Gain Compensation - Voltage and Current Channel
VSGC[9:0]
IGCx[9:0]
Voltage Channel Gain
Current Channel Gain
0x3FF
1.3174
1.7832
0x3FE
1.3169
1.7822
0x3FD
1.3164
1.7812
.
.
.
.
.
.
MM912_637, Rev. 3.0
Freescale Semiconductor
101
Channel Acquisition
Table 101. Gain Compensation - Voltage and Current Channel
5.7.3.4.2
VSGC[9:0]
IGCx[9:0]
Voltage Channel Gain
Current Channel Gain
0x203
1.0694
1.2872
0x202
1.0689
1.2862
0x201
1.0684
1.2852
0x200 (default)
1.0679
1.2842
0x1FF
1.0674
1.2832
0x1FE
1.0669
1.2822
0x1FD
1.0664
1.2812
.
.
.
.
.
.
0x002
0.8189
0.7862
0x001
0.8184
0.7852
0x000
0.8179
0.7842
Offset Compensation
Table 102 shows the offset compensation register for the current and voltage channel. At system startup, the factory trimmed
values have to be copied into the VOC and COC registers (see Section 6.2, “IFR Trimming Content and Location").
NOTE
Based on the voltage channel multiplexer and copper configuration, a different trim offset
compensation value has to be used in the compensation register. The compensation
register content has to be updated when changing the multiplexer setting.
While there is only one offset compensation register VOC[7:0] for the voltage channel, there
are 8 individual offset compensation registers for the current channel. The access happens
through the COC[7:0] register mapped, based on the IGAIN[2:0] register content.
Table 102. Offset Compensation - Voltage and Current Channel
VOC[7:0]
COC[7:0]
Voltage Channel
Offset(105)
Current Channel
Offset(105)
0x7F
+9.073
+15.092
0x7E
+9.002
+14.974
0x7D
+8.93
+14.855
.
.
.
.
.
.
0x03
0.214
+0.357
0x02
0.143
+0.238
0x01
0.071
+0.119
0x00 (default)
0
0
0xFF
-0.071
-0.119
0xFE
-0.143
-0.238
0xFD
-0.214
-0.357
.
.
.
.
.
.
0x82
-9.002
-14.974
0x81
-9.073
-15.092
MM912_637, Rev. 3.0
Freescale Semiconductor
102
Channel Acquisition
Table 102. Offset Compensation - Voltage and Current Channel
VOC[7:0]
COC[7:0]
Voltage Channel
Offset(105)
Current Channel
Offset(105)
0x80
-9.145
-15.211
Notes
105.SD input related (mV)
5.7.3.5
5.7.3.5.1
IIR / Decimation / Chopping Stage
Functional Description
The chopper frequency is set to one eighth of the decimator frequency (512 kHz typ). On each phase, four decimation cycles are
necessary to get a steady signal.
The equation of the IIR is yn+1=.xn+(1-).yn.
The  parameter can be configured by the IIRC[2:0] register. See Section 5.7.6.3.18, “I and V Chopper Control Register
(ACQ_CVCR (lo))".
The decimation process is then completed by a programmable (DEC[2:0]) sinc3 filter, which outputs a 0.5...8 kS/s signal. The
modulated noise is removed by an averaging filter (SINC1; L=4), which has an infinite rejection at the chopping frequency.
5.7.3.5.2
•
•
Latency and Throughput
The throughput is 512 kHz/DF with DF configurable from 64 to 1024.
The latency is given by (4+3*IIR+3*Avger+N_LPF)*DF/512 kHz where:
— IIR=1 if IIR is enabled (0 otherwise),
— Avger=1 if the chopper mode is activated (0 otherwise),
— N_LPF is the LPF coefficient number.
5.7.3.6
Low Pass Filter
To achieve the required attenuation of the measured voltage and current signals in the frequency domain, a programmable
low-pass filter following the SINC3+IIR filter, is implemented for both channels with shared configuration registers to deliver the
equivalent filtering.
The following filter characteristic is implemented:
•
FPASS = 100 Hz (Att100 Hz)
•
FSTOPP = 500 Hz (Att500 Hz)
The number of filter coefficients used can be programmed in the ACQ_LPFC[3:0] register. The filter can be bypassed completely
clearing the LPFEN bit.
The filter uses an algorithmic and logic unit (ALU) for calculating the filtered output data, depending on the incoming data stream
at “DATA IN” and the low-pass coefficients (A0...15) at the input “COEFF”, 16-bit width of each coefficient (See 5.7.6.3.22, “Low
Pass Filter Coefficient Ax (LPF_Ax (hi))"). The filter structure calculates during one cycle (Tcyc=1/Fadc) the filtered data output.
MM912_637, Rev. 3.0
Freescale Semiconductor
103
Channel Acquisition
Y(n)
+
+
+
a0
a1
a2
Z-1
Z-1
Z-1
Z-1
……
……
+
+
+
a13
a14
a15
Z-1
Z-1
……
Z-1
Z-1
Z-1
Z-1
X(n)
y(n) = a0.x(n)+a1.x(n-1)+a2.x(n-2)+a3.x(n-3)+a4.x(n-4)+a5.x(n-5)+a6.x(n-6)+a7.x(n-7)
+a8.x(n-8)+a9.x(n-9)+a10.x(n-10)+a11.x(n-11)+a12.x(n-12)+a13.x(n-13)+a14.x(n-14)+a15.x(n-15)
Figure 34. FIR Structure
Z-1 Unit delay is done at a programmable frequency, depending on the decimation factor programmed in the DEC[2:0] register.
See Table 120.
NOTE
There is no decimation from SINC3 to the LPF output, LPF uses same output rate than
decimator. It's therefore possible to select an output update rate independent of the filter
characteristic and bandwidth.
The coefficient vector consists of 16*16-bit elements and is free programmable, the maximum response time for 16 coefficients
structure is 16*1/output rate. The following filter function can be realized.
M
H LP ( z )   ai * z i
i 0
LP filter function
Eqn. 3
The coefficients aj are the elements of the coefficient vector and determine the filter function. M <= 16. It's possible to realize FIR
filter functions.
A typical total frequency response of the decimator and the programmable LP filter is given in Figure 35.
MM912_637, Rev. 3.0
Freescale Semiconductor
104
Channel Acquisition
0
0
20
40
Gto t ( f)
60
80
 100
1 00
10
10
1 10
1 00
f
3
1 1 0
4
1 0000
Figure 35. Typical Total Filter Response Sinc3 (D=128), LP Filter (FIR Type with 15 Coefficients Used)
5.7.3.7
Format and Clamping
The output data stream is formatted into its final size for both channels (16-Bit for Voltage and 24-Bit for Current).
The current result will contain the gain information as part of the result. See Section 5.7.6.3.12, “Current Measurement Result
(ACQ_CURR1 / ACQ_CURR0)" and Section 5.7.6.3.13, “Voltage Measurement Result (ACQ_VOLT)". Both results are written
into the corresponding result registers and will issue an IRQ if enabled.
The internal voltage measurement results (no compensation active) are clamped to maximum and minimum values of 0xFFFF
and 0x0000 respectively. Terminal voltages outside this range will result in the respective max or min clamped values.
The internal current measurement results (no compensation active) are clamped to maximum and minimum values of 0x0FFFF
and 0x10000 respectively. Terminal voltages outside this range will result in the respective max or min clamped values.
NOTE
Both channels will perform synchronized conversions when enabled with a single write to
the ACQ_CTL register.
As the voltage channel is not active during low power mode, the synchronicity might not be
given after wake-up, and has to be re-established by restarting both channels.
Entering low power mode with the current / temperature channel enabled will have the
channel(s) remain active during low power mode.
MM912_637, Rev. 3.0
Freescale Semiconductor
105
Channel Acquisition
5.7.4
Temperature Measurement Channel
The MM912_637 can measure the temperature from an internal built-in temperature sensor, or from an external temperature
sensor connected to the VTEMP pin. The external temperature sensor is supplied via the TSUP pin. The measurement channel
is the same for the internal and external temperature sensor.
The temperature measurement channel uses the same Sigma Delta (SD) converter implementation as the current and voltage
channel, followed by a fixed decimation (L=128).
A selectable chopper mode is implemented to compensate for offset errors. Once the chopper is enabled, an average (sinc1,
L=2) is active.
Once the measurement is enabled, the temperature result registers are updated with the channel update rate.
When both measurements are enabled, both temperature sensors are measured successively where the measurement is started
with the internal sensor.
The internal temperature measurement result (no compensation active) of 0x0000 represents 0K, the maximum 0xFFFF = 523K
(typ).
The result data is stored into the result registers ACQ_ITEMP and ACQ_ETEMP (both 16-bit).
During an over range event, the ADC is limited to the maximum value.
The result of the internal temperature measurement is utilized to generate the calibration request. See Section 5.7.5,
“Calibration".
5.7.4.1
Compensation
The compensation for the temperature channels is implemented similar to the current and voltage channel.
Table 103. Gain Compensation - Temperature Channel
ITGC[7:0]
ETGC[7:0]
Temperature Channel Gain Compensation
0xFF
1.124
0xFE
1.123
0xFD
1.122
.
.
.
.
0x83
1.003
0x82
1.002
0x81
1.001
0x80 (default)
1.000
0x7F
0.999
0x7E
0.998
0x7D
0.997
.
.
.
.
0x02
0.877
0x01
0.876
0x00
0.875
MM912_637, Rev. 3.0
Freescale Semiconductor
106
Channel Acquisition
Table 104. Offset Compensation - Temperature Channel(106)
ITOC[7:0]
ETOC[7:0]
Temperature Channel Offset
Compensation(107)
0x7F
+9.689
0x7E
+9.613
0x7D
+9.537
.
.
.
.
0x03
+0.229
0x02
+0.153
0x01
+0.076
0x00 (default)
0
0xFF
-0.076
0xFE
-0.153
0xFD
-0.229
.
.
.
.
0x82
-9.613
0x81
-9.689
0x80
-9.766
Notes
106.Typical values based on default gain setting
107.SD input related (mV)
NOTE
Factory trimmed compensation values are only available for the internal temperature
channel.
5.7.5
Calibration
To ensure the maximum precision of the current and voltage sense module, several stages of calibration are implemented to
compensate temperature effects. The calibration concept combines the availability of FLASH and the temperature information to
guarantee the measurement accuracy under all functional conditions.
The trimming and calibration procedures are split in three different categories: Power On-, Calibration Request-, and Optional
Verification Procedures.
5.7.5.1
System Power On Procedure
Several device parameters are guaranteed with full precision after system trimming only. During final test of the device, trim
values are computed, verified, and stored into the system FLASH memory.
To ensure optimum system performance, the following power on procedure has to be performed during power on. As the device
is typically constantly powered during its operation, this operation has to be performed typically one time only.
During a system power loss or low power reset condition, the application software has to ensure the procedure executes again.
MM912_637, Rev. 3.0
Freescale Semiconductor
107
Channel Acquisition
Power On
Procedure
(One time only)
Startup Trimming
Bandgap Trim (BG1,2,3)
LIN Slope Trim
LVT Trim
LPOSC Trim
Build Gain Compensation
Reference Table
Build Current Channel GC
Look Up table
Build VSENSE Channel GC
Look Up table
Build VOpt Channel GC
Look Up table
Startup Calibration
VSENSE / VOPT Channel
Offset Compensation1
ITEMP Channel Offset
Compensation
ITEMP Channel Gain
Compensation
PGA Auto Zero Sequence
Current / Voltage Channel
Gain Comp. based on
ITEMP and LookUp Table
Current Channel Offset
Compensation procedure2
Program Calibration IRQ
Temperature Thresholds
1
: Based on first channel used
2
: In case copper mode is not used
Figure 36. Power On Procedure
5.7.5.1.1
Startup Trimming
To ensure all analog die modules are being trimmed properly, the following FLASH information (located in the MCU IFR from
0x0_40D0 to 0x0_40D9) has to be copied to the analog die register 0xE0 to 0xE9. This trimming includes the Band Gap
Reference adjustment for the 3 system Band Gap circuits, The LIN slope adjustment (TRIM_LIN), the Low Voltage Threshold
(TRIM_LVT), and the Low Power Oscillator (TRIM_OSC). See Section 6, “MM912_637 - Trimming".
NOTE
The LPOSC[12:0] trim will adjust the low power oscillator to its specified accuracy. This will
result in the dependent Watchdog timing to be accurate after writing the trimming
information.
MM912_637, Rev. 3.0
Freescale Semiconductor
108
Channel Acquisition
5.7.5.1.2
Gain Compensation Look Up Table
In order to prepare the system for the optional calibration interrupt service during operation, it is be beneficial to create a look up
table for the voltage and current channel gain compensation over temperature.
For all current and voltage channel gain buffers, there are corresponding ROOM temperature optimum trim values stored in the
IFR FLASH. For HOT (125 °C) and COLD (-40 °C) temperature, the adjustment towards the ROOM value is stored.
Note: This table is partially populated for Analog Option 1 devices (populated from 0x0_40C0 to 0x0_40E1). Only Default (room
temperature) Gain Compensation values applicable. For ISENSE, see Table 22 (IGAINERR). For VSENSE, see Table 23
(VGAINERR).
Table 105. Gain Compensation Buffer Optimum
Global
Address
(IFRON)
OFFSET
Byte Description
HEX
DEC
0x0_40C0
00
00
0x0_40C1
01
01
0x0_40C2
02
02
0x0_40C3
03
03
0x0_40C4
04
04
0x0_40C5
05
05
0x0_40C6
06
06
0x0_40C7
07
07
0x0_40C8
08
08
0x0_40C9
09
09
0x0_40CA
0A
10
0x0_40CB
0B
11
0x0_40CC
0C
12
0x0_40CD
0D
13
0x0_40CE
0E
14
0x0_40CF
0F
15
0x0_40DE
1E
30
0x0_40DF
1F
31
0x0_40E0
20
32
0x0_40E1
21
33
VOGC[7:0]
0x0_40EC
2C
44
COMP_VSG_COLD[7:0]
VSENSE Channel Gain Compensation COLD Temp(108)
0x0_40ED
2D
45
COMP_VSG_HOT[7:0]
VSENSE Channel Gain Compensation HOT Temp(108)
0x0_40EE
2E
46
COMP_VOG_COLD[7:0]
VOPT Channel Gain Compensation COLD Temp(108)
0x0_40EF
2F
47
COMP_VOG_HOT[7:0]
VOPT Channel Gain Compensation HOT Temp(108)
0x0_40F0
30
48
IGC4_COLD[7:0]
Current Channel Gain (4) Compensation
- COLD Temp(108)
0x0_40F1
31
49
IGC4_HOT[7:0]
Current Channel Gain (4) Compensation
- HOT Temp(108)
0x0_40F2
32
50
IGC8_COLD[7:0]
Current Channel Gain (8) Compensation
- COLD Temp(108)
0x0_40F3
33
51
IGC8_HOT[7:0]
Current Channel Gain (8) Compensation
- HOT Temp(108)
Content
7
6
5
4
3
2
1
0
IGC4[9:8]
Current Channel Gain (4) Compensation
- Room Temp
IGC8[9:8]
Current Channel Gain (8) Compensation
- Room Temp
IGC16[9:8]
Current Channel Gain (16)
Compensation - Room Temp
IGC32[9:8]
Current Channel Gain (32)
Compensation - Room Temp
IGC64[9:8]
Current Channel Gain (64)
Compensation - Room Temp
IGC128[9:8]
Current Channel Gain (128)
Compensation - Room Temp
IGC256[9:8]
Current Channel Gain (256)
Compensation - Room Temp
IGC512[9:8]
Current Channel Gain (512)
Compensation - Room Temp
VSGC[9:8]
VSENSE Channel Gain Compensation Room Temp
VOGC[9:8]
VOPT Channel Gain Compensation Room Temp
IGC4[7:0]
IGC8[7:0]
IGC16[7:0]
IGC32[7:0]
IGC64[7:0]
IGC128[7:0]
IGC256[7:0]
IGC512[7:0]
VSGC[7:0]
MM912_637, Rev. 3.0
Freescale Semiconductor
109
Channel Acquisition
Table 105. Gain Compensation Buffer Optimum
Global
Address
(IFRON)
OFFSET
Byte Description
HEX
DEC
0x0_40F4
34
52
IGC16_COLD[7:0]
Current Channel Gain (16)
Compensation - COLD Temp(108)
0x0_40F5
35
53
IGC16_HOT[7:0]
Current Channel Gain (16)
Compensation - HOT Temp(108)
0x0_40F6
36
54
IGC32_COLD[7:0]
Current Channel Gain (32)
Compensation - COLD Temp(108)
0x0_40F7
37
55
IGC32_HOT[7:0]
Current Channel Gain (32)
Compensation - HOT Temp(108)
0x0_40F8
38
56
IGC64_COLD[7:0]
Current Channel Gain (64)
Compensation - COLD Temp(108)
0x0_40F9
39
57
IGC64_HOT[7:0]
Current Channel Gain (64)
Compensation - HOT Temp(108)
0x0_40FA
3A
58
IGC128_COLD[7:0]
Current Channel Gain (128)
Compensation - COLD Temp(108)
0x0_40FB
3B
59
IGC128_HOT[7:0]
Current Channel Gain (128)
Compensation - HOT Temp(108)
0x0_40FC
3C
60
IGC256_COLD[7:0]
Current Channel Gain (256)
Compensation - COLD Temp(108)
0x0_40FD
3D
61
IGC256_HOT[7:0]
Current Channel Gain (256)
Compensation - HOT Temp(108)
0x0_40FE
3E
62
IGC512_COLD[7:0]
Current Channel Gain (512)
Compensation - COLD Temp(108)
0x0_40FF
3F
63
IGC512_HOT[7:0]
Current Channel Gain (512)
Compensation - HOT Temp(108)
Content
7
6
5
4
3
2
1
0
Notes
108.7-Bit character with bit 7 (MSB) as sign (0 = “+”; 1 = “-”) with the difference to the corresponding room temperature value (e.g. 10000010
= “-2”).
To create the look up table, a linear interpolation of the gain adjustment has to be done between the three given temperatures,
based on the temperature step width specified (TCALSTEP).
MM912_637, Rev. 3.0
Freescale Semiconductor
110
HOT
+x
+2
+1
ROOM
0
-1
-2
COLD
-x
Figure 37. Loop Up Table Creation
5.7.5.1.3
Startup Calibration
The power on trimming / calibration procedure is finalized by performing the start up calibration.
5.7.5.1.3.1
VSENSE / VOPT Channel Offset Compensation and ITEMP Channel Gain /
Offset Compensation
Copying the default compensation values, according to Table 106, will establish the optimum offset compensation for the
VSENSE and VOPT channels, as well as the optimum gain and offset compensation for the internal temperature sensor.
Table 106. Voltage / Temp Trim
Global
Address
(IFRON)
OFFSET
HEX
DEC
0x0_40DA
1A
26
0x0_40DB
1B
0x0_40DC
Byte Description
7
6
5
4
3
Target Register
2
1
0
Name
Offset
VOC_S[7:0]
COMP_VOS
0xAA(109)
27
VOC_O[7:0]
COMP_VOO
0xAA(109)
1C
28
VOC_S[7:0] (Chopper Mode)
COMP_VOS_CHOP
0xAA(109)
0x0_40DD
1D
29
VOC_O[7:0] (Chopper Mode)
COMP_VOO_CHOP
0xAA(109)
0x0_40E2
22
34
ITO[7:0]
COMP_ITO
0xD0
0x0_40E3
23
35
ITG[7:0]
COMP_ITG
0xD1
Notes
109.Based on the selection of the voltage measurement source (VSENSE or VOPT) and the activation of chopper mode.
5.7.5.1.3.2
PGA Auto Zero Sequence
The following procedure has to be performed for the PGA (Programmable Gain Amplifier) Auto Zero (AZ).
1. Write a “1” to the PGAO bit and its mask in the COMP_CTL register (0xA0)
2. Approximately 6.5 ms later, PGAOF will become set at to “1” (Flag needs to be polled)
3. Exit the PGAO mode by writing “0” in PGA0 and its mask being a “1”
4. Clear the PGAOF flag by writing “1”
MM912_637, Rev. 3.0
Freescale Semiconductor
111
NOTE
The new offset compensation data can be observed in the (PGAOC4...512[10:0]) registers.
The sequence will require 3352 clock cycles of the D2DFCLK (512kHz), typically 6.5 ms.
5.7.5.1.3.3
Current and Voltage Channel Gain Compensation Based on ITEMP from Look
Up Table
After the first reading of the temperature channel measurement, the current and voltage channel gain compensation buffers must
be written with the corresponding look up table value (see Section 5.7.5.1.2, “Gain Compensation Look Up Table").
5.7.5.1.3.4
Current Channel Offset Compensation procedure (Chopper Off Only)
If the chopper feature is not used for the current measurement channel, the offset should be compensated using the following
procedure with the highest decimation selected and the LPF active.
Short PGA inputs
PGAZ(M) = 1
Start regular SD Current Channel
Conversion with Compensation
disabled (CCOMP(M) = 0)
Wait for conversion complete IRQ
and adjust offset compensation
buffers with result.
Figure 38. Current Channel Offset Compensation Sequence
5.7.5.1.3.5
Program Calibration IRQ Temperature Thresholds
To finalize the startup sequence, the new temperature limits must be programmed into the Calibration Temperature Limits
(TCMAX[15:0] and TCMIN[15:0]), and the Calibration Request interrupt must be enabled.
5.7.5.2
Calibration Request Procedure
During normal system operation (in Normal and Low Power mode), a calibration request interrupt / wake-up will indicate the
device temperature changed outside the range for the programmed Current and Voltage Channel Gain Compensation.
During a calibration request interrupt (wake-up), the Current and Voltage Channel Gain Compensation buffers have to be
updated with the corresponding values stored in the look up table created upon system start up (see Section 5.7.5.1.2, “Gain
Compensation Look Up Table"). The the new temperature limits must be programmed into the Calibration Temperature Limits
(TCMAX[15:0] and TCMIN[15:0]) before leaving the interrupt service routine.
5.7.5.3
Verification Procedures
As an optional feature, upon application requirement, the proper function of the current and voltage measurement channels can
be verified by connecting a special calibration reference to the input of the channels.
MM912_637, Rev. 3.0
Freescale Semiconductor
112
Connect Calibration Reference to
Channel Inputs
(DIAGI(M) = DIAGV(M) = 1)
Start regular SD Conversion.
Wait for conversion complete IRQ.
Verify result based on the reference
measurements
Disconnect Calibration Reference to
Channel Inputs
(DIAGI(M) = DIAGV(M) = 0)
Table 107 shows the location of the diagnostic reference measurements.
Note: This table is unpopulated for Analog Option 1 devices.
Table 107. Diagnostic Measurement Flash location
Global
Address
(IFRON)
HEX
DEC
0x0_40E4
24
36
0x0_40E5
25
37
0x0_40E6
26
38
0x0_40E7
27
39
0x0_40E8
28
40
0x0_40E9
29
41
0x0_40EA
2A
42
5.7.6
5.7.6.1
OFFSET
Byte Description
7
6
5
4
3
2
1
0
BG3 diag measurement from Vsense channel after cal at room
BG3 diag measurement from Vopt channel after cal at room
BG3 diag measurement from I channel (gain4) at room
Memory Map and Registers
Overview
This section provides a detailed description of the memory map and registers.
5.7.6.2
Module Memory Map
The memory map for the Acquisition, Compensation, and LPF module is given in Table 108.
MM912_637, Rev. 3.0
Freescale Semiconductor
113
Table 108. Module Memory Map
Offset
0x58
0x5A
0x5B
Name
ACQ_CTL
Acquisition control register
7
0x61
0x62
0x63
0
0
0
0
0
0
0
0
OPENEM
CVMIEM
ETMENM
ITMENM
VMENM
CMENM
OPTE
OPENE
CVMIE
ETMEN
ITMEN
VMEN
CMEN
PGAG
VMOW
CMOW
ETM
ITM
VM
CM
ITCHOP
VCHOP
CCHOP
0
AHCR
ACQ_SR (hi)
R
AVRF
Acquisition status register
W
ACQ_SR (lo)
R
Acquisition status register
W
Write 1 will clear the flags
OPEN
0
0
0
W TCOMPM VCOMPM
R
0
VTH
0
ETCHOP
0
0
0
0
0
CCOMP
M
LPFENM
ETCHOP
M
ITCHOP
M
CVCHOP
M
AGENM
TCOMP
VCOMP
CCOMP
LPFEN
ETCHOP
ITCHOP
CVCHOP
AGEN
R
0
0
0
0
0
0
0
0
W
ZEROM
ECAPM
TDENM
VDENM
CDENM
ZERO
ECAP
TADCG
VADCG
CADCG
TDEN
VDEN
CDEN
0
0
0
0
0
0
0
0
0
R
ACQ_DEC
R
Decimation Rate
W
ACQ_BGC
R
BandGap control
W
ACQ_GAIN
R
PGA gain
W
ACQ_GCB
R
GCB threshold
W
ACQ_ITEMP (hi)
R
0x64
Internal temp. measurement
result
W
ACQ_ITEMP (lo)
R
0x65
Internal temp. measurement
result
W
ACQ_ETEMP (hi)
R
0x66
External temp. measurement
result
W
ACQ_ETEMP (lo)
R
0x67
External temp. measurement
result
W
0x68
Reserved
0x69
1
OPTEM
W
0x60
2
0
R
ACQ_ACC0
Acquisition chain control 0
3
AHCRM
W
0x5E
4
R
W
ACQ_ACC1
Acquisition chain control 1
5
W
R
0x5C
6
R
TADCGM VADCGM CADCGM
BGADC[1:0]
0
BGLDO
0
DEC[2:0]
BG3EN
0
BG2EN
BG1EN
IGAIN[2:0]
D[7:0]
ITEMP[15:8]
ITEMP[7:0]
EEMP[15:8]
EEMP[7:0]
0
0
0
0
0
0
0
0
W
ACQ_CURR1
R
Current measurement result
W
CURR[23:16]
MM912_637, Rev. 3.0
Freescale Semiconductor
114
Table 108. Module Memory Map
Offset
Name
7
6
5
4
R
0x6A
ACQ_CURR0
Current measurement result
3
2
1
0
0
0
0
0
0
0
0
0
CURR[15:8]
W
R
CURR[7:0]
W
R
0x6C
ACQ_VOLT
Voltage measurement result
VOLT[15:8]
W
R
VOLT[7:0]
W
ACQ_LPFC
R
0x6E
Low pass filter coefficient
number
W
0x6F
Reserved
0x70
ACQ_TCMP
Low power trigger current
measurement period
R
0
0
0
0
LPFC[3:0]
0
0
0
0
0
W
R
W
TCMP[15:0]
R
W
ACQ_THF
R
0x72
Low power current threshold
filtering period
W
0x73
Reserved
0x74
0x75
0x76
0x77
0x78
0x79
0x7A
0x7B
0x7C
0x7D
R
ACQ_CVCR (hi)
R
W
ACQ_CVCR (lo)
R
I and V chopper control register
W
ACQ_CTH
R
Low power current threshold
W
ACQ_AHTH1 (hi)
0
0
0
0
0
0
0
0
0
0
W
I and V chopper control register
Reserved
THF[7:0]
R
0
IIRCM[2:0]
PGAFM
DBT[1:0]
IIRC[2:0]
PGAF
0
CTH[7:0]
0
0
0
0
0
0
0
0
W
R
0
Low power Ah counter threshold W
ACQ_AHTH1 (lo)
0
DBTM[1:0]
AHTH[30:16]
R
Low power Ah counter threshold W
ACQ_AHTH0 (hi)
R
Low power Ah counter threshold W
ACQ_AHTH0 (lo)
AHTH[15:0]
R
Low power Ah counter threshold W
ACQ_AHC1 (hi)
R
Low power Ah counter
W
ACQ_AHC1 (lo)
R
Low power Ah counter
W
AHC[31:24]
AHC[23:16]
MM912_637, Rev. 3.0
Freescale Semiconductor
115
Table 108. Module Memory Map
Offset
0x7E
0x7F
0x80
0x81
0x82
0x83
0x84
0x85
0x86
0x87
0x88
0x89
0x8A
0x8B
0x8C
0x8D
0x8E
0x8F
0x90
0x91
Name
7
ACQ_AHC0 (hi)
R
Low power Ah counter
W
ACQ_AHC0 (lo)
R
Low power Ah counter
W
LPF_A0 (hi)
R
A0 filter coeff
W
LPF_A0 (lo)
R
A0 filter coeff
W
LPF_A1 (hi)
R
A1 filter coeff
W
LPF_A1 (lo)
R
A1 filter coeff
W
LPF_A2 (hi)
R
A2 filter coeff
W
LPF_A2 (lo)
R
A2 filter coeff
W
LPF_A3 (hi)
R
A3 filter coeff
W
LPF_A3 (lo)
R
A3 filter coeff
W
LPF_A4 (hi)
R
A4 filter coeff
W
LPF_A4 (lo)
R
A4 filter coeff
W
LPF_A5 (hi)
R
A5 filter coeff
W
LPF_A5 (lo)
R
A5 filter coeff
W
LPF_A6 (hi)
R
A6 filter coeff
W
LPF_A6 (lo)
R
A6 filter coeff
W
LPF_A7 (hi)
R
A7 filter coeff
W
LPF_A7 (lo)
R
A7 filter coeff
W
LPF_A8 (hi)
R
A8 filter coeff
W
LPF_A8 (lo)
R
A8 filter coeff
W
6
5
4
3
2
1
0
AHC[15:8]
AHC[7:0]
A0[15:0]
A1[15:0]
A2[15:0]
A3[15:0]
A4[15:0]
A5[15:0]
A6[15:0]
A7[15:0]
A8[15:0]
MM912_637, Rev. 3.0
Freescale Semiconductor
116
Table 108. Module Memory Map
Offset
0x92
0x93
0x94
0x95
0x96
0x97
0x98
0x99
0x9A
0x9B
0x9C
0x9D
0x9E
0x9F
0xA0
Name
7
LPF_A9 (hi)
R
A9 filter coeff
W
LPF_A9 (lo)
R
A9 filter coeff
W
LPF_A10 (hi)
R
A10 filter coeff
W
LPF_A10 (lo)
R
A10 filter coeff
W
LPF_A11 (hi)
R
A11 filter coeff
W
LPF_A11 (lo)
R
A11 filter coeff
W
LPF_A12 (hi)
R
A12 filter coeff
W
LPF_A12 (lo)
R
A12 filter coeff
W
LPF_A13 (hi)
R
A13 filter coeff
W
LPF_A13 (lo)
R
A13 filter coeff
W
LPF_A14 (hi)
R
A14 filter coeff
W
LPF_A14 (lo)
R
A14 filter coeff
W
0xA3
5
4
3
2
1
0
A9[15:0]
A10[15:0]
A11[15:0]
A12[15:0]
A13[15:0]
A14[15:0]
LPF_A15 (hi)
R
A15 filter coeff
W
LPF_A15 (lo)
R
A15 filter coeff
W
R
0
0
0
0
0
0
COMP_CTL
Compensation control register
W
BGCALM[1:0]
PGAZM
PGAOM
DIAGVM
DIAGIM
CALIEM
BGCAL[1:0]
PGAZ
PGAO
DIAGV
DIAGI
PGAOF
0
0
R
W
0xA2
6
COMP_SR
R
Compensation status register
W
COMP_TF
R
Temperature filtering period
W
COMP_TMAX
Max temp before recalibration
W
A15[15:0]
0
0
BGRF
0
CALIE
0
CALF
Write 1 will clear the flags
0
0
0
0
0
TMF[2:0]
R
0xA4
TCMAX[15:0]
R
W
MM912_637, Rev. 3.0
Freescale Semiconductor
117
Table 108. Module Memory Map
Offset
Name
7
6
5
4
3
2
1
0
R
0xA6
COMP_TMIN
Min temp before recalibration
W
TCMIN[15:0]
R
W
0xA8
Reserved
0xA9
Reserved
0xAA
0xAB
R
R
COMP_VO
R
W
COMP_IO
R
Offset current compensation
window
W
R
0xAC
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
Offset voltage compensation
COMP_VSG
Gain voltage comp. vsense
channel
0
W
VOC[7:0]
COC[7:0]
0
0
0
W
R
Reserved
0xAF
Reserved
R
0xB0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
R
W
R
COMP_IG4
Gain current compensation 4
W
R
R
0xB2
0
0
0
0
W
R
0xB4
COMP_IG16
Gain current compensation 16
0
0
0
R
0xB6
0
0
0
R
0xB8
0
0
IGC32[9:8]
IGC32[7:0]
W
COMP_IG64
Gain current compensation 64
0
W
R
IGC16[9:8]
IGC16[7:0]
W
COMP_IG32
Gain current compensation 32
0
W
R
IGC8[9:8]
IGC8[7:0]
W
R
IGC4[9:8]
IGC4[7:0]
W
COMP_IG8
Gain current compensation 8
VSGC[9:8]
VSGC[7:0]
W
0xAE
0
0
0
0
0
0
W
R
0
IGC64[9:8]
IGC64[7:0]
W
MM912_637, Rev. 3.0
Freescale Semiconductor
118
Table 108. Module Memory Map
Offset
Name
R
0xBA
COMP_IG128
Gain current compensation 128
7
6
5
4
3
2
0
0
0
0
0
0
W
R
0xBC
COMP_IG256
Gain current compensation 256
0
0
0
R
COMP_IG512
Gain current compensation 512
0
0
0
R
COMP_PGAO4
Offset PGA compensation 4
0
0
0
R
R
COMP_PGAO8
Offset PGA compensation 8
COMP_PGAO16
Offset PGA compensation 16
0
0
0
R
COMP_PGAO32
Offset PGA compensation 32
0
0
0
R
COMP_PGAO64
Offset PGA compensation 64
0
0
0
R
COMP_PGAO128
Offset PGA compensation 128
0
0
0
R
0
0
0
0
0
0
0
0
0
0
0
W
R
R
COMP_PGAO256
Offset PGA compensation 256
0
PGAOC8[10:8]
PGAOC16[10:8]
PGAOC32[10:8]
PGAOC64[10:8]
PGAOC64[7:0]
PGAOC128[10:8]
PGAOC128[7:0]
W
0xCC
0
W
R
PGAOC4[10:8]
PGAOC32[7:0]
W
0xCA
0
W
R
IGC512[9:8]
PGAOC16[7:0]
W
0xC8
0
W
R
0
PGAOC8[7:0]
W
0xC6
0
W
R
IGC256[9:8]
PGAOC4[7:0]
W
0xC4
0
W
W
0xC2
0
IGC512[7:0]
W
0xC0
0
W
R
IGC128[9:8]
IGC256[7:0]
W
0xBE
0
W
R
0
IGC128[7:0]
W
R
1
0
0
0
0
0
W
R
PGAOC256[10:8]
PGAOC256[7:0]
W
MM912_637, Rev. 3.0
Freescale Semiconductor
119
Table 108. Module Memory Map
Offset
Name
R
0xCE
COMP_PGAO512
Offset PGA compensation 512
7
6
5
4
3
0
0
0
0
0
R
COMP_ITO
R
Internal temp. offset
compensation
W
COMP_ITG
R
0xD1
Internal temp. gain
compensation
W
COMP_ETO
R
0xD2
External temp. offset
compensation
W
COMP_ETG
R
0xD3
External temp. gain
compensation
W
0xD4
Reserved
0xD5
Reserved
0xD6
Reserved
0xD7
Reserved
R
1
0
PGAOC512[10:8]
W
PGAOC512[7:0]
W
0xD0
2
ITOC[7:0]
ITGC[7:0]
ETOC[7:0]
ETGC[7:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
R
W
R
W
R
W
Notes
110.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
111.Register Offset with the “lo” address value not shown have to be accessed in 16Bit mode. 8 Bit access will not function.
5.7.6.3
Register Descriptions
This section consists of register descriptions in address order. Each description includes a standard register diagram with an
associated figure number. Details of register bit and field function follow the register diagrams, in bit order.
MM912_637, Rev. 3.0
Freescale Semiconductor
120
5.7.6.3.1
Acquisition Control Register (ACQ_CTL)
Table 109. Acquisition Control Register (ACQ_CTL)
Offset
0x58
Access: User read/write
(112),(113)
15
14
13
12
11
10
9
8
R
0
0
0
0
0
0
0
0
W
AHCRM
OPTEM
OPENEM
CVMIEM
ETMENM
ITMENM
VMENM
CMENM
Reset
0
0
0
0
0
0
0
0
7
6
5
4
3
2
1
0
OPTE
OPENE
CVMIE
ETMEN
ITMEN
VMEN
CMEN
0
0
0
0
0
0
0
R
0
W
AHCR
Reset
0
Notes
112.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
113.This Register is 16-Bit access only.
Table 110. Acquisition Control Register (ACQ_CTL) - Register Field Descriptions
Field
15
AHCRM
14
OPTEM
13
OPENEM
12
CVMIEM
11
ETMENM
10
ITMENM
9
VMENM
8
CMENM
7
AHCR
6
OPTE
5
OPENE
Description
Ampere Hour Counter Reset - Mask
0 - writing the AHCR Bit will have no effect
1 - writing the AHCR Bit will be effective
Optional Voltage Sense Enable - Mask
0 - writing the OPTE Bit will have no effect
1 - writing the OPTE Bit will be effective
Enable Shunt Resistor Open Detection - Mask
0 - writing the OPENE Bit will have no effect
1 - writing the OPENE Bit will be effective
Current / Voltage Measurement Interrupt Enable - Mask
0 - writing the CVMIE Bit will have no effect
1 - writing the CVMIE Bit will be effective
External Temperature Measurement Enable - Mask
0 - writing the ETMEN Bit will have no effect
1 - writing the ETMEN Bit will be effective
Internal Temperature Measurement Enable - Mask
0 - writing the ITMEN Bit will have no effect
1 - writing the ITMEN Bit will be effective
Voltage Measurement Enable - Mask
0 - writing the VMEN Bit will have no effect
1 - writing the VMEN Bit will be effective
Current Measurement Enable - Mask
0 - writing the CMEN Bit will have no effect
1 - writing the CMEN Bit will be effective
Ampere Hour Counter Reset, this write only bit will reset the ACQ_AHC register.
0 - no effect
1 - ACQ_AHC reset to 0x00000000
Optional Voltage Sense Enable (Voltage Channel Multiplexer Control)
0 - VSENSE routed to ADC
1 - VOPT routed to ADC
Enable Shunt Resistor Open Detection
0 - Shunt resistor open detection disabled, the OPEN bit must be ignored
1 - Shunt resistor open detection enabled, OPEN bit will indicate status
MM912_637, Rev. 3.0
Freescale Semiconductor
121
Table 110. Acquisition Control Register (ACQ_CTL) - Register Field Descriptions
Field
Description
Current / Voltage Measurement Interrupt Enable
0 - current and voltage measurement interrupt disabled
1 - current and voltage measurement interrupt enabled
4
CVMIE
External Temperature Measurement Enable
0 - external temperature measurement disabled
1 - external temperature measurement enabled
3
ETMEN
Internal Temperature Measurement Enable
0 - internal temperature measurement disabled
1 - internal temperature measurement enabled
2
ITMEN
Voltage Measurement Enable
0 - voltage measurement disabled
1 - voltage measurement enabled
1
VMEN
Current Measurement Enable
0 - current measurement disabled
1 - current measurement enabled
0
CMEN
5.7.6.3.2
Acquisition Status Register (ACQ_SR (hi))
Table 111. Acquisition Status Register (ACQ_SR (hi))
(114
Offset
0x5A
Access: User read/write
)
R
7
6
5
AVRF
PGAG
VMOW
W
4
3
2
1
0
CMOW
ETM
ITM
VM
CM
0
0
0
Write 1 will clear the flags
Reset
0
0
0
0
0
Notes
114.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 112. Acquisition Status Register (ACQ_SR (hi)) - Register Field Descriptions
Field
7
AVRF
6
PGAG
5
VMOW
4
CMOW
3
ETM
2
ITM
Description
VDDA Low Voltage Reset Flag. Writing this bit to logic 1 will clear the flag.
0 - n.a.
1 - Last reset was caused by a low voltage condition at the VDDA regulator.
PGA Gain Change Flag(115). Writing this bit to logic 1 will clear the flag.
0 - PGA gain has not changed since last flag clear
1 - PGA gain has changed since last flag clear
Voltage Measurement Result Overwritten(115). Writing this bit to logic 1 will clear the flag.
0 - Voltage measurement result register VOLT[15:0] not overwritten(116) since last VMOW flag clear
1 - Voltage measurement result register VOLT[15:0] overwritten(116) since last VMOW flag clear
Current Measurement Result Overwritten(115). Writing this bit to logic 1 will clear the flag.
0 - Current measurement result register CURR[15:0] not overwritten(116) since last CMOW flag clear
1 - Current measurement result register CURR[15:0] overwritten(116) since last CMOW flag clear
End of Measurement - External Temperature(115). Writing this bit to logic 1 will clear the flag.
0 - No external temperature measurement completed since last ETM clear
1 - External temperature measurement completed since last ETM clear
End of Measurement - Internal Temperature(115). Writing this bit to logic 1 will clear the flag.
0 - No internal temperature measurement completed since last ITM clear
1 - Internal temperature measurement completed since last ITM clear
MM912_637, Rev. 3.0
Freescale Semiconductor
122
Table 112. Acquisition Status Register (ACQ_SR (hi)) - Register Field Descriptions
Field
Description
End of Measurement - Voltage. Writing this bit to logic 1 will clear the flag.
0 - No voltage measurement completed since last VM clear
1 - Voltage measurement completed since last VM clear
1
VM
End of Measurement - Current. Writing this bit to logic 1 will clear the flag.
0 - No current measurement completed since last CM clear
1 - Current measurement completed since last CM clear
0
CM
Notes
115.No Interrupts issued for those flags
116.Overwritten - new result latched before previous result was read
5.7.6.3.3
Acquisition Status Register (ACQ_SR (lo))
Table 113. Acquisition Status Register (ACQ_SR (lo))
Offset(117 0x5B
Access: User read
)
R
7
6
5
4
3
2
1
0
OPEN
0
0
VTH
ETCHOP
ITCHOP
VCHOP
CCHOP
W
Notes
117.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 114. Acquisition Status Register (ACQ_SR (lo)) - Register Field Descriptions
Field
7
OPEN
4
VTH
3
ETCHOP
2
ITCHOP
1
VCHOP
0
CCHOP
Description
Shunt Resistor Open Detection Status (Normal mode only, only functional if OPENE=1)
0 - Shunt resistor detected
1 - Shunt resistor disconnected
Digital Voltage High Threshold Reached
0 - Voltage measurement result for VSENSE / VOPT below VTH (0xDAC0: equivalent to 28 V at 0.5 mV LSB weighing)
1 - Voltage measurement result for VSENSE / VOPT above or equal VTH (0xDAC0: equivalent to 28 V at 0.5 mV LSB
weighing)
Chopping Active Status - External Temperature
0 - Chopper for external temperature measurement disabled
1 - Chopper for external temperature measurement enabled
Chopping Active Status - Internal Temperature
0 - Chopper for internal temperature measurement disabled
1 - Chopper for internal temperature measurement enabled
Chopping Active Status - Voltage
0 - Chopper for voltage measurement disabled
1 - Chopper for voltage measurement enabled
Chopping Active Status - Current
0 - Chopper for current measurement disabled
1 - Chopper for current measurement enabled
MM912_637, Rev. 3.0
Freescale Semiconductor
123
5.7.6.3.4
Acquisition Chain Control 1 (ACQ_ACC1)
Table 115. Acquisition Chain Control 1 (ACQ_ACC1)
Offset
0x5C
Access: User read/write
(118)(119)
15
14
13
12
11
10
9
8
R
0
0
0
0
0
0
0
0
W
TCOMPM
VCOMPM
CCOMPM
LPFENM
ETCHOPM
ITCHOPM
CVCHOPM
AGENM
Reset
0
0
0
0
0
0
0
0
7
6
5
4
3
2
1
0
TCOMP
VCOMP
CCOMP
LPFEN
ETCHOP
ITCHOP
CVCHOP
AGEN
1
1
1
0
0
0
0
1
R
W
Reset
Notes
118.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
119.This Register is 16 Bit access only.
Table 116. Acquisition Chain Control 1 (ACQ_ACC1) - Register Field Descriptions
Field
15
TCOMPM
14
VCOMPM
13
CCOMPM
12
LPFENM
11
ETCHOPM
10
ITCHOPM
9
CVCHOPM
8
AGENM
7
TCOMP
6
VCOMP
5
CCOMP
Description
Temperature Measurement Channel - Compensation Enable - Mask
0 - writing the TCOMP bit will have no effect
1 - writing the TCOMP bit will be effective
Voltage Measurement Channel - Compensation Enable - Mask
0 - writing the VCOMP bit will have no effect
1 - writing the VCOMP bit will be effective
Current Measurement Channel - Compensation Enable - Mask
0 - writing the CCOMP bit will have no effect
1 - writing the CCOMP bit will be effective
LPF Enable - Mask
0 - writing the CCOMP bit will have no effect
1 - writing the CCOMP bit will be effective
Chopping Enable - External Temperature Measurement Channel - Mask
0 - writing the ETCHOP bit will have no effect
1 - writing the ETCHOP bit will be effective
Chopping Enable - Internal Temperature Measurement Channel - Mask
0 - writing the ITCHOP bit will have no effect
1 - writing the ITCHOP bit will be effective
Chopping Enable - Voltage Measurement Channel - Mask
0 - writing the CVCHOP bit will have no effect
1 - writing the CVCHOP bit will be effective
Automatic Gain Control Enable - Mask
0 - writing the AGEN bit will have no effect
1 - writing the AGEN bit will be effective
Temperature Measurement Channel - Compensation Enable
0 - Temperature measurement channel offset and gain compensation disabled
1 - Temperature measurement channel offset and gain compensation enabled
Voltage Compensation Enable
0 - Voltage measurement channel offset and gain compensation disabled
1 - Voltage measurement channel offset and gain compensation enabled
Current Compensation Enable
0 - Current measurement channel offset and gain compensation disabled
1 - Current measurement channel offset and gain compensation enabled
MM912_637, Rev. 3.0
Freescale Semiconductor
124
Table 116. Acquisition Chain Control 1 (ACQ_ACC1) - Register Field Descriptions
Field
Description
LPF Enable
0 - Low pass filter for current and voltage channel disabled
1 - Low pass filter for current and voltage channel enabled
4
LPFEN
Chopping Enable - External Temperature
0 - Chopper mode for external temperature measurement disabled
1 - Chopper mode for external temperature measurement enabled
3
ETCHOP
Chopping Enable - Internal Temperature
0 - Chopper mode for internal temperature measurement disabled
1 - Chopper mode for internal temperature measurement enabled
2
ITCHOP
Chopping Enable - Voltage
0 - Chopper mode for voltage measurement disabled
1 - Chopper mode for voltage measurement enabled
1
CVCHOP
Automatic Gain Control Enable
0 - Automatic gain control disabled (manual gain control via IGAIN[2:0])
1 - Automatic gain control enabled
0
AGEN
5.7.6.3.5
Acquisition Chain Control 0 (ACQ_ACC0)
Table 117. Acquisition Chain Control 0 (ACQ_ACC0)
Offset
0x5E
Access: User read/write
(120),(121)
15
14
13
12
11
10
9
8
R
0
0
0
0
0
0
0
0
W
ZEROM
ECAPM
TADCGM
VADCGM
CADCGM
TDENM
VDENM
CDENM
Reset
0
0
0
0
0
0
0
0
7
6
5
4
3
2
1
0
ZERO
ECAP
TADCG
VADCG
CADCG
TDEN
VDEN
CDEN
0
0
1
1
1
0
0
0
R
W
Reset
Notes
120.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
121.This Register is 16 Bit access only.
Table 118. Acquisition Chain Control 0 (ACQ_ACC0) - Register Field Descriptions
Field
15
ZEROM
14
ECAPM
13
TADCGM
12
VADCGM
Description
Current and Voltage Sigma Delta Input Short - Mask
0 - writing the ZERO bit will have no effect
1 - writing the ZERO bit will be effective
TSUP External Capacitor - Mask
0 - writing the ECAP bit will have no effect
1 - writing the ECAP bit will be effective
Temperature ADC Gain Select - Mask
0 - writing the TADCG bit will have no effect
1 - writing the TADCG bit will be effective
Voltage ADC Gain Select - Mask
0 - writing the VADCG bit will have no effect
1 - writing the VADCG bit will be effective
MM912_637, Rev. 3.0
Freescale Semiconductor
125
Table 118. Acquisition Chain Control 0 (ACQ_ACC0) - Register Field Descriptions
Field
Description
11
CADCGM
10
TDENM
9
VDENM
8
CDENM
Current ADC Gain Select - Mask
0 - writing the CADCG bit will have no effect
1 - writing the CADCG bit will be effective
100ns Clock delay - Internal Temperature - Mask
0 - writing the TDEN bit will have no effect
1 - writing the TDEN bit will be effective
100ns Clock delay - Voltage - Mask
0 - writing the VDEN bit will have no effect
1 - writing the VDEN bit will be effective
100ns Clock delay - Current - Mask
0 - writing the CDEN bit will have no effect
1 - writing the CDEN bit will be effective
Current and Voltage Sigma Delta Input Short (to perform Offset Compensation measurement)
0 - Sigma delta inputs not shorted
1 - Current and voltage sigma delta inputs shorted
7
ZERO
TSUP External Capacitor select
0 - TSUP frequency compensation disabled. No capacitor at pin.
0 - TSUP frequency compensation enabled. Capacitor CTSUP allowed at pin.
6
ECAP
5
TADCG
4
VADCG
3
CADCG
Temperature ADC Gain Select; Test purpose only, Default value (1) must be used
0 - Temperature ADC - gain adjustment
1 - Temperature ADC - standard gain (default)
Voltage ADC Gain Select; Test purpose only; Default value (1) must be used
0 - Voltage ADC - gain adjustment
1 - Voltage ADC - standard gain (default)
Current ADC Gain Select; Test purpose only; Default value (1) must be used
0 - Current ADC - gain adjustment
1 - Current ADC - standard gain (default)
Timing delay - Temperature
0 - standard timing for temperature measurement channel
1 - additional SD converter input delay (typ. 100 ns) for temperature measurement channel
2
TDEN
Timing delay - Voltage
0 - standard timing for Voltage measurement channel
1 - additional SD converter input delay (typ. 100 ns) for voltage measurement channel
1
VDEN
Timing delay - Current
0 - standard timing for current measurement channel
1 - additional SD converter input delay (typ. 100 ns) for current measurement channel
0
CDEN
5.7.6.3.6
Decimation Rate (ACQ_DEC)
Table 119. Decimation Rate (ACQ_DEC)
Offset(122)
R
0x60
Access: User read/write
7
6
5
4
3
0
0
0
0
0
0
0
0
0
0
2
0
DEC[2:0]
W
Reset
1
1
0
0
Notes
122.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
MM912_637, Rev. 3.0
Freescale Semiconductor
126
Table 120. Decimation Rate (ACQ_DEC) - Register Field Descriptions
Field
2-0
DEC[2:0]
5.7.6.3.7
Description
Decimation Rate Selection (Combined decimation rate of first and second sinc3 decimator; Fist decimator is fixed to D=8)
000 - D = 512 (Channel Output Rate = 1.0 kHz)
001 - D = 64 (Channel Output Rate = 8.0 kHz)
010 - D = 128 (Channel Output Rate = 4.0 kHz)
011 - D = 256 (Channel Output Rate = 2.0 kHz)
100 - D = 512 (Channel Output Rate = 1.0 kHz), (default)
101 - D = 1024 (Channel Output Rate = 500 Hz)
110 - D = 512 (Channel Output Rate = 1.0 kHz)
111 - D = 512 (Channel Output Rate = 1.0 kHz)
BandGap Control (ACQ_BGC)
Table 121. BandGap Control (ACQ_BGC)
Offset(123)
0x61
R
Access: User read/write
7
6
0
0
0
0
5
3
BGADC
W
Reset
4
0
BGLDO
1
1
2
1
0
BG3EN
BG2EN
BG1EN
0
0
0
Notes
123.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 122. BandGap Control (ACQ_BGC) - Register Field Descriptions
Field
5-4
BGADC
3
BGLDO
2
BG3EN
1
BG2EN
0
BG1EN
Description
ADC Bandgap select
00 - n.a. (not allowed - VDDA Reset)
01 - BG1 reference selected for the AD converters (default)
10 - BG2 reference selected for the AD converters
11 - BG3 reference selected for the AD converters
LDO (Low Dropout Regulator) Bandgap select
0 - BG2 selected as voltage regulator reference
1 - BG1 selected as voltage regulator reference (default)
Bandgap 3 Status
0 - Bandgap 3 disabled
1 - Bandgap 3 enabled
Bandgap 2 Status
0 - Bandgap 2 disabled
1 - Bandgap 2 enabled
Bandgap 1 Status
0 - Bandgap 1 disabled
1 - Bandgap 1 enabled
MM912_637, Rev. 3.0
Freescale Semiconductor
127
5.7.6.3.8
PGA Gain (ACQ_GAIN)
Table 123. PGA Gain (ACQ_GAIN)
Offset(124)
0x62
R
Access: User read/write
7
6
5
4
3
0
0
0
0
0
0
0
0
0
0
2
1
IGAIN[2:0]
W
Reset
0
0
0
0
Notes
124.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 124. PGA Gain (ACQ_GAIN) - Register Field Descriptions
Field
2-0
IGAIN[2:0]
5.7.6.3.9
Description
PGA Gain Register - Writing will select (manually override) the PGA gain if the automatic gain control is disabled (AGEN=0).
Reading will return current gain setting (including the auto gain). The register content will also determine the current
channel offset compensation buffer accessed through the COC[7:0] register.
000 - PGA Gain = 4
001 - PGA Gain = 8
010 - PGA Gain = 16
011 - PGA Gain = 32
100 - PGA Gain = 64
101 - PGA Gain = 128
110 - PGA Gain = 256
111 - PGA Gain = 512
GCB Threshold (ACQ_GCB)
Table 125. GCB Threshold (ACQ_GCB)
Offset(125) 0x63
Access: User read/write
7
6
R
5
4
3
2
D (hi)
W
Reset
0
0
1
0
0
0
D (lo)
0
0
0
0
Notes
125.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 126. GCB Threshold (ACQ_GCB) - Register Field Descriptions
Field
7-4
Description
Gain Control Block (GCB) - 4 Bit Gain “Up” Threshold. See Section 5.7.3.1.3, “Gain Control Block (GCB)".
D[7:4]
3-0
Gain Control Block (GCB) - 4 Bit Gain “Down” Threshold. See Section 5.7.3.1.3, “Gain Control Block (GCB)".
D[3:0]
MM912_637, Rev. 3.0
Freescale Semiconductor
128
5.7.6.3.10
Internal Temp. Measurement Result (ACQ_ITEMP (hi) / ACQ_ITEMP (lo))
Table 127. Internal Temp. Measurement Result (ACQ_ITEMP (hi) / ACQ_ITEMP (lo))
Offset(126)
0x64 / 0x65
7
Access: User read
6
5
4
R
3
2
1
0
ITEMP[15:8]
W
R
ITEMP[7:0]
W
Notes
126.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 128. Internal Temp. Measurement Result (ACQ_ITEMP (hi) / ACQ_ITEMP (lo)) - Register Field Descriptions
Field
15-0
Description
Internal Temperature Measurement - 16 Bit ADC Result Register (unsigned Integer)
ITEMP[15:0]
5.7.6.3.11
External Temp. Measurement Result (ACQ_ETEMP (hi) / ACQ_ETEMP (lo))
Table 129. External Temp. Measurement Result (ACQ_ETEMP (hi) / ACQ_ETEMP (lo))
(127)
Offset
0x66 / 0x67
7
R
Access: User read
6
5
4
3
2
1
0
ETEMP[15:8]
W
R
ETEMP[7:0]
W
Notes
127.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 130. External Temp. Measurement Result (ACQ_ETEMP (hi) / ACQ_ETEMP (lo)) - Register Field Descriptions
Field
15-0
Description
External Temperature Measurement - 16 Bit ADC Result Register (unsigned Integer)
ETEMP[15:0]
MM912_637, Rev. 3.0
Freescale Semiconductor
129
5.7.6.3.12
Current Measurement Result (ACQ_CURR1 / ACQ_CURR0)
Table 131. Current Measurement Result (ACQ_CURR1 / ACQ_CURR0)
Offset(128)
0x69(129)
/
0x6A(130)
7
Access: User read
6
5
4
R
3
2
1
0
CURR[23:16]
W
R
CURR[15:8]
W
R
CURR[7:0]
W
Notes
128.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
129.0x69 for 8-Bit access. 0x68 for 16-Bit access.
130.This Register is 16-Bit access only.
Table 132. Current Measurement Result (ACQ_CURR1 / ACQ_CURR0) - Register Field Descriptions
Field
CURR[23:0]
Description
Two's complement 24-Bit signed integer result register for the current measurement channel.
23-16
CURR[23:16]
Current Measurement - High Byte Result Register, 8 or 16-Bit read operation.
15-0
Current Measurement - Low Word Result Register, 16-Bit read operation only.
CURR[15:0]
5.7.6.3.13
Voltage Measurement Result (ACQ_VOLT)
Table 133. Voltage Measurement Result (ACQ_VOLT)
Offset
0x6C
Access: User read
(131)(132)
7
6
R
5
4
3
2
1
0
VOLT[15:8]
W
R
VOLT[7:0]
W
Notes
131.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
132.This Register is 16-Bit access only.
Table 134. Voltage Measurement Result (ACQ_VOLT) - Register Field Descriptions
Field
15-0
Description
Unsigned 16-Bit integer result register for the voltage measurement channel.
VOLT[15:0]
MM912_637, Rev. 3.0
Freescale Semiconductor
130
5.7.6.3.14
Low Pass Filter Coefficient Number (ACQ_LPFC)
Table 135. Low Pass Filter Coefficient Number (ACQ_LPFC)
Offset(133)
0x6E
Access: User read/write
R
7
6
5
4
0
0
0
0
0
0
0
0
3
2
0
1
0
LPFC[3:0]
W
Reset
1
1
1
Notes
133.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 136. Low Pass Filter Coefficient Number (ACQ_LPFC) - Register Field Descriptions
Field
3-0
LPFC[3:0]
Description
Low Pass Filter Coefficient Number. Defines the highest coefficient Number used.
0000 - LPF used with Coefficient A0
0001 - LPF used with Coefficient A0...A1
....
1111 - LPF used with Coefficient A0...A15
5.7.6.3.15
Low Power Trigger Current Measurement Period (ACQ_TCMP)
Table 137. Low Power Trigger Current Measurement Period (ACQ_TCMP)
Offset
0x70
Access: User read / write
(134)(135)
7
6
5
4
R
3
2
1
0
0
0
0
0
0
0
0
0
TCMP[15:8]
W
Reset
0
0
0
0
R
TCMP[7:0]
W
Reset
0
0
0
0
Notes
134.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
135.This Register is 16-Bit access only.
Table 138. Low Power Trigger Current Measurement Period (ACQ_TCMP) - Register Field Descriptions
Field
Description
15-0
Low power trigger current measurement period (Trigger counter based on ALFCLK). See Section 5.2.4.1.1, “Cyclic Current
Acquisition / Calibration Temperature Check".
TCMP[15:0]
NOTE
The cyclic acquisition period must be greater than the acquisition time. See
Section 5.7.3.5.2, “Latency and Throughput"” for estimation. A continuous acquisition is still
possible by using TCMP=0.
MM912_637, Rev. 3.0
Freescale Semiconductor
131
5.7.6.3.16
Low Power Current Threshold Filtering Period (ACQ_THF)
Table 139. Low Power Current Threshold Filtering Period (ACQ_THF)
Offset(136)
0x72
Access: User read / write
7
6
5
4
R
3
2
1
0
0
0
0
0
THF[7:0]
W
Reset
0
0
0
0
Notes
136.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 140. Low Power Current Threshold Filtering Period (ACQ_THF) - Register Field Descriptions
Field
Description
7-0
Low power current threshold wake up filtering period. See Section 5.2.4.1.1, “Cyclic Current Acquisition / Calibration
Temperature Check".
THF[7:0]
5.7.6.3.17
I and V chopper control register (ACQ_CVCR (hi))
Table 141. I and V chopper control register (ACQ_CVCR (hi))
Offset(137)
0x74
R
Access: User write
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
DBTM
Reset
IIRCM
0
PGAFM
0
0
Notes
137.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 142. I and V Chopper Control Register (ACQ_CVCR (hi)) - Register Field Descriptions
Field
5-4
DBTM[1:0]
3-1
IIRCM[2:0]
0
PGAFM
Description
Hold Time After Chopper Swap - Mask
0 - writing the DBT bits will have no effect
1 - writing the DBT bits will be effective
IIR Low Pass Filter Configuration - Mask
0 - writing the IIRC bits will have no effect
1 - writing the IIRC bits will be effective
PGA fast mode enable - Mask
0 - writing the PGAF bit will have no effect
1 - writing the PGAF bit will be effective
MM912_637, Rev. 3.0
Freescale Semiconductor
132
5.7.6.3.18
I and V Chopper Control Register (ACQ_CVCR (lo))
Table 143. I and V Chopper Control Register (ACQ_CVCR (lo))
Offset(138)
0x75
R
Access: User write
7
6
0
0
0
0
5
3
DBT
W
Reset
4
2
1
IIRC
0
0
1
0
PGAF
1
1
1
Notes
138.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 144. I and V Chopper Control Register (ACQ_CVCR (lo)) - Register Field Descriptions
Field
5-4
DBT[1:0]
3-1
IIRC[2:0]
0
PGAF
Description
Hold Time After Chopper Swap
00 - Hold after swap disabled
01 - 3 x 64 kHz cycles hold time for the SINC3-L8
10 - 4 x 64 kHz cycles hold time for the SINC3-L8
11 - 5 x 64 kHz cycles hold time for the SINC3-L8
IIR Low Pass Filter Coefficient (
000 - 1/8
001 - 1/16
010 - 1/32
011 - 1/64
100 - 1/128
101 - IIR disabled
110 - IIR disabled
111 - IIR disabled
PGA fast mode enable
0 - PGA capacitor swap disabled (slow mode).
1 - PGA capacitors swapped during chopper
NOTE
During Low Power mode: 0x15; (00010101b) is recommend for ACQ_CVCR (DBT =01, IIRC
= 010, PGAF = 1)
5.7.6.3.19
Low Power Current Threshold (ACQ_CTH)
Table 145. Low Power Current Threshold (ACQ_CTH
(139)
Offset
0x76
Access: User read / write
7
6
5
4
R
2
1
0
0
0
0
0
CTH[7:0]
W
Reset
3
0
0
0
0
Notes
139.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 146. Low Power Current Threshold (ACQ_CTH - Register Field Descriptions
Field
7-0
CTH[7:0]
Description
Low power current threshold
See Section 5.2.4.1.1.1, “Current Threshold Wake-up" for details.
MM912_637, Rev. 3.0
Freescale Semiconductor
133
5.7.6.3.20
Low Power Ah Counter Threshold (ACQ_AHTH1 (hi) / ACQ_AHTH1 (lo) /
ACQ_AHTH0 (hi) / ACQ_AHTH0 (lo))
Table 147. Low Power Ah Counter Threshold (ACQ_AHTH1 (hi) / ACQ_AHTH1 (lo) / ACQ_AHTH0 (hi) / ACQ_AHTH0 (lo))
Offset(140) 0x78 / 0x79 / 0x7A / 0x7B
7
R
6
Access: User read / write
5
4
3
2
1
0
0
0
0
0
0
W
R
W
AHTH[30:0]
R
W
R
W
Reset
0
0
0
0
Notes
140.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 148. Low Power Ah Counter Threshold (ACQ_AHTH1 (hi) / ACQ_AHTH1 (lo) / ACQ_AHTH0 (hi) / ACQ_AHTH0 (lo))
- Register Field Descriptions
Field
Description
30-0
AHTH[30:0]
Low power Ah counter threshold. Absolute (unsigned) 31-Bit integer. Reading one 16-Bit part of the register will buffer the
second. Reading the second will unlock the buffer. See Section 5.2.4.1.1.2, “Current Ampere Hour Threshold Wake-up". for
details on the Register.
5.7.6.3.21
Low Power Ah Counter (ACQ_AHC1 (hi) / ACQ_AHC1 (lo) / ACQ_AHC0 (hi) /
ACQ_AHC0 (lo))
Table 149. Low power Ah counter (ACQ_AHC1 (hi) / ACQ_AHC1 (lo) / ACQ_AHC0 (hi) / ACQ_AHC0 (lo))
Offset(141)
0x7C / 0x7D / 0x7E / 0x7F
7
R
6
Access: User read
5
4
3
2
1
0
AHC[31:0]
W
R
AHC[23:16]
W
R
AHC[15:8]
W
R
AHC[7:0]
W
Notes
141.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
MM912_637, Rev. 3.0
Freescale Semiconductor
134
Table 150. Low Power Ah Counter (ACQ_AHC1 (hi) / ACQ_AHC1 (lo) / ACQ_AHC0 (hi) / ACQ_AHC0 (lo)) - Register Field
Descriptions
Field
Description
31-0
AHC[31:0]
5.7.6.3.22
Low power Ah counter (32-Bit signed integer, two’s complement). Reading one 16-Bit part of the register will buffer the
second. Reading the second will unlock the buffer. See Section 5.2.4.1.1.2, “Current Ampere Hour Threshold Wake-up".
Low Pass Filter Coefficient Ax (LPF_Ax (hi))
Table 151. Low Pass Filter Coefficient Ax (LPF_Ax (hi))
Offset(142) 0x80...0x9E
7
Access: User read/write
6
5
4
R
3
2
1
0
Ax[15:8]
W
Reset
see Table 154
Notes
142.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
5.7.6.3.23
Low Pass Filter Coefficient Ax (LPF_Ax (lo))
Table 152. Low Pass Filter Coefficient Ax (LPF_Ax (lo))
(143)
Offset
0x81...0x9F
7
Access: User read/write
6
5
4
R
3
2
1
0
Ax[7:0]
W
Reset
see Table 154
Notes
143.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 153. Low Pass Filter Coefficient Ax - Register Field Descriptions
Field
15-0
Description
Low Pass Filter Coefficient Value. x = 0...15. Data Format: MSB = Sign (“1” minus). [14:0] integer.
Ax[15:0]
Table 154. Low Pass Filter Coefficient Ax - Reset Values
Field
Reset Value
Field
Reset Value
A0
0x00F5
A8
0x1021
A1
0x0312
A9
0x0E35
A2
0x051F
A10
0x0B44
A3
0x0852
A11
0x0852
A4
0x0B44
A12
0x051F
A5
0x0E35
A13
0x0312
A6
0x1021
A14
0x00F5
A7
0x10E5
A15
0x0000
MM912_637, Rev. 3.0
Freescale Semiconductor
135
5.7.6.3.24
Compensation control register (COMP_CTL)
Table 155. Compensation Control Register (COMP_CTL)
Offset
0xA0
Access: User read/write
(144)(145)
15
R
14
0
W
0
BGCALM
Reset
12
11
10
9
0
0
0
0
0
PGAZM
PGAOM
DIAGVM
DIAGIM
8
0
CALIEM
0
0
0
0
0
0
0
0
7
6
5
4
3
2
1
0
PGAZ
PGAO
DIAGV
DIAGI
0
0
0
0
R
BGCAL
W
Reset
13
1
0
0
0
CALIE
0
Notes
144.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
145.This Register is 16-Bit access only.
Table 156. Compensation Control Register (COMP_CTL) - Register Field Descriptions
Field
15-14
BGCALM
13
PGAZM
12
PGAOM
11
DIAGVM
10
DIAGIM
8
CALIEM
7-6
BGCAL
5
PGAZ
4
PGAO
Description
Calibration Band Gap Select - Mask
0 - writing the corresponding BGCAL bits will have no effect
1 - writing the corresponding BGCAL bits will be effective
PGA Input Zero - Mask
0 - writing the PGAZ bit will have no effect
1 - writing the PGAZ bit will be effective
PGA Offset Calibration - Mask
0 - writing the PGAO bit will have no effect
1 - writing the PGAO bit will be effective
Diagnostic Mode Voltage Channel - Mask
0 - writing the DIAGV bit will have no effect
1 - writing the DIAGV bit will be effective
Diagnostic Mode Current Channel - Mask
0 - writing the DIAGI bit will have no effect
1 - writing the DIAGI bit will be effective
Calibration IRQ Enable - Mask
0 - writing the CALIE bit will have no effect
1 - writing the CALIE bit will be effective
Calibration Band Gap Select
00 - Bandgap disconnected from calibration
01 - BG1 selected as calibration reference
10 - BG2 selected as calibration reference (default)
11 - BG3 selected as calibration reference
PGA Input Zero
0 - Programmable gain amplifier inputs in normal operation
1 - Programmable gain amplifier inputs shorted for Calibration
PGA Offset Calibration Start
0 - PGA normal operation
1 - PGA internal offset calibration start (PGAOF will indicate calibration complete). PGAZ has to be set to 1 during calibration.
The bit will remain set after the calibration is complete. It has to be cleared by writing 0 before it can be set to start the next
calibration. The current measurement channel has to be enabled (ACQ_CTL[CMEN]=1) in order to perform the PGA offset
compensation.
MM912_637, Rev. 3.0
Freescale Semiconductor
136
Table 156. Compensation Control Register (COMP_CTL) - Register Field Descriptions
Field
Description
Diagnostic Mode Voltage Channel
0 - Calibration reference disconnected from the voltage channel input
1 - Calibration reference connected to the voltage channel input for calibration. Manual conversion needed to measure
reference
3
DIAGV
Diagnostic Mode Current Channel
0 - Calibration reference disconnected from the current channel input
1 - Calibration reference connected to the current channel input for calibration. Manual conversion needed to measure
reference
2
DIAGI
Calibration IRQ Enable
0 - Calibration request interrupt disabled
1 - Calibration request interrupt enabled. A temperature “out of calibration range” will cause a calibration interrupt request
0
CALIE
5.7.6.3.25
Compensation Status Register (COMP_SR)
Table 157. Compensation Status Register (COMP_SR)
Offset(146)
0xA2
R
Access: User read/write
7
6
5
4
3
2
1
0
0
BGRF
0
PGAOF
0
0
0
CALF
0
0
0
0
W
Write 1 will clear the flags and will start next calibration steps
Reset
0
0
0
0
Notes
146.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 158. Compensation Status Register (COMP_SR) - Register Field Descriptions
Field
Description
Band Gap Reference Status Flag
0 - Indicates the reference bandgap has not been set / applied
1 - Reference bandgap has been set. Writing 1 will clear the flag
6
BGRF
PGA Internal Offset Compensation Complete Flag
0 - PGA offset compensation ongoing or not started since last flag clear
1 - PGA offset compensation finished since last flag clear. Writing 1 will clear the flag
4
PGAOF
Calibration Request Status Flag
0 - No Temperature out of range condition detected
1 - Temperature out of range condition detected. Writing 1 will clear the flag
0
CALF
5.7.6.3.26
Temperature Filtering Period (COMP_TF)
Table 159. Temperature Filtering Period (COMP_TF)
Offset(147)
R
0xA3
Access: User read / write
7
6
5
4
3
0
0
0
0
0
0
0
0
0
0
2
0
TMF[2:0]
W
Reset
1
0
0
0
Notes
147.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
MM912_637, Rev. 3.0
Freescale Semiconductor
137
Table 160. Temperature Filtering Period (COMP_TF) - Register Field Descriptions
Field
Description
2-0
TMF[2:0]
Recalibration Temperature Filtering period. Defines the number of measurements above / below the Max / Min thresholds
that are required before a calibration request is detected.
5.7.6.3.27
Max Temp. Before Recalibration (COMP_TMAX)
Table 161. Max Temp. Before Recalibration (COMP_TMAX)
Offset
0xA4
Access: User read/write
(148)(149)
15
14
13
12
R
11
10
9
8
TCMAX[15:8]
W
Reset
0
0
0
0
0
0
0
0
7
6
5
4
3
2
1
0
0
0
0
0
R
TCMAX[7:0]
W
Reset
0
0
0
0
Notes
148.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
149.This Register is 16 Bit access only.
Table 162. Max Temp. Before Recalibration (COMP_TMAX) - Register Field Descriptions
Field
Description
15-0
Maximum Temperature before recalibration. Once the internal temperature measurement result is above or equal to TCMAX,
the TMF filter counter is increased, if below, the counter is decreased.
TCMAX[15:0]
5.7.6.3.28
Min Temp. Before Recalibration (COMP_TMIN)
Table 163. Min Temp. Before Recalibration (COMP_TMIN)
Offset
0xA6
Access: User read/write
(150)(151)
15
14
13
12
R
9
8
0
0
0
0
0
0
0
0
7
6
5
4
3
2
1
0
0
0
0
0
R
TCMIN[7:0]
W
Reset
10
TCMIN[15:8]
W
Reset
11
0
0
0
0
Notes
150.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
151.This Register is 16-Bit access only.
MM912_637, Rev. 3.0
Freescale Semiconductor
138
Table 164. Min Temp. Before Recalibration (COMP_TMIN) - Register Field Descriptions
Field
Description
15-0
Minimum Temperature before recalibration. Once the internal temperature measurement result is below TCMIN, the TMF filter
counter is increased, if above or equal, the counter is decreased.
TCMIN[15:0]
5.7.6.3.29
Offset voltage compensation (COMP_VO)
Table 165. Offset Voltage Compensation (COMP_VO)
Offset(152)
0xAA
Access: User read/write
7
6
5
4
R
3
2
1
0
0
0
0
0
VOC[7:0]
W
Reset
0
0
0
0
Notes
152.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 166. Offset Voltage Compensation (COMP_VO) - Register Field Descriptions
Field
Description
7-0
Voltage Offset Compensation Buffer. This register contains the voltage channel offset compensation as an 8-bit signed char
(two complement). 0x7F = max, 0x80 =min.
VOC[7:0]
5.7.6.3.30
Offset current compensation window (COMP_IO)
Table 167. Offset Current Compensation Window (COMP_IO)
Offset(153)
0xAB
Access: User read/write
7
6
5
4
R
3
2
1
0
0
0
0
0
COC[7:0]
W
Reset
0
0
0
0
Notes
153.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 168. Offset Current Compensation Window (COMP_IO) - Register Field Descriptions
Field
7-0
COC[7:0]
Description
Current Offset Compensation Buffer window for the 8 current compensation values stored. The content of the IGAIN[2:0]
register will determine the compensation buffer accessed through the COC[7:0] register. This register contains the current
channel offset compensation as 8-bit signed char (two complement). 0x7F = max, 0x80 =min.
MM912_637, Rev. 3.0
Freescale Semiconductor
139
5.7.6.3.31
Gain Voltage Comp. VSENSE Channel (COMP_VSG)
Table 169. Gain Voltage Comp. VSENSE Channel (COMP_VSG)
Offset
0xAC
Access: User read/write
(154)(155)
R
15
14
13
12
11
10
9
0
0
0
0
0
0
0
0
0
0
0
0
0
0
7
6
5
4
3
2
1
0
0
0
0
0
VSGC[9:8]
W
Reset
R
8
VSGC[7:0]
W
Reset
0
0
0
0
Notes
154.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
155.This Register is 16 Bit access only.
Table 170. Gain Voltage Comp. VSENSE Channel (COMP_VSG) - Register Field Descriptions
Field
Description
9-0
Voltage Channel Gain Compensation Buffer. This register contains the voltage channel gain compensation as 10-bit special
coded value. Refer to Section 5.7.3.4, “Compensation" for details.
VSGC[9:0]
5.7.6.3.32
8 x Gain Current Compensation 4...512 (COMP_IG4... COMP_IG512)
Table 171. 8 x Gain Current Compensation 4...512 (COMP_IG4... COMP_IG512)
Offset
0xB0... 0xBE
Access: User read/write
(156)(157)
R
15
14
13
12
11
10
0
0
0
0
0
0
0
0
0
0
0
0
1
0
7
6
5
4
3
2
1
0
0
0
0
W
Reset
R
8
IGC4...512 (hi) [9:8]
IGC4...512 (lo) [7:0]
W
Reset
9
0
0
0
0
0
Notes
156.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
157.This Register is 16 Bit access only.
MM912_637, Rev. 3.0
Freescale Semiconductor
140
Table 172. 8 x Gain Current Compensation 4...512 (COMP_IG4 COMP_IG512) - Register Field Descriptions
Field
Description
9-0
Individual Current Gain Compensation Buffers for the 8 Gain configurations. Those registers contain the current channel gain
compensation as 10-bit special coded value. Refer to Section 5.7.3.4, “Compensation" for details.
IGC4[9:0]
IGC8[9:0]
IGC16[9:0]
IGC32[9:0]
IGC64[9:0]
IGC128[9:0]
IGC256[9:0]
IGC512[9:0]
5.7.6.3.33
8 x Offset PGA Compensation (COMP_PGAO4COMP_PGAO512)
Table 173. 8 x Offset PGA Compensation (COMP_PGAO4... COMP_PGAO512)
Offset
0xC0... 0xCE
Access: User read/write
(158)(159)
R
15
14
13
12
11
0
0
0
0
0
10
0
0
0
0
0
0
0
0
7
6
5
4
3
2
1
0
0
0
0
R
8
PGAOC4...512 (hi) [10:8]
W
Reset
9
PGAOC4...512 (lo) [7:0]
W
Reset
0
0
0
0
0
Notes
158.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
159.This Register is 16 Bit access only.
Table 174. 8 x Offset PGA Compensation (COMP_PGAO4...COMP_PGAO512) - Register Field Descriptions
Field
10-0
PGAOC4[10:0]
Description
Individual PGA Offset Compensation Buffers for the 8 Gain configurations. Those registers contain the PGA Offset
compensation as 11-bit special coded value. Refer to Section 5.7.3.4, “Compensation" for details.
PGAOC8[10:0]
PGAOC16[10:0]
PGAOC32[10:0]
PGAOC64[10:0]
PGAOC128[10:0]
PGAOC256[10:0]
PGAOC512[10:0]
MM912_637, Rev. 3.0
Freescale Semiconductor
141
5.7.6.3.34
Internal Temp. Offset Compensation (COMP_ITO)
Table 175. Internal Temp. Offset Compensation (COMP_ITO)
Offset(160)
0xD0
Access: User read/write
7
6
5
4
R
3
2
1
0
0
0
0
0
ITOC[7:0]
W
Reset
0
0
0
0
Notes
160.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 176. Internal Temp. Offset Compensation (COMP_ITO) - Register Field Descriptions
Field
Description
7-0
ITOC[7:0]
Internal Temperature Offset Compensation Buffer. This register contains the Internal Temperature Offset compensation as
8-bit signed char (two complement). Refer to Section 5.7.3.4, “Compensation" for details.
5.7.6.3.35
Internal Temp. Gain Compensation (COMP_ITG)
Table 177. Internal Temp. Gain Compensation (COMP_ITG)
(161)
Offset
0xD1
Access: User read/write
7
6
5
4
R
3
2
1
0
0
0
0
0
ITGC[7:0]
W
Reset
1
0
0
0
Notes
161.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 178. Internal Temp. Gain Compensation (COMP_ITG) - Register Field Descriptions
Field
Description
7-0
Internal Temperature Gain Compensation Buffer. This register contains the Internal Temperature Gain compensation as 8-bit
special coded value. Refer to Section 5.7.3.4, “Compensation" for details.
ITGC[7:0]
5.7.6.3.36
External Temp. Offset Compensation (COMP_ETO)
Table 179. External Temp. Offset Compensation (COMP_ETO)
Offset(162
0xD2
Access: User read/write
)
7
6
5
4
R
2
1
0
0
0
0
0
ETOC[7:0]
W
Reset
3
0
0
0
0
Notes
162.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
MM912_637, Rev. 3.0
Freescale Semiconductor
142
Table 180. External Temp. Offset Compensation (COMP_ETO) - Register Field Descriptions
Field
Description
7-0
External Temperature Offset Compensation Buffer. This register contains the External Temperature Offset compensation as
8-bit signed char (two complement). Refer to Section 5.7.3.4, “Compensation" for details.
ETOC[7:0]
5.7.6.3.37
External Temp. Gain Compensation (COMP_ETG)
Table 181. External Temp. Gain Compensation (COMP_ETG)
Offset(163)
0xD3
Access: User read/write
7
6
5
4
R
3
2
1
0
0
0
0
0
ETGC[7:0]
W
Reset
1
0
0
0
Notes
163.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 182. External Temp. Gain Compensation (COMP_ETG) - Register Field Descriptions
Field
7-0
ETGC[7:0]
Description
External Temperature Gain Compensation Buffer. This register contains the External Temperature Gain compensation as
8-bit special coded value. Refer to Section 5.7.3.4, “Compensation" for details.
MM912_637, Rev. 3.0
Freescale Semiconductor
143
Window Watchdog
5.8
Window Watchdog
The MM912_637 analog die includes a configurable window watchdog which is active in Normal mode. The watchdog
module is based on the Low Power Oscillator (LPCLK) to operate independently from the MCU based D2DCLK clock.
The watchdog timeout (tWDTO) can be configured between 4.0 ms and 2048 ms using the watchdog control register
(WD_CTL).
MCU
ANALOG
NOTE
As the watchdog timing is based on the LPCLK, its accuracy is based on the trimming
applied to the TRIM_OSC register. The given timeout values are typical values only.
During Low Power mode, the watchdog feature is not active, a D2D read during Stop mode will have the WDOFF bit set. After
wake-up and transition to Normal mode, the watchdog is reset to the same state as when following a Power-On-Reset (POR).
To clear the watchdog counter, a alternating write has to be performed to the watchdog rearm register (WD_RR). The first write
after the wake-up or RESET_A has been released has to be 0xAA, the next one has to be 0x55.
After the wake-up or RESET_A has been released, there will be a standard (non window) watchdog active with a fixed timeout
of tIWDTO (tWDTO = b100 = 256 ms). The Watchdog Window Open (WDWO) bit is set during that time.
WD Register
WRITE = 0xAA
(to be continued)
Window WD timing (tWDTO)
tWDTO / 2
tWDTO / 2
RESET_A release
WD Register
WRITE = 0x55
Initial WD Reg.
WRITE = 0xAA
Window Watch Dog
Window Closed
Window Watch Dog
Window Closed
Window Watch Dog
Window Open
Window Watch Dog
Window Open
Standard Initial Watch Dog (no window)
t
tIWDTO
Figure 39. MM912_637 Analog Die Watchdog Operation
To change from the standard initial watchdog to the window watchdog, the initial counter reset has to be performed by writing
0xAA to the Watchdog rearm register (WD_RR) before tIWDTO is reached.
NOTE
An immediate trimming of the low power oscillator after reset release assures tIWDTO being
at the maximum accuracy.
If the tIWDTO timeout is reached with no counter reset or a value different from 0xAA written to the WD_RR, a watchdog reset will
occur.
Once entering window watchdog mode, the first half of the time, tWDTO is forbidden for a counter reset. To reset the watchdog
counter, a alternating write of 0x55 and 0xAA has to be performed within the second half of the tWDTO. A Window Open (WDWO)
flag will indicate the current status of the window. A timeout or wrong value written to the WD_RR will force a watchdog reset.
If the first write to the WD_CTL register is 000 (WD OFF), the WD will be disabled(164). If a different cycle time is written or the
WD is refreshed with the default Window (100) unchanged, no further “000” write will be effective (a change of cycle time would
still be possible).
Notes
164.The Watchdog can be enabled any time later.
MM912_637, Rev. 3.0
Freescale Semiconductor
144
Window Watchdog
5.8.1
5.8.1.1
Memory Map and Registers
Overview
This section provides a detailed description of the memory map and registers.
5.8.1.2
Module Memory Map
The memory map for the Watchdog module is given in Table 183
Table 183. Module Memory Map
Offset
0x10
Name
WD_CTL
Watchdog control register
7
6
5
4
3
2
1
0
R
0
0
0
0
0
0
0
0
W
WDTST
M
R
W
0x12
0x13
0x14
WD_SR
R
Watchdog status register
W
Reserved
R
Watchdog rearm register
W
Reserved
0x16
Reserved
0x17
Reserved
0
0
0
0
0
0
0
0
0
WDOFF
WDWO
0
0
0
0
0
0
0
0
WDTO[2:0]
W
WD_RR
0x15
0
WDTST
R
WDTOM[2:0]
R
WDR[7:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
R
W
R
W
Notes
165.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
166.Register Offset with the “lo” address value not shown have to be accessed in 16-Bit mode. 8-Bit access will not function.
5.8.1.3
Register Descriptions
This section consists of register descriptions in address order. Each description includes a standard register diagram with an
associated figure number. Details of register bits and field function follow the register diagrams, in bit order.
MM912_637, Rev. 3.0
Freescale Semiconductor
145
Window Watchdog
5.8.1.3.1
Watchdog Control Register (WD_CTL)
Table 184. Watchdog Control Register (WD_CTL)
Offset
0x10
Access: User write
(167),(168)
15
14
13
12
11
10
0
0
0
0
0
9
8
0
0
R
0
W
WDTSTM
Reset
0
0
0
0
0
0
0
0
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
R
WDTOM
WDTST
W
Reset
1
WDTO
1
0
0
Notes
167.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
168.This Register is 16 Bit access only.
Table 185. Watchdog Control Register (WD_CTL) - Register Field Descriptions
Field
Description
15
WDTSTM
10-8
WDTOM[2:0]
7
Watchdog Test - Mask
0 - writing the WDTST bit will have no effect
1 - writing the WDTST bit will be effective
Watchdog Timeout - Mask
0 - writing the WDTO bits will have no effect
1 - writing the WDTO bits will be effective
Watchdog Test
This bit is implemented for test purpose and has no function in Normal mode.
WDTST
2-0
WDTO[2:0]
5.8.1.3.2
Watchdog Timeout Configuration - configuring the watchdog timeout duration tWDTO.
000 - Watchdog OFF
001 - 4.0 ms
010 - 16.0 ms
011 - 64.0 ms
100 - 256 ms (default)
101 - 512 ms
110 - 1024 ms
111 - 2048 ms
Watchdog status register (WD_SR)
Table 186. Watchdog Status Register (WD_SR)
Offset(169)
R
0x12
Access: User read
7
6
5
4
3
2
1
0
0
0
0
0
0
0
WDOFF
WDWO
W
Notes
169.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
MM912_637, Rev. 3.0
Freescale Semiconductor
146
Window Watchdog
Table 187. Watchdog Status Register (WD_SR) - Register Field Descriptions
Field
Description
1
WDOFF
0
WDWO
5.8.1.3.3
Watchdog Status - Indicating the watchdog module being enabled/disabled
1 - Watchdog Off
0 - Watchdog Active
Watchdog Window Status
1 - Open - Indicating the watchdog window is currently open for counter reset.
0 - Closed - Indicating the watchdog window is currently closed for counter reset. Resetting the watchdog with the window
closed will cause a watchdog - reset.
Watchdog Rearm Register (WD_RR)
Table 188. Watchdog Rearm Register (WD_RR)
(170)
Offset
0x14
Access: User read/write
7
6
5
4
R
3
2
1
0
0
0
0
0
WDR
W
Reset
0
0
0
0
Notes
170.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 189. Watchdog Rearm Register (WD_RR) - Register Field Descriptions
Field
7-0
WDR[7:0]
Description
Watchdog rearm register- Writing this register with the correct value (0xAA alternating 0x55) while the window is open will
reset the watchdog counter. Writing the register while the watchdog is disabled will have no effect.
MM912_637, Rev. 3.0
Freescale Semiconductor
147
Basic Timer Module - TIM (TIM16B4C)
5.9
Basic Timer Module - TIM (TIM16B4C)
MCU
5.9.1
ANALOG
Introduction
5.9.1.1
Overview
The basic timer consists of a 16-bit, software-programmable counter driven by a seven stage programmable prescaler.
This timer can be used for many purposes, including input waveform measurements while simultaneously generating an output
waveform. Pulse widths can vary from microseconds to many seconds.
This timer contains four complete input capture/output compare channels [IOC 3:0]. The input capture function is used to detect
a selected transition edge and record the time. The output compare function is used for generating output signals or for timer
software delays.
Full access for the counter registers or the input capture/output compare registers should take place in a16-bit word access.
Accessing high bytes and low bytes separately for all of these registers may not yield the same result as accessing them in one
word.
5.9.1.2
Features
The TIM16B4C includes these distinctive features:
•
Four input capture/output compare channels.
•
Clock prescaler
•
16-bit counter
5.9.1.3
Modes of Operation
The TIM16B4C is driven by the D2DCLK / 4 during Normal mode and the ALFCLK during Low Power mode.
5.9.1.4
Block Diagram
Channel 0
Input capture
Output compare
D2DCLK / 4 or
ALFCLK
Prescaler
Timer overflow
interrupt
16-bit Counter
Channel 2
Input capture
Output compare
Timer channel 0
interrupt
Registers
Timer channel 3
interrupt
Channel 1
Input capture
Output compare
Channel 3
Input capture
Output compare
IOC0
IOC1
IOC2
IOC3
Figure 40. Timer Block Diagram
For more information on the respective functional descriptions see Section 5.9.4, “Functional Description" of this chapter.
MM912_637, Rev. 3.0
Freescale Semiconductor
148
Basic Timer Module - TIM (TIM16B4C)
5.9.2
Signal Description
5.9.2.1
Overview
The TIM16B4C module can be used as regular time base, or can be internally routed to the PTB and LIN module. Refer to the
corresponding sections for further details, see Section 5.11, “LIN" and Section 5.10, “General Purpose I/O - GPIO". In addition,
the TIM16B4C module is used during Low Power mode to determine the cyclic wake-up and current measurement timing
(Section 5.2, “Analog Die - Power, Clock and Resets - PCR")
5.9.2.2
Detailed Signal Descriptions
5.9.2.2.1
IOC3 – Input capture and Output compare channel 3
This pin serves as the input capture or output compare for channel 3.
5.9.2.2.2
IOC2 – Input capture and Output compare channel 2
This pin serves as the input capture or output compare for channel 2.
5.9.2.2.3
IOC1 – Input capture and Output compare channel 1
This pin serves as the input capture or output compare for channel 1.
5.9.2.2.4
IOC0 – Input capture and Output compare channel 0
This pin serves as the input capture or output compare for channel 0.
5.9.3
Memory Map and Registers
5.9.3.1
Overview
This section provides a detailed description of all memory and registers.
5.9.3.2
Module Memory Map
The memory map for the TIM16B4C module is given in Table 190.
Table 190. Module Memory Map
Offset
Name
TIOS
R
0x20
Timer Input Capture/Output
Compare Select
W
0x21
(172)
0x22
0x23
CFORC
R
Timer Compare Force Register
W
OC3M
R
Output Compare 3 Mask
Register
W
OC3D
R
Output Compare 3 Data
Register
W
7
6
5
4
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
2
1
0
IOS3
IOS2
IOS1
IOS0
0
0
0
0
FOC3
FOC2
FOC1
FOC0
OC3M3
OC3M2
OC3M1
OC3M0
OC3D3
OC3D2
OC3D1
OC3D0
0
0
MM912_637, Rev. 3.0
Freescale Semiconductor
149
Basic Timer Module - TIM (TIM16B4C)
Table 190. Module Memory Map
Offset
0x24
(173)
0x25
(173)
0x26
0x27
0x28
0x29
0x2A
0x2B
0x2C
0x2D
0x2E
(174)
0x2F
(174)
0x30
(174)
0x31
(174)
0x32
(174)
0x33
(174)
0x34
(174)
0x35
(174)
Name
7
TCNT (hi)
R
Timer Count Register
W
TCNT (lo)
R
Timer Count Register
W
TSCR1
R
Timer System Control Register 1 W
TTOV
R
Timer Toggle Overflow Register
W
TCTL1
R
Timer Control Register 1
W
TCTL2
R
Timer Control Register 2
W
TIE
R
Timer Interrupt Enable Register
W
TSCR2
R
Timer System Control Register 2 W
TFLG1
R
Main Timer Interrupt Flag 1
W
TFLG2
R
Main Timer Interrupt Flag 2
W
TC0 (hi)
R
Timer Input Capture/Output
Compare Register 0
W
TC0 (lo)
R
Timer Input Capture/Output
Compare Register 0
W
TC1 (hi)
R
Timer Input Capture/Output
Compare Register 1
W
TC1 (lo)
R
Timer Input Capture/Output
Compare Register 1
W
TC2 (hi)
R
Timer Input Capture/Output
Compare Register 2
W
TC2 (lo)
R
Timer Input Capture/Output
Compare Register 2
W
TC3 (hi)
R
Timer Input Capture/Output
Compare Register 3
W
TC3 (lo)
R
Timer Input Capture/Output
Compare Register 3
W
6
5
4
3
2
1
0
0
0
0
0
TOV3
TOV2
TOV1
TOV0
TCNT
0
0
0
0
0
0
OM3
OL3
OM2
OL2
OM1
OL1
OM0
OL0
EDG3B
EDG3A
EDG2B
EDG2A
EDG1B
EDG1A
EDG0B
EDG0A
0
0
0
0
C3I
C2I
C1I
C0I
0
0
0
TCRE
PR2
PR1
PR0
0
0
0
C3F
C2F
C1F
C0F
0
0
0
0
0
0
0
TEN
TOI
0
TOF
TFFCA
TC0
TC1
TC2
TC3
MM912_637, Rev. 3.0
Freescale Semiconductor
150
Basic Timer Module - TIM (TIM16B4C)
Table 190. Module Memory Map
Offset
Name
TIMTST
R
Timer Test Register
W
0x36
(173)
7
6
5
4
3
2
0
0
0
0
0
0
1
0
0
TCBYP
Notes
171.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
172.Always reads $00.
173.Only writable in special modes. (Refer to the SOC Guide for different modes).
174.A write to these registers has no meaning or effect during input capture.
5.9.3.3
Register Descriptions
This section consists of register descriptions in address order. Each description includes a standard register diagram with an
associated figure number. Details of register bit and field function follow the register diagrams, in bit order.
5.9.3.3.1
Timer Input Capture/Output Compare Select (TIOS)
Table 191. Timer Input Capture/Output Compare Select (TIOS)
Offset(175) 0x20
R
Access: User read/write
7
6
5
4
0
0
0
0
0
0
0
0
W
Reset
3
2
1
0
IOS3
IOS2
IOS1
IOS0
0
0
0
0
Notes
175.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 192. TIOS - Register Field Descriptions
Field
Description
3-0
IOS[3-0]
5.9.3.3.2
Input Capture or Output Compare Channel Configuration
0 - The corresponding channel acts as an input capture.
1 - The corresponding channel acts as an output compare.
Timer Compare Force Register (CFORC)
Table 193. Timer Compare Force Register (CFORC)
Offset(176)
0x21
R
Access: User write
7
6
5
4
0
0
0
0
W
Reset
0
0
0
3
2
1
0
0
0
0
0
FOC3
FOC2
FOC1
FOC0
0
0
0
0
0
Notes
176.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 194. CFORC - Register Field Descriptions
Field
3-0
FOC[3-0]
Description
Force Output Compare Action for Channel 3-0
0 - Force output compare action disabled. Input capture or output compare channel configuration
1 - Force output compare action enabled
MM912_637, Rev. 3.0
Freescale Semiconductor
151
Basic Timer Module - TIM (TIM16B4C)
A write to this register with the corresponding (FOC 3:0) data bit(s) set causes the action programmed for output compare on
channel “n” to occur immediately.The action taken is the same as if a successful comparison had just taken place with the TCn
register, except the interrupt flag does not get set.
NOTE
A successful channel 3 output compare overrides any channel 2:0 compare. If a forced
output compare on any channel occurs at the same time as the successful output compare,
then a forced output compare action will take precedence and the interrupt flag will not get
set.
5.9.3.3.3
Output Compare 3 Mask Register (OC3M)
Table 195. Output Compare 3 Mask Register (OC3M)
(177)
Offset
0x22
R
Access: User read/write
7
6
5
4
0
0
0
0
0
0
0
0
W
Reset
3
2
1
0
OC3M3
OC3M2
OC3M1
OC3M0
0
0
0
0
Notes
177.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 196. OC3M - Register Field Descriptions
Field
Description
3-0
OC3M[3-0]
Output Compare 3 Mask “n” Channel bit
0 - Does not set the corresponding port to be an output port
1 - Sets the corresponding port to be an output port when this corresponding TIOS bit is set to be an output compare
Setting the OC3Mn (n ranges from 0 to 2) will set the corresponding port to be an output port when the corresponding TIOSn (n
ranges from 0 to 2) bit is set to be an output compare.
NOTE
A successful channel 3 output compare overrides any channel 2:0 compares. For each
OC3M bit that is set, the output compare action reflects the corresponding OC3D bit.
5.9.3.3.4
Output Compare 3 Data Register (OC3D)
Table 197. Output Compare 3 Data Register (OC3D)
Offset(178)
R
0x23
Access: User read/write
7
6
5
4
0
0
0
0
0
0
0
0
W
Reset
3
2
1
0
OC3D3
OC3D2
OC3D1
OC3D0
0
0
0
0
Notes
178.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
MM912_637, Rev. 3.0
Freescale Semiconductor
152
Basic Timer Module - TIM (TIM16B4C)
Table 198. OC3D - Register Field Descriptions
Field
Description
3
Output Compare 3 Data for Channel 3
OC3D3
2
Output Compare 3 Data for Channel 2
OC3D2
1
Output Compare 3 Data for Channel 1
OC3D1
0
Output Compare 3 Data for Channel 0
OC3D0
NOTE
A channel 3 output compare will cause bits in the output compare 3 data register to transfer
to the timer port data register if the corresponding output compare 3 mask register bits are
set.
5.9.3.3.5
Timer Count Register (TCNT)
Table 199. Timer Count Register (TCNT)
(179)
Offset
0x24, 0x25
R
W
Reset
R
W
Reset
Access: User read (anytime)/write (special mode)
15
14
13
12
11
10
9
8
tcnt15
tcnt14
tcnt13
tcnt12
tcnt11
tcnt10
tcnt9
tcnt8
0
0
0
0
0
0
0
0
7
6
5
4
3
2
1
0
tcnt7
tcnt6
tcnt5
tcnt4
tcnt3
tcnt2
tcnt1
tcnt0
0
0
0
0
0
0
0
0
Notes
179.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 200. TCNT - Register Field Descriptions
Field
15-0
Description
16-Bit Timer Count Register
tcnt[15-0]
NOTE
The 16-bit main timer is an up counter. Full access to the counter register should take place
in one clock cycle. A separate read/write for high bytes and low bytes will give a different
result than accessing them as a word. The period of the first count after a write to the TCNT
registers may be a different length, because the write is not synchronized with the prescaler
clock.
MM912_637, Rev. 3.0
Freescale Semiconductor
153
Basic Timer Module - TIM (TIM16B4C)
5.9.3.3.6
Timer System Control Register 1 (TSCR1)
Table 201. Timer System Control Register 1 (TSCR1)
Offset(180)
0x26
Access: User read/write
7
R
TEN
W
Reset
0
6
5
0
0
0
0
4
TFFCA
0
3
2
1
0
0
0
0
0
0
0
0
0
Notes
180.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 202. TSCR1 - Register Field Descriptions
Field
Description
Timer Enable
1 = Enables the timer.
0 = Disables the timer. (Used for reducing power consumption).
7
TEN
4
TFFCA
5.9.3.3.7
Timer Fast Flag Clear All
1 = For TFLG1 register, a read from an input capture or a write to the output compare channel [TC 3:0] causes the
corresponding channel flag, CnF, to be cleared. For TFLG2 register, any access to the TCNT register clears the TOF flag.
This has the advantage of eliminating software overhead in a separate clear sequence. Extra care is required to avoid
accidental flag clearing due to unintended accesses.
0 = Allows the timer flag clearing.
Timer Toggle On Overflow Register 1 (TTOV)
Table 203. Timer Toggle On Overflow Register 1 (TTOV)
Offset(181)
0x27
R
Access: User read/write
7
6
5
4
0
0
0
0
0
0
0
0
W
Reset
3
2
1
0
TOV3
TOV2
TOV1
TOV0
0
0
0
0
Notes
181.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 204. TTOV - Register Field Descriptions
Field
3-0
TOV[3-0]
Description
Toggle On Overflow Bits
1 = Toggle output compare pin on overflow feature enabled.
0 = Toggle output compare pin on overflow feature disabled.
NOTE
TOVn toggles the output compare pin on overflow. This feature only takes effect when the
corresponding channel is configured for an output compare mode. When set, an overflow
toggle on the output compare pin takes precedence over forced output compare events.
MM912_637, Rev. 3.0
Freescale Semiconductor
154
Basic Timer Module - TIM (TIM16B4C)
5.9.3.3.8
Timer Control Register 1 (TCTL1)
Table 205. Timer Control Register 1 (TCTL1)
Offset(182)
0x28
R
W
Reset
Access: User read/write
7
6
5
4
3
2
1
0
OM3
OL3
OM2
OL2
OM1
OL1
OM0
OL0
0
0
0
0
0
0
0
0
Notes
182.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 206. TCTL1 - Register Field Descriptions
Field
Description
7,5,3,1
Output Mode bit
OMn
6,4,2,0
Output Level bit
OLn
NOTE
These four pairs of control bits are encoded to specify the output action to be taken as a
result of a successful Output Compare on “n” channel. When either OMn or OLn, the pin
associated with the corresponding channel becomes an output tied to its IOC. To enable
output action by the OMn and OLn bits on a timer port, the corresponding bit in OC3M should
be cleared.
Table 207. Compare Result Output Action
5.9.3.3.9
OMn
OLn
Action
0
0
Timer disconnected from output pin logic
0
1
Toggle OCn output line
1
0
Clear OCn output line to zero
1
1
Set OCn output line to one
Timer Control Register 2 (TCTL2)
Table 208. Timer Control Register 2 (TCTL2)
Offset(183)
0x29
R
W
Reset
Access: User read/write
7
6
5
4
3
2
1
0
EDG3B
EDG3A
EDG2B
EDG2A
EDG1B
EDG1A
EDG0B
EDG0A
0
0
0
0
0
0
0
0
Notes
183.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 209. TCTL2 - Register Field Descriptions
Field
EDGnB,EDGn
A
Description
Input Capture Edge Control
MM912_637, Rev. 3.0
Freescale Semiconductor
155
Basic Timer Module - TIM (TIM16B4C)
These four pairs of control bits configure the input capture edge detector circuits.
Table 210. Edge Detector Circuit Configuration
5.9.3.3.10
EDGnB
EDGnA
Configuration
0
0
Capture disabled
0
1
Capture on rising edges only
1
0
Capture on falling edges only
1
1
Capture on any edge (rising or falling)
Timer Interrupt Enable Register (TIE)
Table 211. Timer Interrupt Enable Register (TIE)
(184)
Offset
0x2A
R
Access: User read/write
7
6
5
4
0
0
0
0
0
0
0
0
W
Reset
3
2
1
0
C3I
C2I
C1I
C0I
0
0
0
0
Notes
184.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 212. TIE - Register Field Descriptions
Field
Description
Input Capture/Output Compare Interrupt Enable.
1 = Enables corresponding Interrupt flag (CnF of TFLG1 register) to cause a hardware interrupt
0 = Disables corresponding Interrupt flag (CnF of TFLG1 register) from causing a hardware interrupt
3-0
C[3-0]I
5.9.3.3.11
Timer System Control Register 2 (TSCR2)
Table 213. Timer System Control Register 2 (TSCR2)
Offset(185)
0x2B
Access: User read/write
7
R
TOI
W
Reset
0
6
5
4
0
0
0
0
0
0
3
2
1
0
TCRE
PR2
PR1
PR0
0
0
0
0
Notes
185.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 214. TIE - Register Field Descriptions
Field
7
TOI
3
TCRE
3-0
PR[2:0]
Description
Timer Overflow Interrupt Enable
1 = Hardware interrupt requested when TOF flag set in TFLG2 register.
0 = Hardware Interrupt request inhibited.
TCRE — Timer Counter Reset Enable
1 = Enables timer counter reset by a successful output compare on channel 3
0 = Inhibits timer counter reset and counter continues to run.
Timer Prescaler Select
These three bits select the frequency of the timer prescaler clock derived from the bus clock as shown in Table 215.
MM912_637, Rev. 3.0
Freescale Semiconductor
156
Basic Timer Module - TIM (TIM16B4C)
NOTE
This mode of operation is similar to an up-counting modulus counter.
If register TC3 = $0000 and TCRE = 1, the timer counter register (TCNT) will stay at $0000
continuously. If register TC3 = $FFFF and TCRE = 1, TOF will not be set when the timer
counter register (TCNT) is reset from $FFFF to $0000.
The newly selected prescale factor will not take effect until the next synchronized edge,
where all prescale counter stages equal zero.
Table 215. Timer Clock Selection
PR2
PR1
PR0
Timer Clock(186)
0
0
0
TimerClk / 1
0
0
1
TimerClk / 2
0
1
0
TimerClk / 4
0
1
1
TimerClk / 8
1
0
0
TimerClk / 16
1
0
1
TimerClk / 32
1
1
0
TimerClk / 64
1
1
1
TimerClk / 128
Notes
186.TimerClk = D2DCLK/4 or ALFCLK
5.9.3.3.12
Main Timer Interrupt Flag 1 (TFLG1)
Table 216. Main Timer Interrupt Flag 1 (TFLG1)
(187)
Offset
R
0x2C
Access: User read/write
7
6
5
4
0
0
0
0
0
0
0
0
W
Reset
3
2
1
0
C3F
C2F
C1F
C0F
0
0
0
0
Notes
187.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 217. TFLG1 - Register Field Descriptions
Field
3-0
C[3:0]F
Description
Input Capture/Output Compare Channel Flag.
1 = Input capture or output compare event occurred
0 = No event (input capture or output compare event) occurred.
NOTE
These flags are set when an input capture or output compare event occurs. Flag set on a
particular channel is cleared by writing a one to that corresponding CnF bit. Writing a zero
to CnF bit has no effect on its status. When TFFCA bit in TSCR register is set, a read from
an input capture or a write into an output compare channel will cause the corresponding
channel flag CnF to be cleared.
MM912_637, Rev. 3.0
Freescale Semiconductor
157
Basic Timer Module - TIM (TIM16B4C)
5.9.3.3.13
Main Timer Interrupt Flag 2 (TFLG2)
Table 218. Main Timer Interrupt Flag 2 (TFLG2)
Offset(188)
0x2D
Access: User read/write
7
R
TOF
W
Reset
0
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Notes
188.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 219. TFLG2 - Register Field Descriptions
Field
7
TOF
Description
Timer Overflow Flag
1 = Indicates that an interrupt has occurred (Set when 16-bit free-running timer counter overflows from $FFFF to $0000)
0 = Flag indicates an interrupt has not occurred.
NOTE
The TFLG2 register indicates when an interrupt has occurred. Writing a one to the TOF bit
will clear it. Any access to TCNT will clear TOF bit of TFLG2 register if the TFFCA bit in
TSCR register is set.
5.9.3.3.14
Timer Input Capture/Output Compare Registers (TC3 - TC0)
Table 220. Timer Input Capture/Output Compare Register 0 (TC0)
Offset(189) 0x2E, 0x2F
R
W
Reset
R
W
Reset
Access: User read/write
15
14
13
12
11
10
9
8
tc0_15
tc0_14
tc0_13
tc0_12
tc0_11
tc0_10
tc0_9
tc0_8
0
0
0
0
0
0
0
0
7
6
5
4
3
2
1
0
tc0_7
tc0_6
tc0_5
tc0_4
tc0_3
tc0_2
tc0_1
tc0_0
0
0
0
0
0
0
0
0
Notes
189.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
MM912_637, Rev. 3.0
Freescale Semiconductor
158
Basic Timer Module - TIM (TIM16B4C)
Table 221. Timer Input Capture/Output Compare Register 1(TC1)
Offset(190)
0x30, 0x31
R
W
Reset
R
W
Reset
Access: User read/write
15
14
13
12
11
10
9
8
tc1_15
tc1_14
tc1_13
tc1_12
tc1_11
tc1_10
tc1_9
tc1_8
0
0
0
0
0
0
0
0
7
6
5
4
3
2
1
0
tc1_7
tc1_6
tc1_5
tc1_4
tc1_3
tc1_2
tc1_1
tc1_0
0
0
0
0
0
0
0
0
Notes
190.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 222. Timer Input Capture/Output Compare Register 2(TC2)
Offset(191) 0x32, 0x33
R
W
Reset
R
W
Reset
Access: User read/write
15
14
13
12
11
10
9
8
tc2_15
tc2_14
tc2_13
tc2_12
tc2_11
tc2_10
tc2_9
tc2_8
0
0
0
0
0
0
0
0
7
6
5
4
3
2
1
0
tc2_7
tc2_6
tc2_5
tc2_4
tc2_3
tc2_2
tc2_1
tc2_0
0
0
0
0
0
0
0
0
Notes
191.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 223. Timer Input Capture/Output Compare Register 3(TC3)
Offset(192)
0x34, 0x35
R
W
Reset
R
W
Reset
Access: User read/write
15
14
13
12
11
10
9
8
tc3_15
tc3_14
tc3_13
tc3_12
tc3_11
tc3_10
tc3_9
tc3_8
0
0
0
0
0
0
0
0
7
6
5
4
3
2
1
0
tc3_7
tc3_6
tc3_5
tc3_4
tc3_3
tc3_2
tc3_1
tc3_0
0
0
0
0
0
0
0
0
Notes
192.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 224. TCn - Register Field Descriptions
Field
15-0
Description
16 Timer Input Capture/Output Compare Registers
tcn[15-0]
MM912_637, Rev. 3.0
Freescale Semiconductor
159
Basic Timer Module - TIM (TIM16B4C)
NOTE
TRead anytime. Write anytime for output compare function. Writes to these registers have
no effect during input capture.
Depending on the TIOS bit for the corresponding channel, these registers are used to latch
the value of the free-running counter when a defined transition is sensed by the
corresponding input capture edge detector or to trigger an output action for output compare.
Read/Write access in byte mode for high byte should takes place before low byte otherwise
it will give a different result.
5.9.4
5.9.4.1
Functional Description
General
This section provides a complete functional description of the timer TIM16B4C block. Refer to the detailed timer block diagram
in Figure 41 as necessary.
D2D Clock / 4 or ALFCLK
channel 3 output
compare
PR[2:1:0]
TCRE
PRESCALER
CxI
TCNT(hi):TCNT(lo)
CxF
CLEAR COUNTER
16-BIT COUNTER
TOF
INTERRUPT
LOGIC
TOI
TE
TOF
CHANNEL 0
16-BIT COMPARATOR
OM:OL0
TC0
EDG0A
EDG0B
C0F
C0F
EDGE
DETECT
CH. 0 CAPTURE
IOC0 PIN
LOGIC CH. 0 COMPARE
TOV0
IOC0 PIN
IOC0
CHANNEL3
16-BIT COMPARATOR
TC3
EDG3A
EDG3B
C3F
C3F
EDGE
DETECT
CH.3 CAPTURE
IOC3 PIN
LOGIC CH.3 COMPARE
OM:OL3
TOV3
IOC3 PIN
IOC3
Figure 41. Detailed Timer Block Diagram
MM912_637, Rev. 3.0
Freescale Semiconductor
160
5.9.4.2
Prescaler
The prescaler divides the bus clock by 1, 2, 4, 8,16, 32, 64, or 128. The prescaler select bits, PR[2:0], select the prescaler divisor.
PR[2:0] are in the timer system control register 2 (TSCR2).
5.9.4.3
Input Capture
Clearing the I/O (input/output) select bit, IOSn, configures channel n as an input capture channel. The input capture function
captures the time at which an external event occurs. When an active edge occurs on the pin of an input capture channel, the
timer transfers the value in the timer counter into the timer channel registers, TCn.
The minimum pulse width for the input capture input is greater than two bus clocks. An input capture on channel n sets the CnF
flag. The CnI bit enables the CnF flag to generate interrupt requests.
5.9.4.4
Output Compare
Setting the I/O select bit, IOSn, configures channel n as an output compare channel. The output compare function can generate
a periodic pulse with a programmable polarity, duration, and frequency. When the timer counter reaches the value in the channel
registers of an output compare channel, the timer can set, clear, or toggle the channel pin. An output compare on channel n sets
the CnF flag. The CnI bit enables the CnF flag to generate interrupt requests.
The output mode and level bits, OMn and OLn, select set, clear, toggle on output compare. Clearing both OMn and OLn
disconnects the pin from the output logic. Setting a force output compare bit, FOCn, causes an output compare on channel n. A
forced output compare does not set the channel flag.
A successful output compare on channel 3 overrides output compares on all other output compare channels. The output compare
3 mask register masks the bits in the output compare 3 data register. The timer counter reset enable bit, TCRE, enables channel
3 output compares to reset the timer counter.Writing to the timer port bit of an output compare pin does not affect the pin state.
The value written is stored in an internal latch. When the pin becomes available for general-purpose output, the last value written
to the bit appears at the pin.
5.9.5
5.9.5.1
Resets
General
The reset state of each individual bit is listed within the Register Description Section 5.9.3, “Memory Map and Registers", which
details the registers and their bit-fields.
5.9.6
5.9.6.1
Interrupts
General
This section describes interrupts originated by the TIM16B4C block. Table 225 lists the interrupts generated by the TIM16B4C to
communicate with the MCU.
Table 225. TIM16B4C Interrupts
Interrupt
Offset
Vector
Priority
Source
Description
C[3:0]F
-
-
-
Timer Channel 3-0
Active high timer channel interrupts 3-0
TOF
-
-
-
Timer Overflow
Timer Overflow interrupt
5.9.6.2
Description of Interrupt Operation
The TIM16B4C uses a total of 5 interrupt vectors. The interrupt vector offsets and interrupt numbers are chip dependent. More
information on interrupt vector offsets and interrupt numbers can be found in Section 5.3, “Interrupt Module - IRQ".
MM912_637, Rev. 3.0
Freescale Semiconductor
161
Channel [3:0] Interrupt
These active high outputs is asserted by the module to request a timer channel 3 – 0 interrupt following an input capture or output
compare event on these channels [3-0]. For the interrupt to be asserted on a specific channel, the enable, CnI bit of TIE register
should be set. These interrupts are serviced by the system controller.
5.9.6.2.1
Timer Overflow Interrupt (TOF)
This active high output will be asserted by the module to request a timer overflow interrupt, following the timer counter overflow
when the overflow enable bit (TOI) bit of TFLG2 register is set. This interrupt is serviced by the system controller.
MM912_637, Rev. 3.0
Freescale Semiconductor
162
General Purpose I/O - GPIO
5.10
General Purpose I/O - GPIO
MCU
5.10.1
ANALOG
Introduction
The 3 General Purpose I/Os (PTB0...2) are multipurpose ports, making internal signals available externally and providing digital
inputs. L0 (PTB3) offers an additional wake-up on rising edge during low power mode.
Additional routing options allow connections to the LIN, TIMER, and SCI module.
5.10.2
•
•
•
•
•
•
Features
Internal Clamping Structure to operate as High Voltage Input (PTB3/L0 only).
5.0 V (VDDX) digital port Input/Output (PTB3/L0 only as Input)
Selectable internal pull-up (PTB3/L0 pull-down) resistor
Selectable Wake-up Input during Low Power mode (PTB3/L0 - rising edge only).
Selectable Timer Channel Input / Output
Selectable connection to LIN / SCI
Block Diagram
PE3
5.10.3
0
Z
PTB3 / L0
PD3
1
PDE3
PTWU
Wake-up Detection
TCAP3..0
VDDX
=1
PTBXx
TX
LINRX
LIN
RX
SCITX
PUEx
IC
TCOMP3..0
Z
TIMER3..0
OC
PTBx
WKUP
PTB0..PTB2
(x = 2..0)
PEx
Internal Wake-up
DIRx (M)
PDx
TCAP3..0
TX
SCI
RX
SCIRX
LINTX
Figure 42. General Purpose I/O - Block Diagram
MM912_637, Rev. 3.0
Freescale Semiconductor
163
General Purpose I/O - GPIO
5.10.4
High Voltage Wake-up Input - PTB3 / L0
To offer robust high voltage wake-up capabilities, the following structure is implemented for PTB3/L0.
47k
2k
1k
ESD
47n
6V clamp
External
components
100k
ESD / clamp
1p
Input
buffer
Figure 43. L0 / PTB3 Input Structure (typical values indicated)
NOTE
Due the different implementation of the L0/PTB3, the PTWU bit needs to be set in the
GPIO_IN3 register, to read the port status PD3 during Normal mode.
5.10.4.1
Modes of Operation
The full GPIO functionality is only available during Normal mode. The only features in available in both low power modes is the
PTB3/L0 external wake-up and the wake-up routing of the timer output compare.
NOTE
TCOMP3...0 needs to be configured to allow timer output compare interrupts to generate a
system wake-up.
5.10.5
5.10.5.1
Memory Map and Registers
Overview
This section provides a detailed description of the memory map and registers.
5.10.5.2
Module Memory Map
The memory map for the GPIO module is given in Table 226
MM912_637, Rev. 3.0
Freescale Semiconductor
164
General Purpose I/O - GPIO
Table 226. Module Memory Map
Offset
(193), (194)
Name
7
R
0x40
GPIO_CTL
GPIO control register
0
0x43
0x44
0x45
0x46
0x47
0x48
0x49
0x4A
GPIO_PUC
R
GPIO pull up configuration
W
GPIO_DATA
R
GPIO port data register
W
GPIO_IN0
R
Port 0 input configuration
W
GPIO_OUT0
R
Port 0 output configuration
W
GPIO_IN1
R
Port 1 input configuration
W
GPIO_OUT1
R
Port 1 output configuration
W
GPIO_IN2
R
Port 2 input configuration
W
GPIO_OUT2
R
Port 2 output configuration
W
GPIO_IN3
R
Port 3 input configuration
W
0x4B
Reserved
0x4C
Reserved
0x4D
Reserved
0x4E
Reserved
0x4F
Reserved
R
4
3
2
1
0
0
0
0
0
0
0
0
DIR1M
DIR0M
PE3M
PE2M
PE1M
PE0M
DIR2
DIR1
DIR0
PE3
PE2
PE1
PE0
0
0
0
0
PDE3
PUE2
PUE1
PUE0
0
0
0
0
PD3
PD2
PD1
PD0
TCAP3
TCAP2
TCAP1
TCAP0
SCIRX
LINTX
TCOMP3
TCOMP2
TCOMP1
TCOMP0
SCITX
LINRX
TCAP3
TCAP2
TCAP1
TCAP0
SCIRX
LINTX
TCOMP3
TCOMP2
TCOMP1
TCOMP0
SCITX
LINRX
TCAP3
TCAP2
TCAP1
TCAP0
SCIRX
LINTX
WKUP
TCOMP3
TCOMP2
TCOMP1
TCOMP0
SCITX
LINRX
PTWU
PTWU
TCAP3
TCAP2
TCAP1
TCAP0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
0x42
5
DIR2M
W
R
6
0
WKUP
0
WKUP
0
0
0
PTBX0
0
0
PTBX1
0
0
PTBX2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
R
W
R
W
R
W
R
W
Notes
193.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
194.Register Offset with the “lo” address value not shown have to be accessed in 16-Bit mode. 8-Bit access will not function.
MM912_637, Rev. 3.0
Freescale Semiconductor
165
General Purpose I/O - GPIO
5.10.5.3
Register Descriptions
5.10.5.3.1
GPIO Control Register (GPIO_CTL)
Table 227. GPIO Control Register (GPIO_CTL)
Offset
0x40
Access: User read/write
(195),(196)
15
R
0
R
12
11
10
9
8
0
0
0
0
0
0
0
DIR1M
DIR0M
PE3M
PE2M
PE1M
PE0M
0
0
0
0
0
0
0
0
7
6
5
4
3
2
1
0
DIR2
DIR1
DIR0
PE3
PE2
PE1
PE0
0
0
0
0
0
0
0
0
W
Reset
13
DIR2M
W
Reset
14
0
Notes
195.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
196.Those Registers are 16-Bit access only.
Table 228. GPIO control register (GPIO_CTL)
Field
14
DIR2M
13
DIR1M
12
DIR0M
11
PE3M
10
PE2M
9
PE1M
8
PE0M
6
DIR2
5
DIR1
4
DIR0
Description
Data Direction PTB2 - Mask
0 - writing the DIR2 bit will have no effect
1 - writing the DIR2 bit will be effective
Data Direction PTB1 - Mask
0 - writing the DIR1 bit will have no effect
1 - writing the DIR1 bit will be effective
Data Direction PTB0 - Mask
0 - writing the DIR0 bit will have no effect
1 - writing the DIR0 bit will be effective
Port 3 Enable - Mask
0 - writing the PE3 bit will have no effect
1 - writing the PE3 bit will be effective
Port 2 Enable - Mask
0 - writing the PE2 bit will have no effect
1 - writing the PE2 bit will be effective
Port 1 Enable - Mask
0 - writing the PE1 bit will have no effect
1 - writing the PE1 bit will be effective
Port 0 Enable - Mask
0 - writing the PE0 bit will have no effect
1 - writing the PE0 bit will be effective
Data Direction PTB2
0 - PTB2 configured as Input
1 - PTB2 configured as Output
Data Direction PTB1
0 - PTB1 configured as Input
1 - PTB1 configured as Output
Data Direction PTB0
0 - PTB0 configured as Input
1 - PTB0 configured as Output
MM912_637, Rev. 3.0
Freescale Semiconductor
166
General Purpose I/O - GPIO
Table 228. GPIO control register (GPIO_CTL)
Field
Description
Enable(197)
Port 3
0 - PTB3 Disabled (Z state)
1 - PTB3 Enabled (I)
3
PE3
Port 2 Enable(197)
0 - PTB2 disabled (Z state)
1 - PTB2 enabled (I/O)
2
PE2
Port 1 Enable(197)
0 - PTB1 disabled (Z state)
1 - PTB1 enabled (I/O)
1
PE1
Port 0 Enable(197)
0 - PTB0 disabled (Z state)
1 - PTB0 enabled (I/O)
0
PE0
Notes
197.The port logic is always enabled. Setting PEx will connect the logic to the port I/O buffers.
5.10.5.3.2
GPIO Pull-up Configuration (GPIO_PUC)
Table 229. GPIO Pull-up Configuration (GPIO_PUC)
(198)
Offset
0x42
R
Access: User read/write
7
6
5
4
0
0
0
0
0
0
0
0
W
Reset
3
2
1
0
PDE3
PUE2
PUE1
PUE0
0
0
0
0
Notes
198.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 230. GPIO Pull-up Configuration (GPIO_PUC)
Field
3
PDE3
2
PUE2
1
PUE1
0
PUE0
Description
PTB3 Pull-down Enable
0 - PTB3 pull-down disabled
1 - PTB3 pull-down enabled
PTB2 Pull-up Enable
0 - PTB2 pull-up disabled
1 - PTB2 pull-up enabled
PTB1 Pull-up Enable
0 - PTB1 pull-up disabled
1 - PTB1 pull-up enabled
PTB0 Pull-up Enable
0 - PTB0 pull-up disabled
1 - PTB0 pull-up enabled
MM912_637, Rev. 3.0
Freescale Semiconductor
167
General Purpose I/O - GPIO
5.10.5.3.3
GPIO Port Data Register (GPIO_DATA)
Table 231. GPIO Port Data Register (GPIO_DATA)
Offset(199)
0x43
R
Access: User read
7
6
5
4
3
2
1
0
0
0
0
0
PD3(200)
PD2
PD1
PD0
W
Notes
199.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
200.Due the different implementation of the L0/PTB3, PTWU needs to be set in the GPIO_IN3 to read the PD3 port status during normal mode.
Table 232. GPIO Port Data Register (GPIO_DATA)
Field
3
PD3
2
PD2
1
PD1
0
PD0
5.10.5.3.4
Description
PTB3 Data Register
A read returns the value of the PTB3 buffer.
PTB2 Data Register
A read returns the value of the PTB2 buffer.
PTB1 Data Register
A read returns the value of the PTB1 buffer.
PTB0 Data Register
A read returns the value of the PTB0 buffer.
Port 0 Input Configuration (GPIO_IN0)
Table 233. Port 0 Input Configuration (GPIO_IN0)
Offset(201) 0x44
Access: User read/write
7
R
0
W
Reset
0
6
5
4
3
2
1
TCAP3
TCAP2
TCAP1
TCAP0
SCIRX
LINTX
0
0
0
0
0
0
0
0
0
Notes
201.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 234. Port 0 input configuration (GPIO_IN0)
Field
6
TCAP3
5
TCAP2
4
TCAP1
3
TCAP0
Description
PTB0 - Timer Input Capture Channel 3
0 - PTB0 Input buffer disconnected from Timer Channel 3 - Input Capture
1 - PTB0 Input buffer routed to Timer Channel 3 - Input Capture
PTB0 - Timer Input Capture Channel 2
0 - PTB0 Input buffer disconnected from Timer Channel 2 - Input Capture
1 - PTB0 Input buffer routed to Timer Channel 2 - Input Capture
PTB0 - Timer Input Capture Channel 1
0 - PTB0 Input buffer disconnected from Timer Channel 1 - Input Capture
1 - PTB0 Input buffer routed to Timer Channel 1 - Input Capture
PTB0 - Timer Input Capture Channel 0
0 - PTB0 Input buffer disconnected from Timer Channel 0 - Input Capture
1 - PTB0 Input buffer routed to Timer Channel 0 - Input Capture
MM912_637, Rev. 3.0
Freescale Semiconductor
168
General Purpose I/O - GPIO
Table 234. Port 0 input configuration (GPIO_IN0)
Field
Description
PTB0 - SCI Module Rx Input
0 - PTB0 Input buffer disconnected from SCI Module Rx Input
1 - PTB0 Input buffer routed to SCI Module Rx Input
2
SCIRX
PTB0 - LIN Module Tx Input
0 - PTB0 Input buffer disconnected from LIN Module Tx Input
1 - PTB0 Input buffer routed to LIN Module Tx Input
1
LINTX
5.10.5.3.5
Port 0 output configuration (GPIO_OUT0)
Table 235. Port 0 Output Configuration (GPIO_OUT0)
Offset(202)
0x45
R
W
Reset
Access: User read/write
7
6
5
4
3
2
1
WKUP
TCOMP3
TCOMP2
TCOMP1
TCOMP0
SCITX
LINRX
0
0
0
0
0
0
0
0
0
PTBX0
0
Notes
202.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 236. Port 0 Output Configuration (GPIO_OUT0)
Field
7
WKUP
6
TCOMP3
5
TCOMP2
4
TCOMP1
3
TCOMP0
2
SCITX
1
LINRX
0
PTBX0
Description
PTB0 - Wake-up output
0 - Internal wake-up signal disconnected from PTB0 output buffer OR gate
1 - Internal wake-up signal connected to PTB0 output buffer OR gate
PTB0 - Timer Channel 3 - Output Compare output
0 - Timer Channel 3 - output compare disconnected from PTB0 output buffer OR gate
1 - Timer Channel 3 - output compare connected to PTB0 output buffer OR gate
PTB0 - Timer Channel 2 - Output Compare output
0 - Timer Channel 2 - output compare disconnected from PTB0 output buffer OR gate
1 - Timer Channel 2 - output compare connected to PTB0 output buffer OR gate
PTB0 - Timer Channel 1 - Output Compare output
0 - Timer Channel 1 - output compare disconnected from PTB0 output buffer OR gate
1 - Timer Channel 1 - output compare connected to PTB0 output buffer OR gate
PTB0 - Timer Channel 0 - Output Compare output
0 - Timer Channel 0 - output compare disconnected from PTB0 output buffer OR gate
1 - Timer Channel 0 - output compare connected to PTB0 output buffer OR gate
PTB0 - SCI TX Output
0 - SCI TX output disconnected from PTB0 output buffer OR gate
1 - SCI TX output connected to PTB0 output buffer OR gate
PTB0 - LIN RX Output
0 - LIN RX output disconnected from PTB0 output buffer OR gate
1 - LIN RX output connected to PTB0 output buffer OR gate
PTB0 - Output Buffer Control
0 - PTB0 output buffer OR gate input = 0
1 - PTB0 output buffer OR gate input = 1
MM912_637, Rev. 3.0
Freescale Semiconductor
169
General Purpose I/O - GPIO
5.10.5.3.6
Port 1 Input Configuration (GPIO_IN1)
Table 237. Port 1 Input Configuration (GPIO_IN1)
Offset(203)
0x46
Access: User read/write
7
R
0
W
Reset
0
6
5
4
3
2
1
TCAP3
TCAP2
TCAP1
TCAP0
SCIRX
LINTX
0
0
0
0
0
0
0
0
Notes
203.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 238. Port 1 Input Configuration (GPIO_IN1)
Field
Description
PTB1 - Timer Input Capture Channel 3
0 - PTB1 Input buffer disconnected from Timer Channel 3 - Input Capture
1 - PTB1 Input buffer routed to Timer Channel 3 - Input Capture
6
TCAP3
PTB1 - Timer Input Capture Channel 2
0 - PTB1 Input buffer disconnected from Timer Channel 2 - Input Capture
1 - PTB1 Input buffer routed to Timer Channel 2 - Input Capture
5
TCAP2
PTB1 - Timer Input Capture Channel 1
0 - PTB1 Input buffer disconnected from Timer Channel 1 - Input Capture
1 - PTB1 Input buffer routed to Timer Channel 1 - Input Capture
4
TCAP1
PTB1 - Timer Input Capture Channel 0
0 - PTB1 Input buffer disconnected from Timer Channel 0 - Input Capture
1 - PTB1 Input buffer routed to Timer Channel 0 - Input Capture
3
TCAP0
PTB1 - SCI Module Rx Input
0 - PTB1 Input buffer disconnected from SCI Module Rx Input
1 - PTB1 Input buffer routed to SCI Module Rx Input
2
SCIRX
PTB1 - LIN Module Tx Input
0 - PTB1 Input buffer disconnected from LIN Module Tx Input
1 - PTB1 Input buffer routed to LIN Module Tx Input
1
LINTX
5.10.5.3.7
Port 1 Output Configuration (GPIO_OUT1)
Table 239. Port 1 Output Configuration (GPIO_OUT1)
(204)
Offset
R
W
Reset
0x47
Access: User read/write
7
6
5
4
3
2
1
WKUP
TCOMP3
TCOMP2
TCOMP1
TCOMP0
SCITX
LINRX
0
0
0
0
0
0
0
0
0
PTBX1
0
Notes
204.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
MM912_637, Rev. 3.0
Freescale Semiconductor
170
General Purpose I/O - GPIO
Table 240. Port 1 Output Configuration (GPIO_OUT1)
Field
Description
7
WKUP
6
TCOMP3
5
TCOMP2
4
TCOMP1
3
TCOMP0
2
SCITX
1
LINRX
0
PTBX1
PTB1 - Wake-up output
0 - Internal wake-up signal disconnected from PTB1 output buffer OR gate
1 - Internal wake-up signal connected to PTB1 output buffer OR gate
PTB1 - Timer Channel 3 - Output Compare output
0 - Timer Channel 3 - output compare disconnected from PTB1 output buffer OR gate
1 - Timer Channel 3 - output compare connected to PTB1 output buffer OR gate
PTB1 - Timer Channel 2 - Output Compare output
0 - Timer Channel 2 - output compare disconnected from PTB1 output buffer OR gate
1 - Timer Channel 2 - output compare connected to PTB1 output buffer OR gate
PTB1 - Timer Channel 1 - Output Compare output
0 - Timer Channel 1 - output compare disconnected from PTB1 output buffer OR gate
1 - Timer Channel 1 - output compare connected to PTB1 output buffer OR gate
PTB1 - Timer Channel 0 - Output Compare output
0 - Timer Channel 0 - output compare disconnected from PTB1 output buffer OR gate
1 - Timer Channel 0 - output compare connected to PTB1 output buffer OR gate
PTB1 - SCI TX Output
0 - SCI TX output disconnected from PTB1 output buffer OR gate
1 - SCI TX output connected to PTB1 output buffer OR gate
PTB1 - LIN RX Output
0 - LIN RX output disconnected from PTB1 output buffer OR gate
1 - LIN RX output connected to PTB1 output buffer OR gate
PTB1 - Output Buffer Control
0 - PTB1 output buffer OR gate input = 0
1 - PTB1 output buffer OR gate input = 1
5.10.5.3.8
Port 2 Input Configuration (GPIO_IN2)
Table 241. Port 2 Input Configuration (GPIO_IN2)
Offset(205)
0x48
Access: User read/write
7
R
0
W
Reset
0
6
5
4
3
2
1
TCAP3
TCAP2
TCAP1
TCAP0
SCIRX
LINTX
0
0
0
0
0
0
0
0
0
Notes
205.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 242. Port 2 Input Configuration (GPIO_IN2)
Field
6
TCAP3
5
TCAP2
4
TCAP1
Description
PTB2 - Timer Input Capture Channel 3
0 - PTB2 Input buffer disconnected from Timer Channel 3 - Input Capture
1 - PTB2 Input buffer routed to Timer Channel 3 - Input Capture
PTB2 - Timer Input Capture Channel 2
0 - PTB2 Input buffer disconnected from Timer Channel 2 - Input Capture
1 - PTB2 Input buffer routed to Timer Channel 2 - Input Capture
PTB2 - Timer Input Capture Channel 1
0 - PTB2 Input buffer disconnected from Timer Channel 1 - Input Capture
1 - PTB2 Input buffer routed to Timer Channel 1 - Input Capture
MM912_637, Rev. 3.0
Freescale Semiconductor
171
General Purpose I/O - GPIO
Table 242. Port 2 Input Configuration (GPIO_IN2)
Field
Description
PTB2 - Timer Input Capture Channel 0
0 - PTB2 Input buffer disconnected from Timer Channel 0 - Input Capture
1 - PTB2 Input buffer routed to Timer Channel 0 - Input Capture
3
TCAP0
PTB2 - SCI Module Rx Input
0 - PTB2 Input buffer disconnected from SCI Module Rx Input
1 - PTB2 Input buffer routed to SCI Module Rx Input
2
SCIRX
PTB2 - LIN Module Tx Input
0 - PTB2 Input buffer disconnected from LIN Module Tx Input
1 - PTB2 Input buffer routed to LIN Module Tx Input
1
LINTX
5.10.5.3.9
Port 2 output configuration (GPIO_OUT2)
Table 243. Port 2 Output Configuration (GPIO_OUT2)
Offset(205)
0x49
R
W
Reset
Access: User read/write
7
6
5
4
3
2
1
WKUP
TCOMP3
TCOMP2
TCOMP1
TCOMP0
SCITX
LINRX
0
0
0
0
0
0
0
0
0
PTBX2
0
Notes
206.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 244. Port 2 Output Configuration (GPIO_OUT2)
Field
7
WKUP
6
TCOMP3
5
TCOMP2
4
TCOMP1
3
TCOMP0
2
SCITX
1
LINRX
0
PTBX2
Description
PTB2 - Wake-up output
0 - Internal wake-up signal disconnected from PTB2 output buffer OR gate
1 - Internal wake-up signal connected to PTB2 output buffer OR gate
PTB2 - Timer Channel 3 - Output Compare output
0 - Timer Channel 3 - output compare disconnected from PTB2 output buffer OR gate
1 - Timer Channel 3 - output compare connected to PTB2 output buffer OR gate
PTB2 - Timer Channel 2 - Output Compare output
0 - Timer Channel 2 - output compare disconnected from PTB2 output buffer OR gate
1 - Timer Channel 2 - output compare connected to PTB2 output buffer OR gate
PTB2 - Timer Channel 1 - Output Compare output
0 - Timer Channel 1 - output compare disconnected from PTB2 output buffer OR gate
1 - Timer Channel 1 - output compare connected to PTB2 output buffer OR gate
PTB2 - Timer Channel 0 - Output Compare output
0 - Timer Channel 0 - output compare disconnected from PTB2 output buffer OR gate
1 - Timer Channel 0 - output compare connected to PTB2 output buffer OR gate
PTB2 - SCI TX Output
0 - SCI TX output disconnected from PTB2 output buffer OR gate
1 - SCI TX output connected to PTB2 output buffer OR gate
PTB2 - LIN RX Output
0 - LIN RX output disconnected from PTB2 output buffer OR gate
1 - LIN RX output connected to PTB2 output buffer OR gate
PTB2 - Output Buffer Control
0 - PTB2 output buffer OR gate input = 0
1 - PTB2 output buffer OR gate input = 1
MM912_637, Rev. 3.0
Freescale Semiconductor
172
5.10.5.3.10 Port 3 Input Configuration (GPIO_IN3)
Table 245. Port 3 Input Configuration (GPIO_IN3)
Offset(207)
0x4A
Access: User read/write
7
R
W
Reset
6
5
4
3
PTWU
TCAP3
TCAP2
TCAP1
TCAP0
0
0
0
0
0
2
1
0
0
0
0
0
0
0
Notes
207.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 246. Port 3 Input Configuration (GPIO_IN3)
Field
7
PTWU
6
TCAP3
5
TCAP2
4
TCAP1
3
TCAP0
Description
PTB3 Wake-up
0 - PTB3 Input buffer low power mode wake-up circuity disabled
1 - PTB3 Input buffer low power mode wake-up circuity enabled
PTB3 - Timer Input Capture Channel 3
0 - PTB3 Input buffer disconnected from Timer Channel 3 - Input Capture
1 - PTB3 Input buffer routed to Timer Channel 3 - Input Capture
PTB3 - Timer Input Capture Channel 2
0 - PTB3 Input buffer disconnected from Timer Channel 2 - Input Capture
1 - PTB3 Input buffer routed to Timer Channel 2 - Input Capture
PTB3 - Timer Input Capture Channel 1
0 - PTB3 Input buffer disconnected from Timer Channel 1 - Input Capture
1 - PTB3 Input buffer routed to Timer Channel 1 - Input Capture
PTB3 - Timer Input Capture Channel 0
0 - PTB3 Input buffer disconnected from Timer Channel 0 - Input Capture
1 - PTB3 Input buffer routed to Timer Channel 0 - Input Capture
MM912_637, Rev. 3.0
Freescale Semiconductor
173
LIN
5.11
LIN
MCU
5.11.1
ANALOG
Introduction
The LIN bus pin provides a physical layer for single-wire communication in automotive applications. The LIN physical layer is
designed to meet the LIN physical layer version 2.0 / 2.1 and J2602 specification, and has the following features:
•
LIN physical layer 2.0 / 2.1 / J2602 compliant
•
Slew rate selection 20 kBit, 10 kBit, and fast Mode (100 kBit)
•
Over-temperature Shutdown - HTI
•
Permanent Pull-up in Normal mode 30 k, 1.0 M in low power
•
Current limitation
•
Special J2602 compliant configuration
•
Direct Rx / Tx access
•
Optional external Rx / Tx access and routing to the TIMER Input through PTBx
The LIN driver is a low side MOSFET with current limitation and thermal shutdown. An internal pull-up resistor with a serial diode
structure is integrated, so no external pull-up components are required for the application in a slave node. The fall time from
dominant to recessive and the rise time from recessive to dominant is controlled. The symmetry between both slopes is
guaranteed.
5.11.2
Overview
5.11.2.1
Block Diagram
Figure 44 shows the basic function of the LIN module.
UV
Undervoltage
Detection
LVSD (M)
VSUP
Wake Up
DSER
HF
Wake-up
Filter
RSLAVE
RX
TOPTB
TOSCI
Receiver
RX
SCI
LIN
=1
TX
TX
FROMSCI
PTB
0
FROMPTB
1
TXDM (M)
LGND
SRS (M)[1:0]
RDY
EN (M)
Transmitter
Control
OTIE (M)
OT
Interrupt
Overtemperature
Detection
Figure 44. LIN Module Block Diagram
MM912_637, Rev. 3.0
Freescale Semiconductor
174
LIN
5.11.2.2
LIN Pin
The LIN pin offers high susceptibility immunity level from external disturbance, guaranteeing communication during external
disturbances. See Section 4.8, “Electromagnetic Compatibility (EMC)".
5.11.2.3
Slew Rate Selection
The slew rate can be selected for optimized operation at 10 kBit/s and 20 kBit/s as well as a fast baud rate (100 kBit) for test and
programming. The slew rate can be adapted with the bits SRS[1:0] in the LIN Control Register (LIN_CTL). The initial slew rate is
20 kBit/s.
5.11.2.4
Over-temperature Shutdown (LIN Interrupt)
The output low side FET (transmitter) is protected against over-temperature conditions. In an over-temperature condition, the
transmitter will be shut down, and the TO bit in the LIN Control Register (LIN_CTL) is set as long as the condition is present.
If the OTIEM bit is set in the LIN Status Register (LIN_SR), an Interrupt IRQ will be generated. Acknowledge the interrupt by
writing a “1” in the LIN Status Register (LIN_SR). To issue a new interrupt, the condition has to vanish and reoccur.
The transmitter is automatically re-enabled once the over-temperature condition is gone and TxD is High.
5.11.2.5
Low Power Mode and Wake-up Feature
During Low Power mode operation, the transmitter of the physical layer is disabled. The receiver is still active and able to detect
wake-up events on the LIN bus line.
A dominant level longer than tPROPWL, followed by a rising edge will generate a wake-up event and be reported in the Wake-up
Source Register (WSR).
5.11.2.6
J2602 Compliance
A Low Voltage Shutdown feature was implemented to allow controlled LIN driver behavior under low voltage conditions at VSUP.
If LVSD is set, once VSUP is below the threshold VJ2602H, the LIN transmitter is not turned dominant again. The condition is
indicated by the UV flag.
5.11.2.7
Transmit / Receiving Line Definition
The LIN module can be connected to the SCI or PTB module, or can be directly controlled by the TXDM / RX bit
5.11.2.8
Transmitter Enable / Ready
The LIN transmitter must be enabled before transmission is possible (EN). The RDY bit is set to 1 about 50 µs after the LIN
transmitter is enabled. This is due to the initialization time for the LIN transmitter, under some low voltage conditions.
During this period (LIN enabled to RDY = 1), the LIN is forced to a recessive state.
5.11.3
5.11.3.1
Memory Map and Registers
Overview
This section provides a detailed description of the memory map and registers.
5.11.3.2
Module Memory Map
The memory map for the LIN module is given in Table 247
MM912_637, Rev. 3.0
Freescale Semiconductor
175
LIN
Table 247. Module Memory Map
Offset
Name
LIN_CTL
0x50
LIN control register
7
6
5
R
0
0
0
W
OTIEM
R
OTIE
W
0x52
0x53
0x54
0x55
LIN_SR (hi)
R
LIN status register
W
LIN_SR (lo)
R
LIN status register
W
LIN_TX
R
LIN transmit line definition
W
LIN_RX
R
LIN receive line definition
W
0x56
Reserved
0x57
Reserved
OT
0
0
0
HF
4
3
2
1
0
0
0
0
0
TXDM
LVSDM
ENM
SRSM
0
TXD
LVSD
EN
SRS
0
UV
0
0
0
RX
TX
Write 1 will clear the flags
RDY
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
R
FROMPT FROMSC
B
I
TOPTB
TOSCI
0
0
0
0
0
0
W
R
W
Notes
208.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
209.This Register is 16-Bit access only.
5.11.3.3
Register Descriptions
This section consists of register descriptions in address order. Each description includes a standard register diagram with an
associated figure number. Details of the register bit and field function follow the register diagrams, in bit order.
5.11.3.3.1
LIN Control Register (LIN_CTL)
Table 248. LIN Control Register (LIN_CTL)
Offset
0x50
Access: User write
(210) ,(211)
15
14
13
12
11
10
9
8
R
0
0
0
0
0
0
0
0
W
OTIEM
TXDM
LVSDM
ENM
Reset
0
0
0
0
0
0
0
0
7
6
5
4
3
2
1
0
0
0
TXD
LVSD
EN
0
0
0
0
0
R
W
Reset
OTIE
0
SRSM
SRS
0
0
Notes
210.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
211.This Register is 16-Bit access only.
MM912_637, Rev. 3.0
Freescale Semiconductor
176
LIN
Table 249. LIN Control Register (LIN_CTL) - Register Field Descriptions
Field
Description
LIN Over-temperature Interrupt Enable - Mask
0 - writing the OTIE Bit will have no effect
1 - writing the OTIE Bit will be effective
15
OTIEM
IN - Direct Transmitter Control - Mask
0 - writing the TXD Bit will have no effect
1 - writing the TXD Bit will be effective
12
TXDM
LIN - Low Voltage Shutdown Disable (J2602 Compliance Control) - Mask
0 - writing the LVSD Bit will have no effect
1 - writing the LVSD Bit will be effective
11
LVSDM
LIN Module Enable - Mask
0 - writing the EN Bit will have no effect
1 - writing the EN Bit will be effective
10
ENM
9-8
SRSM[1:0]
LIN - Slew Rate Select - Mask
00,01,10 - writing the SRS Bits will have no effect
11 - writing the SRS Bits will be effective
LIN Over-temperature Interrupt Enable
0 - LIN over-temperature interrupt disabled
1 - LIN over-temperature interrupt enabled
7
OTIE
IN - Direct Transmitter Control
0 - Transmitter not controlled
1 - Transmitter dominant
4
TXD
LIN - Low Voltage Shutdown Disable (J2602 Compliance Control)
0 - LIN will be remain in recessive state in case of VSUP under-voltage condition
1 - LIN will stay functional even with a VSUP under-voltage condition
3
LVSD
LIN Module Enable
0 - LIN module disabled
1 - LIN module enabled
2
EN
LIN - Slew Rate Select
00 - Normal slew rate (20 kBit)
01 - Slow slew rate (10.4 kBit)
10 - Fast slew rate (100 kbit)
11 - normal Slew Rate (20 kBit)
1-0
SRS[1:0]
5.11.3.3.2
LIN Status Register (LIN_SR (hi))
Table 250. LIN Status Register (LIN_SR (hi))
Offset(212)
R
0x52
Access: User read/write
7
6
5
OT
0
HF
W
Reset
4
3
2
1
0
0
UV
0
0
0
0
0
0
Write 1 will clear the flags
0
0
0
0
0
Notes
212.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
MM912_637, Rev. 3.0
Freescale Semiconductor
177
LIN
Table 251. LIN Status Register (LIN_SR (hi)) - Register Field Descriptions
Field
Description
LIN Over-temperature Status. This bit is latched and has to be reset by writing 1 into OT bit.
0 - No LIN over-temperature condition detected
1 - LIN over-temperature condition detected
7
OT
LIN HF (High Frequency) Condition Status indicating HF (DPI) disturbance in the LIN module. This bit is latched and has to
be reset by writing 1 into HF bit.
0 - No LIN HF (DPI) condition detected
1 - LIN HF (DPI) condition detected
5
HF
LIN Under-voltage Status. This threshold is used for the J2602 feature as well. This bit is latched and has to be reset by
writing 1 into UV bit.
0 - No LIN under-voltage condition detected
1 - LIN under-voltage condition detected
3
UV
5.11.3.3.3
LIN Status Register (LIN_SR (lo))
Table 252. LIN Status Register (LIN_SR (lo))
Offset(213)
0x53
R
Access: User read
7
6
5
4
3
2
1
0
RDY
0
0
0
0
0
RX
TX
W
Notes
213.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 253. LIN Status Register (LIN_SR (lo)) - Register Field Descriptions
Field
Description
Transmitter Ready Status
0 - Transmitter not ready
1 - Transmitter ready
1
RDY
Current RX status
0 - Rx recessive
1 - Rx dominant
1
RX
Current TX status
0 - Tx recessive
1 - Tx dominant
0
TX
5.11.3.3.4
LIN Transmit Line Definition (LIN_TX)
Table 254. LIN Transmit Line Definition (LIN_TX)
Offset(214)
R
0x54
Access: User read/write
7
6
5
4
3
2
0
0
0
0
0
0
0
0
0
0
0
0
W
Reset
1
0
FROMPTB
FROMSCI
0
0
Notes
214.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
MM912_637, Rev. 3.0
Freescale Semiconductor
178
LIN
Table 255. LIN Transmit Line Definition (LIN_TX) - Register Field Descriptions
Field
Description
1
FROMPTB
0
FROMSCI
LIN_TX internally routed from PTB. See Section 5.10, “General Purpose I/O - GPIO" for details.(215)
0 - LIN transmitter disconnected from PTB module.
1 - LIN transmitter connected to the PTB module.
LIN_TX internally routed from SCI(215)
0 - LIN transmitter disconnected from SCI module.
1 - LIN transmitter connected to the SCI module.
Notes
215.In case both, FROMPTB and FROMSCI are selected, the SCI has priority and the PTB signal is ignored. In any case, the signal is logically
ORed with the TXD direct transmitter control.
5.11.3.3.5
LIN Receive Line Definition (LIN_RX)
Table 256. LIN Receive Line Definition (LIN_RX)
(216)
Offset
R
0x55
Access: User read/write
7
6
5
4
3
2
0
0
0
0
0
0
0
0
0
0
0
0
W
Reset
1
0
TOPTB
TOSCI
0
0
Notes
216.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 257. LIN Receive Line Definition (LIN_RX) - Register Field Descriptions
Field
1
TOPTB
0
TOSCI
Description
LIN_RX internally routed to PTB
0 - LIN receiver disconnected from PTB module.
1 - LIN receiver connected to the PTB module.
LIN_RX internally routed to SCI
0 - LIN receiver disconnected from SCI module.
1 - LIN receiver connected to the SCI module.
NOTE
In order to route the RX signal to the Timer Input capture, one of the PTBx must be
configured as a pass through.
MM912_637, Rev. 3.0
Freescale Semiconductor
179
Figure 45. Definition of LIN Bus Timing Parameters
MM912_637, Rev. 3.0
Freescale Semiconductor
180
Serial Communication Interface (S08SCIV4)
5.12
Serial Communication Interface (S08SCIV4)
MCU
5.12.1
5.12.1.1
ANALOG
Introduction
Features
Features of SCI module include:
•
Full-duplex, standard non-return-to-zero (NRZ) format
•
Double-buffered transmitter and receiver with separate enables
•
Programmable baud rates (13-bit modulo divider)
•
Interrupt-driven or polled operation:
— Transmit data register empty and transmission complete
— Receive data register full
— Receive overrun, parity error, framing error, and noise error
— Idle receiver detect
— Active edge on receive pin
— Break detect supporting LIN
•
Hardware parity generation and checking
•
Programmable 8-bit or 9-bit character length
•
Receiver wake-up by idle-line or address-mark
•
Optional 13-bit break character generation / 11-bit break character detection
•
Selectable transmitter output polarity
5.12.1.2
Modes of Operation
See Section 5.12.3, “Functional Description", for details concerning SCI operation in these modes:
•
8- and 9-bit data modes
•
Loop mode
•
Single-wire mode
5.12.1.3
Block Diagram
Figure 46 shows the transmitter portion of the SCI.
MM912_637, Rev. 3.0
Freescale Semiconductor
181
Serial Communication Interface (S08SCIV4)
INTERNAL BUS
(WRITE-ONLY)
LOOPS
SCID – Tx BUFFER
STOP
11-BIT TRANSMIT SHIFT REGISTER
H
1  BAUD
RATE CLOCK
8
7
6
5
4
3
2
1
0
LOOP
CONTROL
TO RECEIVE
DATA IN
TO TxD
L
LSB
M
START
RSRC
SHIFT DIRECTION
SCI CONTROLS TxD
TE
SBK
BREAK (ALL 0s)
PARITY
GENERATION
PT
PREAMBLE (ALL 1s)
PE
SHIFT ENABLE
T8
LOAD FROM SCID
TXINV
TRANSMIT CONTROL
TXDIR
TxD DIRECTION
TO TxD
LOGIC
BRK13
TDRE
TIE
TC
Tx INTERRUPT
REQUEST
TCIE
Figure 46. SCI Transmitter Block Diagram
MM912_637, Rev. 3.0
Freescale Semiconductor
182
Serial Communication Interface (S08SCIV4)
Figure 47 shows the receiver portion of the SCI.
INTERNAL BUS
(READ-ONLY)
16  BAUD
RATE CLOCK
DIVIDE
BY 16
SCID – Rx BUFFER
FROM RxD
RXINV
H
DATA RECOVERY
0
L
11-BIT RECEIVE SHIFT REGISTER
8
7
6
5
4
3
2
1
SHIFT DIRECTION
WAKEUP
LOGIC
ILT
LSB
LBKDE
START
RSRC
M
MSB
SINGLE-WIRE
LOOP CONTROL
ALL 1s
LOOPS
STOP
FROM
TRANSMITTER
RWU
RWUID
ACTIVE EDGE
DETECT
RDRF
RIE
IDLE
ILIE
LBKDIF
Rx INTERRUPT
REQUEST
LBKDIE
RXEDGIF
RXEDGIE
OR
ORIE
FE
FEIE
ERROR INTERRUPT
REQUEST
NF
NEIE
PE
PT
PARITY
CHECKING
PF
PEIE
Figure 47. SCI Receiver Block Diagram
MM912_637, Rev. 3.0
Freescale Semiconductor
183
Serial Communication Interface (S08SCIV4)
5.12.2
Memory Map and Registers
5.12.2.1
Overview
This section provides a detailed description of the memory map and registers.
5.12.2.2
Module Memory Map
The memory map for the S08SCIV4 module is given in Table 258.
Table 258. Module Memory Map
Offse
0x18
0x19
0x1A
0x1B
0x1C
0x1D
0x1E
Name
SCIBD (hi)
R
SCI Baud Rate Register
W
SCIBD (lo)
R
SCI Baud Rate Register
W
SCIC1
R
SCI Control Register 1
W
SCIC2
R
SCI Control Register 2
W
SCIS1
R
SCI Status Register 1
W
SCIS2
R
SCI Status Register 2
W
SCIC3
R
SCI Control Register 3
W
SCID
R
SCI Data Register
W
0x1F
7
6
5
4
3
2
1
0
LBKDIE
RXEDGIE
0
SBR12
SBR11
SBR10
SBR9
SBR8
SBR7
SBR6
SBR5
SBR4
SBR3
SBR2
SBR1
SBR0
RSRC
M
ILT
PE
PT
LOOPS
0
0
TIE
TCIE
RIE
ILIE
TE
RE
RWU
SBK
TDRE
TC
RDRF
IDLE
OR
NF
FE
PF
LBKDIF
RXEDGIF
RXINV
RWUID
BRK13
LBKDE
R8
0
RAF
T8
TXDIR
TXINV
ORIE
NEIE
FEIE
PEIE
R7
R6
R5
R4
R3
R2
R1
R0
T7
T6
T5
T4
T3
T2
T1
T0
Notes
217.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
5.12.2.3
Register Definition
The SCI has eight 8-bit registers to control baud rate, select SCI options, report SCI status, and for transmit/receive data.
5.12.2.3.1
SCI Baud Rate Registers (SCIBD (hi), SCIBD (lo))
This pair of registers control the prescale divisor for SCI baud rate generation. To update the 13-bit baud rate setting
[SBR12:SBR0], first write to SCIBD (hi) to buffer the high half of the new value, and then write to SCIBD (lo). The working value
in SCIBD (hi) does not change until SCIBD (lo) is written.
SCIBDL is reset to a non-zero value, so after reset the baud rate generator remains disabled until the first time the receiver or
transmitter is enabled (RE or TE bits in SCIC2 are written to 1).
MM912_637, Rev. 3.0
Freescale Semiconductor
184
Serial Communication Interface (S08SCIV4)
Table 259. SCI Baud Rate Register (SCIBD (hi))
Offset(218)
0x18
Access: User read/write
7
R
W
6
5
LBKDIE
RXEDGIE
0
0
Reset
0
4
3
2
1
0
SBR12
SBR11
SBR10
SBR9
SBR8
0
0
0
0
0
0
= Unimplemented or Reserved
Notes
218.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 260. SCIBD (hi) Field Descriptions
Field
Description
LIN Break Detect Interrupt Enable (for LBKDIF)
0 Hardware interrupts from LBKDIF disabled (use polling).
1 Hardware interrupt requested when LBKDIF flag is 1.
7
LBKDIE
6
RXEDGIE
4:0
SBR[12:8]
RxD Input Active Edge Interrupt Enable (for RXEDGIF)
0 Hardware interrupts from RXEDGIF disabled (use polling).
1 Hardware interrupt requested when RXEDGIF flag is 1.
Baud Rate Modulo Divisor — The 13 bits in SBR[12:0] are referred to collectively as BR, and they set the modulo divide rate
for the SCI baud rate generator. When BR = 0, the SCI baud rate generator is disabled to reduce supply current. When BR = 1
to 8191, the SCI baud rate = BUSCLK/(64BR). See BR bits in Table 261.
Table 261. SCI Baud Rate Register (SCIBDL)
(219)
Offset
0x19
R
W
Reset
Access: User read/write
7
6
5
4
3
2
1
0
SBR7
SBR6
SBR5
SBR4
SBR3
SBR2
SBR1
SBR0
0
0
0
0
0
1
0
0
Notes
219.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 262. SCIBDL Field Descriptions
Field
Description
7:0
Baud Rate Modulo Divisor — These 13 bits in SBR[12:0] are referred to collectively as BR, and they set the modulo divide
rate for the SCI baud rate generator. When BR = 0, the SCI baud rate generator is disabled to reduce supply current. When
BR = 1 to 8191, the SCI baud rate = BUSCLK/(64BR). See also BR bits in Table 259.
SBR[7:0]
MM912_637, Rev. 3.0
Freescale Semiconductor
185
Serial Communication Interface (S08SCIV4)
5.12.2.3.2
SCI Control Register 1 (SCIC1)
This read/write register is used to control various optional features of the SCI system.
Table 263. SCI Control Register 1 (SCIC1)
Offset(220) 0x1A
Access: User read/write
7
R
LOOPS
W
Reset
0
6
0
0
5
4
RSRC
M
0
0
3
0
0
2
1
0
ILT
PE
PT
0
0
0
Notes
220.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 264. SCIC1 Field Descriptions
Field
7
LOOPS
5
RSRC
4
M
2
ILT
1
PE
0
PT
Description
Loop Mode Select — Selects between loop back modes and normal 2-pin full-duplex modes. When LOOPS = 1, the
transmitter output is internally connected to the receiver input.
0 Normal operation — RxD and TxD use separate pins.
1 Loop mode or single-wire mode where transmitter outputs are internally connected to receiver input. (See RSRC bit.) RxD
pin is not used by SCI.
Receiver Source Select — This bit has no meaning or effect unless the LOOPS bit is set to 1. When LOOPS = 1, the receiver
input is internally connected to the TxD pin and RSRC determines whether this connection is also connected to the transmitter
output.
0 Provided LOOPS = 1, RSRC = 0 selects internal loop back mode and the SCI does not use the RxD pins.
1 Single-wire SCI mode where the TxD pin is connected to the transmitter output and receiver input.
9-Bit or 8-Bit Mode Select
0 Normal — start + 8 data bits (LSB first) + stop.
1 Receiver and transmitter use 9-bit data characters
start + 8 data bits (LSB first) + 9th data bit + stop.
Idle Line Type Select — Setting this bit to 1 ensures that the stop bit and logic 1 bits at the end of a character do not count
toward the 10 or 11 bit times of logic high level needed by the idle line detection logic. Refer to Section 5.12.3.3.2.1, “Idle-Line
Wake-up" for more information.
0 Idle character bit count starts after start bit.
1 Idle character bit count starts after stop bit.
Parity Enable — Enables hardware parity generation and checking. When parity is enabled, the most significant bit (MSB) of
the data character (eighth or ninth data bit) is treated as the parity bit.
0 No hardware parity generation or checking.
1 Parity enabled.
Parity Type — Provided parity is enabled (PE = 1), this bit selects even or odd parity. Odd parity means the total number of 1s
in the data character, including the parity bit, is odd. Even parity means the total number of 1s in the data character, including
the parity bit, is even.
0 Even parity.
1 Odd parity.
MM912_637, Rev. 3.0
Freescale Semiconductor
186
Serial Communication Interface (S08SCIV4)
5.12.2.3.3
SCI Control Register 2 (SCIC2)
This register can be read or written at any time.
Table 265. SCI Control Register 2 (SCIC2)
Offset(221) 0x1B
R
W
Reset
Access: User read/write
7
6
5
4
3
2
1
0
TIE
TCIE
RIE
ILIE
TE
RE
RWU
SBK
0
0
0
0
0
0
0
0
Notes
221.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 266. SCIC2 Field Descriptions
Field
7
TIE
6
TCIE
5
RIE
4
ILIE
3
TE
2
RE
1
RWU
0
SBK
Description
Transmit Interrupt Enable (for TDRE)
0 Hardware interrupts from TDRE disabled (use polling).
1 Hardware interrupt requested when TDRE flag is 1.
Transmission Complete Interrupt Enable (for TC)
0 Hardware interrupts from TC disabled (use polling).
1 Hardware interrupt requested when TC flag is 1.
Receiver Interrupt Enable (for RDRF)
0 Hardware interrupts from RDRF disabled (use polling).
1 Hardware interrupt requested when RDRF flag is 1.
Idle Line Interrupt Enable (for IDLE)
0 Hardware interrupts from IDLE disabled (use polling).
1 Hardware interrupt requested when IDLE flag is 1.
Transmitter Enable
0 Transmitter off.
1 Transmitter on.
TE must be 1 in order to use the SCI transmitter. When TE = 1, the SCI forces the TxD pin to act as an output for the SCI
system.
When the SCI is configured for single-wire operation (LOOPS = RSRC = 1), TXDIR controls the direction of traffic on the single
SCI communication line (TxD pin).
TE also can be used to queue an idle character by writing TE = 0 then TE = 1 while a transmission is in progress. Refer to
Section 5.12.3.2.1, “Send Break and Queued Idle" for more details.
When TE is written to 0, the transmitter keeps control of the port TxD pin until any data, queued idle, or queued break character
finishes transmitting before allowing the pin to revert to a general-purpose I/O pin.
Receiver Enable — When the SCI receiver is off, the RxD pin reverts to being a general-purpose port I/O pin. If LOOPS = 1
the RxD pin reverts to being a general-purpose I/O pin even if RE = 1.
0 Receiver off.
1 Receiver on.
Receiver Wake-up Control — This bit can be written to 1 to place the SCI receiver in a standby state where it waits for
automatic hardware detection of a selected wake-up condition. The wake-up condition is either an idle line between messages
(WAKE = 0, idle-line wake-up), or a logic 1 in the most significant data bit in a character (WAKE = 1, address-mark wake-up).
Application software sets RWU and (normally) a selected hardware condition automatically clears RWU. Refer to
Section 5.12.3.3.2, “Receiver Wake-up Operation" for more details.
0 Normal SCI receiver operation.
1 SCI receiver in standby waiting for wake-up condition.
Send Break — Writing a 1 and then a 0 to SBK queues a break character in the transmit data stream. Additional break
characters of 10 or 11 (13 or 14 if BRK13 = 1) bit times of logic 0 are queued as long as SBK = 1. Depending on the timing of
the set and clear of SBK relative to the information currently being transmitted, a second break character may be queued
before software clears SBK. Refer to Section 5.12.3.2.1, “Send Break and Queued Idle" for more details.
0 Normal transmitter operation.
1 Queue break character(s) to be sent.
MM912_637, Rev. 3.0
Freescale Semiconductor
187
Serial Communication Interface (S08SCIV4)
5.12.2.3.4
SCI Status Register 1 (SCIS1)
This register has eight read-only status flags. Writes have no effect. Special software sequences (which do not involve writing to
this register) are used to clear these status flags.
Table 267. SCI Status Register 1 (SCIS1)
Offset(222)
R
0x1C
Access: User read/write
7
6
5
4
3
2
1
0
TDRE
TC
RDRF
IDLE
OR
NF
FE
PF
1
1
0
0
0
0
0
0
W
Reset
= Unimplemented or Reserved
Notes
222.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 268. SCIS1 Field Descriptions
Field
7
TDRE
6
TC
5
RDRF
4
IDLE
3
OR
Description
Transmit Data Register Empty Flag — TDRE is set out of reset and when a transmit data value transfers from the transmit
data buffer to the transmit shifter, leaving room for a new character in the buffer. To clear TDRE, read SCIS1 with TDRE = 1
and then write to the SCI data register (SCID).
0 Transmit data register (buffer) full.
1 Transmit data register (buffer) empty.
Transmission Complete Flag — TC is set out of reset and when TDRE = 1 and no data, preamble, or break character is being
transmitted.
0 Transmitter active (sending data, a preamble, or a break).
1 Transmitter idle (transmission activity complete).
TC is cleared automatically by reading SCIS1 with TC = 1 and then doing one of the following three things:
• Write to the SCI data register (SCID) to transmit new data
• Queue a preamble by changing TE from 0 to 1
• Queue a break character by writing 1 to SBK in SCIC2
Receive Data Register Full Flag — RDRF becomes set when a character transfers from the receive shifter into the receive
data register (SCID). To clear RDRF, read SCIS1 with RDRF = 1 and then read the SCI data register (SCID).
0 Receive data register empty.
1 Receive data register full.
Idle Line Flag — IDLE is set when the SCI receive line becomes idle for a full character time after a period of activity. When
ILT = 0, the receiver starts counting idle bit times after the start bit. So if the receive character is all 1s, these bit times and the
stop bit time count toward the full character time of logic high (10 or 11 bit times depending on the M control bit) needed for the
receiver to detect an idle line. When ILT = 1, the receiver doesn’t start counting idle bit times until after the stop bit. So the stop
bit and any logic high bit times at the end of the previous character do not count toward the full character time of logic high
needed for the receiver to detect an idle line.
To clear IDLE, read SCIS1 with IDLE = 1 and then read the SCI data register (SCID). After IDLE has been cleared, it cannot
become set again until after a new character has been received and RDRF has been set. IDLE will get set only once even if
the receive line remains idle for an extended period.
0 No idle line detected.
1 Idle line was detected.
Receiver Overrun Flag — OR is set when a new serial character is ready to be transferred to the receive data register (buffer),
but the previously received character has not been read from SCID yet. In this case, the new character (and all associated
error information) is lost because there is no room to move it into SCID. To clear OR, read SCIS1 with OR = 1 and then read
the SCI data register (SCID).
0 No overrun.
1 Receive overrun (new SCI data lost).
MM912_637, Rev. 3.0
Freescale Semiconductor
188
Serial Communication Interface (S08SCIV4)
Table 268. SCIS1 Field Descriptions
Field
2
NF
1
FE
0
PF
Description
Noise Flag — The advanced sampling technique used in the receiver takes seven samples during the start bit and three
samples in each data bit and the stop bit. If any of these samples disagrees with the rest of the samples within any bit time in
the frame, the flag NF will be set at the same time as the flag RDRF gets set for the character. To clear NF, read SCIS1 and
then read the SCI data register (SCID).
0 No noise detected.
1 Noise detected in the received character in SCID.
Framing Error Flag — FE is set at the same time as RDRF when the receiver detects a logic 0 where the stop bit was
expected. This suggests the receiver was not properly aligned to a character frame. To clear FE, read SCIS1 with FE = 1 and
then read the SCI data register (SCID).
0 No framing error detected. This does not guarantee the framing is correct.
1 Framing error.
Parity Error Flag — PF is set at the same time as RDRF when parity is enabled (PE = 1) and the parity bit in the received
character does not agree with the expected parity value. To clear PF, read SCIS1 and then read the SCI data register (SCID).
0 No parity error.
1 Parity error.
5.12.2.3.5
SCI Status Register 2 (SCIS2)
This register has one read-only status flag.
Table 269. SCI Status Register 2 (SCIS2)
Offset(223) 0x1D
Access: User read/write
7
R
W
Reset
6
5
LBKDIF
RXEDGIF
0
0
0
4
3
2
1
RXINV
RWUID
BRK13
LBKDE
0
0
0
0
0
0
RAF
0
= Unimplemented or Reserved
Notes
223.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 270. SCIS2 Field Descriptions
Field
7
LBKDIF
6
RXEDGIF
4
RXINV
(224)
3
RWUID
2
BRK13
Description
LIN Break Detect Interrupt Flag — LBKDIF is set when the LIN break detect circuitry is enabled and a LIN break character
is detected. LBKDIF is cleared by writing a “1” to it.
0 No LIN break character has been detected.
1 LIN break character has been detected.
RxD Pin Active Edge Interrupt Flag — RXEDGIF is set when an active edge (falling if RXINV = 0, rising if RXINV=1) on the
RxD pin occurs. RXEDGIF is cleared by writing a “1” to it.
0 No active edge on the receive pin has occurred.
1 An active edge on the receive pin has occurred.
Receive Data Inversion — Setting this bit reverses the polarity of the received data input.
0 Receive data not inverted
1 Receive data inverted
Receive Wake Up Idle Detect— RWUID controls whether the idle character that wakes up the receiver sets the IDLE bit.
0 During receive standby state (RWU = 1), the IDLE bit does not get set upon detection of an idle character.
1 During receive standby state (RWU = 1), the IDLE bit gets set upon detection of an idle character.
Break Character Generation Length — BRK13 is used to select a longer transmitted break character length. Detection of a
framing error is not affected by the state of this bit.
0 Break character is transmitted with length of 10 bit times (11 if M = 1)
1 Break character is transmitted with length of 13 bit times (14 if M = 1)
MM912_637, Rev. 3.0
Freescale Semiconductor
189
Serial Communication Interface (S08SCIV4)
Table 270. SCIS2 Field Descriptions
Field
1
LBKDE
0
RAF
Description
LIN Break Detection Enable— LBKDE is used to select a longer break character detection length. While LBKDE is set,
framing error (FE) and receive data register full (RDRF) flags are prevented from setting.
0 Break character detection enabled.
1 Break character detection disabled.
Receiver Active Flag — RAF is set when the SCI receiver detects the beginning of a valid start bit, and RAF is cleared
automatically when the receiver detects an idle line. This status flag can be used to check whether an SCI character is being
received before instructing the MCU to go to stop mode.
0 SCI receiver idle waiting for a start bit.
1 SCI receiver active (RxD input not idle).
Notes
224.Setting RXINV inverts the RxD input for all cases: data bits, start and stop bits, break, and idle.
When using an internal oscillator in a LIN system, it is necessary to raise the break detection threshold by one bit time. Under
the worst case timing conditions allowed in LIN, it is possible that a 0x00 data character can appear to be 10.26 bit times long at
a slave which is running 14% faster than the master. This would trigger normal break detection circuitry, which is designed to
detect a 10 bit break symbol. When the LBKDE bit is set, framing errors are inhibited and the break detection threshold changes
from 10 bits to 11 bits, preventing false detection of a 0x00 data character as a LIN break symbol.
5.12.2.3.6
SCI Control Register 3 (SCIC3)
Table 271. SCI Control Register 3 (SCIC3)
Offset(225) 0x1E
Access: User read/write
7
R
R8
W
Reset
0
6
5
4
3
2
1
0
T8
TXDIR
TXINV
ORIE
NEIE
FEIE
PEIE
0
0
0
0
0
0
0
= Unimplemented or Reserved
Notes
225.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 272. SCIC3 Field Descriptions
Field
7
R8
6
T8
5
TXDIR
4
TXINV(226)
Description
Ninth Data Bit for Receiver — When the SCI is configured for 9-bit data (M = 1), R8 can be thought of as a ninth receive data
bit to the left of the MSB of the buffered data in the SCID register. When reading 9-bit data, read R8 before reading SCID,
because reading SCID completes automatic flag clearing sequences, which could allow R8 and SCID to be overwritten with
new data.
Ninth Data Bit for Transmitter — When the SCI is configured for 9-bit data (M = 1), T8 may be thought of as a ninth transmit
data bit to the left of the MSB of the data in the SCID register. When writing 9-bit data, the entire 9-bit value is transferred to
the SCI shift register after SCID is written, so T8 should be written (if it needs to change from its previous value) before SCID
is written. If T8 does not need to change in the new value (such as when it is used to generate mark or space parity), it need
not be written each time SCID is written.
TxD Pin Direction in Single-wire Mode — When the SCI is configured for single-wire half-duplex operation
(LOOPS = RSRC = 1), this bit determines the direction of data at the TxD pin.
0 TxD pin is an input in single-wire mode.
1 TxD pin is an output in single-wire mode.
Transmit Data Inversion — Setting this bit reverses the polarity of the transmitted data output.
0 Transmit data not inverted
1 Transmit data inverted
MM912_637, Rev. 3.0
Freescale Semiconductor
190
Serial Communication Interface (S08SCIV4)
Table 272. SCIC3 Field Descriptions (continued)
Field
3
ORIE
2
NEIE
1
FEIE
0
PEIE
Description
Overrun Interrupt Enable — This bit enables the overrun flag (OR) to generate hardware interrupt requests.
0 OR interrupts disabled (use polling).
1 Hardware interrupt requested when OR = 1.
Noise Error Interrupt Enable — This bit enables the noise flag (NF) to generate hardware interrupt requests.
0 NF interrupts disabled (use polling).
1 Hardware interrupt requested when NF = 1.
Framing Error Interrupt Enable — This bit enables the framing error flag (FE) to generate hardware interrupt requests.
0 FE interrupts disabled (use polling).
1 Hardware interrupt requested when FE = 1.
Parity Error Interrupt Enable — This bit enables the parity error flag (PF) to generate hardware interrupt requests.
0 PF interrupts disabled (use polling).
1 Hardware interrupt requested when PF = 1.
Notes
226.Setting TXINV inverts the TxD output for all cases: data bits, start and stop bits, break, and idle.
5.12.2.3.7
SCI Data Register (SCID)
This register is actually two separate registers. Reads return the contents of the read-only receive data buffer and writes go to
the write-only transmit data buffer. Reads and writes of this register are also involved in the automatic flag clearing mechanisms
for the SCI status flags.
Table 273. SCI Data Register (SCID)
Offset(227) 0x1D
Access: User read/write
7
6
5
4
3
2
1
0
R
R7
R6
R5
R4
R3
R2
R1
R0
W
T7
T6
T5
T4
T3
T2
T1
T0
Reset
0
0
0
0
0
0
0
0
Notes
227.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
5.12.3
Functional Description
The SCI allows full-duplex, asynchronous, NRZ serial communication among the MCU and remote devices, including other
MCUs. The SCI comprises a baud rate generator, transmitter, and receiver block. The transmitter and receiver operate
independently, although they use the same baud rate generator. During normal operation, the MCU monitors the status of the
SCI, writes the data to be transmitted, and processes received data. The following describes each of the blocks of the SCI.
5.12.3.1
Baud Rate Generation
Figure 48 shows the clock source for the SCI baud rate generator is the D2D clock / 4.
MM912_637, Rev. 3.0
Freescale Semiconductor
191
Serial Communication Interface (S08SCIV4)
MODULO DIVIDE BY
(1 THROUGH 8191)
D2D / 4
DIVIDE BY
16
SBR12:SBR0
Tx BAUD RATE
Rx SAMPLING CLOCK
(16  BAUD RATE)
BAUD RATE GENERATOR
OFF IF [SBR12:SBR0] = 0
D2DCLK / 4
BAUD RATE =
[SBR12:SBR0]  16
Figure 48. SCI Baud Rate Generation
SCI communications require the transmitter and receiver (which typically derive baud rates from independent clock sources) to
use the same baud rate. Allowed tolerance on this baud frequency depends on the details of how the receiver synchronizes to
the leading edge of the start bit and how bit sampling is performed.
The MCU resynchronizes to bit boundaries on every high-to-low transition, but in the worst case, there are no such transitions in
the full 10- or 11-bit time character frame so any mismatch in baud rate is accumulated for the whole character time. For a
Freescale Semiconductor SCI system whose bus frequency is driven by a crystal, the allowed baud rate mismatch is about ±4.5
percent for 8-bit data format and about ±4.0 percent for 9-bit data format. Although baud rate modulo divider settings do not
always produce baud rates that exactly match standard rates, it is normally possible to get within a few percent, which is
acceptable for reliable communications.
5.12.3.2
Transmitter Functional Description
This section describes the overall block diagram for the SCI transmitter, as well as specialized functions for sending break and
idle characters. The transmitter block diagram is shown in Figure 46.
The transmitter output (TxD) idle state defaults to logic high (TXINV = 0 following reset). The transmitter output is inverted by
setting TXINV = 1. The transmitter is enabled by setting the TE bit in SCIC2. This queues a preamble character that is one full
character frame of the idle state. The transmitter then remains idle until data is available in the transmit data buffer. Programs
store data into the transmit data buffer by writing to the SCI data register (SCID).
The central element of the SCI transmitter is the transmit shift register that is either 10 or 11 bits long depending on the setting
in the M control bit. For the remainder of this section, we will assume M = 0, selecting the normal 8-bit data mode. In 8-bit data
mode, the shift register holds a start bit, eight data bits, and a stop bit. When the transmit shift register is available for a new SCI
character, the value waiting in the transmit data register is transferred to the shift register (synchronized with the baud rate clock)
and the transmit data register empty (TDRE) status flag is set to indicate another character may be written to the transmit data
buffer at SCID.
If no new character is waiting in the transmit data buffer after a stop bit is shifted out the TxD pin, the transmitter sets the transmit
complete flag and enters an idle mode, with TxD high, waiting for more characters to transmit.
Writing 0 to TE does not immediately release the pin to be a general purpose I/O pin. Any transmit activity that is in progress must
first be completed. This includes data characters in progress, queued idle characters, and queued break characters.
5.12.3.2.1
Send Break and Queued Idle
The SBK control bit in SCIC2 is used to send break characters which were originally used to gain the attention of old teletype
receivers. Break characters are a full character time of logic 0 (10 bit times including the start and stop bits). A longer break of
13 bit times can be enabled by setting BRK13 = 1. Normally, a program would wait for TDRE to become set to indicate the last
character of a message has moved to the transmit shifter, then write 1 and then write 0 to the SBK bit. This action queues a break
character to be sent as soon as the shifter is available. If SBK is still 1 when the queued break moves into the shifter
(synchronized to the baud rate clock), an additional break character is queued. If the receiving device is another Freescale
Semiconductor SCI, the break characters will be received as 0s in all eight data bits and a framing error (FE = 1) occurs.
When idle-line wake-up is used, a full character time of idle (logic 1) is needed between messages to wake up any sleeping
receivers. Normally, a program would wait for TDRE to become set to indicate the last character of a message has moved to the
transmit shifter, then write 0 and then write 1 to the TE bit. This action queues an idle character to be sent as soon as the shifter
is available. As long as the character in the shifter does not finish while TE = 0, the SCI transmitter never actually releases control
MM912_637, Rev. 3.0
Freescale Semiconductor
192
Serial Communication Interface (S08SCIV4)
of the TxD pin. If there is a possibility of the shifter finishing while TE = 0, set the general-purpose I/O controls so the pin that is
shared with TxD is an output driving a logic 1. This ensures that the TxD line will look like a normal idle line even if the SCI loses
control of the port pin between writing 0 and then 1 to TE.
The length of the break character is affected by the BRK13 and M bits as shown below.
Table 274. Break Character Length
5.12.3.3
BRK13
M
Break Character Length
0
0
10 bit times
0
1
11 bit times
1
0
13 bit times
1
1
14 bit times
Receiver Functional Description
In this section, the receiver block diagram (Figure 47) is used as a guide for the overall receiver functional description. The data
sampling technique used to reconstruct receiver data is then described in more detail. Finally, two variations of the receiver
wake-up function are explained.
The receiver input is inverted by setting RXINV = 1. The receiver is enabled by setting the RE bit in SCIC2. Character frames
consist of a start bit of logic 0, eight (or nine) data bits (LSB first), and a stop bit of logic 1. For information about 9-bit data mode,
refer to Section 5.12.3.5.1, “8- and 9-Bit Data Modes". For the remainder of this discussion, we assume the SCI is configured for
normal 8-bit data mode.
After receiving the stop bit into the receive shifter, and provided the receive data register is not already full, the data character is
transferred to the receive data register and the receive data register full (RDRF) status flag is set. If RDRF was already set
indicating the receive data register (buffer) was already full, the overrun (OR) status flag is set and the new data is lost. Because
the SCI receiver is double-buffered, the program has one full character time after RDRF is set before the data in the receive data
buffer must be read to avoid a receiver overrun.
When a program detects that the receive data register is full (RDRF = 1), it gets the data from the receive data register by reading
SCID. The RDRF flag is cleared automatically by a 2-step sequence which is normally satisfied in the course of the user’s
program that handles receive data. Refer to Section 5.12.3.4, “Interrupts and Status Flags" for more details about flag clearing.
5.12.3.3.1
Data Sampling Technique
The SCI receiver uses a 16 baud rate clock for sampling. The receiver starts by taking logic level samples at 16 times the baud
rate to search for a falling edge on the RxD serial data input pin. A falling edge is defined as a logic 0 sample after three
consecutive logic 1 samples. The 16 baud rate clock is used to divide the bit time into 16 segments labeled RT1 through RT16.
When a falling edge is located, three more samples are taken at RT3, RT5, and RT7 to make sure this was a real start bit and
not merely noise. If at least two of these three samples are 0, the receiver assumes it is synchronized to a receive character.
The receiver then samples each bit time, including the start and stop bits, at RT8, RT9, and RT10 to determine the logic level for
that bit. The logic level is interpreted to be that of the majority of the samples taken during the bit time. In the case of the start bit,
the bit is assumed to be 0 if at least two of the samples at RT3, RT5, and RT7 are 0 even if one or all of the samples taken at
RT8, RT9, and RT10 are 1s. If any sample in any bit time (including the start and stop bits) in a character frame fails to agree
with the logic level for that bit, the noise flag (NF) will be set when the received character is transferred to the receive data buffer.
The falling edge detection logic continuously looks for falling edges, and if an edge is detected, the sample clock is
resynchronized to bit times. This improves the reliability of the receiver in the presence of noise or mismatched baud rates. It
does not improve worst case analysis because some characters do not have any extra falling edges anywhere in the character
frame.
In the case of a framing error, provided the received character was not a break character, the sampling logic that searches for a
falling edge is filled with three logic 1 samples so that a new start bit can be detected almost immediately. The receiver is inhibited
from receiving any new characters until the framing error flag is cleared. The receive shift register continues to function, but a
complete character cannot transfer to the receive data buffer if FE is still set.
MM912_637, Rev. 3.0
Freescale Semiconductor
193
Serial Communication Interface (S08SCIV4)
5.12.3.3.2
Receiver Wake-up Operation
Receiver wake-up is a hardware mechanism that allows an SCI receiver to ignore the characters in a message that is intended
for a different SCI receiver. In such a system, all receivers evaluate the first character(s) of each message, and as soon as they
determine the message is intended for a different receiver, they write logic 1 to the receiver wake up (RWU) control bit in SCIC2.
When RWU bit is set, the status flags associated with the receiver (with the exception of the idle bit, IDLE, when RWUID bit is
set) are inhibited from setting, thus eliminating the software overhead for handling the unimportant message characters. At the
end of a message, or at the beginning of the next message, all receivers automatically force RWU to 0 so all receivers wake up
in time to look at the first character(s) of the next message.
5.12.3.3.2.1 Idle-Line Wake-up
When WAKE = 0, the receiver is configured for idle-line wake-up. In this mode, RWU is cleared automatically when the receiver
detects a full character time of the idle-line level. The M control bit selects 8-bit or 9-bit data mode that determines how many bit
times of idle are needed to constitute a full character time (10 or 11 bit times because of the start and stop bits).
When RWU is one and RWUID is zero, the idle condition that wakes up the receiver does not set the IDLE flag. The receiver
wakes up and waits for the first data character of the next message which will set the RDRF flag and generate an interrupt if
enabled. When RWUID is one, any idle condition sets the IDLE flag and generates an interrupt if enabled, regardless of whether
RWU is zero or one.
The idle-line type (ILT) control bit selects one of two ways to detect an idle line. When ILT = 0, the idle bit counter starts after the
start bit so the stop bit and any logic 1s at the end of a character count toward the full character time of idle. When ILT = 1, the
idle bit counter does not start until after a stop bit time, so the idle detection is not affected by the data in the last character of the
previous message.
5.12.3.3.2.2 Address-Mark Wake-up
When WAKE = 1, the receiver is configured for address-mark wake-up. In this mode, RWU is cleared automatically when the
receiver detects a logic 1 in the most significant bit of a received character (eighth bit in M = 0 mode and ninth bit in M = 1 mode).
Address-mark wake-up allows messages to contain idle characters but requires that the MSB be reserved for use in address
frames. The logic 1 MSB of an address frame clears the RWU bit before the stop bit is received and sets the RDRF flag. In this
case, the character with the MSB set is received even though the receiver was sleeping during most of this character time.
5.12.3.4
Interrupts and Status Flags
The SCI system has three separate interrupt vectors to reduce the amount of software needed to isolate the cause of the
interrupt. One interrupt vector is associated with the transmitter for TDRE and TC events. Another interrupt vector is associated
with the receiver for RDRF, IDLE, RXEDGIF, and LBKDIF events, and a third vector is used for OR, NF, FE, and PF error
conditions. Each of these ten interrupt sources can be separately masked by local interrupt enable masks. The flags can still be
polled by software when the local masks are cleared to disable generation of hardware interrupt requests.
The SCI transmitter has two status flags that optionally can generate hardware interrupt requests. Transmit data register empty
(TDRE) indicates when there is room in the transmit data buffer to write another transmit character to SCID. If the transmit
interrupt enable (TIE) bit is set, a hardware interrupt will be requested whenever TDRE = 1. Transmit complete (TC) indicates
that the transmitter is finished transmitting all data, preamble, and break characters and is idle with TxD at the inactive level. This
flag is often used in systems with modems to determine when it is safe to turn off the modem. If the transmit complete interrupt
enable (TCIE) bit is set, a hardware interrupt will be requested whenever TC = 1. Instead of hardware interrupts, software polling
may be used to monitor the TDRE and TC status flags if the corresponding TIE or TCIE local interrupt masks are 0s.
When a program detects that the receive data register is full (RDRF = 1), it gets the data from the receive data register by reading
SCID. The RDRF flag is cleared by reading SCIS1 while RDRF = 1 and then reading SCID.
When polling is used, this sequence is naturally satisfied in the normal course of the user program. If hardware interrupts are
used, SCIS1 must be read in the interrupt service routine (ISR). Normally, this is done in the ISR anyway to check for receive
errors, so the sequence is automatically satisfied.
The IDLE status flag includes logic that prevents it from getting set repeatedly when the RxD line remains idle for an extended
period of time. IDLE is cleared by reading SCIS1 while IDLE = 1 and then reading SCID. After IDLE has been cleared, it cannot
become set again until the receiver has received at least one new character and has set RDRF.
MM912_637, Rev. 3.0
Freescale Semiconductor
194
Serial Communication Interface (S08SCIV4)
If the associated error was detected in the received character that caused RDRF to be set, the error flags — noise flag (NF),
framing error (FE), and parity error flag (PF) — get set at the same time as RDRF. These flags are not set in overrun cases.
If RDRF was already set when a new character is ready to be transferred from the receive shifter to the receive data buffer, the
overrun (OR) flag gets set instead the data along with any associated NF, FE, or PF condition is lost.
At any time, an active edge on the RxD serial data input pin causes the RXEDGIF flag to set. The RXEDGIF flag is cleared by
writing a “1” to it. This function does depend on the receiver being enabled (RE = 1).
5.12.3.5
Additional SCI Functions
The following sections describe additional SCI functions.
5.12.3.5.1
8- and 9-Bit Data Modes
The SCI system (transmitter and receiver) can be configured to operate in 9-bit data mode by setting the M control bit in SCIC1.
In 9-bit mode, there is a ninth data bit to the left of the MSB of the SCI data register. For the transmit data buffer, this bit is stored
in T8 in SCIC3. For the receiver, the ninth bit is held in R8 in SCIC3.
For coherent writes to the transmit data buffer, write to the T8 bit before writing to SCID.
If the bit value to be transmitted as the ninth bit of a new character is the same as for the previous character, it is not necessary
to write to T8 again. When data is transferred from the transmit data buffer to the transmit shifter, the value in T8 is copied at the
same time data is transferred from SCID to the shifter.
9-bit data mode typically is used in conjunction with parity to allow eight bits of data plus the parity in the ninth bit. Or it is used
with address-mark wake-up so the ninth data bit can serve as the wake-up bit. In custom protocols, the ninth bit can also serve
as a software-controlled marker.
5.12.3.5.2
Stop Mode Operation
During all stop modes, clocks to the SCI module are halted.
In stop1 and stop2 modes, all SCI register data is lost and must be re-initialized upon recovery from these two stop modes. No
SCI module registers are affected in stop3 mode.
The receive input active edge detect circuit is still active in stop3 mode, but not in stop2. An active edge on the receive input
brings the CPU out of stop3 mode if the interrupt is not masked (RXEDGIE = 1).
Note, because the clocks are halted, the SCI module will resume operation upon exit from stop (only in stop3 mode). Software
should ensure stop mode is not entered while there is a character being transmitted out of or received into the SCI module.
5.12.3.5.3
Loop Mode
When LOOPS = 1, the RSRC bit in the same register chooses between loop mode (RSRC = 0) or single-wire mode (RSRC = 1).
Loop mode is sometimes used to check software, independent of connections in the external system, to help isolate system
problems. In this mode, the transmitter output is internally connected to the receiver input and the RxD pin is not used by the SCI,
so it reverts to a general purpose port I/O pin.
5.12.3.5.4
Single-wire Operation
When LOOPS = 1, the RSRC bit in the same register chooses between loop mode (RSRC = 0) or single-wire mode (RSRC = 1).
Single-wire mode is used to implement a half-duplex serial connection. The receiver is internally connected to the transmitter
output and to the TxD pin. The RxD pin is not used and reverts to a general-purpose port I/O pin.
In single-wire mode, the TXDIR bit in SCIC3 controls the direction of serial data on the TxD pin. When TXDIR = 0, the TxD pin
is an input to the SCI receiver and the transmitter is temporarily disconnected from the TxD pin so an external device can send
serial data to the receiver. When TXDIR = 1, the TxD pin is an output driven by the transmitter. In single-wire mode, the internal
loop back connection from the transmitter to the receiver causes the receiver to receive characters that are sent out by the
transmitter.
MM912_637, Rev. 3.0
Freescale Semiconductor
195
Life Time Counter (LTC)
5.13
Life Time Counter (LTC)
MCU
5.13.1
ANALOG
Introduction
The Life Time Counter is implemented as flexible counter running in both, low power (STOP and SLEEP) and normal modes.
It is based on the ALFCLK clock featuring IRQ and Wake Up capabilities on the Life Time Counter Overflow. The Wake Up on
overflow would be indicated in the PCR_SR register WULTCF bit.
5.13.2
Memory Map and Registers
5.13.2.1
Overview
This section provides a detailed description of the memory map and registers.
5.13.2.2
Module Memory Map
The memory map for the LTC module is in Table 275
Table 275. Module Memory Map
Offset(228)
Name
LTC_CTL (hi)
0x38
Life Time Counter control
register
LTC_CTL (lo)
R
0x39
0x3A
7
6
5
4
3
2
1
0
R
0
0
0
0
0
0
0
0
W
LTCIEM
Life Time Counter control
register
W
LTC_SR
R
Life Time Counter status register W
0x3B
Reserved
R
LTCEM
0
0
0
0
0
0
LTCIE
LTCOF
LTCE
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1 = clear
0
W
R
0x3C
LTC_CNT1
W
Life Time Counter Register
R
W
LTC[31:0]
R
0x3E
LTC_CNT0
W
Life Time Counter Register
R
W
Notes
228.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
5.13.2.3
Register Descriptions
This section consists of register descriptions in address order. Each description includes a standard register diagram with an
associated figure number. Details of register bit and field function follow the register diagrams, in bit order.
MM912_637, Rev. 3.0
Freescale Semiconductor
196
5.13.2.3.1
Life Time Counter Control Register (LTC_CTL (hi))
Table 276. Life Time Counter control register (LTC_CTL (hi))
Offset(229)
0x38
Access: User write
7
6
5
4
3
2
1
0
R
0
0
0
0
0
0
0
0
W
LTCIEM
Reset
0
0
0
0
0
0
0
LTCEM
0
Notes
229.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 277. Life Time Counter Control Register (LTC_CTL (hi)) - Register Field Descriptions
Field
Description
Life Time Counter Enable Mask
0 - writing the LTCE Bit will have no effect
1 - writing the LTCE Bit will be effective
0
LTCEM
Life Time Counter Interrupt Enable Mask
0 - writing the LTCIE Bit will have no effect
1 - writing the LTCIE Bit will be effective
7
LTCIEM
5.13.2.3.2
Life Time Counter Control Register (LTC_CTL (lo))
Table 278. Life Time Counter Control Register (LTC_CTL (lo))
Offset(230)
0x39
Access: User read/write
7
R
LTCIE
W
Reset
0
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
LTCE
0
Notes
230.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 279. Life Time Counter Control Register (LTC_CTL (lo)) - Register Field Descriptions
Field
0
LTCE
7
LTCIE
Description
Life Time Counter Enable
1 - Life time counter module enabled. Counter will be incremented with based on the ALFCLK frequency.
0 - Life time counter module disabled. Counter content will remain.(231)
Life Time Counter Interrupt Enable
1 - Life time counter overflow will generate an interrupt request.
0 - Life time counter overflow will not generate an interrupt request.
Notes
231.The first period after enable might be shorted due to the asynchronous clocks.
MM912_637, Rev. 3.0
Freescale Semiconductor
197
5.13.2.3.3
Life Time Counter status register (LTC_SR)
Table 280. Life Time Counter status register (LTC_SR)
Offset(232)
0x3A
R
Access: User read/write
7
6
5
4
3
2
1
0
LTCOF
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
Reset
Notes
232.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 281. Life Time Counter Status Register (LTC_SR) - Register Field Descriptions
Field
0
LTCOF
Description
Life Time Counter Overflow Flag. Writing 1 will clear the flag.
1 - Life time counter overflow detected.
0 - No life time counter overflow since last clear
5.13.2.3.4
Life Time Counter Register (LTC_CNT1, LTC_CNT0)
Table 282. Life Time Counter Register (LTC_CNT1, LTC_CNT0)
Offset
0x3C, 0x3E
Access: User read/write
(233),(234)
7
6
5
4
3
2
1
0
0
0
0
0
R
W
LTC[31:16]
R
W
R
W
LTC[15:0]
R
W
Reset
0
0
0
0
Notes
233.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
234.Those Registers are 16-Bit access only.
Table 283. Life Time Counter Register (LTC_CNT1, LTC_CNT0) - Register Field Descriptions
Field
0-31
LTC[31:0]
Description
Life Time Counter Register
The two 16-Bit words of the 32-Bit Life Time Counter register represent the current counter status. Whenever the
microcontroller performs a reading operation on one of the 16Bit registers, the Life Time Counter is stopped until the
remaining 16-Bit register is read, to prevent loss of information. After the second part is read, the LTC continues
automatically.
Write operations should be performed with the Life Time Counter disabled to prevent a loss of data.
MM912_637, Rev. 3.0
Freescale Semiconductor
198
Die to Die Interface - Target
5.14
Die to Die Interface - Target
The D2D Interface is the bus interface to the Microcontroller. Access to the MM912_637 analog die is controlled by
the D2D Interface module. This section describes the functionality of the die-to-die target block (D2D).
5.14.1
MCU
ANALOG
Overview
The D2D is the target for a data transfer from the target to the initiator (MCU). The initiator provides a set of configuration registers
and two memory mapped 256 Byte address windows. When writing to a window a transaction is initiated sending a write
command, followed by an 8-bit address and the data byte or word is received from the initiator. When reading from a window a
transaction is received with the read command, followed by an 8-bit address. The target then responds with the data. The basic
idea is that a peripheral located on the MM912_637 analog die, can be addressed like an on-chip peripheral.
Internal Read Data Bus
Command,
Address and
Data Buffer
Internal Write Data Bus
Internal Address Bus
D2DCLK
Internal Interrupt signal (INT)
Internal
Interrupt
Sources
Figure 49. Die to Die Interface
Features:
•
software transparent register access to peripherals on the MM912_637 analog die
•
256 Byte address window
•
supports blocking read or write as well as non-blocking write transactions
•
8 bit physical bus width
•
automatic synchronization of the target when initiator starts driving the interface clock
•
generates transaction and error status as well as EOT acknowledge
•
providing single interrupt interface to D2D Initiator
5.14.2
Low Power Mode Operation
The D2D module is disabled in SLEEP and STOP mode. In Stop mode, the D2DINT signal is used to wake-up a powered down
MCU after re-enabling the D2D interface. As the MCU could wake-up without the MM912_637 analog die, a special command
will be recognized as wake-up event during Stop mode. See Section 5.2, “Analog Die - Power, Clock and Resets - PCR".
5.14.2.1
Normal Mode
While in Normal, D2DCLK acts as an input only with pull present. D2D[7:0] operates as input/output with pull-down always
present. D2DINT acts as an output only.
5.14.2.2
Sleep Mode / Stop Mode
While in Sleep mode, all Interface data pins are pulled down to DGND to reduce power consumption.
MM912_637, Rev. 3.0
Freescale Semiconductor
199
Embedded Microcontroller - Overview
5.15
Embedded Microcontroller - Overview
MCU
5.15.1
ANALOG
Introduction
The S12 Central Processing Unit (CPU) offers 128 kB of Flash memory and 6.0 kB of system SRAM, up to eight general purpose
I/Os, an on-chip oscillator and clock multiplier, one Serial Peripheral Interface (SPI), an interrupt module, and debug capabilities
via the on-chip debug module (DBG), in combination with the Background Debug mode (BDM) interface. Additionally, there is a
die-to-die initiator (D2DI) which represents the communication interface to the companion (analog) die.
5.15.2
Features
This section describes the key features of the MM912_637 micro controller die.
5.15.2.1
Chip-level Features
On-chip modules available within the family include the following features:
•
S12 CPU core (CPU12_V1)
•
128 kByte on-chip flash with ECC
•
4.0 kbyte on-chip data flash with ECC
•
6.0 kbyte on-chip SRAM
•
Phase locked loop (IPLL) frequency multiplier with internal filter
•
4.0–16 MHz amplitude controlled Pierce oscillator
•
1.024 MHz internal RC oscillator
•
One serial peripheral interface (SPI) module
•
On-chip voltage regulator (VREG) for regulation of input supply and all internal voltages
•
Die to Die Initiator (D2DI)
5.15.3
Module Features
The following sections provide more details of the modules implemented on the MC9S12I128.
5.15.3.1
S12 16-Bit Central Processor Unit (CPU)
S12 CPU is a high-speed 16-bit processing unit:
•
•
•
Full 16-bit data paths supports efficient arithmetic operation and high speed math execution
Includes many single-byte instructions. This allows much more efficient use of ROM space
Extensive set of indexed addressing capabilities, including:
— Using the stack pointer as an indexing register in all indexed operations
— Using the program counter as an indexing register in all but auto increment/decrement mode
— Accumulator offsets using A, B, or D accumulators
— Automatic index predecrement, preincrement, postdecrement, and postincrement (by –8 to +8)
MM912_637, Rev. 3.0
Freescale Semiconductor
200
Embedded Microcontroller - Overview
5.15.3.2
On-chip Flash with ECC
On-chip flash memory on the MM912_637 features the following:
•
128 kbyte of program flash memory
— 32 data bits plus 7 syndrome ECC (Error Correction Code) bits allow single bit error correction and double fault
detection
— Erase sector size 512 bytes
— Automated program and erase algorithm
— User margin level setting for reads
— Protection scheme to prevent accidental program or erase
•
4.0 kbyte data flash memory
— 16 data bits plus 6 syndrome ECC (Error Correction Code) bits allow single bit error correction and double-bit error
detection
— Erase sector size 256 bytes
— Automated program and erase algorithm
— User margin level setting for reads
5.15.3.3
•
6.0 kBytes of general purpose RAM
5.15.3.4
•
Internal RC Oscillator (IRC)
Trimmable internal reference clock
— Frequency: 1.024 MHz
5.15.3.6
•
Main External Oscillator (XOSC)
Loop controlled Pierce oscillator using a 4.0 MHz to 16 MHz crystal or resonator
— Current gain control on amplitude output
— Signal with low harmonic distortion
— Low power
— Good noise immunity
— Eliminates need for external current limiting resistor
— Transconductance sized for optimum start-up margin for typical crystals
5.15.3.5
•
On-chip SRAM
Internal Phase-locked-loop (IPLL)
Phase-locked-loop clock frequency multiplier
— No external components required
— Reference divider and multiplier allow large variety of clock rates
— Automatic bandwidth control mode for low-jitter operation
— Automatic frequency lock detector
— Configurable option to spread spectrum for reduced EMC radiation (frequency modulation)
— Reference clock sources:
– External 4.0–16 MHz resonator/crystal (XOSC)
– Internal 1.024 MHz RC oscillator (IRC)
MM912_637, Rev. 3.0
Freescale Semiconductor
201
Embedded Microcontroller - Overview
5.15.3.7
•
•
•
•
•
•
•
Power-on reset (POR)
System reset generation
Illegal address detection with reset
Low voltage detection with interrupt or reset
Real time interrupt (RTI)
Computer operating properly (COP) watchdog
— Configurable as window COP for enhanced failure detection
— Initialized out of reset using option bits located in flash memory
Clock monitor supervising the correct function of the oscillator
5.15.3.8
•
•
•
•
•
•
Serial Peripheral Interface Module (SPI)
Configurable 8- or 16-bit data size
Full duplex or single-wire bidirectional
Double buffered transmit and receive
Master or slave mode
MSB-first or LSB-first shifting
Serial clock phase and polarity options
5.15.3.9
•
•
•
•
System Integrity Support
On-chip Voltage Regulator (VREG)
Linear voltage regulator with bandgap reference
Low voltage detect (LVD) with low voltage interrupt (LVI)
Power-on reset (POR) circuit
Low voltage reset (LVR)
5.15.3.10 Background Debug (BDM)
•
•
Non-intrusive memory access commands
Supports in-circuit programming of on-chip nonvolatile memory
5.15.3.11 Debugger (DBG)
•
•
•
•
•
Trace buffer with depth of 64 entries
Three comparators (A, B and C)
— Comparator A compares the full address bus and full 16-bit data bus
— Exact address or address range comparisons
Two types of comparator matches
— Tagged: This matches just before a specific instruction begins execution
— Force: This is valid on the first instruction boundary after a match occurs
Four trace modes
Four stage state sequencer
5.15.3.12 Die to Die Initiator (D2DI)
•
•
Up to 2.0 Mbyte/s data rate
Configurable 4-bit or 8-bit wide data path
MM912_637, Rev. 3.0
Freescale Semiconductor
202
Embedded Microcontroller - Overview
5.15.4
Block Diagram
Voltage Regulator
Input: 3.13 V … 5.5 V
Outputs: 1.8 V core and 2.7 Flash
CPU12-V1
PORTE
PE0
PE1
SPI
Debug Module
Single-wire Background 3 address breakpoints
Debug Module
1 data breakpoints
64 Byte Trace Buffer
EXTAL
XTAL
RESET
TEST
Clock Monitor
COP Watchdog
Periodic Interrupt
.
PLL with Frequency
Modulation option
Reset Generation
and Test Entry
PORTD
4.0 k bytes Dataflash with ECC
Amplitude
Controlled
Low Power
PD0
PD1
PD2
PD3
PD4
PD5
PD6
PD7
D2DCLK
D2DINT
PC0
PC1
PA0
PA1
PA2
PA3
PA4
PA5
PA6
PA7
Die-to-Die Initiator
selectable 4 or 8 bit wide
6.0 k bytes RAM
BKGD
D2D0
D2D1
D2D2
D2D3
D2D4
D2D5
D2D6
D2D7
PORTC
128 k bytes Flash with ECC
PORTA
Figure 50 shows a block diagram of the MC9S12I128 device.
Interrupt Module
Synchronous Serial IF
MISO
MOSI
SCK
SS
Power Supply:
VDDRX, VSSRX: 3.13 V …5.5V
for Regulator Input, Port A, Port E, BKGD, TEST
and RESET
VDDD2D, VSSD2D: 2.5 V for Ports C and D
Figure 50. MC9S12I128 Block Diagram
MM912_637, Rev. 3.0
Freescale Semiconductor
203
Embedded Microcontroller - Overview
5.15.5
Device Memory Map
Table 284 shows the device register memory map.
Table 284. Device Register Memory Map
Address
Module
Size
(Bytes)
0x0000–0x0009
PIM (port integration module)
10
0x000A–0x000B
MMC (memory map control)
2
0x000C–0x000D
PIM (port integration module)
2
0x000E–0x000F
Reserved
2
0x0010–0x0015
MMC (memory map control)
8
0x0016–0x0019
Reserved
2
0x001A–0x001B
Device ID register
2
0x001C–0x001E
Reserved
4
0x001F
INT (interrupt module)
1
0x0020–0x002F
DBG (debug module)
16
0x0030–0x0033
Reserved
4
0x0034–0x003F
CPMU (clock and power management)
12
0x0040–0x00D7
Reserved
152
0x00D8–0x00DF
D2DI (die 2 die initiator)
8
0x00E0–0x00E7
Reserved
32
0x00E8–0x00EF
SPI (serial peripheral interface)
8
0x00F0–0x00FF
Reserved
32
0x0100–0x0113
FTMRC control registers
20
0x0114–0x011F
Reserved
12
0x0120–0x017F
PIM (port integration module)
96
0x0180–0x01EF
Reserved
112
0x01F0–0x01FC
CPMU (clock and power management)
13
0x01FD–0x01FF
Reserved
3
0x0200-0x02FF
D2DI (die 2 die initiator, blocking access window)
256
0x0300–0x03FF
D2DI (die 2 die initiator, non-blocking write window)
256
NOTE
Reserved register space shown in Table 284 is not allocated to any module. This register
space is reserved for future use. Writing to these locations have no effect. Read access to
these locations returns zero.
MM912_637, Rev. 3.0
Freescale Semiconductor
204
Embedded Microcontroller - Overview
Figure 51 shows MM912_637 CPU and BDM local address translation to the global memory map. It indicates also the location
of the internal resources in the memory map. The whole 256 k global memory space is visible through the P-Flash window located
in the 64 k local memory map located at 0x8000 - 0xBFFF using the PPAGE register.
CPU and BDM
Local Memory Map
Global Memory Map
0x0000
Registers
0x0400
Unimplemented
D-Flash 4K Bytes
0x0_2800
0x1400
RAM 6K
Unpaged P-Flash
Page 0x0C
0x0_4000
0x0_4400
RAM 6K Bytes
NVM Resources
D-Flash
0x0_5400
NVM Resources
0x4000
Unimplemented
(PPAGES
0x02-0x07)
P-Flash
4* 16K Pages
(PPAGES
0x08-0x0B)
0x0_8000
(PPAGE 0x01)
0x2800
(PPAGE 0x00)
0x0_0000
Registers
Unpaged P-Flash
Page 0x0D
0x2_0000
0x8000
P-Flash window
0 0 0 0
Unpaged P-Flash
P3 P2 P1 P0
PPAGE
0x3_4000
0xC000
Unpaged P-Flash
0x3_8000
Unpaged P-Flash
Page 0x0F
0xFFFF
0x3_C000
Unpaged P-Flash
0x3_FFFF
Figure 51. MC9S12I128 Global Memory Map
(PPAGE 0x0C) (PPAGE 0x0D) (PPAGE 0x0E) (PPAGE 0x0F)
0x3_0000
MM912_637, Rev. 3.0
Freescale Semiconductor
205
Embedded Microcontroller - Overview
5.15.6
Part ID Assignments
The part ID is located in two 8-bit registers PARTIDH and PARTIDL (addresses 0x001A and 0x001B). The read-only value is a
unique part ID for each revision of the chip. Table 285 shows the assigned part ID number and Mask Set number.
The Version ID in Table 285 is a word located in a flash information row. The version ID number indicates a specific version of
internal NVM controller.
Table 285. Assigned Part ID Numbers
Device
Mask Set Number
Part ID(235)
Version ID
MM912_637
0M96X
0x3880
0x0000
Notes
235.The coding is as follows:
Bit 15-12: Major family identifier
Bit 11-6: Minor family identifier
Bit 5-4: Major mask set revision number including FAB transfers 
Bit 3-0: Minor — non full — mask set revision
5.15.7
System Clock Description
Refer to Section 5.22, “S12 Clock, Reset, and Power Management Unit (S12CPMU)" for the system clock description.
5.15.8
Modes of Operation
The MCU can operate in different modes. These are described in Section 5.15.8.1, “Chip Configuration Summary".
The MCU can operate in different power modes to facilitate power saving when full system performance is not required. These
are described in Section 5.15.8.2, “Low Power Operation".
Some modules feature a software programmable option to freeze the module status while the background debug module is active
to facilitate debugging.
5.15.8.1
Chip Configuration Summary
The different modes and the security state of the MCU affect the debug features (enabled or disabled).
The operating mode out of reset is determined by the state of the MODC signal during reset (see Table 286). The MODC bit in
the MODE register shows the current operating mode and provides limited mode switching during operation. The state of the
MODC signal is latched into this bit on the rising edge of RESET.
Table 286. Chip Modes
Chip Modes
5.15.8.1.1
MODC
Normal single chip
1
Special single chip
0
Normal Single-chip Mode
This mode is intended for normal device operation. The opcode from the on-chip memory is being executed after reset (requires
the reset vector to be programmed correctly). The processor program is executed from internal memory.
5.15.8.1.2
Special Single-chip Mode
This mode is used for debugging single-chip operation, boot-strapping, or security related operations. The background debug
module BDM is active in this mode. The CPU executes a monitor program located in an on-chip ROM. BDM firmware waits for
additional serial commands through the BKGD pin.
MM912_637, Rev. 3.0
Freescale Semiconductor
206
Embedded Microcontroller - Overview
5.15.8.2
Low Power Operation
The MM912_637 has two static low-power modes Pseudo Stop and Stop mode. For a detailed description refer to the S12CPMU
section.
5.15.9
Security
The MCU security mechanism prevents unauthorized access to the Flash memory. Refer to Section 5.20, “MCU - Security
(S12XS9SECV2)", Section 5.21.4.1, “Security", and Section 5.24.5, “Security". Resets and Interrupts
Consult the S12 CPU manual and the S12SINT section for information on exception processing.
5.15.9.1
Resets
Table 287 lists all Reset sources and the vector locations. Resets are explained in detail in Section 5.22, “S12 Clock, Reset, and
Power Management Unit (S12CPMU)".
Table 287. Reset Sources and Vector Locations
Reset Source
CCR
Mask
Local Enable
$FFFE
Power-On Reset (POR)
None
None
$FFFE
Low Voltage Reset (LVR)
None
None
$FFFE
External pin RESET
None
None
$FFFE
Illegal Address Reset
None
None
$FFFC
Clock monitor reset
None
OSCE Bit in CPMUOSC register
$FFFA
COP watchdog reset
None
CR[2:0] in CPMUCOP register
Vector Address
5.15.9.2
Interrupt Vectors
Table 288 lists all interrupt sources and vectors in the default order of priority. The interrupt module (see Section 5.17, “MCU Interrupt Module (S12SINTV1)") provides an interrupt vector base register (IVBR) to relocate the vectors.
Table 288. Interrupt Vector Locations (Sheet 1 of 2)
Vector Address(236)
Interrupt Source
CCR
Mask
Local Enable
Vector base + $F8
Unimplemented instruction trap
None
None
-
-
Vector base+ $F6
SWI
None
None
-
-
Vector base+ $F4
D2DI Error Interrupt
X Bit
None
Yes
Yes
Vector base+ $F2
D2DI External Interrupt
I bit
D2DCTL (D2DIE)
Yes
Yes
Vector base+ $F0
RTI timeout interrupt
I bit
CPMUINT (RTIE)
Vector base + $EE
to
Vector base + $DA
Vector base + $D8
Wake-up
Wake-up
from STOP from WAIT
3.22.6 Interrupts
Reserved
SPI
I bit
Vector base + $D6
to
Vector base + $CA
SPICR1 (SPIE, SPTIE)
No
Yes
Reserved
Vector base + $C8
Oscillator status interrupt
I bit
CPMUINT (OSCIE)
No
No
Vector base + $C6
PLL lock interrupt
I bit
CPMUINT (LOCKIE)
No
No
Vector base + $C4
to
Vector base + $BC
Reserved
MM912_637, Rev. 3.0
Freescale Semiconductor
207
Embedded Microcontroller - Overview
Table 288. Interrupt Vector Locations (Sheet 2 of 2)
Interrupt Source
CCR
Mask
Local Enable
Vector base + $BA
FLASH error
I bit
FERCNFG (SFDIE, DFDIE)
No
No
Vector base + $B8
FLASH command
I bit
FCNFG (CCIE)
No
Yes
No
Yes
-
-
Vector Address(236)
Vector base + $B6
to
Vector base + $8C
Vector base + $8A
Reserved
Low-voltage interrupt (LVI)
I bit
Vector base + $88
to
Vector base + $82
Vector base + $80
Wake-up
Wake-up
from STOP from WAIT
CPMUCTRL (LVIE)
Reserved
Spurious interrupt
—
None
Notes
236.16-bit vector address based
5.15.9.3
Effects of Reset
When a reset occurs, MCU registers and control bits are initialized. Refer to the respective block sections for register reset states.
On each reset, the Flash module executes a reset sequence to load Flash configuration registers.
5.15.9.3.1
Flash Configuration Reset Sequence Phase
The Flash module will hold CPU on each reset activity while loading Flash module registers from the Flash memory. If double
faults are detected in the reset phase, Flash module protection and security may be active on leaving reset. This is explained in
more detail in the Flash module, Section 5.24.6, “Initialization".
5.15.9.3.2
Reset While Flash Command Active
If a reset occurs while any Flash command is in progress, that command will be immediately aborted. The state of the word being
programmed or the sector/block being erased is not guaranteed.
5.15.9.3.3
I/O Pins
Refer to the PIM section for reset configurations of all peripheral module ports.
5.15.9.3.4
Memory
The RAM arrays are not initialized out of reset.
5.15.10 COP Configuration
The COP timeout rate bits CR[2:0] and the WCOP bit in the CPMUCOP register at address 0x003C are loaded from the Flash
register FOPT. See Table 289 and Table 290 for coding. The FOPT register is loaded from the Flash configuration field byte at
global address 0x3_FF0E during the reset sequence.
Table 289. Initial COP Rate Configuration
NV[2:0] in FOPT Register
CR[2:0] in COPCTL Register
000
111
001
110
010
101
011
100
MM912_637, Rev. 3.0
Freescale Semiconductor
208
Embedded Microcontroller - Overview
Table 289. Initial COP Rate Configuration
NV[2:0] in FOPT Register
CR[2:0] in COPCTL Register
100
011
101
010
110
001
111
000
Table 290. Initial WCOP Configuration
NV[3] in FOPT Register
WCOP in COPCTL Register
1
0
0
1
MM912_637, Rev. 3.0
Freescale Semiconductor
209
MCU - Port Integration Module (9S12I128PIMV1)
5.16
MCU - Port Integration Module (9S12I128PIMV1)
MCU
5.16.1
ANALOG
Introduction
The Port Integration Module (PIM) establishes the interface between the S12I128 peripheral modules SPI and Die-To-Die
Interface module (D2DI) to the I/O pins of the MCU.
All port A and port E pins support general purpose I/O functionality, if not in use with other functions. The PIM controls the signal
prioritization and multiplexing on shared pins.
5.16.1.1
Overview
Figure 52 is a block diagram of the Port Integration Module.
D2DDAT0
D2DDAT1
D2DDAT2
D2DDAT3
D2DDAT4
D2DDAT5
D2DDAT6
D2DDAT7
PD0
PD1
PD2
PD3
PD4
PD5
PD6
PD7
EXTAL
XTAL
SPI
Synchronous Serial IF
MISO
MOSI
SCK
SS
PORTA
CPMU OSC
PORTE
PC0
PC1
DDRE
Die-to-Die IF
D2DCLK
D2DINT
DDRA
D2DI
PE0
PE1
PA0
PA1
PA2
PA3
PA4
PA5
PA6
PA7
Figure 52. Port Integration Module - Block Diagram
5.16.1.2
•
•
•
•
•
•
•
Features
8-pin port A associated with the SPI module
2-pin port C used as D2DI clock output and D2DI interrupt input
8-pin port D used as 8 or 4 bit data I/O for the D2DI module
2-pin port E associated with the CPMU OSC module
GPIO function shared on port A and E pins
Pull-down devices on PC1 and PD7-0 if used as D2DI inputs
Reduced drive capability on PC0 and PD7-0 on per pin basis
The Port Integration Module includes these distinctive registers:
•
Data registers for ports A and E when used as general purpose I/O
•
Data direction registers for ports A and E when used as general purpose I/O
•
Port input register on ports A and E
•
Reduced drive register on port C and D
MM912_637, Rev. 3.0
Freescale Semiconductor
210
MCU - Port Integration Module (9S12I128PIMV1)
5.16.2
External Signal Description
This section lists and describes the signals that do connect off-chip. Table 291 shows all the pins and their functions that are
controlled by the Port Integration Module.
NOTE
If there is more than one function associated with a pin, the priority is indicated by the
position in the table from top (highest priority) to bottom (lowest priority).
Table 291. Pin Functions and Priorities
Port
Pin Name
Pin Function
& Priority
I/O
PA7
GPIO
I/O
General-purpose I/O
PA6
GPIO
I/O
General-purpose I/O
PA5
GPIO
I/O
General-purpose I/O
PA4
GPIO
I/O
General-purpose I/O
SS
I/O
Serial Peripheral Interface 0 slave select output in master mode, input
in slave or master mode
GPIO
I/O
General-purpose I/O
SCK
I/O
Serial Peripheral Interface 0 serial clock pin
PA3
A
PA2
PA1
PA0
PE1
E
PE0
5.16.3
Pin Function
after Reset
Description
GPI
GPIO
I/O
General-purpose I/O
MOSI
I/O
Serial Peripheral Interface 0 master out/slave in pin
GPIO
I/O
General-purpose I/O
MISO
I/O
Serial Peripheral Interface 0 master in/slave out pin
GPIO
I/O
General-purpose I/O
XTAL
-
CPMU OSC XTAL pin
General-purpose I/O
GPIO
I/O
EXTAL
-
GPIO
I/O
GPI
CPMU OSC EXTAL pin
General-purpose I/O
Memory Map and Register Definition
This section provides a detailed description of all Port Integration Module registers.
5.16.3.1
Memory Map
Table 292. PIM Register Summary
Register
Name
0x0000
R
PORTA
W
0x0001
R
PORTE
W
0x0002
R
DDRA
W
0x0003
R
DDRE
W
Bit 7
6
5
4
3
2
1
Bit 0
PA7
PA6
PA5
PA4
PA3
PA2
PA1
PA0
0
0
0
0
0
0
PE1
PE0
DDRA7
DDRA6
DDRA5
DDRA4
DDRA3
DDRA2
DDRA1
DDRA0
0
0
0
0
0
0
DDRE1
DDRE0
MM912_637, Rev. 3.0
Freescale Semiconductor
211
MCU - Port Integration Module (9S12I128PIMV1)
Table 292. PIM Register Summary
Register
Name
0x00040x0009
Reserved
R
R
PUCR
W
0x000D
R
RDRIV
W
0x0120
R
PTIA
W
0x0121
R
PTIE
W
0x0122-
R
Reserved
6
5
4
3
2
1
Bit 0
0
0
0
0
0
0
0
0
0
0
0
0
RDPD
RDPC
W
0x000C
0x017F
Bit 7
0
BKPUE
0
0
0
0
PTIA7
PTIA6
PTIA5
PTIA4
PTIA3
0
0
0
0
0
0
0
0
PDPEE
0
0
0
PTIA2
PTIA1
PTIA0
0
0
PTIE1
PTIE0
0
0
0
0
W
= Unimplemented or Reserved
5.16.3.2
Port A Data Register (PORTA)
Table 293. Port A Data Register (PORTA)
Address 0x0000
Access: User read/write
7
6
5
4
3
2
1
0
PA7
PA6
PA5
PA4
PA3
PA2
PA1
PA0
SPI
Function
—
—
—
—
SS
SCK
MOSI
MISO
Reset
0
0
0
0
0
0
0
0
R
W
Read: Anytime.
Write: Anytime.
Table 294. PORTA Register Field Descriptions
Field
7–4
PA
3
PA
2
PA
Description
Port A general purpose input/output data—Data Register In / output mode the register bit is driven to the pin.
If the associated data direction bit of this pin is set to 1, a read returns the value of the port register, otherwise the buffered and
synchronized pin input state is read.
Port A general purpose input/output data—Data Register, SPI SS input/output
When not used with the alternative function, this pin can be used as general purpose I/O.
In general purpose output mode the register bit is driven to the pin.
If the associated data direction bit of this pin is set to 1, a read returns the value of the port register, otherwise the buffered pin input
state is read. The SPI function takes precedence over the general purpose I/O function if enabled.
Port A general purpose input/output data—Data Register, SPI SCK input/output
When not used with the alternative function, this pin can be used as general purpose I/O.
In general purpose output mode the register bit is driven to the pin.
If the associated data direction bit of this pin is set to 1, a read returns the value of the port register, otherwise the buffered pin input
state is read. The SPI function takes precedence over the general purpose I/O function if enabled.
MM912_637, Rev. 3.0
Freescale Semiconductor
212
MCU - Port Integration Module (9S12I128PIMV1)
Table 294. PORTA Register Field Descriptions
Field
1
PA
0
PA
Description
Port A general purpose input/output data—Data Register, SPI MOSI input/output
When not used with the alternative function, this pin can be used as general purpose I/O.
In general purpose output mode the register bit is driven to the pin.
If the associated data direction bit of this pin is set to 1, a read returns the value of the port register, otherwise the buffered pin input
state is read. The SPI function takes precedence over the general purpose I/O function if enabled.
Port A general purpose input/output data—Data Register, SPI MISO input/output
When not used with the alternative function, this pin can be used as general purpose I/O.
In general purpose output mode the register bit is driven to the pin.
If the associated data direction bit of this pin is set to 1, a read returns the value of the port register, otherwise the buffered pin input
state is read. The SPI function takes precedence over the general purpose I/O function if enabled.
5.16.3.3
Port E Data Register (PORTE)
Table 295. Port E Data Register (PORTE)
Address 0x0001
Access: User read/write
7
6
5
4
3
2
0
0
0
0
0
0
CPMU
OSC
Function
—
—
—
—
—
Reset
0
0
0
0
0
R
1
0
PE1
PE0
—
XTAL
EXTAL
0
0
0
W
Read: Anytime.
Write: Anytime.
Table 296. PORTE Register Field Descriptions
Field
1
PE
0
PE
Description
Port E general purpose input/output data—Data Register, CPMU OSC XTAL signal
When not used with the alternative function, this pin can be used as general purpose I/O.
In general purpose output mode the register bit is driven to the pin.
If the associated data direction bit of this pin is set to 1, a read returns the value of the port register, otherwise the buffered pin input
state is read. The CPMU OSC function takes precedence over the general purpose I/O function if enabled.
Port E general purpose input/output data—Data Register, CPMU OSC EXTAL signal
When not used with the alternative function, this pin can be used as general purpose I/O.
In general purpose output mode the register bit is driven to the pin.
If the associated data direction bit of this pin is set to 1, a read returns the value of the port register, otherwise the buffered pin input
state is read. The CPMU OSC function takes precedence over the general purpose I/O function if enabled.
MM912_637, Rev. 3.0
Freescale Semiconductor
213
MCU - Port Integration Module (9S12I128PIMV1)
5.16.3.4
Port A Data Direction Register (DDRA)
Table 297. Port A Data Direction Register (DDRA)
Address 0x0002
R
W
Access: User read/write
7
6
5
4
3
2
1
0
DDRA7
DDRA6
DDRA5
DDRA4
DDRA3
DDRA2
DDRA1
DDRA0
0
0
0
0
0
0
0
0
Reset
Read: Anytime.
Write: Anytime.
Table 298. DDRA Register Field Descriptions
Field
7–4
DDRA
3–0
DDRA
Description
Port A Data Direction—
This bit determines whether the associated pin is an input or output.
1 Associated pin is configured as output.
0 Associated pin is configured as input.
Port A Data Direction—
This bit determines whether the associated pin is an input or output.
Depending on the configuration of the enabled SPI the I/O state will be forced to input or output. In this case, the data direction
bits will not change.
1 Associated pin is configured as output.
0 Associated pin is configured as input.
5.16.3.5
Port E Data Direction Register (DDRE)
Table 299. Port E Data Direction Register (DDRE)
Address 0x0003
R
Access: User read/write
7
6
5
4
3
2
0
0
0
0
0
0
0
0
0
0
0
0
W
Reset
1
0
DDRE1
DDRE0
0
0
Read: Anytime.
Write: Anytime.
Table 300. DDRE Register Field Descriptions
Field
1–0
DDRE
Description
Port E Data Direction—
This bit determines whether the associated pin is an input or output.
The enabled CPMU OSC function connects the associated pins directly to the oscillator module. In this case, the data direction bits
will not change.
1 Associated pin is configured as output.
0 Associated pin is configured as input.
MM912_637, Rev. 3.0
Freescale Semiconductor
214
MCU - Port Integration Module (9S12I128PIMV1)
5.16.3.6
Pull-up Control Register (PUCR)
Table 301. Pull Control Register (PUCR)
Address 0x000C
7
R
0
W
Reset
0
Access: User read/write
6
BKPUE
1
5
4
3
2
0
0
0
0
0
0
0
0
1
PDPEE
1
0
0
0
Read: Anytime.
Write: Anytime.
Table 302. PUCR Register Field Descriptions
Field
6
BKPUE
1
PDPEE
Description
BKGD pin pull-up Enable—Enable pull-up devices on BKGD pin
This bit configures whether a pull-up device is activated, if the pin is used as input. This bit has no effect if the pin is
used as output. Out of reset the pull-up device is enabled.
1 Pull-up device enabled.
0 Pull-up device disabled.
Pull-down Port E Enable—Enable pull-down devices on all Port E input pins
This bit configures whether pull-down devices are activated, if the pins are used as inputs. This bit has no effect if the
pins are used as outputs. Out of reset the pull-down devices are enabled. If the CPMU OSC function is active, the pull-down devices
are disabled. In this case, the register bit will not change.
1 Pull-down devices enabled.
0 Pull-down devices disabled.
5.16.3.7
Reduced Drive Register (RDRIV)
Table 303. Reduced Drive Register (RDRIV)
Address 0x000D
R
Access: User read/write
7
6
5
4
0
0
0
0
0
0
0
0
W
Reset
3
2
RDPD
RDPC
0
0
1
0
0
0
0
0
Read: Anytime.
Write: Anytime.
Table 304. RDRIV Register Field Descriptions
Field
3
RDPD
2
RDPC
Description
Port D reduced drive—Select reduced drive for output pins
This bit configures the drive strength of output pins as either full or reduced. If a pin is used as input, this bit has no effect.
1 Reduced drive selected (1/5 of the full drive strength)
0 Full drive strength enabled
Port C reduced drive—Select reduced drive for D2DCLK output pin
This bit configures the drive strength of D2DCLK output pin as either full or reduced.
1 Reduced drive selected (1/5 of the full drive strength)
0 Full drive strength enabled
MM912_637, Rev. 3.0
Freescale Semiconductor
215
MCU - Port Integration Module (9S12I128PIMV1)
5.16.3.8
Port A Input Register (PTIA)
Table 305. Port A Input Register (PTIA)
Address 0x0120
R
Access: User read
7
6
5
4
3
2
1
0
PTIA7
PTIA6
PTIA5
PTIA4
PTIA3
PTIA2
PTIA1
PTIA0
u
u
u
u
u
u
u
u
W
Reset(237)
Notes
237.u = Unaffected by reset
Read: Anytime.
Write: Unimplemented. Writing to this register has no effect.
Table 306. PTIA Register Field Descriptions
Field
Description
7–0
Port A input data—
A read always returns the buffered input state of the associated pin. It can be used to detect overload or short-circuit conditions
on output pins.
PTIA
5.16.3.9
Port E Input Register (PTIE)
Table 307. Port E Input Register (PTIE)
Address 0x0121
R
Access: User read
7
6
5
4
3
2
1
0
0
0
0
0
0
0
PTIE1
PTIE0
u
u
u
u
u
u
u
u
W
Reset
(238)
Notes
238.u = Unaffected by reset
Read: Anytime.
Write: Unimplemented. Writing to this register has no effect.
Table 308. PTIE Register Field Descriptions
Field
Description
1–0
Port E input data—
A read always returns the buffered input state of the associated pin. It can be used to detect overload or short-circuit conditions
on output pins.
PTIE
MM912_637, Rev. 3.0
Freescale Semiconductor
216
MCU - Port Integration Module (9S12I128PIMV1)
5.16.4
5.16.4.1
5.16.4.1.1
Functional Description
Registers
Data Register (PORTx)
This register holds the value driven out to the pin, if the pin is used as a general purpose I/O.
Writing to this register has only an effect on the pin, if the pin is used as general purpose output. When reading this address, the
buffered and synchronized state of the pin is returned, if the associated data direction register bit is set to “0”.
If the data direction register bits are set to logic level “1”, the contents of the data register is returned. This is independent of any
other configuration (Figure 53).
5.16.4.1.2
Data Direction Register (DDRx)
This register defines whether the pin is used as an input or an output.
If a peripheral module controls the pin the contents of the data direction register is ignored (Figure 53).
5.16.4.1.3
Input Register (PTIx)
This is a read-only register and always returns the buffered and synchronized state of the pin (Figure 53).
PTIx
synch.
0
1
PORTx
0
PIN
1
DDRx
0
1
data out
Periph.
Module
output enable
port enable
data in
Figure 53. Illustration of I/O Pin Functionality
5.16.4.1.4
Reduced Drive Register (RDRIV)
If the pin is used as an output, this register allows the configuration of the drive strength.
5.16.4.1.5
Pull device enable register (PUCR)
This register turns on a pull-up or pull-down device.
It becomes active only if the pin is used as an input.
MM912_637, Rev. 3.0
Freescale Semiconductor
217
5.16.4.2
5.16.4.2.1
Ports
Port A
This port is associated with the SPI. Port A pins PA7-0 can be used for general purpose I/O and PA3-0 also with the SPI
subsystem.
5.16.4.2.2
Port E
This port is associated with the CPMU OSC.
Port E pins PE1-0 can be used for general purpose or with the CPMU OSC module.
5.16.5
5.16.5.1
Initialization Information
Port Data and Data Direction Register Writes
Writing PTx and DDRx in a word access is not recommended. When changing the register pins from inputs to outputs, the data
may have extra transitions during the write access. Initialize the port data register before enabling the outputs.
MM912_637, Rev. 3.0
Freescale Semiconductor
218
MCU - Interrupt Module (S12SINTV1)
5.17
MCU - Interrupt Module (S12SINTV1)
MCU
5.17.1
ANALOG
Introduction
The INT module decodes the priority of all system exception requests and provides the applicable vector for processing the
exception to the CPU. The INT module supports:
•
I bit and X bit maskable interrupt requests
•
A non-maskable unimplemented op-code trap
•
A non-maskable software interrupt (SWI) or background debug mode request
•
Three system reset vector requests
•
A spurious interrupt vector
Each of the I bit maskable interrupt requests is assigned to a fixed priority level.
5.17.1.1
Glossary
Table 309 contains terms and abbreviations used in the document.
Table 309. Terminology
Term
CCR
Condition Code Register (in the CPU)
ISR
Interrupt Service Routine
MCU
5.17.1.2
•
•
•
•
•
•
•
•
•
•
Meaning
Micro-controller Unit
Features
Interrupt vector base register (IVBR)
One spurious interrupt vector (at address vector base(239) + 0x0080).
2–58 I bit maskable interrupt vector requests (at addresses vector base + 0x0082–0x00F2)
I bit maskable interrupts can be nested
One X bit maskable interrupt vector request (at address vector base + 0x00F4)
One non-maskable software interrupt request (SWI) or background debug mode vector request (at address vector base
+ 0x00F6)
One non-maskable unimplemented op-code trap (TRAP) vector (at address vector base + 0x00F8)
Three system reset vectors (at addresses 0xFFFA–0xFFFE)
Determines the highest priority interrupt vector requests, drives the vector to the bus on CPU request
Wakes up the system from stop or wait mode when an appropriate interrupt request occurs
Notes
239.The vector base is a 16-bit address which is accumulated from the contents of the interrupt vector base register (IVBR, used as upper byte)
and 0x00 (used as lower byte).
MM912_637, Rev. 3.0
Freescale Semiconductor
219
MCU - Interrupt Module (S12SINTV1)
5.17.1.3
•
•
•
•
Modes of Operation
Run mode
This is the basic mode of operation.
Wait mode
In Wait mode, the clock to the INT module is disabled. The INT module is however capable of waking up the CPU from
Wait mode, if an interrupt occurs. Refer to Section 5.17.5.3, “Wake-up from Stop or Wait Mode"” for details
Stop mode
In Stop mode, the clock to the INT module is disabled. The INT module is however capable of waking up the CPU from
Stop mode, if an interrupt occurs. Refer to Section 5.17.5.3, “Wake-up from Stop or Wait Mode"” for details
Freeze mode (BDM active)
In Freeze mode (BDM active), the interrupt vector base register is overridden internally. Refer to Section 5.17.3.1.1,
“Interrupt Vector Base Register (IVBR)"” for details
5.17.1.4
Block Diagram
Figure 54 shows a block diagram of the INT module.
Peripheral
Interrupt Requests
Vector
Address
Priority
Decoder
Non I bit Maskable Channels
To CPU
Wake-up
CPU
IVBR
I bit Maskable Channels
Interrupt
Requests
Figure 54. INT Block Diagram
5.17.2
External Signal Description
The INT module has no external signals.
5.17.3
Memory Map and Register Definition
This section provides a detailed description of all registers accessible in the INT module.
5.17.3.1
Register Descriptions
This section describes in address order all the INT registers and their individual bits.
5.17.3.1.1
Interrupt Vector Base Register (IVBR)
MM912_637, Rev. 3.0
Freescale Semiconductor
220
MCU - Interrupt Module (S12SINTV1)
Table 310. Interrupt Vector Base Register (IVBR)
Address: 0x001F
7
6
5
4
R
3
2
1
0
1
1
1
IVB_ADDR[7:0]
W
Reset
1
1
1
1
1
Read: Anytime.
Write: Anytime.
Table 311. IVBR Field Descriptions
Field
Description
7–0
IVB_ADDR[7:0]
5.17.4
Interrupt Vector Base Address Bits — These bits represent the upper byte of all vector addresses. Out of reset, these bits
are set to 0xFF (i.e., vectors are located at 0xFF80–0xFFFE) to ensure compatibility to HCS12.
Note: A system reset will initialize the interrupt vector base register with “0xFF” before it is used to determine the reset
vector address. Therefore, changing the IVBR has no effect on the location of the three reset vectors
(0xFFFA–0xFFFE).
Note: If the BDM is active (i.e., the CPU is in the process of executing BDM firmware code), the contents of IVBR are
ignored and the upper byte of the vector address is fixed as “0xFF”. This is done to enable handling of all
non-maskable interrupts in the BDM firmware.
Functional Description
The INT module processes all exception requests to be serviced by the CPU module. These exceptions include interrupt vector
requests and reset vector requests. Each of these exception types and their overall priority level is discussed in the following
subsections.
5.17.4.1
S12S Exception Requests
The CPU handles both reset requests and interrupt requests. A priority decoder is used to evaluate the priority of pending
interrupt requests.
5.17.4.2
Interrupt Prioritization
The INT module contains a priority decoder to determine the priority for all interrupt requests pending for the CPU. If more than
one interrupt request is pending, the interrupt request with the higher vector address wins the prioritization.
The following conditions must be met for an I bit maskable interrupt request to be processed.
1. The local interrupt enabled bit in the peripheral module must be set.
2. The I bit in the condition code register (CCR) of the CPU must be cleared.
3. There is no SWI, TRAP, or X bit maskable request pending.
NOTE
All non I bit maskable interrupt requests always have higher priority than the I bit maskable
interrupt requests. If the X bit in the CCR is cleared, it is possible to interrupt an I bit
maskable interrupt by an X bit maskable interrupt. It is possible to nest non maskable
interrupt requests, e.g., by nesting SWI or TRAP calls.
Since an interrupt vector is only supplied at the time when the CPU requests it, it is possible that a higher priority interrupt request
could override the original interrupt request that caused the CPU to request the vector. In this case, the CPU will receive the
highest priority vector and the system will process this interrupt request first, before the original interrupt request is processed.
If the interrupt source is unknown (for example, in the case where an interrupt request becomes inactive after the interrupt has
been recognized, but prior to the CPU vector request), the vector address supplied to the CPU will default to that of the spurious
interrupt vector.
MM912_637, Rev. 3.0
Freescale Semiconductor
221
MCU - Interrupt Module (S12SINTV1)
NOTE
Care must be taken to ensure that all interrupt requests remain active until the system
begins execution of the applicable service routine; otherwise, the exception request may not
get processed at all or the result may be a spurious interrupt request (vector at address
(vector base + 0x0080)).
5.17.4.3
Reset Exception Requests
The INT module supports three system reset exception request types (Refer to the Clock and Reset generator module for details):
1. Pin reset, power-on reset or illegal address reset, low voltage reset (if applicable)
2. Clock monitor reset request
3. COP watchdog reset request
5.17.4.4
Exception Priority
The priority (from highest to lowest) and address of all exception vectors issued by the INT module upon request by the CPU is
shown in Table 312.
Table 312. Exception Vector Map and Priority
Vector Address(240)
Source
0xFFFE
Pin reset, power-on reset, illegal address reset, low voltage reset (if applicable)
0xFFFC
Clock monitor reset
0xFFFA
COP watchdog reset
(Vector base + 0x00F8)
Unimplemented opcode trap
(Vector base + 0x00F6)
Software interrupt instruction (SWI) or BDM vector request
(Vector base + 0x00F4)
X bit maskable interrupt request (XIRQ or D2D error interrupt)(241)
(Vector base + 0x00F2)
IRQ or D2D interrupt request(242)
(Vector base + 0x00F0–0x0082)
(Vector base + 0x0080)
Device specific I bit maskable interrupt sources (priority determined by the low byte of the vector address,
in descending order)
Spurious interrupt
Notes
240.16-bit vector address based
241.D2D error interrupt on MCUs featuring a D2D initiator module, otherwise XIRQ pin interrupt
242.D2D interrupt on MCUs featuring a D2D initiator module, otherwise IRQ pin interrupt
5.17.5
5.17.5.1
Initialization/Application Information
Initialization
After a system reset, the software should:
1. Initialize the interrupt vector base register, if the interrupt vector table is not located at the default location
(0xFF80–0xFFF9).
2. Enable I bit maskable interrupts by clearing the I bit in the CCR.
3. Enable the X bit maskable interrupt by clearing the X bit in the CCR.
MM912_637, Rev. 3.0
Freescale Semiconductor
222
MCU - Interrupt Module (S12SINTV1)
5.17.5.2
Interrupt Nesting
The interrupt request scheme makes it possible to nest I bit maskable interrupt requests handled by the CPU.
I bit maskable interrupt requests can be interrupted by an interrupt request with a higher priority.
I bit maskable interrupt requests cannot be interrupted by other I bit maskable interrupt requests per default. In order to make an
interrupt service routine (ISR) interruptible, the ISR must explicitly clear the I bit in the CCR (CLI). After clearing the I bit, other
I bit maskable interrupt requests can interrupt the current ISR.
An ISR of an interruptible I bit maskable interrupt request could basically look like this:
1. Service interrupt, e.g., clear interrupt flags, copy data, etc.
2. Clear I bit in the CCR by executing the instruction CLI (thus allowing other I bit maskable interrupt requests)
3. Process data
4. Return from interrupt by executing the instruction RTI
5.17.5.3
5.17.5.3.1
Wake-up from Stop or Wait Mode
CPU Wake-up from Stop or Wait Mode
Every I bit maskable interrupt request is capable of waking the MCU from Stop or Wait mode. To determine whether an I bit
maskable interrupts is qualified to wake-up the CPU, the same conditions as in normal run mode are applied during Stop or Wait
mode:
If the I bit in the CCR is set, all I bit maskable interrupts are masked from waking up the MCU.
Since there are no clocks running in Stop mode, only interrupts which can be asserted asynchronously can wake-up the MCU
from Stop mode.
NOTE
The only asynchronously asserted, I bit maskable interrupt for the MM912_637 would be the
“D2D External Interrupt”.
The X bit maskable interrupt request can wake-up the MCU from Stop or Wait mode at anytime, even if the X bit in CCR is set.
If the X bit maskable interrupt request is used to wake-up the MCU with the X bit in the CCR set, the associated ISR is not called.
The CPU then resumes program execution with the instruction following the WAI or STOP instruction. This features works the
same rules as with any interrupt request, i.e. care must be taken that the X interrupt request used for wake-up remains active at
least until the system begins execution of the instruction following the WAI or STOP instruction; otherwise, wake-up may not
occur.
NOTE
The only X bit maskable interrupt for the MM912_637 would be the D2D Error Interrupt. As
the D2D Initiator module is not active during STOP and WAIT mode, no X bit maskable
interrupt source is existing for the MM912_637.
MM912_637, Rev. 3.0
Freescale Semiconductor
223
Memory Map Control (S12PMMCV1)
5.18
Memory Map Control (S12PMMCV1)
MCU
5.18.1
ANALOG
Introduction
The S12PMMC module controls the access to all internal memories and peripherals for the CPU12 and S12SBDM module. It
regulates access priorities and determines the address mapping of the on-chip resources. Figure 55 shows a block diagram of
the S12PMMC module.
5.18.1.1
Glossary
Table 313. Glossary Of Terms
Term
Definition
Local Address
Address within the CPU12’s Local Address Map (Figure 60)
Global Address
Address within the Global Address Map (Figure 60)
Aligned Bus Access
Bus access to an even address.
Misaligned Bus Access
Bus access to an odd address.
NS
Normal Single-chip Mode
SS
Special Single-chip Mode
Unimplemented Address Ranges
Address ranges which are not mapped to any on-chip resource.
P-Flash
Program Flash
D-Plash
Data Flash
NVM
Non-volatile Memory; P-Flash or D-Flash
IFR
NVM Information Row. Refer to FTMRC Block Guide
5.18.1.2
Overview
The S12PMMC connects the CPU12’s and the S12SBDM’s bus interfaces to the MCU’s on-chip resources (memories and
peripherals). It arbitrates the bus accesses and determines all of the MCU’s memory maps. Furthermore, the S12PMMC is
responsible for constraining memory accesses on secured devices and for selecting the MCU’s functional mode.
5.18.1.3
Features
The main features of this block are:
•
Paging capability to support a global 256 kByte memory address space
•
Bus arbitration between the masters CPU12, S12SBDM to different resources
•
MCU operation mode control
•
MCU security control
•
Separate memory map schemes for each master CPU12, S12SBDM
•
Generation of system reset when CPU12 accesses an unimplemented address (i.e., an address which does not belong
to any of the on-chip modules) in single-chip modes
5.18.1.4
Modes of Operation
The S12PMMC selects the MCU’s functional mode. It also determines the devices behavior in secured and unsecured state.
MM912_637, Rev. 3.0
Freescale Semiconductor
224
Memory Map Control (S12PMMCV1)
5.18.1.4.1
Functional Modes
Two functional modes are implemented on devices of the S12I product family:
•
Normal Single Chip (NS)
The mode used for running applications.
•
Special Single Chip Mode (SS)
A debug mode which causes the device to enter BDM Active Mode after each reset. Peripherals may also provide
special debug features in this mode
5.18.1.4.2
Security
S12I devices can be secured to prohibit external access to the on-chip P-Flash. The S12PMMC module determines the access
permissions to the on-chip memories in secured and unsecured state.
5.18.1.5
Block Diagram
Figure 55 shows a block diagram of the S12PMMC.
CPU
BDM
MMC
Address Decoder & Priority
DBG
Target Bus Controller
D-Flash
P-Flash
RAM
Peripherals
Figure 55. S12PMMC Block Diagram
5.18.2
External Signal Description
The S12PMMC uses two external pins to determine the devices operating mode: RESET and MODC (Table 314) See Device
User Guide (DUG) for the mapping of these signals to device pins.
MM912_637, Rev. 3.0
Freescale Semiconductor
225
Memory Map Control (S12PMMCV1)
Table 314. External System Pins Associated With S12PMMC
Pin Name
Pin Functions
RESET (See DUG)
RESET
The RESET pin is used the select the MCU’s operating mode.
MODC (See DUG)
MODC
The MODC pin is captured at the rising edge of the RESET pin. The captured value
determines the MCU’s operating mode.
5.18.3
5.18.3.1
Description
Memory Map and Registers
Module Memory Map
A summary of the registers associated with the S12PMMC block is shown in Table 315. Detailed descriptions of the registers and
bits are given in the subsections that follow.
Table 315. MMC Register Table
Address
0x000A
0x000B
0x0010
0x0011
0x0012
0x0013
0x0014
0x0015
Register
Name
Reserved
MODE
Reserved
DIRECT
Reserved
Reserved
Reserved
PPAGE
R
Bit 7
6
5
4
3
2
1
Bit 0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
DP15
DP14
DP13
DP12
DP11
DP10
DP9
DP8
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
PIX3
PIX2
PIX1
PIX0
W
R
W
R
MODC
W
R
W
R
W
R
W
R
W
R
W
= Unimplemented or Reserved
5.18.3.2
Register Descriptions
This section consists of the S12PMMC control register descriptions in address order.
MM912_637, Rev. 3.0
Freescale Semiconductor
226
Memory Map Control (S12PMMCV1)
5.18.3.2.1
Mode Register (MODE)
Table 316. Mode Register (MODE)
Address: 0x000B
7
R
MODC
W
Reset
MODC(243)
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
= Unimplemented or Reserved
Notes
243.External signal (see Table 314).
Read: Anytime.
Write: Only if a transition is allowed (see Figure 56).
The MODC bit of the MODE register is used to select the MCU’s operating mode.
Table 317. MODE Field Descriptions
Field
7
MODC
Description
Mode Select Bit — This bit controls the current operating mode during RESET high (inactive). The external mode MODC pin
determines the operating mode during RESET low (active). The state of the pin is registered into the respective register bit
after the RESET signal goes inactive (see Figure 56).
Write restrictions exist to disallow transitions between certain modes. Figure 56 illustrates all allowed mode changes.
Attempting non authorized transitions will not change the MODE bit, but it will block further writes to the register bit except in
special modes.
Write accesses to the MODE register are blocked when the device is secured.
RESET
1
Normal
Single-Chip
(NS)
1
0
1
Special
Single-Chip
(SS)
0
Figure 56. Mode Transition Diagram When MCU is Unsecured
MM912_637, Rev. 3.0
Freescale Semiconductor
227
Memory Map Control (S12PMMCV1)
5.18.3.2.2
Direct Page Register (DIRECT)
Table 318. Direct Register (DIRECT)
Address: 0x0011
R
W
7
6
5
4
3
2
1
0
DP15
DP14
DP13
DP12
DP11
DP10
DP9
DP8
0
0
0
0
0
0
0
0
Reset
Read: Anytime.
Write: anytime in special SS, write-one in NS.
This register determines the position of the 256 Byte direct page within the memory map.It is valid for both global and local
mapping scheme.
Table 319. DIRECT Field Descriptions
Field
Description
7–0
Direct Page Index Bits 15–8 — These bits are used by the CPU when performing accesses using the direct addressing mode.
These register bits form bits [15:8] of the local address (see Figure 57).
DP[15:8]
Bit15
Bit8
Bit7
Bit0
DP [15:8]
CPU Address [15:0]
Figure 57. DIRECT Address Mapping
Example 1. This example demonstrates usage of the Direct Addressing Mode
MOVB
#$80,DIRECT
;Set DIRECT register to 0x80. Write once only.
;Global data accesses to the range 0xXX_80XX can be direct.
;Logical data accesses to the range 0x80XX are direct.
LDY
<$00
;Load the Y index register from 0x8000 (direct access).
;< operator forces direct access on some assemblers but in
;many cases assemblers are “direct page aware” and can
;automatically select direct mode.
MM912_637, Rev. 3.0
Freescale Semiconductor
228
Memory Map Control (S12PMMCV1)
5.18.3.2.3
Program Page Index Register (PPAGE)
Table 320. Program Page Index Register (PPAGE)
Address: 0x0030
R
7
6
5
4
0
0
0
0
0
0
0
0
W
Reset
3
2
1
0
PIX3
PIX2
PIX1
PIX0
1
1
1
0
Read: Anytime.
Write: Anytime.
These four index bits are used to map 16 kB blocks into the Flash page window located in the local (CPU or BDM) memory map,
from address 0x8000 to address 0xBFFF (see Figure 58). This supports accessing up to 256 kB of Flash (in the Global map)
within the 64 kB Local map. The PPAGE index register is effectively used to construct paged Flash addresses in the Local map
format. The CPU has special access to read and write this register directly during execution of CALL and RTC instructions.
Global Address [17:0]
Bit17
Bit0
Bit14 Bit13
PPAGE Register [3:0]
Address [13:0]
Address: CPU Local Address
or BDM Local Address
Figure 58. PPAGE Address Mapping
NOTE
Writes to this register using the special access of the CALL and RTC instructions will be
complete before the end of the instruction execution.
Table 321. PPAGE Field Descriptions
Field
Description
3–0
Program Page Index Bits 3–0 — These page index bits are used to select which of the 256 P-Flash or ROM array pages is
to be accessed in the Program Page Window.
PIX[3:0]
The fixed 16 kB page from 0x0000 to 0x3FFF is the page number 0x0C. Parts of this page are covered by Registers, D-Flash
and RAM space. See the SoC Guide for details.
The fixed 16 kB page from 0x4000–0x7FFF is the page number 0x0D.
The reset value of 0x0E ensures that there is linear Flash space available between addresses 0x0000 and 0xFFFF out of reset.
The fixed 16 kB page from 0xC000-0xFFFF is the page number 0x0F.
MM912_637, Rev. 3.0
Freescale Semiconductor
229
Memory Map Control (S12PMMCV1)
5.18.4
Functional Description
The S12PMMC block performs several basic functions of the S12I sub-system operation: MCU operation modes, priority control,
address mapping, select signal generation, and access limitations for the system. Each aspect is described in the following
subsections.
5.18.4.1
•
•
MCU Operating Modes
Normal single chip mode
This is the operation mode for running application code. There is no external bus in this mode.
Special single chip mode
This mode is generally used for debugging operation, boot-strapping or security related operations. The active
background debug mode is in control of the CPU code execution and the BDM firmware is waiting for serial commands
sent through the BKGD pin.
5.18.4.2
5.18.4.2.1
Memory Map Scheme
CPU and BDM Memory Map Scheme
The BDM firmware lookup tables and BDM register memory locations share addresses with other modules; however they are not
visible in the memory map during user’s code execution. The BDM memory resources are enabled only during the READ_BD
and WRITE_BD access cycles to distinguish between accesses to the BDM memory area and accesses to the other modules.
(Refer to the BDM Block Guide for further details).
When the MCU enters active BDM mode, the BDM firmware look-up tables and the BDM registers become visible in the local
memory map in the range 0xFF00-0xFFFF (global address 0x3_FF00 - 0x3_FFFF) and the CPU begins execution of firmware
commands or the BDM begins execution of hardware commands. The resources which share memory space with the BDM
module will not be visible in the memory map during active BDM mode.
Note that after the MCU enters active BDM mode the BDM firmware look-up tables and the BDM registers will also be visible
between addresses 0xBF00 and 0xBFFF if the PPAGE register contains value of 0x0F.
5.18.4.2.1.1 Expansion of the Local Address Map
5.18.4.2.1.1.1 Expansion of the CPU Local Address Map
The program page index register in S12PMMC allows accessing up to 256 kB of P-Flash in the global memory map by using the
four index bits (PPAGE[3:0]) to page 16x16 kB blocks into the program page window, located from address 0x8000 to address
0xBFFF in the local CPU memory map.
The page value for the program page window is stored in the PPAGE register. The value of the PPAGE register can be read or
written by normal memory accesses as well as by the CALL and RTC instructions (see Section 5.18.6.1, “CALL and RTC
Instructions").
Control registers, vector space and parts of the on-chip memories are located in unpaged portions of the 64 kB local CPU address
space.
The starting address of an interrupt service routine must be located in unpaged memory unless the user is certain that the PPAGE
register will be set to the appropriate value when the service routine is called. However an interrupt service routine can call other
routines that are in paged memory. The upper 16 kB block of the local CPU memory space (0xC000–0xFFFF) is unpaged. It is
recommended that all reset and interrupt vectors point to locations in this area or to the other unmapped pages sections of the
local CPU memory map.
5.18.4.2.1.1.2 Expansion of the BDM Local Address Map
PPAGE and BDMPPR register is also used for the expansion of the BDM local address to the global address. These registers
can be read and written by the BDM.
The BDM expansion scheme is the same as the CPU expansion scheme.
MM912_637, Rev. 3.0
Freescale Semiconductor
230
Memory Map Control (S12PMMCV1)
The four BDMPPR Program Page index bits allow access to the full 256 kB address map that can be accessed with 18 address
bits.
The BDM program page index register (BDMPPR) is used only when the feature is enabled in BDM and, in the case the CPU is
executing a firmware command which uses CPU instructions, or by a BDM hardware commands. See the BDM Block Guide for
further details. (see Figure 59).
BDM HARDWARE COMMAND
Global Address [17:0]
Bit17
Bit0
Bit14 Bit13
BDMPPR Register [3:0]
BDM Local Address [13:0]
BDM FIRMWARE COMMAND
Global Address [17:0]
Bit17
Bit0
Bit14 Bit13
BDMPPR Register [3:0]
CPU Local Address [13:0]
Figure 59. BDMPPR Address Mapping
MM912_637, Rev. 3.0
Freescale Semiconductor
231
Memory Map Control (S12PMMCV1)
CPU and BDM
Local Memory Map
0x0000
Global Memory Map
0x0400
REGISTERS
0x1400
RAM_LOW
Unpaged P-Flash
0x0_4000
NVM Resources
D-Flash
0x0_5400
NVM Resources
0x4000
(PPAGE 0x01)
RAMSIZE
RAM
0x0_4400
RAM
RAMSIZE
Unimplemented Area
D-Flash
(PPAGE 0x00)
0x0_0000
REGISTERS
0x0_8000
P-Flash
10 *16K paged
0x8000
(PPAGE 0x02-0x0B))
Unpaged P-Flash
0x3_0000
P-Flash window
0 0 0 0 P3P2P1P0
Unpaged P-Flash
PPAGE
Unpaged P-Flash
Unpaged P-Flash
(PPAGE 0x0E)
Unpaged P-Flash
(PPAGE 0x0F)
0xC000
(PPAGE 0x0D)
0x3_4000
0x3_8000
Unpaged P-Flash
0x3_C000
0xFFFF
0x3_FFFF
(PPAGE 0x0C)
Unpaged P-Flash
or
Figure 60. Local to Global Address Mapping
MM912_637, Rev. 3.0
Freescale Semiconductor
232
Memory Map Control (S12PMMCV1)
5.18.5
Implemented Memory in the System Memory Architecture
Each memory can be implemented in its maximum allowed size. But some devices have been defined for smaller sizes, which
means less implemented pages. All non implemented pages are called unimplemented areas.
•
Registers has a fixed size of 1.0 kB, accessible via xbus0
•
SRAM has a maximum size of 11 kB, accessible via xbus0
•
D-Flash has a fixed size of 4.0 kB accessible via xbus0
•
P-Flash has a maximum size of 224 kB, accessible via xbus0
•
NVM resources (IFR) including D-Flash have maximum size of 16 kB (PPAGE 0x01)
5.18.5.0.1
Implemented Memory Map
The global memory spaces reserved for the internal resources (RAM, D-Flash, and P-Flash) are not determined by the MMC
module. Size of the individual internal resources are however fixed in the design of the device cannot be changed by the user.
Refer to the SoC Guide for further details. Figure 61 and Table 322 show the memory spaces occupied by the on-chip resources.
Note that the memory spaces have fixed top addresses.
Table 322. Global Implemented Memory Space
Internal Resource
Bottom Address
Top Address
Registers
0x0_0000
0x0_03FF
System RAM
D-Flash
P-Flash
RAM_LOW =
0x0_4000 minus RAMSIZE(244)
0x0_4400
PF_LOW =
0x4_0000 minus FLASHSIZE(245)
0x0_3FFF
0x0_53FF
0x3_FFFF
Notes
244.RAMSIZE is the hexadecimal value of RAM SIZE in bytes
245.FLASHSIZE is the hexadecimal value of FLASH SIZE in bytes
In single-chip modes accesses by the CPU12 (except for firmware commands) to any of the unimplemented areas (see
Figure 61) will result in an illegal access reset (system reset). BDM accesses to the unimplemented areas are allowed but the
data will be undefined.
No misaligned word access from the BDM module will occur; these accesses are blocked in the BDM module (Refer to BDM
Block Guide).
MM912_637, Rev. 3.0
Freescale Semiconductor
233
Memory Map Control (S12PMMCV1)
CPU and BDM
Local Memory Map
0x0000
Global Memory Map
REGISTERS
D-Flash
REGISTERS
RAM_LOW
Unpaged P-Flash
0x0_4000
NVM Resources
0x0_4400
D-Flash
0x0_5400
NVM Resources
0x4000
(PPAGE 0x01)
RAMSIZE
RAM
RAM
RAMSIZE
Unimplemented Area
0x1400
(PPAGE 0x00)
0x0_0000
0x0400
0x0_8000
Unpaged P-Flash
Unimplemented area
0x8000
P-Flash window
0 0 0 0 P3P2P1P0
PPAGE
PF_LOW
0xC000
0xFFFF
PFSIZE
P-Flash
Unpaged P-Flash
0x3_FFFF
Figure 61. Implemented Global Address Mapping
MM912_637, Rev. 3.0
Freescale Semiconductor
234
Memory Map Control (S12PMMCV1)
5.18.5.1
Chip Bus Control
The S12PMMC controls the address buses and the data buses that interface the bus masters (CPU12, S12SBDM) with the rest
of the system (master buses). In addition, the MMC handles all CPU read data bus swapping operations. All internal resources
are connected to specific target buses (see Figure 62).
DBG
BDM
CPU
S12X1
S12X0
MMC “Crossbar Switch”
XBUS0
P-Flash
D-Flash
BDM
resources
SRAM
IPBI
Peripherals
Figure 62. S12I platform
5.18.5.1.1
Master Bus Prioritization Regarding Access Conflicts on Target Buses
The arbitration scheme allows only one master to be connected to a target at any given time. The following rules apply when
prioritizing accesses from different masters to the same target bus:
•
CPU12 always has priority over BDM.
•
BDM has priority over CPU12 when its access is stalled for more than 128 cycles. In the later case the CPU will be
stalled after finishing the current operation and the BDM will gain access to the bus.
5.18.5.2
Interrupts
The MMC does not generate any interrupts.
5.18.6
5.18.6.1
Initialization/Application Information
CALL and RTC Instructions
CALL and RTC instructions are uninterruptable CPU instructions that automate page switching in the program page window. The
CALL instruction is similar to the JSR instruction, but the subroutine that is called can be located anywhere in the local address
space or in any Flash or ROM page visible through the program page window. The CALL instruction calculates and stacks a
return address, stacks the current PPAGE value and writes a new instruction-supplied value to the PPAGE register. The PPAGE
value controls which of the 256 possible pages is visible through the 16 kbyte program page window in the 64 kbyte local CPU
memory map. Execution then begins at the address of the called subroutine.
MM912_637, Rev. 3.0
Freescale Semiconductor
235
Memory Map Control (S12PMMCV1)
During the execution of the CALL instruction, the CPU performs the following steps:
1. Writes the current PPAGE value into an internal temporary register and writes the new instruction supplied PPAGE value
into the PPAGE register
2. Calculates the address of the next instruction after the CALL instruction (the return address) and pushes this 16-bit value
onto the stack
3. Pushes the temporarily stored PPAGE value onto the stack
4. Calculates the effective address of the subroutine, refills the queue and begins execution at the new address
This sequence is uninterruptable. There is no need to inhibit interrupts during the CALL instruction execution. A CALL instruction
can be performed from any address to any other address in the local CPU memory space.
The PPAGE value supplied by the instruction is part of the effective address of the CPU. For all addressing mode variations
(except indexed-indirect modes), the new page value is provided by an immediate operand in the instruction. In indexed indirect
variations of the CALL instruction, a pointer specifies memory locations where the new page value and the address of the called
subroutine are stored. Using indirect addressing for both the new page value and the address within the page allows usage of
values calculated at run time, rather than immediate values that must be known at the time of assembly.
The RTC instruction terminates subroutines invoked by a CALL instruction. The RTC instruction unstacks the PPAGE value and
the return address and refills the queue. Execution resumes with the next instruction after the CALL instruction.
During the execution of an RTC instruction the CPU performs the following steps:
1. Pulls the previously stored PPAGE value from the stack
2. Pulls the 16-bit return address from the stack and loads it into the PC
3. Writes the PPAGE value into the PPAGE register
4. Refills the queue and resumes execution at the return address
This sequence is uninterruptable. The RTC can be executed from anywhere in the local CPU memory space.
The CALL and RTC instructions behave like JSR and RTS instruction. However they require more execution cycles. Usage of
JSR/RTS instructions is therefore recommended when possible, and CALL/RTC instructions should only be used when needed.
The JSR and RTS instructions can be used to access subroutines that are already present in the local CPU memory map (i.e. in
the same page in the program memory page window for example). However calling a function located in a different page requires
usage of the CALL instruction. The function must be terminated by the RTC instruction. Because the RTC instruction restores
contents of the PPAGE register from the stack. Functions terminated with the RTC instruction must be called using the CALL
instruction, even when the correct page is already present in the memory map. This is to make sure that the correct PPAGE value
will be present on the stack at the time of the RTC instruction execution.
MM912_637, Rev. 3.0
Freescale Semiconductor
236
MCU - Debug Module (S12SDBG)
5.19
MCU - Debug Module (S12SDBG)
MCU
5.19.1
ANALOG
Introduction
The S12SDBG module provides an on-chip trace buffer with flexible triggering capability, to allow non-intrusive debug of
application software. The S12SDBG module is optimized for S12SCPUdebugging.
Typically, the S12SDBG module is used in conjunction with the S12SBDM module, whereby the user configures the S12SDBG
module for a debugging session over the BDM interface. Once configured the S12SDBG module is armed, the device leaves
BDM returning control to the user program, which is then monitored by the S12SDBG module. Alternatively the S12SDBG
module can be configured over a serial interface using SWI routines.
5.19.1.1
Glossary Of Terms
COF: Change Of Flow. Change in the program flow due to a conditional branch, indexed jump or interrupt.
BDM: Background Debug Mode
S12SBDM: Background Debug Module
DUG: Device User Guide, describing the features of the device into which the DBG is integrated.
WORD: 16-bit data entity
Data Line: 20-bit data entity
CPU: S12SCPU module
DBG: S12SDBG module
POR: Power On Reset
Tag: Tags can be attached to CPU opcodes as they enter the instruction pipe. If the tagged opcode reaches the execution stage
a tag hit occurs.
5.19.1.2
Overview
The comparators monitor the bus activity of the CPU module. A match can initiate a state sequencer transition. On a transition
to the Final state, bus tracing is triggered and/or a breakpoint can be generated.
Independent of comparator matches a transition to Final state with associated tracing and breakpoint can be triggered
immediately by writing to the TRIG control bit.
The trace buffer is visible through a 2-byte window in the register address map and can be read out using standard 16-bit word
reads. Tracing is disabled when the MCU system is secured.
5.19.1.3
•
•
•
Features
Three comparators (A, B and C)
— Comparators A compares the full address bus and full 16-bit data bus
— Comparator A features a data bus mask register
— Comparators B and C compare the full address bus only
— Each comparator features selection of read or write access cycles
— Comparator B allows selection of byte or word access cycles
— Comparator matches can initiate state sequencer transitions
Three comparator modes
— Simple address/data comparator match mode
— Inside address range mode, Addmin  Address Addmax
— Outside address range match mode, Address Addminor Address  Addmax
Two types of matches
— Tagged — This matches just before a specific instruction begins execution
— Force — This is valid on the first instruction boundary after a match occurs
MM912_637, Rev. 3.0
Freescale Semiconductor
237
MCU - Debug Module (S12SDBG)
•
Two types of breakpoints
— CPU breakpoint entering BDM on breakpoint (BDM)
— CPU breakpoint executing SWI on breakpoint (SWI)
Trigger mode independent of comparators
— TRIG Immediate software trigger
Four trace modes
— Normal: change of flow (COF) PC information is stored (see Section 5.19.4.5.2.1, “Normal Mode") for change of
flow definition.
— Loop1: same as Normal but inhibits consecutive duplicate source address entries
— Detail: address and data for all cycles except free cycles and opcode fetches are stored
— Compressed Pure PC: all program counter addresses are stored
4-stage state sequencer for trace buffer control
— Tracing session trigger linked to Final State of state sequencer
— Begin and End alignment of tracing to trigger
•
•
•
5.19.1.4
Modes of Operation
The DBG module can be used in all MCU functional modes.
During BDM hardware accesses and while the BDM module is active, CPU monitoring is disabled. When the CPU enters active
BDM Mode through a BACKGROUND command, the DBG module, if already armed, remains armed.
The DBG module tracing is disabled if the MCU is secure, however, breakpoints can still be generated.
Table 323. Mode Dependent Restriction Summary
BDM
Enable
BDM
Active
MCU
Secure
Comparator
Matches Enabled
Breakpoints
Possible
Tagging
Possible
Tracing
Possible
x
x
1
Yes
Yes
Yes
No
0
0
0
Yes
Only SWI
Yes
Yes
0
1
0
1
0
0
Yes
Yes
Yes
Yes
1
1
0
No
No
No
No
Active BDM not possible when not enabled
MM912_637, Rev. 3.0
Freescale Semiconductor
238
MCU - Debug Module (S12SDBG)
5.19.1.5
Block Diagram
TAGS
TAGHITS
BREAKPOINT REQUESTS
TO CPU
CPU BUS
COMPARATOR A
COMPARATOR
MATCH CONTROL
BUS INTERFACE
SECURE
COMPARATOR B
COMPARATOR C
MATCH0
TRANSITION
TAG &
MATCH
CONTROL
LOGIC
MATCH1
STATE
STATE SEQUENCER
STATE
MATCH2
TRACE
CONTROL
TRIGGER
TRACE BUFFER
READ TRACE DATA (DBG READ DATA BUS)
Figure 63. Debug Module Block Diagram
5.19.2
External Signal Description
There are no external signals associated with this module.
5.19.3
5.19.3.1
Memory Map and Registers
Module Memory Map
A summary of the registers associated with the DBG sub-block is shown in Table 324. Detailed descriptions of the registers and
bits are given in the subsections that follow.
Table 324. Quick Reference to DBG Registers
Address
Name
0x0020
DBGC1
0x0021
DBGSR
0x0022
DBGTCR
0x0023
DBGC2
0x0024
DBGTBH
Bit 7
R
W
R
ARM
(246)
TBF
6
5
4
3
0
0
BDM
DBGBRK
0
0
0
0
0
TRIG
0
2
1
0
SSF2
Bit 0
COMRV
SSF1
SSF0
W
R
0
W
R
TSOURCE
0
TRCMOD
0
0
0
0
0
0
Bit 15
Bit 14
Bit 13
Bit 12
Bit 11
Bit 10
ABCM
W
R
TALIGN
Bit 9
Bit 8
W
MM912_637, Rev. 3.0
Freescale Semiconductor
239
MCU - Debug Module (S12SDBG)
Table 324. Quick Reference to DBG Registers
Address
Name
0x0025
DBGTBL
0x0026
DBGCNT
0x0027
DBGSCRX
0x0027
DBGMFR
0x0028(247)
DBGACTL
0x0028(248)
DBGBCTL
0x0028(249)
DBGCCTL
0x0029
DBGXAH
0x002A
DBGXAM
0x002B
DBGXAL
0x002C
DBGADH
0x002D
DBGADL
0x002E
DBGADHM
0x002F
DBGADLM
R
Bit 7
6
5
4
3
2
1
Bit 0
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
TBF
0
0
0
0
0
SC3
SC2
SC1
SC0
0
0
0
0
0
MC2
MC1
MC0
SZE
SZ
TAG
BRK
RW
RWE
NDB
COMPE
SZE
SZ
TAG
BRK
RW
RWE
0
0
TAG
BRK
RW
RWE
0
0
0
0
0
0
Bit 15
14
13
12
11
Bit 7
6
5
4
Bit 15
14
13
Bit 7
6
Bit 15
Bit 7
W
R
CNT
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
R
W
0
COMPE
COMPE
Bit 17
Bit 16
10
9
Bit 8
3
2
1
Bit 0
12
11
10
9
Bit 8
5
4
3
2
1
Bit 0
14
13
12
11
10
9
Bit 8
6
5
4
3
2
1
Bit 0
W
R
0
Notes
246.This bit is visible at DBGCNT[7] and DBGSR[7]
247.This represents the contents if the Comparator A control register is blended into this address
248.This represents the contents if the Comparator B control register is blended into this address
249.This represents the contents if the Comparator C control register is blended into this address
5.19.3.2
Register Descriptions
This section consists of the DBG control and trace buffer register descriptions in address order. Each comparator has a bank of
registers that are visible through an 8-byte window between 0x0028 and 0x002F in the DBG module register address map. When
ARM is set in DBGC1, the only bits in the DBG module registers that can be written are ARM, TRIG, and COMRV[1:0]
MM912_637, Rev. 3.0
Freescale Semiconductor
240
MCU - Debug Module (S12SDBG)
5.19.3.2.1
Debug Control Register 1 (DBGC1)
Table 325. Debug Control Register (DBGC1)
Address: 0x0020
7
R
ARM
W
Reset
0
6
5
0
0
4
TRIG
0
3
BDM
DBGBRK
0
0
0
2
1
0
0
0
COMRV
0
0
= Unimplemented or Reserved
Read: Anytime
Write: Bits 7, 1, 0 anytime 
Bit 6 can be written anytime but always reads back as 0. 
Bits 4:3 anytime DBG is not armed.
NOTE
When disarming the DBG by clearing ARM with software, the contents of bits[4:3] are not
affected by the write, since up until the write operation, ARM = 1 preventing these bits from
being written. These bits must be cleared using a second write if required.
Table 326. DBGC1 Field Descriptions
Field
7
ARM
6
TRIG
4
BDM
3
DBGBRK
1–0
COMRV
Description
Arm Bit — The ARM bit controls whether the DBG module is armed. This bit can be set and cleared by user software and is
automatically cleared on completion of a debug session, or if a breakpoint is generated with tracing not enabled. On setting
this bit the state sequencer enters State1.
0 Debugger disarmed
1 Debugger armed
Immediate Trigger Request Bit — This bit when written to 1 requests an immediate trigger independent of state sequencer
status. When tracing is complete a forced breakpoint may be generated depending upon DBGBRK and BDM bit settings. This
bit always reads back a 0. Writing a 0 to this bit has no effect. If the DBGTCR_TSOURCE bit is clear no tracing is carried out.
If tracing has already commenced using BEGIN trigger alignment, it continues until the end of the tracing session as defined
by the TALIGN bit, thus TRIG has no affect. In secure mode, tracing is disabled and writing to this bit cannot initiate a tracing
session.
The session is ended by setting TRIG and ARM simultaneously.
0 Do not trigger until the state sequencer enters the Final state.
1 Trigger immediately
Background Debug Mode Enable — This bit determines if a breakpoint causes the system to enter Background Debug mode
(BDM) or initiate a Software Interrupt (SWI). If this bit is set but the BDM is not enabled by the ENBDM bit in the BDM module,
then breakpoints default to SWI.
0 Breakpoint to Software Interrupt if BDM inactive. Otherwise no breakpoint.
1 Breakpoint to BDM, if BDM enabled. Otherwise breakpoint to SWI
S12SDBG Breakpoint Enable Bit — The DBGBRK bit controls whether the debugger will request a breakpoint on reaching
the state sequencer Final State. If tracing is enabled, the breakpoint is generated on completion of the tracing session. If
tracing is not enabled, the breakpoint is generated immediately.
0 No Breakpoint generated
1 Breakpoint generated
Comparator Register Visibility Bits — These bits determine which bank of comparator register is visible in the 8-byte window
of the S12SDBG module address map, located between 0x0028 to 0x002F. Furthermore these bits determine which register
is visible at the address 0x0027. See Table 327.
MM912_637, Rev. 3.0
Freescale Semiconductor
241
MCU - Debug Module (S12SDBG)
Table 327. COMRV Encoding
5.19.3.2.2
COMRV
Visible Comparator
Visible Register at 0x0027
00
Comparator A
DBGSCR1
01
Comparator B
DBGSCR2
10
Comparator C
DBGSCR3
11
None
DBGMFR
Debug Status Register (DBGSR)
Table 328. Debug Status Register (DBGSR)
Address: 0x0021
7
6
5
4
3
2
1
0
TBF
0
0
0
0
SSF2
SSF1
SSF0
Reset
—
0
0
0
0
0
0
0
POR
0
0
0
0
0
0
0
0
R
W
= Unimplemented or Reserved
Read: Anytime
Write: Never
Table 329. DBGSR Field Descriptions
Field
7
TBF
2–0
SSF[2:0]
Description
Trace Buffer Full — The TBF bit indicates that the trace buffer has stored 64 or more lines of data since it was last armed. If
this bit is set, then all 64 lines will be valid data, regardless of the value of DBGCNT bits. The TBF bit is cleared when ARM in
DBGC1 is written to a one. The TBF is cleared by the power on reset initialization. Other system generated resets have no
affect on this bit
This bit is also visible at DBGCNT[7]
State Sequencer Flag Bits — The SSF bits indicate in which state the State Sequencer is currently in. During a debug session
on each transition to a new state these bits are updated. If the debug session is ended by software clearing the ARM bit, then
these bits retain their value to reflect the last state of the state sequencer before disarming. If a debug session is ended by an
internal event, then the state sequencer returns to state0 and these bits are cleared to indicate that state0 was entered during
the session. On arming the module the state sequencer enters state1 and these bits are forced to SSF[2:0] = 001. See
Table 330.
Table 330. SSF[2:0] — State Sequence Flag Bit Encoding
SSF[2:0]
Current State
000
State0 (disarmed)
001
State1
010
State2
011
State3
100
Final State
101,110,111
Reserved
MM912_637, Rev. 3.0
Freescale Semiconductor
242
MCU - Debug Module (S12SDBG)
5.19.3.2.3
Debug Trace Control Register (DBGTCR)
Table 331. Debug Trace Control Register (DBGTCR)
Address: 0x0022
7
R
6
0
TSOURCE
W
Reset
0
0
5
4
0
0
0
0
3
2
0
0
TRCMOD
0
1
0
TALIGN
0
0
Read: Anytime
Write: Bit 6 only when DBG is neither secure nor armed.Bits 3,2,0 anytime the module is disarmed.
Table 332. DBGTCR Field Descriptions
Field
6
TSOURCE
3–2
TRCMOD
0
TALIGN
Description
Trace Source Control Bit — The TSOURCE bit enables a tracing session given a trigger condition. If the MCU system is
secured, this bit cannot be set and tracing is inhibited. 
This bit must be set to read the trace buffer.
0 Debug session without tracing requested
1 Debug session with tracing requested
Trace Mode Bits — See Section 5.19.4.5.2, “Trace Modes" for detailed Trace mode descriptions. In Normal mode, change of
flow information is stored. In Loop1 mode, change of flow information is stored but redundant entries into trace memory are
inhibited. In Detail mode, address and data for all memory and register accesses is stored. In Compressed Pure PC mode the
program counter value for each instruction executed is stored. See Table 333.
Trigger Align Bit — This bit controls whether the trigger is aligned to the beginning or end of a tracing session.
0 Trigger at end of stored data
1 Trigger before storing data
Table 333. TRCMOD Trace Mode Bit Encoding
5.19.3.2.4
TRCMOD
Description
00
Normal
01
Loop1
10
Detail
11
Compressed Pure PC
Debug Control Register2 (DBGC2)
Table 334. Debug Control Register2 (DBGC2)
Address: 0x0023
R
7
6
5
4
3
2
0
0
0
0
0
0
0
0
0
0
0
0
1
ABCM
W
Reset
0
0
0
= Unimplemented or Reserved
Read: Anytime
Write: Anytime the module is disarmed
This register configures the comparators for range matching.
MM912_637, Rev. 3.0
Freescale Semiconductor
243
MCU - Debug Module (S12SDBG)
Table 335. DBGC2 Field Descriptions
Field
Description
1–0
A and B Comparator Match Control — These bits determine the A and B comparator match mapping as described in
Table 336.
ABCM[1:0]
Table 336. ABCM Encoding
ABCM
Description
00
Match0 mapped to comparator A match: Match1 mapped to comparator B match.
01
Match 0 mapped to comparator A/B inside range: Match1 disabled.
10
Match 0 mapped to comparator A/B outside range: Match1 disabled.
11
Reserved(250)
Notes
250.Currently defaults to Comparator A, Comparator B disabled
5.19.3.2.5
Debug Trace Buffer Register (DBGTBH:DBGTBL)
Table 337. Debug Trace Buffer Register (DBGTB)
Address:
0x0024, 0x0025
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Bit 15
Bit 14
Bit 13
Bit 12
Bit 11
Bit 10
Bit 9
Bit 8
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
POR
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
Other
Resets
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
R
W
Read: Only when unlocked AND unsecured AND not armed AND TSOURCE set
Write: Aligned word writes when disarmed unlock the trace buffer for reading but do not affect trace buffer contents
Table 338. DBGTB Field Descriptions
Field
15–0
Bit[15:0]
Description
Trace Buffer Data Bits — The Trace Buffer Register is a window through which the 20-bit wide data lines of the Trace Buffer
may be read 16 bits at a time. Each valid read of DBGTB increments an internal trace buffer pointer which points to the next
address to be read. When the ARM bit is set the trace buffer is locked to prevent reading. The trace buffer can only be unlocked
for reading by writing to DBGTB with an aligned word write when the module is disarmed. The DBGTB register can be read
only as an aligned word, any byte reads or misaligned access of these registers return a 0, and do not cause the trace buffer
pointer to increment to the next trace buffer address. Similarly reads while the debugger is armed or with the TSOURCE bit
clear, return a 0, and do not affect the trace buffer pointer. The POR state is undefined. Other resets do not affect the trace
buffer contents.
MM912_637, Rev. 3.0
Freescale Semiconductor
244
MCU - Debug Module (S12SDBG)
5.19.3.2.6
Debug Count Register (DBGCNT)
Table 339. Debug Count Register (DBGCNT)
Address: 0x0026
7
6
TBF
0
Reset
—
—
—
—
POR
0
0
0
0
R
5
4
3
2
1
0
—
—
—
—
0
0
0
0
CNT
W
= Unimplemented or Reserved
Read: Anytime
Write: Never
Table 340. DBGCNT Field Descriptions
Field
7
TBF
5–0
CNT[5:0]
Description
Trace Buffer Full — The TBF bit indicates that the trace buffer has stored 64 or more lines of data since it was last armed. If
this bit is set, then all 64 lines will be valid data, regardless of the value of DBGCNT bits. The TBF bit is cleared when ARM in
DBGC1 is written to a one. The TBF is cleared by the power on reset initialization. Other system generated resets have no
affect on this bit
This bit is also visible at DBGSR[7]
Count Value — The CNT bits indicate the number of valid data 20-bit data lines stored in the Trace Buffer. Table 341 shows
the correlation between the CNT bits and the number of valid data lines in the Trace Buffer. When the CNT rolls over to zero,
the TBF bit in DBGSR is set and incrementing of CNT will continue in end-trigger mode. The DBGCNT register is cleared when
ARM in DBGC1 is written to a one. The DBGCNT register is cleared by power-on-reset initialization but is not cleared by other
system resets. Thus should a reset occur during a debug session, the DBGCNT register still indicates after the reset, the
number of valid trace buffer entries stored before the reset occurred. The DBGCNT register is not decremented when reading
from the trace buffer.
Table 341. CNT Decoding Table
TBF
CNT[5:0]
Description
0
000000
No data valid
0
1
000001
1 line valid
000010
2 lines valid
000100
4 lines valid
000110
6 lines valid
...
...
111111
63 lines valid
000000
64 lines valid; if using Begin trigger alignment,
ARM bit will be cleared and the tracing session ends.
000001
1
...
...
64 lines valid,
oldest data has been overwritten by most recent data
111110
5.19.3.2.7
Debug State Control Registers
There is a dedicated control register for each of the state sequencer states 1 to 3, that determines if transitions from that state
are allowed, depending upon comparator matches or tag hits, and define the next state for the state sequencer following a match.
The three debug state control registers are located at the same address in the register address map (0x0027). Each register can
be accessed using the COMRV bits in DBGC1 to blend in the required register. The COMRV = 11 value blends in the match flag
register (DBGMFR).
MM912_637, Rev. 3.0
Freescale Semiconductor
245
MCU - Debug Module (S12SDBG)
Table 342. State Control Register Access Encoding
COMRV
Visible State Control Register
00
DBGSCR1
01
DBGSCR2
10
DBGSCR3
11
DBGMFR
5.19.3.2.7.1 Debug State Control Register 1 (DBGSCR1)
Table 343. Debug State Control Register 1 (DBGSCR1)
Address: 0x0027
R
7
6
5
4
0
0
0
0
0
0
0
0
W
Reset
3
2
1
0
SC3
SC2
SC1
SC0
0
0
0
0
= Unimplemented or Reserved
Read: If COMRV[1:0] = 00
Write: If COMRV[1:0] = 00 and DBG is not armed
This register is visible at 0x0027 only with COMRV[1:0] = 00. The state control register 1 selects the targeted next state while in
State1. The matches refer to the match channels of the comparator match control logic, as depicted in Figure 63 and described
in Section 5.19.3.2.8.1, “Debug Comparator Control Register (DBGXCTL)". Comparators must be enabled by setting the
comparator enable bit in the associated DBGXCTL control register.
Table 344. DBGSCR1 Field Descriptions
Field
3–0
Description
These bits select the targeted next state while in State1, based upon the match event.
SC[3:0]
Table 345. State1 Sequencer Next State Selection
SC[3:0]
Description (Unspecified matches have no effect)
0000
Any match to Final State
0001
Match1 to State3
0010
Match2 to State2
0011
Match1 to State2
0100
Match0 to State2....... Match1 to State3
0101
Match1 to State3.........Match0 to Final State
0110
Match0 to State2....... Match2 to State3
0111
Either Match0 or Match1 to State2
1000
Reserved
1001
Match0 to State3
1010
Reserved
1011
Reserved
1100
Reserved
1101
Either Match0 or Match2 to Final State........Match1 to State2
MM912_637, Rev. 3.0
Freescale Semiconductor
246
MCU - Debug Module (S12SDBG)
Table 345. State1 Sequencer Next State Selection
SC[3:0]
Description (Unspecified matches have no effect)
1110
Reserved
1111
Reserved
The priorities described in Table 378 dictate that in the case of simultaneous matches, a match leading to final state has priority
followed by the match on the lower channel number (0,1,2). Thus with SC[3:0]=1101, a simultaneous match0/match1 transitions
to Final state.
5.19.3.2.7.2 Debug State Control Register 2 (DBGSCR2)
Table 346. Debug State Control Register 2 (DBGSCR2)
Address: 0x0027
R
7
6
5
4
0
0
0
0
0
0
0
0
W
Reset
3
2
1
0
SC3
SC2
SC1
SC0
0
0
0
0
= Unimplemented or Reserved
Read: If COMRV[1:0] = 01
Write: If COMRV[1:0] = 01 and DBG is not armed
This register is visible at 0x0027 only with COMRV[1:0] = 01. The state control register 2 selects the targeted next state while in
State 2. The matches refer to the match channels of the comparator match control logic, as depicted in Figure 63 and described
in Section 5.19.3.2.8.1, “Debug Comparator Control Register (DBGXCTL)". Comparators must be enabled by setting the
comparator enable bit in the associated DBGXCTL control register.
Table 347. DBGSCR2 Field Descriptions
Field
3–0
Description
These bits select the targeted next state while in State 2, based upon the match event.
SC[3:0]
Table 348. State2 —Sequencer Next State Selection
SC[3:0]
Description (Unspecified matches have no effect)
0000
Match0 to State1....... Match2 to State3.
0001
Match1 to State3
0010
Match2 to State3
0011
Match1 to State3....... Match0 Final State
0100
Match1 to State1....... Match2 to State3.
0101
Match2 to Final State
0110
Match2 to State1..... Match0 to Final State
0111
Either Match0 or Match1 to Final State
1000
Reserved
1001
Reserved
1010
Reserved
1011
Reserved
1100
Either Match0 or Match1 to Final State........Match2 to State3
1101
Reserved
1110
Reserved
1111
Either Match0 or Match1 to Final State........Match2 to State1
MM912_637, Rev. 3.0
Freescale Semiconductor
247
MCU - Debug Module (S12SDBG)
The priorities described in Table 378 dictate that in the case of simultaneous matches, a match leading to final state has priority
followed by the match on the lower channel number (0,1,2).
5.19.3.2.7.3 Debug State Control Register 3 (DBGSCR3)
Table 349. Debug State Control Register 3 (DBGSCR3)
Address: 0x0027
R
7
6
5
4
0
0
0
0
0
0
0
0
W
Reset
3
2
1
0
SC3
SC2
SC1
SC0
0
0
0
0
= Unimplemented or Reserved
Read: If COMRV[1:0] = 10
Write: If COMRV[1:0] = 10 and DBG is not armed
This register is visible at 0x0027 only with COMRV[1:0] = 10. The state control register three selects the targeted next state while
in State 3. The matches refer to the match channels of the comparator match control logic, as depicted in Figure 63 and described
in Section 5.19.3.2.8.1, “Debug Comparator Control Register (DBGXCTL)". Comparators must be enabled by setting the
comparator enable bit in the associated DBGXCTL control register.
Table 350. DBGSCR3 Field Descriptions
Field
3–0
Description
These bits select the targeted next state while in State 3, based upon the match event.
SC[3:0]
Table 351. State3 — Sequencer Next State Selection
SC[3:0]
Description (Unspecified matches have no effect)
0000
Match0 to State1
0001
Match2 to State2........ Match1 to Final State
0010
Match0 to Final State....... Match1 to State1
0011
Match1 to Final State....... Match2 to State1
0100
Match1 to State2
0101
Match1 to Final State
0110
Match2 to State2........ Match0 to Final State
0111
Match0 to Final State
1000
Reserved
1001
Reserved
1010
Either Match1 or Match2 to State1....... Match0 to Final State
1011
Reserved
1100
Reserved
1101
Either Match1 or Match2 to Final State....... Match0 to State1
1110
Match0 to State2....... Match2 to Final State
1111
Reserved
The priorities described in Table 378 dictate that in the case of simultaneous matches, a match leading to final state has priority,
followed by the match on the lower channel number (0,1,2).
MM912_637, Rev. 3.0
Freescale Semiconductor
248
MCU - Debug Module (S12SDBG)
5.19.3.2.7.4 Debug Match Flag Register (DBGMFR)
Table 352. Debug Match Flag Register (DBGMFR)
Address: 0x0027
R
7
6
5
4
3
2
1
0
0
0
0
0
0
MC2
MC1
MC0
0
0
0
0
0
0
0
0
W
Reset
= Unimplemented or Reserved
Read: If COMRV[1:0] = 11
Write: Never
DBGMFR is visible at 0x0027 only with COMRV[1:0] = 11. It features 3 flag bits, each mapped directly to a channel. Should a
match occur on the channel during the debug session, then the corresponding flag is set and remains set until the next time the
module is armed, by writing to the ARM bit. Thus the contents are retained after a debug session for evaluation purposes. These
flags cannot be cleared by software. They are cleared only when arming the module. A set flag does not inhibit the setting of
other flags. Once a flag is set, further comparator matches on the same channel in the same session have no affect on that flag.
5.19.3.2.8
Comparator Register Descriptions
Each comparator has a bank of registers that are visible through an 8-byte window in the DBG module register address map.
Comparator A consists of 8 register bytes (3 address bus compare registers, two data bus compare registers, two data bus mask
registers, and a control register). Comparator B consists of four register bytes (three address bus compare registers and a control
register). Comparator C consists of four register bytes (three address bus compare registers and a control register).
Each set of comparator registers can be accessed using the COMRV bits in the DBGC1 register. Unimplemented registers (e.g.
Comparator B data bus and data bus masking) read as zero and cannot be written. The control register for comparator B differs
from those of comparators A and C.
Table 353. Comparator Register Layout
0x0028
CONTROL
Read/Write
Comparators A,B and C
0x0029
ADDRESS HIGH
Read/Write
Comparators A,B and C
0x002A
ADDRESS MEDIUM
Read/Write
Comparators A,B and C
0x002B
ADDRESS LOW
Read/Write
Comparators A,B and C
0x002C
DATA HIGH COMPARATOR
Read/Write
Comparator A only
0x002D
DATA LOW COMPARATOR
Read/Write
Comparator A only
0x002E
DATA HIGH MASK
Read/Write
Comparator A only
0x002F
DATA LOW MASK
Read/Write
Comparator A only
5.19.3.2.8.1 Debug Comparator Control Register (DBGXCTL)
The contents of register bits 7 and 6 differ, depending upon which comparator registers are visible in the 8-byte window of the
DBG module register address map.
Table 354. Debug Comparator Control Register DBGACTL (Comparator A)
Address: 0x0028
R
W
Reset
7
6
5
4
3
2
1
0
SZE
SZ
TAG
BRK
RW
RWE
NDB
COMPE
0
0
0
0
0
0
0
0
= Unimplemented or Reserved
MM912_637, Rev. 3.0
Freescale Semiconductor
249
MCU - Debug Module (S12SDBG)
Table 355. Debug Comparator Control Register DBGBCTL (Comparator B)
Address: 0x0028
7
R
W
6
5
4
3
2
SZE
SZ
TAG
BRK
RW
RWE
0
0
0
0
0
0
Reset
1
0
0
COMPE
0
0
1
0
= Unimplemented or Reserved
Table 356. Debug Comparator Control Register DBGCCTL (Comparator C)
Address: 0x0028
R
7
6
0
0
0
0
W
Reset
5
4
3
2
TAG
BRK
RW
RWE
0
0
0
0
0
COMPE
0
0
= Unimplemented or Reserved
Read: DBGACTL if COMRV[1:0] = 00
DBGBCTL if COMRV[1:0] = 01
DBGCCTL if COMRV[1:0] = 10
Write: DBGACTL if COMRV[1:0] = 00 and DBG not armed
DBGBCTL if COMRV[1:0] = 01 and DBG not armed
DBGCCTL if COMRV[1:0] = 10 and DBG not armed
Table 357. DBGXCTL Field Descriptions
Field
7
SZE
(Comparators
A and B)
6
SZ
(Comparators
A and B)
5
TAG
4
BRK
3
RW
2
RWE
Description
Size Comparator Enable Bit — The SZE bit controls whether access size comparison is enabled for the associated
comparator. This bit is ignored if the TAG bit in the same register is set.
0 Word/Byte access size is not used in comparison
1 Word/Byte access size is used in comparison
Size Comparator Value Bit — The SZ bit selects either word or byte access size in comparison for the associated
comparator. This bit is ignored if the SZE bit is cleared or if the TAG bit in the same register is set.
0 Word access size is compared
1 Byte access size is compared
Tag Select— This bit controls whether the comparator match has immediate effect, causing an immediate state sequencer
transition or tag the opcode at the matched address. Tagged opcodes trigger only if they reach the execution stage of the
instruction queue.
0 Allow state sequencer transition immediately on match
1 On match, tag the opcode. If the opcode is about to be executed allow a state sequencer transition
Break— This bit controls whether a comparator match terminates a debug session immediately, independent of state
sequencer state. To generate an immediate breakpoint the module breakpoints must be enabled using the DBGC1 bit
DBGBRK.
0 The debug session termination is dependent upon the state sequencer and trigger conditions.
1 A match on this channel terminates the debug session immediately; breakpoints if active are generated, tracing, if
active, is terminated and the module disarmed.
Read/Write Comparator Value Bit — The RW bit controls whether read or write is used in compare for the associated
comparator. The RW bit is not used if RWE = 0. This bit is ignored if the TAG bit in the same register is set.
0 Write cycle is matched1Read cycle is matched
Read/Write Enable Bit — The RWE bit controls whether read or write comparison is enabled for the associated
comparator.This bit is ignored if the TAG bit in the same register is set
0 Read/Write is not used in comparison
1 Read/Write is used in comparison
MM912_637, Rev. 3.0
Freescale Semiconductor
250
MCU - Debug Module (S12SDBG)
Table 357. DBGXCTL Field Descriptions (continued)
Field
Description
1
Not Data Bus — The NDB bit controls whether the match occurs when the data bus matches the comparator register value
or when the data bus differs from the register value. This bit is ignored if the TAG bit in the same register is set. This bit is
only available for comparator A.
0 Match on data bus equivalence to comparator register contents
1 Match on data bus difference to comparator register contents
NDB
(Comparator A)
Determines if comparator is enabled
0 The comparator is not enabled
1 The comparator is enabled
0
COMPE
Table 358 shows the effect for RWE and RW on the comparison conditions. These bits are ignored if the corresponding TAG bit
is set, since the match occurs based on the tagged opcode reaching the execution stage of the instruction queue.
Table 358. Read or Write Comparison Logic Table
RWE Bit
RW Bit
RW Signal
Comment
0
x
0
RW not used in comparison
0
x
1
RW not used in comparison
1
0
0
Write data bus
1
0
1
No match
1
1
0
No match
1
1
1
Read data bus
5.19.3.2.8.2 Debug Comparator Address High Register (DBGXAH)
Table 359. Debug Comparator Address High Register (DBGXAH)
Address: 0x0029
R
7
6
5
4
3
2
0
0
0
0
0
0
0
0
0
0
0
0
W
Reset
1
0
Bit 17
Bit 16
0
0
= Unimplemented or Reserved
The DBGC1_COMRV bits determine which comparator address registers are visible in the 8-byte window from 0x0028 to 0x002F,
as shown in Table 360
Table 360. Comparator Address Register Visibility
COMRV
Visible Comparator
00
DBGAAH, DBGAAM, DBGAAL
01
DBGBAH, DBGBAM, DBGBAL
10
DBGCAH, DBGCAM, DBGCAL
11
None
Notes
251.Read: Anytime. See Table for visible register encoding.
Write: If DBG not armed. See Table for visible register encoding.
MM912_637, Rev. 3.0
Freescale Semiconductor
251
MCU - Debug Module (S12SDBG)
Table 361. DBGXAH Field Descriptions
Field
1–0
Bit[17:16]
Description
Comparator Address High Compare Bits — The Comparator address high compare bits control whether the selected
comparator compares the address bus bits [17:16] to a logic one or logic zero.
0 Compare corresponding address bit to a logic zero
1 Compare corresponding address bit to a logic one
5.19.3.2.8.3 Debug Comparator Address Mid Register (DBGXAM)
Table 362. Debug Comparator Address Mid Register (DBGXAM)
Address: 0x002A
R
W
7
6
5
4
3
2
1
0
Bit 15
Bit 14
Bit 13
Bit 12
Bit 11
Bit 10
Bit 9
Bit 8
0
0
0
0
0
0
0
0
Reset
Read: Anytime. See Table 360 for visible register encoding.
Write: If DBG not armed. See Table 360 for visible register encoding.
Table 363. DBGXAM Field Descriptions
Field
7–0
Bit[15:8]
Description
Comparator Address Mid Compare Bits — The Comparator address mid compare bits control whether the selected
comparator compares the address bus bits [15:8] to a logic one or logic zero.
0 Compare corresponding address bit to a logic zero
1 Compare corresponding address bit to a logic one
5.19.3.2.8.4 Debug Comparator Address Low Register (DBGXAL)
Table 364. Debug Comparator Address Low Register (DBGXAL)
Address: 0x002B
R
W
Reset
7
6
5
4
3
2
1
0
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
0
0
0
0
0
0
0
0
Read: Anytime. See Table for visible register encoding
Write: If DBG not armed. See Table for visible register encoding
Table 365. DBGXAL Field Descriptions
Field
7–0
Bits[7:0]
Description
Comparator Address Low Compare Bits — The Comparator address low compare bits control whether the selected
comparator compares the address bus bits [7:0] to a logic one or logic zero.
0 Compare corresponding address bit to a logic zero
1 Compare corresponding address bit to a logic one
MM912_637, Rev. 3.0
Freescale Semiconductor
252
MCU - Debug Module (S12SDBG)
5.19.3.2.8.5 Debug Comparator Data High Register (DBGADH)
Table 366. Debug Comparator Data High Register (DBGADH)
Address: 0x002C
R
W
7
6
5
4
3
2
1
0
Bit 15
Bit 14
Bit 13
Bit 12
Bit 11
Bit 10
Bit 9
Bit 8
0
0
0
0
0
0
0
0
Reset
Read: If COMRV[1:0] = 00
Write: If COMRV[1:0] = 00 and DBG not armed
Table 367. DBGADH Field Descriptions
Field
7–0
Bits[15:8]
Description
Comparator Data High Compare Bits— The Comparator data high compare bits control whether the selected comparator
compares the data bus bits [15:8] to a logic one or logic zero. The comparator data compare bits are only used in comparison
if the corresponding data mask bit is logic 1. This register is available only for comparator A. Data bus comparisons are only
performed if the TAG bit in DBGACTL is clear.
0 Compare corresponding data bit to a logic zero
1 Compare corresponding data bit to a logic one
5.19.3.2.8.6 Debug Comparator Data Low Register (DBGADL)
Table 368. Debug Comparator Data Low Register (DBGADL)
Address: 0x002D
R
W
Reset
7
6
5
4
3
2
1
0
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
0
0
0
0
0
0
0
0
Read: If COMRV[1:0] = 00
Write: If COMRV[1:0] = 00 and DBG not armed
Table 369. DBGADL Field Descriptions
Field
7–0
Bits[7:0]
Description
Comparator Data Low Compare Bits — The Comparator data low compare bits control, whether the selected comparator
compares the data bus bits [7:0] to a logic one or a logic zero. The comparator data compare bits are only used in comparison
if the corresponding data mask bit is a logic 1. This register is available only for comparator A. Data bus comparisons are only
performed if the TAG bit in DBGACTL is clear
0 Compare corresponding data bit to a logic zero
1 Compare corresponding data bit to a logic one
MM912_637, Rev. 3.0
Freescale Semiconductor
253
MCU - Debug Module (S12SDBG)
5.19.3.2.8.7 Debug Comparator Data High Mask Register (DBGADHM)
Table 370. Debug Comparator Data High Mask Register (DBGADHM)
Address: 0x002E
R
W
7
6
5
4
3
2
1
0
Bit 15
Bit 14
Bit 13
Bit 12
Bit 11
Bit 10
Bit 9
Bit 8
0
0
0
0
0
0
0
0
Reset
Read: If COMRV[1:0] = 00
Write: If COMRV[1:0] = 00 and DBG not armed
Table 371. DBGADHM Field Descriptions
Field
7–0
Bits[15:8]
Description
Comparator Data High Mask Bits — The Comparator data high mask bits control whether the selected comparator compares
the data bus bits [15:8] to the corresponding comparator data compare bits. Data bus comparisons are only performed if the
TAG bit in DBGACTL is clear
0 Do not compare corresponding data bit Any value of corresponding data bit allows match.
1 Compare corresponding data bit
5.19.3.2.8.8 Debug Comparator Data Low Mask Register (DBGADLM)
Table 372. Debug Comparator Data Low Mask Register (DBGADLM)
Address: 0x002F
R
W
Reset
7
6
5
4
3
2
1
0
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
0
0
0
0
0
0
0
0
Read: If COMRV[1:0] = 00
Write: If COMRV[1:0] = 00 and DBG not armed
Table 373. DBGADLM Field Descriptions
Field
7–0
Bits[7:0]
5.19.4
Description
Comparator Data Low Mask Bits — The Comparator data low mask bits control whether the selected comparator compares
the data bus bits [7:0] to the corresponding comparator data compare bits. Data bus comparisons are only performed if the
TAG bit in DBGACTL is clear
0 Do not compare corresponding data bit. Any value of corresponding data bit allows match
1 Compare corresponding data bit
Functional Description
This section provides a complete functional description of the DBG module. If the part is in secure mode, the DBG module can
generate breakpoints, but tracing is not possible.
5.19.4.1
S12SDBG Operation
Arming the DBG module by setting ARM in DBGC1 allows triggering the state sequencer, storing of data in the trace buffer, and
generation of breakpoints to the CPU. The DBG module is made up of four main blocks, the comparators, control logic, the state
sequencer, and the trace buffer.
The comparators monitor the bus activity of the CPU. All comparators can be configured to monitor address bus activity.
Comparator A can also be configured to monitor data bus activity and mask out individual data bus bits during a compare.
MM912_637, Rev. 3.0
Freescale Semiconductor
254
MCU - Debug Module (S12SDBG)
Comparators can be configured to use R/W and word/byte access qualification in the comparison. A match with a comparator
register value can initiate a state sequencer transition to another state (see Figure 65). Either forced or tagged matches are
possible. Using a forced match, a state sequencer transition can occur immediately on a successful match of system busses and
comparator registers. While tagging at a comparator match, the instruction opcode is tagged, and only if the instruction reaches
the execution stage of the instruction queue, can a state sequencer transition occur. In the case of a transition to Final state, bus
tracing is triggered, and/or a breakpoint can be generated.
A state sequencer transition to final state (with associated breakpoint, if enabled) can be initiated by writing to the TRIG bit in the
DBGC1 control register.
The trace buffer is visible through a 2-byte window in the register address map and must be read out using standard 16-bit word
reads.
TAGS
TAGHITS
BREAKPOINT REQUESTS
TO CPU
CPU BUS
COMPARATOR A
COMPARATOR
MATCH CONTROL
BUS INTERFACE
SECURE
COMPARATOR B
COMPARATOR C
MATCH0
MATCH1
TAG &
MATCH
CONTROL
LOGIC
TRANSITION
STATE
STATE SEQUENCER
STATE
MATCH2
TRACE
CONTROL
TRIGGER
TRACE BUFFER
READ TRACE DATA (DBG READ DATA BUS)
Figure 64. DBG Overview
5.19.4.2
Comparator Modes
The DBG contains three comparators, A, B and C. Each comparator compares the system address bus with the address stored
in DBGXAH, DBGXAM, and DBGXAL. Furthermore, comparator A also compares the data buses to the data stored in DBGADH,
DBGADL and allows masking of individual data bus bits.
All comparators are disabled in BDM and during BDM accesses.
The comparator match control logic (see Figure 64) configures comparators to monitor the buses for an exact address or an
address range, whereby either an access inside or outside the specified range generates a match condition. The comparator
configuration is controlled by the control register contents and the range control by the DBGC2 contents.
A match can initiate a transition to another state sequencer state (see Section 5.19.4.4, “State Sequence Control"”). The
comparator control register also allows the type of access to be included in the comparison through the use of the RWE, RW,
SZE, and SZ bits. The RWE bit controls whether read or write comparison is enabled for the associated comparator and the RW
bit selects either a read or write access for a valid match. Similarly the SZE and SZ bits allow the size of access (word or byte)
to be considered in the compare. Only comparators A and B feature SZE and SZ.
The TAG bit in each comparator control register is used to determine the match condition. By setting TAG, the comparator
qualifies a match with the output of opcode tracking logic, and a state sequencer transition occurs when the tagged instruction
reaches the CPU execution stage. While tagging, the RW, RWE, SZE, and SZ bits and the comparator data registers are ignored;
the comparator address register must be loaded with the exact opcode address.
MM912_637, Rev. 3.0
Freescale Semiconductor
255
MCU - Debug Module (S12SDBG)
If the TAG bit is clear (forced type match), a comparator match is generated when the selected address appears on the system
address bus. If the selected address is an opcode address, the match is generated when the opcode is fetched from the memory,
which precedes the instruction execution by an indefinite number of cycles due to instruction pipelining. For a comparator match
of an opcode at an odd address when TAG = 0, the corresponding even address must be contained in the comparator register.
Thus for an opcode at odd address (n), the comparator register must contain address (n–1).
Once a successful comparator match has occurred, the condition that caused the original match is not verified again on
subsequent matches. If a particular data value is verified at a given address, this address may not still contain that data value
when a subsequent match occurs.
Match[0, 1, 2] map directly to Comparators [A, B, C] respectively, except in range modes (see Section 5.19.3.2.4, “Debug Control
Register2 (DBGC2)"). Comparator channel priority rules are described in the priority section (Section 5.19.4.3.4, “Channel
Priorities").
5.19.4.2.1
Single Address Comparator Match
With range comparisons disabled, the match condition is an exact equivalence of address bus, with the value stored in the
comparator address registers. Further qualification of the type of access (R/W, word/byte) and data bus contents is possible,
depending on comparator channel.
5.19.4.2.1.1 Comparator C
Comparator C offers only address and direction (R/W) comparison. The exact address is compared, with the comparator address
register loaded with address (n), a word access of address (n–1) also accesses (n) but does not cause a match.
Table 374. Comparator C Access Considerations
Condition For Valid Match
Comp C Address RWE
RW
Examples
LDAA ADDR[n]
Read and write accesses of ADDR[n]
ADDR[n](252)
0
X
Write accesses of ADDR[n]
ADDR[n]
1
0
STAA #$BYTE ADDR[n]
Read accesses of ADDR[n]
ADDR[n]
1
1
LDAA #$BYTE ADDR[n]
STAA #$BYTE ADDR[n]
Notes
252.A word access of ADDR[n-1] also accesses ADDR[n] but does not generate a match. The comparator address register must contain the
exact address from the code.
5.19.4.2.1.2 Comparator B
Comparator B offers address, direction (R/W) and access size (word/byte) comparison. If the SZE bit is set, the access size (word
or byte) is compared with the SZ bit value such that only the specified size of access causes a match. If configured for a byte
access of a particular address, a word access covering the same address does not lead to match.
Assuming the access direction is not qualified (RWE=0), for simplicity, the size access considerations are shown in Table 375.
Table 375. Comparator B Access Size Considerations
Condition For Valid Match
Comp B Address RWE
SZE
SZ8
Word and byte accesses of ADDR[n]
ADDR[n](253)
0
0
X
Word accesses of ADDR[n] only
ADDR[n]
0
1
0
Byte accesses of ADDR[n] only
ADDR[n]
0
1
1
Examples
MOVB #$BYTE ADDR[n]
MOVW #$WORD ADDR[n]
MOVW #$WORD ADDR[n]
LDD ADDR[n]
MOVB #$BYTE ADDR[n]
LDAB ADDR[n]
Notes
253.A word access of ADDR[n-1] also accesses ADDR[n] but does not generate a match. The comparator address register must contain the
exact address from the code.
MM912_637, Rev. 3.0
Freescale Semiconductor
256
MCU - Debug Module (S12SDBG)
Access direction can also be used to qualify a match for Comparator B in the same way, as described for Comparator C in
Table 374.
5.19.4.2.1.3 Comparator A
Comparator A offers address, direction (R/W), access size (word/byte), and data bus comparison.
Table 376 lists access considerations with data bus comparison. On word accesses, the data byte of the lower address is mapped
to DBGADH. Access direction can also be used to qualify a match for Comparator A in the same way as described for Comparator
C in Table 374.
Table 376. Comparator A Matches When Accessing ADDR[n]
SZE
SZ
DBGADHM,
DBGADLM
Access
DH=DBGADH, DL=DBGADL
0
X
$0000
Byte
Word
No databus comparison
0
X
$FF00
Byte, data(ADDR[n])=DH
Word, data(ADDR[n])=DH, data(ADDR[n+1])=X
Match data(ADDR[n])
0
X
$00FF
Word, data(ADDR[n])=X, data(ADDR[n+1])=DL
Match data(ADDR[n+1])
0
X
$00FF
Byte, data(ADDR[n])=X, data(ADDR[n+1])=DL
Possible unintended match
0
X
$FFFF
Word, data(ADDR[n])=DH, data(ADDR[n+1])=DL
Match data(ADDR[n], ADDR[n+1])
0
X
$FFFF
Byte, data(ADDR[n])=DH, data(ADDR[n+1])=DL
Possible unintended match
1
0
$0000
Word
No databus comparison
1
0
$00FF
Word, data(ADDR[n])=X, data(ADDR[n+1])=DL
Match only data at ADDR[n+1]
1
0
$FF00
Word, data(ADDR[n])=DH, data(ADDR[n+1])=X
Match only data at ADDR[n]
1
0
$FFFF
Word, data(ADDR[n])=DH, data(ADDR[n+1])=DL
Match data at ADDR[n] & ADDR[n+1]
1
1
$0000
Byte
No databus comparison
1
1
$FF00
Byte, data(ADDR[n])=DH
Match data at ADDR[n]
Comment
5.19.4.2.1.4 Comparator A Data Bus Comparison NDB Dependency
Comparator A features an NDB control bit, which allows data bus comparators to be configured to either trigger on equivalence
or trigger on difference. This allows monitoring of a difference in the contents of an address location from an expected value.
When matching on an equivalence (NDB=0), each individual data bus bit position can be masked out by clearing the
corresponding mask bit (DBGADHM/DBGADLM) so that it is ignored in the comparison. A match occurs when all data bus bits
with corresponding mask bits set are equivalent. If all mask register bits are clear, then a match is based on the address bus only,
the data bus is ignored.
When matching on a difference, mask bits can be cleared to ignore bit positions. A match occurs when any data bus bit with
corresponding mask bit set is different. Clearing all mask bits causes all bits to be ignored and prevents a match because no
difference can be detected. In this case, address bus equivalence does not cause a match.
Table 377. NDB and MASK Bit Dependency
NDB
DBGADHM[n] /
DBGADLM[n]
0
0
Do not compare data bus bit.
0
1
Compare data bus bit. Match on equivalence.
1
0
Do not compare data bus bit.
1
1
Compare data bus bit. Match on difference.
Comment
MM912_637, Rev. 3.0
Freescale Semiconductor
257
MCU - Debug Module (S12SDBG)
5.19.4.2.2
Range Comparisons
Using the AB comparator pair for a range comparison, the data bus can also be used for qualification by using the comparator A
data registers. Furthermore, the DBGACTL RW and RWE bits can be used to qualify the range comparison on either a read or
a write access. The corresponding DBGBCTL bits are ignored. The SZE and SZ control bits are ignored in range mode. The
comparator A TAG bit is used to tag range comparisons. The comparator B TAG bit is ignored in range modes. For a range
comparison using comparators A and B, both COMPEA and COMPEB must be set; to disable range comparisons both must be
cleared. The comparator A BRK bit is used to for the AB range, the comparator B BRK bit is ignored in range mode.
When configured for range comparisons and tagging, the ranges are accurate only to word boundaries.
5.19.4.2.2.1 Inside Range (CompA_Addr  address  CompB_Addr)
In the Inside Range comparator mode, comparator pair A and B can be configured for range comparisons. This configuration
depends upon the control register (DBGC2). The match condition requires that a valid match for both comparators happens on
the same bus cycle. A match condition on only one comparator is not valid. An aligned word access which straddles the range
boundary is valid only if the aligned address is inside the range.
5.19.4.2.2.2 Outside Range (address < CompA_Addr or address > CompB_Addr)
In the Outside Range comparator mode, comparator pair A and B can be configured for range comparisons. A single match
condition on either of the comparators is recognized as valid. An aligned word access which straddles the range boundary is
valid, only if the aligned address is outside the range.
Outside range mode in combination with tagging can be used to detect, if the opcode fetches are from an unexpected range. In
forced match mode, the outside range match would typically be activated at any interrupt vector fetch or register access. This
can be avoided by setting the upper range limit to $3FFFF or lower range limit to $00000 respectively.
5.19.4.3
Match Modes (Forced or Tagged)
Match modes are used as qualifiers for a state sequencer change of state. The Comparator control register TAG bits select the
match mode. The modes are described in the following sections.
5.19.4.3.1
Forced Match
When configured for forced matching, a comparator channel match can immediately initiate a transition to the next state
sequencer state, whereby the corresponding flags in DBGSR are set. The state control register for the current state determines
the next state. Forced matches are typically generated 2-3 bus cycles after the final matching address bus cycle, independent of
comparator RWE/RW settings. Furthermore, since opcode fetches occur several cycles before the opcode execution, a forced
match of an opcode address typically precedes a tagged match at the same address.
5.19.4.3.2
Tagged Match
If a CPU taghit occurs, a transition to another state sequencer state is initiated and the corresponding DBGSR flags are set. For
a comparator related taghit to occur, the DBG must first attach tags to instructions as they are fetched from memory. When the
tagged instruction reaches the execution stage of the instruction queue, a taghit is generated by the CPU. This can initiate a state
sequencer transition.
5.19.4.3.3
Immediate Trigger
Independent of comparator matches, it is possible to initiate a tracing session and/or breakpoint by writing to the TRIG bit in
DBGC1. If configured for begin aligned tracing, this triggers the state sequencer into the Final state, if configured for end
alignment, setting the TRIG bit disarms the module, ending the session and issues a forced breakpoint request to the CPU.
It is possible to set both TRIG and ARM simultaneously to generate an immediate trigger, independent of the current state of
ARM.
MM912_637, Rev. 3.0
Freescale Semiconductor
258
MCU - Debug Module (S12SDBG)
5.19.4.3.4
Channel Priorities
In case of simultaneous matches, the priority is resolved according to Table 378. The lower priority is suppressed. It is possible
to miss a lower priority match, if it occurs simultaneously with a higher priority. The priorities described in Table 378 dictate that
in the case of simultaneous matches, the match pointing to Final state has highest priority, followed by the lower channel number
(0,1,2).
Table 378. Channel Priorities
Priority
Source
Action
Highest
TRIG
Enter Final State
Channel pointing to Final State
Transition to next state as defined by state control registers
Match0 (force or tag hit)
Transition to next state as defined by state control registers
Match1 (force or tag hit)
Transition to next state as defined by state control registers
Match2 (force or tag hit)
Transition to next state as defined by state control registers
Lowest
5.19.4.4
State Sequence Control
ARM = 0
State 0
(Disarmed)
ARM = 1
State1
State2
ARM = 0
Session Complete
(Disarm)
Final State
State3
ARM = 0
Figure 65. State Sequencer Diagram
The state sequencer allows a defined sequence of events to provide a trigger point for tracing of data in the trace buffer. Once
the DBG module has been armed by setting the ARM bit in the DBGC1 register, the state 1 of the state sequencer is entered.
Further transitions between the states are then controlled by the state control registers and channel matches. From Final state,
the only permitted transition is back to the disarmed state 0. Transition between any of the states 1 to 3 is not restricted. Each
transition updates the SSF[2:0] flags in DBGSR accordingly to indicate the current state.
Alternatively, writing to the TRIG bit in DBGSC1, provides an immediate trigger independent of comparator matches.
Independent of the state sequencer, each comparator channel can be individually configured to generate an immediate
breakpoint when a match occurs, through the use of the BRK bits in the DBGxCTL registers. It is possible to generate an
immediate breakpoint on selected channels, while a state sequencer transition can be initiated by a match on other channels. If
a debug session is ended by a match on a channel, the state sequencer transitions through Final state for a clock cycle to state
0. This is independent of tracing and breakpoint activity, and with tracing and breakpoints disabled, the state sequencer enters
state 0 and the debug module is disarmed.
5.19.4.4.1
Final State
On entering Final state, a trigger may be issued to the trace buffer according to the trace alignment control, as defined by the
TALIGN bit (see Section 5.19.3.2.3, “Debug Trace Control Register (DBGTCR)"”). If the TSOURCE bit in DBGTCR is clear, then
the trace buffer is disabled and the transition to Final state can only generate a breakpoint request. In this case or upon
completion of a tracing session when tracing is enabled, the ARM bit in the DBGC1 register is cleared, returning the module to
MM912_637, Rev. 3.0
Freescale Semiconductor
259
MCU - Debug Module (S12SDBG)
the disarmed state 0. If tracing is enabled, a breakpoint request can occur at the end of the tracing session. If neither tracing nor
breakpoints are enabled, when the final state is reached, it returns automatically to state 0 and the debug module is disarmed.
5.19.4.5
Trace Buffer Operation
The trace buffer is a 64 lines deep by 20-bits wide RAM array. The DBG module stores trace information in the RAM array in a
circular buffer format. The system accesses the RAM array through a register window (DBGTBH:DBGTBL) using 16-bit wide
word accesses. After each complete 20-bit trace buffer line is read, an internal pointer into the RAM increments so that the next
read receives fresh information. Data is stored in the format shown in Table 379 and Table 375. After each store the counter
register DBGCNT is incremented. Tracing of CPU activity is disabled when the BDM is active. Reading the trace buffer while the
DBG is armed, returns invalid data and the trace buffer pointer is not incremented.
5.19.4.5.1
Trace Trigger Alignment
Using the TALIGN bit (see Section 5.19.3.2.3, “Debug Trace Control Register (DBGTCR)"), it is possible to align the trigger with
the end or the beginning of a tracing session.
If End tracing is selected, tracing begins when the ARM bit in DBGC1 is set and State1 is entered; the transition to Final state
signals the end of the tracing session. Tracing with Begin Trigger starts at the opcode of the trigger. Using End Trigger or when
the tracing is initiated by writing to the TRIG bit while configured for Begin Trigger, tracing starts in the second cycle after the
DBGC1 write cycle.
5.19.4.5.1.1 Storing with Begin Trigger
Storing with Begin Trigger, data is not stored in the Trace Buffer until the Final state is entered. Once the trigger condition is met,
the DBG module remains armed until 64 lines are stored in the Trace Buffer. If the trigger is at the address of the change-of-flow
instruction, the change of flow associated with the trigger is stored in the Trace Buffer. Using Begin Trigger together with tagging,
if the tagged instruction is about to be executed, then the trace is started. Upon completion of the tracing session, the breakpoint
is generated, thus the breakpoint does not occur at the tagged instruction boundary.
5.19.4.5.1.2 Storing with End Trigger
Storing with End Trigger, data is stored in the Trace Buffer until the Final State is entered, at which point the DBG module
becomes disarmed and no more data is stored. If the trigger is at the address of a change of flow instruction, the trigger event is
not stored in the Trace Buffer.
5.19.4.5.2
Trace Modes
Four trace modes are available. The mode is selected using the TRCMOD bits in the DBGTCR register. Tracing is enabled using
the TSOURCE bit in the DBGTCR register. The modes are described in the following subsections.
5.19.4.5.2.1 Normal Mode
In Normal mode, change of flow (COF) program counter (PC) addresses are stored.
COF addresses are defined as follows:
•
Source address of taken conditional branches (long, short, bit-conditional, and loop primitives)
•
Destination address of indexed JMP, JSR, and CALL instruction
•
Destination address of RTI, RTS, and RTC instructions
•
Vector address of interrupts, except for BDM vectors
LBRA, BRA, BSR, BGND, as well as non-indexed JMP, JSR, and CALL instructions are not classified as change of flow and are
not stored in the trace buffer.
Stored information includes the full 18-bit address bus and information bits, which contains a source/destination bit to indicate
whether the stored address was a source address or destination address.
MM912_637, Rev. 3.0
Freescale Semiconductor
260
MCU - Debug Module (S12SDBG)
NOTE
When a COF instruction with destination address is executed, the destination address is
stored to the trace buffer on instruction completion, indicating the COF has taken place. If
an interrupt occurs simultaneously, then the next instruction carried out is actually from the
interrupt service routine. The instruction at the destination address of the original program
flow gets executed after the interrupt service routine.
In the following example, an IRQ interrupt occurs during execution of the indexed JMP at
address MARK1. The BRN at the destination (SUB_1) is not executed until after the IRQ
service routine, but the destination address is entered into the trace buffer to indicate that
the indexed JMP COF has taken place.
MARK1
MARK2
LDX
JMP
NOP
#SUB_1
0,X
SUB_1
BRN
*
ADDR1
NOP
DBNE
A,PART5
IRQ_ISR
MARK1
IRQ_ISR
SUB_1
ADDR1
LDAB
STAB
RTI
LDX
JMP
LDAB
STAB
RTI
BRN
NOP
DBNE
#$F0
VAR_C1
; IRQ interrupt occurs during execution of this
;
; JMP Destination address TRACE BUFFER ENTRY 1
; RTI Destination address TRACE BUFFER ENTRY 3
;
; Source address TRACE BUFFER ENTRY 4
; IRQ Vector $FFF2 = TRACE BUFFER ENTRY 2
;
The execution flow taking into account the IRQ is as follows
#SUB_1
0,X
#$F0
VAR_C1
;
;
;
*
A,PART5
;
;
5.19.4.5.2.2 Loop1 Mode
Loop1 mode, similarly to Normal mode also stores only COF address information to the trace buffer, it however allows the filtering
out of redundant information.
The intent of Loop1 mode is to prevent the Trace Buffer from being filled entirely with duplicate information from a looping
construct, such as delays using the DBNE instruction or polling loops using BRSET/BRCLR instructions. Immediately after
address information is placed in the Trace Buffer, the DBG module writes this value into a background register. This prevents
consecutive duplicate address entries in the Trace Buffer resulting from repeated branches.
Loop1 mode only inhibits consecutive duplicate source address entries that would typically be stored in most tight looping
constructs. It does not inhibit repeated entries of destination addresses or vector addresses, since repeated entries of these
would most likely indicate a bug in the user’s code that the DBG module is designed to help find.
5.19.4.5.2.3 Detail Mode
In Detail mode, address and data for all memory and register accesses is stored in the trace buffer. This mode is intended to
supply additional information on indexed, indirect addressing modes where storing only the destination address would not
provide all information required for a user to determine where the code is in error. This mode also features information bit storage
to the trace buffer, for each address byte storage. The information bits indicate the size of access (word or byte) and the type of
access (read or write).
When tracing in Detail mode, all cycles are traced except those when the CPU is either in a free or opcode fetch cycle.
MM912_637, Rev. 3.0
Freescale Semiconductor
261
MCU - Debug Module (S12SDBG)
5.19.4.5.2.4 Compressed Pure PC Mode
In Compressed Pure PC mode, the PC addresses of all executed opcodes, including where illegal opcodes are stored. A
compressed storage format is used to increase the effective depth of the trace buffer. This is achieved by storing the lower order
bits each time and using 2 information bits to indicate if a 64 byte boundary has been crossed, in which case the full PC is stored.
Each Trace Buffer row consists of 2 information bits and 18 PC address bits
NOTE:
When tracing is terminated using forced breakpoints, latency in breakpoint generation
means that opcodes following the opcode causing the breakpoint can be stored to the trace
buffer. The number of opcodes is dependent on program flow. This can be avoided by using
tagged breakpoints.
5.19.4.5.3
Trace Buffer Organization (Normal, Loop1, Detail Modes)
ADRH, ADRM, ADRL denote address high, middle, and low byte respectively. The numerical suffix refers to the tracing count.
The information format for Loop1 and Normal modes are identical. In Detail mode, the address and data for each entry are stored
on consecutive lines, thus the maximum number of entries is 32. In this case, DBGCNT bits are incremented twice, once for the
address line, and once for the data line, on each trace buffer entry. In Detail mode, CINF comprises of R/W and size access
information (CRW and CSZ respectively).
Single byte data accesses in Detail mode are always stored to the low byte of the trace buffer (DATAL) and the high byte is
cleared. When tracing word accesses, the byte at the lower address is always stored to trace buffer byte1 and the byte at the
higher address is stored to byte0.
Table 379. Trace Buffer Organization (Normal, Loop1, Detail modes)
Mode
Entry
Number
Entry 1
Detail Mode
Entry 2
Normal/Loop1
Modes
4-bits
8-bits
8-bits
Field 2
Field 1
Field 0
CINF1,ADRH1
ADRM1
ADRL1
0
DATAH1
DATAL1
CINF2,ADRH2
ADRM2
ADRL2
0
DATAH2
DATAL2
Entry 1
PCH1
PCM1
PCL1
Entry 2
PCH2
PCM2
PCL2
5.19.4.5.3.1 Information Bit Organization
The format of the bits is dependent upon the active trace mode as described by the following.
5.19.4.5.3.1.1 Field2 Bits in Detail Mode
Table 380. Field2 Bits in Detail Mode
Bit 3
Bit 2
Bit 1
Bit 0
CSZ
CRW
ADDR[17]
ADDR[16]
In Detail Mode, the CSZ and CRW bits indicate the type of access being made by the CPU.
MM912_637, Rev. 3.0
Freescale Semiconductor
262
MCU - Debug Module (S12SDBG)
Table 381. Field Descriptions
Bit
Description
Access Type Indicator— This bit indicates if the access was a byte or word size when tracing in Detail mode
0 Word Access
1 Byte Access
3
CSZ
Read Write Indicator — This bit indicates if the corresponding stored address corresponds to a read or write access when
tracing in Detail mode.
0 Write Access
1 Read Access
2
CRW
1
Address Bus bit 17— Corresponds to system address bus bit 17.
ADDR[17]
0
Address Bus bit 16— Corresponds to system address bus bit 16.
ADDR[16]
5.19.4.5.3.1.2 Field2 Bits in Normal and Loop1 Modes
Table 382. Information Bits PCH
Bit 3
Bit 2
Bit 1
Bit 0
CSD
CVA
PC17
PC16
Table 383. PCH Field Descriptions
Bit
Description
Source Destination Indicator — In Normal and Loop1 mode, this bit indicates if the corresponding stored address is a source
or destination address. This bit has no meaning in Compressed Pure PC mode.
0 Source Address
1 Destination Address
3
CSD
Vector Indicator — In Normal and Loop1 mode, this bit indicates if the corresponding stored address is a vector address.
Vector addresses are destination addresses, thus if CVA is set, then the corresponding CSD is also set. This bit has no
meaning in Compressed Pure PC mode.
0 Non-Vector destination address
1 Vector destination address
2
CVA
1
Program Counter bit 17— In Normal and Loop1 mode, this bit corresponds to program counter bit 17.
PC17
0
Program Counter bit 16— In Normal and Loop1 mode, this bit corresponds to program counter bit 16.
PC16
5.19.4.5.4
Trace Buffer Organization (Compressed Pure PC Mode)
Table 384. Trace Buffer Organization Example (Compressed PurePC Mode)
Mode
2-bits
Line
Number Field 3
Line 1
Compressed
Pure PC Mode
6-bits
6-bits
6-bits
Field 2
Field 1
Field 0
00
PC1 (Initial 18-bit PC Base Address)
Line 2
11
PC4
PC3
PC2
Line 3
01
0
0
PC5
Line 4
00
Line 5
10
Line 6
00
PC6 (New 18-bit PC Base Address)
0
PC8
PC7
PC9 (New 18-bit PC Base Address)
MM912_637, Rev. 3.0
Freescale Semiconductor
263
MCU - Debug Module (S12SDBG)
5.19.4.5.4.0.1 Field3 Bits in Compressed Pure PC Modes
Table 385. Compressed Pure PC Mode Field 3 Information Bit Encoding
INF1
INF0
TRACE BUFFER ROW CONTENT
0
0
Base PC address TB[17:0] contains a full PC[17:0] value
0
1
Trace Buffer[5:0] contain incremental PC relative to base address zero value
1
0
Trace Buffer[11:0] contain next 2 incremental PCs relative to base address zero value
1
1
Trace Buffer[17:0] contain next 3 incremental PCs relative to base address zero value
Each time PC[17:6] differs form the previous base PC[17:6], a new base address is stored. The base address zero value is the
lowest address in the 64 address range.
The first line of the trace buffer always gets a base PC address; this applies also on rollover.
5.19.4.5.5
Reading Data from Trace Buffer
The data stored in the Trace Buffer can be read provided the DBG module is not armed, is configured for tracing (TSOURCE bit
is set), and the system not secured. When the ARM bit is written to 1 the trace buffer, it is locked to prevent reading. The trace
buffer can only be unlocked for reading by a single aligned word write to DBGTB when the module is disarmed.
The Trace Buffer can only be read through the DBGTB register using aligned word reads. Any byte or misaligned reads return 0
and does not cause the trace buffer pointer to increment to the next trace buffer address. The Trace Buffer data is read out first-in
first-out. By reading CNT in DBGCNT, the number of valid lines can be determined. DBGCNT does not decrement as data is read.
While reading, an internal pointer is used to determine the next line to be read. After a tracing session, the pointer points to the
oldest data entry. If no overflow has occurred, the pointer points to line 0, otherwise it points to the line with the oldest entry. In
compressed Pure PC mode on rollover, the line with the oldest data entry may also contain newer data entries in fields 0 and 1.
If rollover is indicated by the TBF bit, the line status must be decoded using the INF bits in field3 of that line. If both INF bits are
clear, the line contains only entries from before the last rollover. 
If INF0=1, field 0 contains post rollover data but fields 1 and 2 contain pre rollover data. 
If INF1=1, fields 0 and 1 contain post rollover data but field 2 contains pre rollover data.
The pointer is initialized by each aligned write to DBGTBH to point to the oldest data again. This enables an interrupted trace
buffer read sequence to be easily restarted from the oldest data entry.
The least significant word of line is read out first. This corresponds to the fields 1 and 0 of Table 379. The next word read returns
field 2 in the least significant bits [3:0] and “0” for bits [15:4].
Reading the Trace Buffer while the DBG module is armed, returns invalid data and no shifting of the RAM pointer occurs.
5.19.4.5.6
Trace Buffer Reset State
The Trace Buffer contents and DBGCNT bits are not initialized by a system reset. Should a system reset occur, immediately
before the reset occurred, the trace session information can be read out and the number of valid lines in the trace buffer is
indicated by DBGCNT. The internal pointer to the current trace buffer address is initialized by unlocking the trace buffer and points
to the oldest valid data, even if a reset occurred during the tracing session. To read the trace buffer after a reset, TSOURCE must
be set, otherwise the trace buffer reads as all zeroes. Generally, debugging occurrences of system resets are best handled using
end trigger alignment, since the reset may occur before the trace trigger, which in the begin trigger alignment case, means no
information would be stored in the trace buffer.
The Trace Buffer contents and DBGCNT bits are undefined following a POR.
NOTE
An external pin RESET that occurs simultaneous to a trace buffer entry can, in very few
cases, lead to either that entry being corrupted, or the first entry of the session being
corrupted. In such cases, the other contents of the trace buffer still contain valid tracing
information. The case occurs when the reset assertion coincides with the trace buffer entry
clock edge.
MM912_637, Rev. 3.0
Freescale Semiconductor
264
MCU - Debug Module (S12SDBG)
5.19.4.6
Tagging
A tag follows program information as it advances through the instruction queue. When a tagged instruction reaches the head of
the queue, a tag hit occurs and can initiate a state sequencer transition.
Each comparator control register features a TAG bit, which controls whether the comparator match causes a state sequencer
transition immediately or tags the opcode at the matched address. If a comparator is enabled for tagged comparisons, the
address stored in the comparator match address registers must be an opcode address.
Using Begin Trigger together with tagging, if the tagged instruction is about to be executed, the transition to the next state
sequencer state occurs. If the transition is to the Final state, tracing is started. Only upon completion of the tracing session can
a breakpoint be generated. Using End alignment, when the tagged instruction is about to be executed and the next transition is
to Final state, a breakpoint is generated immediately, before the tagged instruction is carried out.
R/W monitoring, access size (SZ) monitoring and data bus monitoring are not useful if tagging is selected, since the tag is
attached to the opcode at the matched address and is not dependent on the data bus nor on ta type of access. These bits are
ignored if tagging is selected.
When configured for range comparisons and tagging, the ranges are accurate only to word boundaries.
Tagging is disabled when the BDM becomes active.
5.19.4.7
Breakpoints
It is possible to generate breakpoints from channel transitions to final state or use software to write to the TRIG bit in the DBGC1
register.
5.19.4.7.1
Breakpoints From Comparator Channels
Breakpoints can be generated when the state sequencer transitions to the Final state. If configured for tagging, the breakpoint is
generated when the tagged opcode reaches the execution stage of the instruction queue.
If a tracing session is selected by the TSOURCE bit, breakpoints are requested when the tracing session has completed. If Begin
aligned triggering is selected, the breakpoint is requested only on completion of the subsequent trace (see Table 386). If no
tracing session is selected, breakpoints are requested immediately.
If the BRK bit is set, the associated breakpoint is generated immediately independent of tracing trigger alignment.
Table 386. Breakpoint Setup For CPU Breakpoints
BRK
TALIGN
DBGBRK
0
0
0
Fill Trace Buffer until trigger then disarm (no breakpoints)
0
0
1
Fill Trace Buffer until trigger, then breakpoint request occurs
0
1
0
Start Trace Buffer at trigger (no breakpoints)
0
1
1
1
x
1
Terminate tracing and generate breakpoint immediately on trigger
1
x
0
Terminate tracing immediately on trigger
5.19.4.7.2
Breakpoint Alignment
Start Trace Buffer at trigger
A breakpoint request occurs when Trace Buffer is full
Breakpoints Generated Via the TRIG Bit
If a TRIG triggers occur, the Final state is entered, where the tracing trigger alignment is defined by the TALIGN bit. If a tracing
session is selected by the TSOURCE bit, breakpoints are requested when the tracing session has completed. If Begin aligned
triggering is selected, the breakpoint is requested only on completion of the subsequent trace (see Table 386). If no tracing
session is selected, breakpoints are requested immediately. TRIG breakpoints are possible with a single write to DBGC1, setting
ARM and TRIG simultaneously.
MM912_637, Rev. 3.0
Freescale Semiconductor
265
MCU - Debug Module (S12SDBG)
5.19.4.7.3
Breakpoint Priorities
If a TRIG trigger occurs after Begin aligned tracing has already started, then the TRIG no longer has an effect. When the
associated tracing session is complete, the breakpoint occurs. Similarly, if a TRIG is followed by a subsequent comparator
channel match, it has no effect, since tracing has already started.
If a forced SWI breakpoint coincides with a BGND in user code with BDM enabled, then the BDM is activated by the BGND and
the breakpoint to SWI is suppressed.
5.19.4.7.3.1 DBG Breakpoint Priorities And BDM Interfacing
Breakpoint operation is dependent on the state of the BDM module. If the BDM module is active, the CPU is executing out of
BDM firmware. Comparator matches and associated breakpoints are disabled. In addition, while executing a BDM TRACE
command, tagging into BDM is disabled. If BDM is not active, the breakpoint gives priority to BDM requests over SWI requests
if the breakpoint happens to coincide with a SWI instruction in user code. On returning from BDM, the SWI from user code gets
executed.
Table 387. Breakpoint Mapping Summary
DBGBRK
BDM Bit
(DBGC1[4])
BDM
Enabled
BDM
Active
Breakpoint
Mapping
0
X
X
X
No Breakpoint
1
0
X
0
Breakpoint to SWI
X
X
1
1
No Breakpoint
1
1
0
X
Breakpoint to SWI
1
1
1
0
Breakpoint to BDM
BDM cannot be entered from a breakpoint unless the ENABLE bit is set in the BDM. If entry to BDM via a BGND instruction is
attempted and the ENABLE bit in the BDM is cleared, the CPU actually executes the BDM firmware code, checks the ENABLE,
and returns if ENABLE is not set. If not serviced by the monitor, the breakpoint is re-asserted when the BDM returns to normal
CPU flow.
If the comparator register contents coincide with the SWI/BDM vector address, an SWI in user code could coincide with a DBG
breakpoint. The CPU ensures that BDM requests have a higher priority than SWI requests. Returning from the BDM/SWI service
routine, care must be taken to avoid a repeated breakpoint at the same address.
Should a tagged or forced breakpoint coincide with a BGND in user code, the instruction that follows the BGND instruction is the
first instruction executed when normal program execution resumes.
NOTE
When program control returns from a tagged breakpoint using an RTI or BDM GO command
without program counter modification, it returns to the instruction whose tag generated the
breakpoint. To avoid a repeated breakpoint at the same location, reconfigure the DBG
module in the SWI routine, if configured for an SWI breakpoint, or over the BDM interface
by executing a TRACE command before the GO, to increment the program flow past the
tagged instruction.
5.19.5
5.19.5.1
Application Information
State Machine Scenarios
Defining the state control registers as SCR1,SCR2, SCR3, and M0,M1,M2 as matches on channels 0, 1, 2 respectively. SCR
encoding supported by S12SDBGV1 are shown in black. SCR encoding supported only in S12SDBGV2 are shown in red. For
backwards compatibility the new scenarios use a 4th bit in each SCR register. Thus the existing encoding for SCRx[2:0] is not
changed.
MM912_637, Rev. 3.0
Freescale Semiconductor
266
MCU - Debug Module (S12SDBG)
5.19.5.2
Scenario 1
A trigger is generated if a given sequence of 3 code events is executed.
SCR2=0010
SCR1=0011
State1
M1
SCR3=0111
M2
State2
State3
M0
Final State
Figure 66. Scenario 1
Scenario 1 is possible with S12SDBGV1 SCR encoding.
5.19.5.3
Scenario 2
A trigger is generated if a given sequence of 2 code events is executed.
SCR2=0101
SCR1=0011
State1
M1
M2
State2
Final State
Figure 67. Scenario 2a
A trigger is generated if a given sequence of 2 code events is executed, whereby the first event is entry into a range (COMPA,
COMPB configured for range mode). M1 is disabled in range modes.
SCR2=0101
SCR1=0111
State1
M01
M2
State2
Final State
Figure 68. Scenario 2b
A trigger is generated if a given sequence of 2 code events is executed, whereby the second event is entry into a range (COMPA,
COMPB configured for range mode).
SCR2=0011
SCR1=0010
State1
M2
State2
M0
Final State
Figure 69. Scenario 2c
All 3 scenarios 2a, 2b, 2c are possible with the S12SDBGV1 SCR encoding.
MM912_637, Rev. 3.0
Freescale Semiconductor
267
MCU - Debug Module (S12SDBG)
5.19.5.4
Scenario 3
A trigger is generated immediately when one of up to 3 given events occurs.
SCR1=0000
State1
M012
Final State
Figure 70. Scenario 3
Scenario 3 is possible with S12SDBGV1 SCR encoding.
5.19.5.5
Scenario 4
Trigger if a sequence of 2 events is carried out in an incorrect order. Event A must be followed by event B, and event B must be
followed by event A. 2 consecutive occurrences of event A without an intermediate event B causes a trigger. Similarly 2
consecutive occurrences of event B without an intermediate event A causes a trigger. This is possible by using CompA and
CompC to match on the same address as shown.
SCR1=0100 State1
M1
SCR3=0001
State 3
M0
State2
M2
M0
M1
M1
SCR2=0011
Final State
Figure 71. Scenario 4a
This scenario is currently not possible using 2 comparators only. S12SDBGV2 makes it possible with 2 comparators, State 3
allows a M0 to return to state 2, while a M2 leads to Final state, as shown in Figure 72.
SCR1=0110 State1
M2
SCR3=1110
State 3
M0
State2
M0
M01
M2
M2
SCR2=1100
M1 disabled in
range mode
Final State
Figure 72. Scenario 4b (with 2 comparators)
The advantage of using only 2 channels is that range comparisons can now be included (channel0).
This however violates the S12SDBGV1 specification, which states that a match leading to final state always has priority, in case
of a simultaneous match, while priority is also given to the lowest channel number. For the S12SDBG, the corresponding CPU
priority decoder is removed to support this, such that on simultaneous taghits, taghits pointing to Final state have highest priority.
MM912_637, Rev. 3.0
Freescale Semiconductor
268
MCU - Debug Module (S12SDBG)
If no taghit points to Final state, then the lowest channel number has priority. With the above encoding from State3, the CPU and
DBG would break on a simultaneous M0/M2.
5.19.5.6
Scenario 5
Trigger if following event A, event C precedes event B. i.e... the expected execution flow is A->B->C.
SCR2=0110
SCR1=0011
M1
State1
M0
State2
Final State
M2
Figure 73. Scenario 5
Scenario 5 is possible with the S12SDBGV1 SCR encoding.
5.19.5.7
Scenario 6
Trigger if event A occurs twice in succession before any of 2 other events (BC) occur. This scenario is not possible using the
S12SDBGV1 SCR encoding. S12SDBGV2 includes additions shown in red. The change in SCR1 encoding also has the
advantage that a State1->State3 transition using M0 is now possible. This is advantageous because range and data bus
comparisons use channel 0 only.
SCR3=1010
SCR1=1001
State1
M0
State3
M0
Final State
M12
Figure 74. Scenario 6
5.19.5.8
Scenario 7
Trigger when a series of 3 events are executed out of order. Specifying the event order as M1, M2, M0 to run in loops
(120120120). Any deviation from that order should trigger. This scenario is not possible using the S12SDBGV1 SCR encoding,
because OR possibilities are very limited in the channel encoding. By adding OR forks as shown in red, this scenario is possible.
M01
SCR2=1100
SCR1=1101
State1
M1
State2
SCR3=1101
M2
State3
M12
Final State
M0
M02
Figure 75. Scenario 7
MM912_637, Rev. 3.0
Freescale Semiconductor
269
MCU - Debug Module (S12SDBG)
On simultaneous matches the lowest channel number has priority, so with this configuration the forking from State1 has the
peculiar effect that a simultaneous match0/match1 transitions to Final state, but a simultaneous match2/match1transitions to
state2.
5.19.5.9
Scenario 8
Trigger when a routine/event at M2 follows either M1 or M0.
SCR2=0101
SCR1=0111
M01
State1
M2
State2
Final State
Figure 76. Scenario 8a
Trigger when an event M2 is followed by either an event M0 or event M1
SCR2=0111
SCR1=0010
M2
State1
State2
M01
Final State
Figure 77. Scenario 8b
Scenario 8a and 8b are possible with the S12SDBGV1 and S12SDBGV2 SCR encoding.
5.19.5.10 Scenario 9
Trigger when a routine/event at A (M2) does not follow either B or C (M1 or M0) before they are executed again. This cannot be
realized with the S12SDBGV1 SCR encoding, due to OR limitations. By changing the SCR2 encoding as shown in red this
scenario becomes possible.
SCR2=1111
SCR1=0111
State1
M01
State2
M01
Final State
M2
Figure 78. Scenario 9
5.19.5.11 Scenario 10
Trigger if an event M0 occurs following up to two successive M2 events, without the resetting event M1. As shown, up to 2
consecutive M2 events are allowed, whereby a reset to State1 is possible, after either one or two M2 events. If an event M0 occurs
following the second M2, before M1 resets to State1, a trigger is generated. Configuring CompA and CompC the same, it is
possible to generate a breakpoint on the third consecutive occurrence of event M0 without a reset on M1.
MM912_637, Rev. 3.0
Freescale Semiconductor
270
M1
SCR1=0010
State1
M2
SCR2=0100
SCR3=0010
M2
State2
M0
State3
Final State
M1
Figure 79. Scenario 10a
M0
SCR2=0011
SCR1=0010
State1
M2
State2
SCR3=0000
M1
State3
Final State
M0
Figure 80. Scenario 10b
Scenario 10b shows the case that after M2, an M1 must occur before M0. Starting from a particular point in code, event M2 must
always be followed by M1 before M0. If after any M2 event, M0 occurs before M1, then a trigger is generated.
MM912_637, Rev. 3.0
Freescale Semiconductor
271
MCU - Security (S12XS9SECV2)
5.20
MCU - Security (S12XS9SECV2)
MCU
5.20.1
ANALOG
Introduction
This specification describes the function of the security mechanism in the S12I chip family (9SEC).
NOTE
No security feature is absolutely secure. However, Freescale’s strategy is to make reading
or copying the FLASH and/or EEPROM difficult for unauthorized users.
5.20.1.1
Features
The user must be reminded that part of the security must lie with the application code. An extreme example would be application
code that dumps the contents of the internal memory. This would defeat the purpose of security. At the same time, the user may
also wish to put a backdoor in the application program. An example of this is the user downloads a security key through the SCI,
which allows access to a programming routine that updates parameters stored in another section of the Flash memory.
The security features of the S12I chip family (in secure mode) are:
•
Protect the content of non-volatile memories (Flash, EEPROM)
•
Execution of NVM commands is restricted
•
Disable access to internal memory via background debug module (BDM)
5.20.1.2
Modes of Operation
Table 388 gives an overview over availability of security relevant features in unsecure and secure modes.
Table 388. Feature Availability in Unsecure and Secure Modes on S12XS
Unsecure Mode
NS
SS
NX
ES
Secure Mode
EX
ST
NS
SS
4
Flash Array Access


4
EEPROM Array Access
4
4
4
4
NVM Commands
(254)
4
(254)
(254)
BDM
4
4
—
(255)
DBG Module Trace
4
4
—
—
NX
ES
EX
ST
Notes
254.Restricted NVM command set only. Refer to the NVM wrapper block guides for detailed information.
255.BDM hardware commands restricted to peripheral registers only.
5.20.1.3
Securing the Microcontroller
Once the user has programmed the Flash and EEPROM, the chip can be secured by programming the security bits located in
the options/security byte in the Flash memory array. These non-volatile bits will keep the device secured through reset and
power-down.
The options/security byte is located at address 0xFF0F (= global address 0x7F_FF0F) in the Flash memory array. This byte can
be erased and programmed like any other Flash location. Two bits of this byte are used for security (SEC[1:0]). On devices which
have a memory page window, the Flash options/security byte is also available at address 0xBF0F by selecting page 0x3F with
the PPAGE register. The contents of this byte are copied into the Flash security register (FSEC) during a reset sequence.
Table 389. Flash Options/Security Byte
0xFF0F
7
6
5
4
3
2
1
0
KEYEN1
KEYEN0
NV5
NV4
NV3
NV2
SEC1
SEC0
MM912_637, Rev. 3.0
Freescale Semiconductor
272
The meaning of the bits KEYEN[1:0] is shown in Table 390. Refer to Section 5.20.1.5.1, “Unsecuring the MCU Using the
Backdoor Key Access" for more information.
Table 390. Backdoor Key Access Enable Bits
KEYEN[1:0]
Backdoor Key
Access Enabled
00
0 (disabled)
01
0 (disabled)
10
1 (enabled)
11
0 (disabled)
The meaning of the security bits SEC[1:0] is shown in Table 391. For security reasons, the state of device security is controlled
by two bits. To put the device in unsecured mode, these bits must be programmed to SEC[1:0] = ‘10’. All other combinations put
the device in a secured mode. The recommended value to put the device in secured state is the inverse of the unsecured state,
i.e. SEC[1:0] = ‘01’.
Table 391. Security Bits
SEC[1:0]
Security State
00
1 (secured)
01
1 (secured)
10
0 (unsecured)
11
1 (secured)
NOTE
Refer to the Flash block guide for actual security configuration (in section “Flash Module
Security”).
5.20.1.4
Operation of the Secured Microcontroller
By securing the device, unauthorized access to the EEPROM and Flash memory contents can be prevented. However, it must
be understood that the security of the EEPROM and Flash memory contents also depends on the design of the application
program. For example, if the application has the capability of downloading code through a serial port and then executing that
code (e.g. an application containing bootloader code), then this capability could potentially be used to read the EEPROM and
Flash memory contents, even when the microcontroller is in the secure state. In this example, the security of the application could
be enhanced by requiring a challenge/response authentication before any code can be downloaded.
Secured operation has the following effects on the microcontroller:
5.20.1.4.1
•
•
•
Background debug module (BDM) operation is completely disabled.
Execution of Flash and EEPROM commands is restricted. Refer to the NVM block guide for details.
Tracing code execution using the DBG module is disabled.
5.20.1.4.2
•
•
•
•
Normal Single Chip Mode (NS)
Special Single Chip Mode (SS)
BDM firmware commands are disabled.
BDM hardware commands are restricted to the register space.
Execution of Flash and EEPROM commands is restricted. Refer to the NVM block guide for details.
Tracing code execution using the DBG module is disabled.
Special single chip mode means BDM is active after reset. The availability of BDM firmware commands depends on the security
state of the device. The BDM secure firmware first performs a blank check of both the Flash memory and the EEPROM. If the
blank check succeeds, security will be temporarily turned off and the state of the security bits in the appropriate Flash memory
location can be changed. If the blank check fails, security will remain active, only the BDM hardware commands will be enabled,
MM912_637, Rev. 3.0
Freescale Semiconductor
273
and the accessible memory space is restricted to the peripheral register area. This will allow the BDM to be used to erase the
EEPROM and Flash memory without giving access to their contents. After erasing both Flash memory and EEPROM, another
reset into special single chip mode will cause the blank check to succeed and the options/security byte can be programmed to
“unsecured” state via BDM.
While the BDM is executing the blank check, the BDM interface is completely blocked, which means that all BDM commands are
temporarily blocked.
5.20.1.5
Unsecuring the Microcontroller
Unsecuring the microcontroller can be done by three different methods:
1. Backdoor key access
2. Reprogramming the security bits
3. Complete memory erase (special modes)
5.20.1.5.1
Unsecuring the MCU Using the Backdoor Key Access
In Normal modes (single chip and expanded), security can be temporarily disabled using the backdoor key access method. This
method requires that:
•
The backdoor key at 0xFF00–0xFF07 (= global addresses 0x7F_FF00–0x7F_FF07) has been programmed to a valid
value.
•
The KEYEN[1:0] bits within the Flash options/security byte select ‘enabled’.
•
In single chip mode, the application program programmed into the microcontroller must be designed to have the
capability to write to the backdoor key locations.
The backdoor key values themselves would not normally be stored within the application data, which means the application
program would have to be designed to receive the backdoor key values from an external source (e.g. through a serial port).
The backdoor key access method allows debugging of a secured microcontroller without having to erase the Flash. This is
particularly useful for failure analysis.
NOTE
No word of the backdoor key is allowed to have the value 0x0000 or 0xFFFF.
5.20.1.6
Reprogramming the Security Bits
In normal single chip mode (NS), security can also be disabled by erasing and reprogramming the security bits within Flash
options/security byte to the unsecured value. Because the erase operation will erase the entire sector from 0xFE00–0xFFFF
(0x7F_FE00–0x7F_FFFF), the backdoor key and the interrupt vectors will also be erased; this method is not recommended for
normal single chip mode. The application software can only erase and program the Flash options/security byte if the Flash sector
containing the Flash options/security byte is not protected (see Flash protection). Flash protection is a useful means of preventing
this method. The microcontroller will enter the unsecured state after the next reset following the programming of the security bits
to the unsecured value.
This method requires that:
•
The application software previously programmed into the microcontroller has been designed to have the capability to
erase and program the Flash options/security byte, or security is first disabled using the backdoor key method, allowing
BDM to be used to issue commands to erase and program the Flash options/security byte.
•
The Flash sector containing the Flash options/security byte is not protected.
5.20.1.7
Complete Memory Erase (Special Modes)
The microcontroller can be unsecured in special modes by erasing the entire EEPROM and Flash memory contents.
When a secure microcontroller is reset into special single chip mode (SS), the BDM firmware verifies whether the EEPROM and
Flash memory are erased. If any EEPROM or Flash memory address is not erased, only BDM hardware commands are enabled.
BDM hardware commands can then be used to write to the EEPROM and Flash registers to mass erase the EEPROM and all
Flash memory blocks.
MM912_637, Rev. 3.0
Freescale Semiconductor
274
When next resetting into special single chip mode, the BDM firmware will again verify whether all EEPROM and Flash memory
are erased. This being the case, it will enable all BDM commands, allowing the Flash options/security byte to be programmed to
the unsecured value. The security bits SEC[1:0] in the Flash security register will indicate the unsecure state following the next
reset.
MM912_637, Rev. 3.0
Freescale Semiconductor
275
Background Debug Module (S12SBDMV1)
5.21
Background Debug Module (S12SBDMV1)
MCU
5.21.1
ANALOG
Introduction
This section describes the functionality of the background debug module (BDM) sub-block of the HCS12S core platform.
The background debug module (BDM) sub-block is a single-wire, background debug system, implemented in on-chip hardware
for minimal CPU intervention. All interfacing with the BDM is done via the BKGD pin.
The BDM has enhanced capability for maintaining synchronization between the target and host while allowing more flexibility in
clock rates. This includes a sync signal to determine the communication rate and a handshake signal to indicate when an
operation is complete. The system is backwards compatible to the BDM of the S12 family with the following exceptions:
•
TAGGO command not supported by S12SBDM
•
External instruction tagging feature is part of the DBG module
•
S12SBDM register map and register content modified
•
Family ID readable from BDM ROM at global address 0x3_FF0F in active BDM
(value for devices with HCS12S core is 0xC2)
•
Clock switch removed from BDM (CLKSW bit removed from BDMSTS register)
5.21.1.1
Features
The BDM includes these distinctive features:
•
Single-wire communication with host development system
•
Enhanced capability for allowing more flexibility in clock rates
•
SYNC command to determine communication rate
•
GO_UNTIL(262) command
•
Hardware handshake protocol to increase the performance of the serial communication
•
Active out of reset in special single chip mode
•
Nine hardware commands using free cycles, if available, for minimal CPU intervention
•
Hardware commands not requiring active BDM
•
14 firmware commands execute from the standard BDM firmware lookup table
•
Software control of BDM operation during Wait mode
•
When secured, hardware commands are allowed to access the register space in special single chip mode, if the Flash
erase tests fail
•
Family ID readable from BDM ROM at global address 0x3_FF0F in active BDM
(value for devices with HCS12S core is 0xC2)
•
BDM hardware commands are operational until system Stop mode is entered
5.21.1.2
Modes of Operation
BDM is available in all operating modes, but must be enabled before firmware commands are executed. Some systems may have
a control bit that allows suspending the function during background debug mode.
5.21.1.2.1
Regular Run Modes
All of these operations refer to the part in run mode and not being secured. The BDM does not provide controls to conserve power
during run mode.
•
Normal modes - General operation of the BDM is available and operates the same in all normal modes
•
Special single chip mode - In special single chip mode, background operation is enabled and active out of reset. This
allows programming a system with blank memory
5.21.1.2.2
Secure Mode Operation
If the device is in secure mode, the operation of the BDM is reduced to a small subset of its regular run mode operation. Secure
operation prevents access to Flash other than allowing erasure. For more information, see Section 5.21.4.1, “Security".
MM912_637, Rev. 3.0
Freescale Semiconductor
276
Background Debug Module (S12SBDMV1)
5.21.1.2.3
Low-power Modes
The BDM can be used until Stop mode is entered. When CPU is in Wait mode, all BDM firmware commands as well as the
hardware BACKGROUND command cannot be used and are ignored. In this case, the CPU can not enter BDM active mode,
and only hardware read and write commands are available. Also, the CPU can not enter a Low Power mode (stop or wait) during
BDM active mode.
In Stop mode, the BDM clocks are stopped. When BDM clocks are disabled and Stop mode is exited, the BDM clocks will restart
and BDM will have a soft reset (clearing the instruction register, any command in progress and disable the ACK function). The
BDM is now ready to receive a new command.
5.21.1.3
Block Diagram
A block diagram of the BDM is shown in Figure 81.
Host
System
Serial
Interface
BKGD
Data
16-Bit Shift Register
Control
Register Block
Address
TRACE
BDMACT
Instruction Code
and
Execution
Bus Interface
and
Control Logic
Data
Control
Clocks
ENBDM
SDV
Standard BDM Firmware
LOOKUP TABLE
UNSEC
Secured BDM Firmware
LOOKUP TABLE
BDMSTS
Register
Figure 81. BDM Block Diagram
5.21.2
External Signal Description
A single-wire interface pin called the background debug interface (BKGD) pin is used to communicate with the BDM system.
During reset, this pin is a mode select input which selects between normal and special modes of operation. After reset, this pin
becomes the dedicated serial interface pin for the background debug mode. The communication rate of this pin is based on the
settings for the VCO clock (CPMUSYNR). The BDM clock frequency is always VCO clock frequency divided by 8. After reset,
the BDM clock is based on the reset values of the CPMUSYNR register (4.0 MHz). When modifying the VCO clock, make sure
that the communication rate is adapted accordingly, and a communication timeout (BDM soft reset) has occurred.
MM912_637, Rev. 3.0
Freescale Semiconductor
277
Background Debug Module (S12SBDMV1)
5.21.3
5.21.3.1
Memory Map and Register Definition
Module Memory Map
Table 392 shows the BDM memory map when BDM is active.
Table 392. BDM Memory Map
5.21.3.2
Global Address
Module
Size
(Bytes)
0x3_FF00–0x3_FF0B
BDM registers
12
0x3_FF0C–0x3_FF0E
BDM firmware ROM
3
0x3_FF0F
Family ID (part of BDM firmware ROM)
1
0x3_FF10–0x3_FFFF
BDM firmware ROM
240
Register Descriptions
A summary of the registers associated with the BDM is shown in Table 393. Registers are accessed by host-driven
communications to the BDM hardware using READ_BD and WRITE_BD commands.
Table 393. BDM Register Summary
Global
Address
Register
Name
0x3_FF00
Reserved
0x3_FF01
BDMSTS
0x3_FF02
Reserved
0x3_FF03
Reserved
0x3_FF04
Reserved
0x3_FF05
Reserved
0x3_FF06
BDMCCR
0x3_FF07
Reserved
0x3_FF08
BDMPPR
R
Reserved
0x3_FF0A
Reserved
6
5
4
3
2
1
Bit 0
X
X
X
X
X
X
0
0
BDMACT
0
SDV
TRACE
0
UNSEC
0
Z
Z
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
CCR7
CCR6
CCR5
CCR4
CCR3
CCR2
CCR1
CCR0
0
0
0
0
0
0
0
0
0
0
0
BPP3
BPP2
BPP1
BPP0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
R
W
R
ENBDM
W
R
W
R
W
R
W
R
W
R
W
R
W
0x3_FF09
Bit 7
R
BPAE
W
R
W
X
= Unimplemented, Reserved
Z
= Implemented (do not alter)
= Indeterminate
0
= Always read zero
MM912_637, Rev. 3.0
Freescale Semiconductor
278
Background Debug Module (S12SBDMV1)
Table 393. BDM Register Summary (continued)
Global
Address
Register
Name
0x3_FF0B
Reserved
Bit 7
6
5
4
3
2
1
Bit 0
0
0
0
0
0
0
0
0
R
W
X
5.21.3.2.1
= Unimplemented, Reserved
Z
= Implemented (do not alter)
= Indeterminate
0
= Always read zero
BDM Status Register (BDMSTS)
Table 394. BDM Status Register (BDMSTS)
Register Global Address
0x3_FF01
R
7
ENBDM
W
6
5
4
3
2
1
0
BDMACT
0
SDV
TRACE
0
UNSEC
0
Reset
Special Single-Chip Mode
0(256)
1
0
0
0
0
0(257)
0
All Other Modes
0
0
0
0
0
0
0
0
= Unimplemented, Reserved
0
Z
= Implemented (do not alter)
= Always read zero
Notes
256.ENBDM is read as a 1 by a debugging environment in special single chip mode, when the device is either secured or not secured, but fully
erased (Flash). This is because the ENBDM bit is set by the standard BDM firmware before a BDM command can be fully transmitted
and executed.
257.UNSEC is read as a 1 by a debugging environment in special single chip mode when the device is secured and fully erased, else it is 0
and can only be read if not secure (see also bit description).
Read: All modes through BDM operation when not secured
Write: All modes through BDM operation when not secured, but subject to the following:
— ENBDM should only be set via a BDM hardware command if the BDM firmware commands are needed. (This does
not apply in special single chip mode)
— BDMACT can only be set by BDM hardware upon entry into BDM. It can only be cleared by the standard BDM
firmware lookup table upon exit from BDM active mode
— All other bits, while writable via BDM hardware or standard BDM firmware write commands, should only be altered
by the BDM hardware or the standard firmware lookup table, as part of BDM command execution
Table 395. BDMSTS Field Descriptions
Field
7
ENBDM
6
BDMACT
Description
Enable BDM — This bit controls whether the BDM is enabled or disabled. When enabled, BDM can be made active to allow
firmware commands to be executed. When disabled, BDM cannot be made active but BDM hardware commands are still
allowed.
0 BDM disabled
1 BDM enabled
Note: ENBDM is set out of reset in special single chip mode. In special single chip mode with the device secured, this bit will
not be set until after the Flash erase verify tests are complete.
BDM Active Status — This bit becomes set upon entering BDM. The standard BDM firmware lookup table is then enabled
and put into the memory map. BDMACT is cleared by a carefully timed store instruction in the standard BDM firmware, as part
of the exit sequence to return to user code and remove the BDM memory from the map.
0 BDM not active
1 BDM active
MM912_637, Rev. 3.0
Freescale Semiconductor
279
Background Debug Module (S12SBDMV1)
Table 395. BDMSTS Field Descriptions (continued)
Field
Description
Shift Data Valid — This bit is set and cleared by the BDM hardware. It is set after data has been transmitted as part of a BDM
firmware or hardware read command, or after data has been received as part of a BDM firmware or hardware write command.
It is cleared when the next BDM command has been received or BDM is exited. SDV is used by the standard BDM firmware
to control program flow execution.
0 Data phase of command not complete
1 Data phase of command is complete
4
SDV
TRACE1 BDM Firmware Command is Being Executed — This bit gets set when a BDM TRACE1 firmware command is
first recognized. It will stay set until BDM firmware is exited by one of the following BDM commands: GO or GO_UNTIL(262).
0 TRACE1 command is not being executed
1 TRACE1 command is being executed
3
TRACE
Unsecure — If the device is secured this bit is only writable in special single chip mode from the BDM secure firmware. It is
in a zero state as secure mode is entered so that the secure BDM firmware lookup table is enabled and put into the memory
map, overlapping the standard BDM firmware lookup table.
The secure BDM firmware lookup table verifies that the on-chip Flash is erased. This being the case, the UNSEC bit is set and
the BDM program jumps to the start of the standard BDM firmware lookup table, and the secure BDM firmware lookup table
is turned off. If the erase test fails, the UNSEC bit will not be asserted.
0 System is in a secured mode.
1 System is in a unsecured mode.
Note: When UNSEC is set, security is off and the user can change the state of the secure bits in the on-chip Flash EEPROM.
Note that if the user does not change the state of the bits to “unsecured” mode, the system will be secured again when
it is next taken out of reset. After reset, this bit has no meaning or effect when the security byte in the Flash EEPROM
is configured for unsecure mode.
1
UNSEC
Table 396. BDM CCR Holding Register (BDMCCR)
Register Global Address
0x3_FF06
7
6
5
4
3
2
1
0
CCR7
CCR6
CCR5
CCR4
CCR3
CCR2
CCR1
CCR0
Special Single-Chip Mode
1
1
0
1
1
0
0
0
All Other Modes
0
0
0
0
0
0
0
0
R
W
Reset
Read: All modes through BDM operation when not secured
Write: All modes through BDM operation when not secured
NOTE
When BDM is made active, the CPU stores the content of its CCR register in the BDMCCR
register. However, out of special single-chip reset, the BDMCCR is set to 0xD8 and not 0xD0
which is the reset value of the CCR register in this CPU mode. Out of reset in all other modes
the BDMCCR register is read zero.
When entering background debug mode, the BDM CCR holding register is used to save the condition code register of the user’s
program. It is also used for temporary storage in the standard BDM firmware mode. The BDM CCR holding register can be written
to modify the CCR value.
MM912_637, Rev. 3.0
Freescale Semiconductor
280
Background Debug Module (S12SBDMV1)
5.21.3.2.2
BDM Program Page Index Register (BDMPPR)
Table 397. BDM Program Page Register (BDMPPR)
Register Global
Address 0x3_FF08
R
W
7
BPAE
Reset
0
6
5
4
0
0
0
0
0
0
3
2
1
0
BPP3
BPP2
BPP1
BPP0
0
0
0
0
= Unimplemented, Reserved
Read: All modes through BDM operation when not secured
Write: All modes through BDM operation when not secured
Table 398. BDMPPR Field Descriptions
Field
7
BPAE
3–0
BPP[3:0]
5.21.3.3
Description
BDM Program Page Access Enable Bit — BPAE enables program page access for BDM hardware and firmware read/write
instructions The BDM hardware commands used to access the BDM registers (READ_BD and WRITE_BD) can not be used
for global accesses even if the BGAE bit is set.
0 BDM Program Paging disabled
1 BDM Program Paging enabled
BDM Program Page Index Bits 3–0 — These bits define the selected program page. For more detailed information regarding
the program page window scheme, refer to the S12S_MMC Block Guide.
Family ID Assignment
The family ID is an 8-bit value located in the BDM ROM in active BDM (at global address: 0x3_FF0F). The read-only value is a
unique family ID which is 0xC2 for devices with an HCS12S core.
5.21.4
Functional Description
The BDM receives and executes commands from a host via a single wire serial interface. There are two types of BDM commands:
hardware and firmware commands.
Hardware commands are used to read and write target system memory locations and to enter active background debug mode.
See Section 5.21.4.3, “BDM Hardware Commands". Target system memory includes all memory that is accessible by the CPU.
Firmware commands are used to read and write CPU resources and to exit from active background debug mode. See
Section 5.21.4.4, “Standard BDM Firmware Commands". The CPU resources referred to are the accumulator (D), X index
register (X), Y index register (Y), stack pointer (SP), and program counter (PC).
Hardware commands can be executed at any time and in any mode, excluding a few exceptions as highlighted (see
Section 5.21.4.3, “BDM Hardware Commands") and in secure mode (see Section 5.21.4.1, “Security"). BDM firmware
commands can only be executed when the system is not secure and is in active background debug mode (BDM).
5.21.4.1
Security
If the user resets into special single chip mode with the system secured, a secured mode BDM firmware lookup table is brought
into the map overlapping a portion of the standard BDM firmware lookup table. The secure BDM firmware verifies that the on-chip
Flash EEPROM is erased. This being the case, the UNSEC and ENBDM bits will get set. The BDM program jumps to the start
of the standard BDM firmware, the secured mode BDM firmware is turned off, and all BDM commands are allowed. If the Flash
does not verify as erased, the BDM firmware sets the ENBDM bit, without asserting UNSEC, and the firmware enters a loop. This
causes the BDM hardware commands to become enabled, but does not enable the firmware commands. This allows the BDM
hardware to be used to erase the Flash.
MM912_637, Rev. 3.0
Freescale Semiconductor
281
Background Debug Module (S12SBDMV1)
BDM operation is not possible in any other mode than special single chip mode when the device is secured. The device can only
be unsecured via the BDM serial interface in special single chip mode. For more information regarding security, see the
S12S_9SEC Block Guide.
5.21.4.2
Enabling and Activating BDM
The system must be in active BDM to execute standard BDM firmware commands. BDM can be activated only after being
enabled. BDM is enabled by setting the ENBDM bit in the BDM status (BDMSTS) register. The ENBDM bit is set by writing to the
BDM status (BDMSTS) register, via the single-wire interface, using a hardware command such as WRITE_BD_BYTE.
After being enabled, BDM is activated by one of the following (258):
•
Hardware BACKGROUND command
•
CPU BGND instruction
•
Breakpoint force or tag mechanism(259)
Notes
258.BDM is enabled and active immediately out of special single-chip reset.
259.This method is provided by the S12S_DBG module.
When BDM is activated, the CPU finishes executing the current instruction and then begins executing the firmware in the
standard BDM firmware lookup table. When BDM is activated by a breakpoint, the type of breakpoint used determines if BDM
becomes active before or after execution of the next instruction.
NOTE
If an attempt is made to activate BDM before being enabled, the CPU resumes normal
instruction execution after a brief delay. If BDM is not enabled, any hardware
BACKGROUND commands issued are ignored by the BDM and the CPU is not delayed.
In active BDM, the BDM registers and standard BDM firmware lookup table are mapped to addresses 0x3_FF00 to 0x3_FFFF.
BDM registers are mapped to addresses 0x3_FF00 to 0x3_FF0B. The BDM uses these registers which are readable anytime by
the BDM. However, these registers are not readable by user programs.
When BDM is activated, while CPU executes code overlapping with the BDM firmware space, the saved program counter (PC)
will be auto incremented by one from the BDM firmware, regardless of what caused the entry into BDM active mode (BGND
instruction, BACKGROUND command or breakpoints). In such cases, the PC must be set to the next valid address via a
WRITE_PC command, before executing the GO command.
5.21.4.3
BDM Hardware Commands
Hardware commands are used to read and write target system memory locations and to enter active background debug mode.
Target system memory includes all memory that is accessible by the CPU such as on-chip RAM, Flash, I/O and control registers.
Hardware commands are executed with minimal or no CPU intervention, and do not require the system to be in active BDM for
execution, although, they can still be executed in this mode. When executing a hardware command, the BDM sub-block waits for
a free bus cycle, so the background access does not disturb the running application program. If a free cycle is not found within
128 clock cycles, the CPU is momentarily frozen so the BDM can steal a cycle. When the BDM finds a free cycle, the operation
does not intrude on normal CPU operation, provided it can be completed in a single cycle. However, if an operation requires
multiple cycles, the CPU is frozen until the operation is complete, even though the BDM found a free cycle.
The BDM hardware commands are listed in Table 399.
The READ_BD and WRITE_BD commands allow access to the BDM register locations. These locations are not normally in the
system memory map, but share addresses with the application in memory. To distinguish between physical memory locations
that share the same address, BDM memory resources are enabled just for the READ_BD and WRITE_BD access cycle. This
allows the BDM to access BDM locations unobtrusively, even if the addresses conflict with the application memory map.
MM912_637, Rev. 3.0
Freescale Semiconductor
282
Background Debug Module (S12SBDMV1)
Table 399. Hardware Commands
Opcode
(hex)
Data
Description
90
None
Enter background mode if BDM is enabled. If enabled, an ACK will be issued when the
part enters active background mode.
ACK_ENABLE
D5
None
Enable Handshake. Issues an ACK pulse after the command is executed.
ACK_DISABLE
D6
None
Disable Handshake. This command does not issue an ACK pulse.
Command
BACKGROUND
READ_BD_BYTE
E4
READ_BD_WORD
EC
READ_BYTE
E0
READ_WORD
E8
WRITE_BD_BYTE
C4
WRITE_BD_WORD
CC
WRITE_BYTE
C0
WRITE_WORD
C8
16-bit address
16-bit data out
16-bit address
16-bit data out
16-bit address
16-bit data out
16-bit address
16-bit data out
16-bit address
16-bit data in
16-bit address
16-bit data in
16-bit address
16-bit data in
16-bit address
16-bit data in
Read from memory with standard BDM firmware lookup table in map. 
Odd address data on low byte; even address data on high byte.
Read from memory with standard BDM firmware lookup table in map.
Must be aligned access.

Read from memory with standard BDM firmware lookup table out of map. 
Odd address data on low byte; even address data on high byte.
Read from memory with standard BDM firmware lookup table out of map. Must be
aligned access.
Write to memory with standard BDM firmware lookup table in map. 
Odd address data on low byte; even address data on high byte.
Write to memory with standard BDM firmware lookup table in map.
Must be aligned access.

Write to memory with standard BDM firmware lookup table out of map. 
Odd address data on low byte; even address data on high byte.
Write to memory with standard BDM firmware lookup table out of map. 
Must be aligned access.
If enabled, ACK will occur when data is ready for transmission for all BDM READ commands, and will occur after the write is
complete for all BDM WRITE commands.
5.21.4.4
Standard BDM Firmware Commands
BDM firmware commands are used to access and manipulate CPU resources. The system must be in active BDM to execute
standard BDM firmware commands. See Section 5.21.4.2, “Enabling and Activating BDM". Normal instruction execution is
suspended while the CPU executes the firmware located in the standard BDM firmware lookup table. The hardware command
BACKGROUND is the usual way to activate BDM.
As the system enters active BDM, the standard BDM firmware lookup table, BDM registers become visible in the on-chip memory
map at 0x3_FF00–0x3_FFFF, and the CPU begins executing the standard BDM firmware. The standard BDM firmware watches
for serial commands and executes them as they are received.
The firmware commands are shown in Table 400.
Table 400. Firmware Commands
Command(260)
Opcode
(hex)
Data
READ_NEXT(261)
62
16-bit data out
Increment X index register by 2 (X = X + 2), then read word X points to.
READ_PC
63
16-bit data out
Read program counter.
READ_D
64
16-bit data out
Read D accumulator.
READ_X
65
16-bit data out
Read X index register.
Description
READ_Y
66
16-bit data out
Read Y index register.
READ_SP
67
16-bit data out
Read stack pointer.
WRITE_NEXT
42
16-bit data in
Increment X index register by 2 (X = X + 2), then write word to location pointed to by X.
MM912_637, Rev. 3.0
Freescale Semiconductor
283
Background Debug Module (S12SBDMV1)
Table 400. Firmware Commands
Command(260)
Opcode
(hex)
Data
WRITE_PC
43
16-bit data in
Write program counter.
WRITE_D
44
16-bit data in
Write D accumulator.
WRITE_X
45
16-bit data in
Write X index register.
WRITE_Y
46
16-bit data in
Write Y index register.
WRITE_SP
47
16-bit data in
Write stack pointer.
GO
08
none
Go to user program. If enabled, ACK will occur when leaving active background mode.
GO_UNTIL(262)
0C
none
Go to user program. If enabled, ACK will occur upon returning to active background
mode.
TRACE1
10
none
Execute one user instruction then return to active BDM. If enabled, ACK will occur upon
returning to active background mode.
TAGGO -> GO
18
none
(Previous enable tagging and go to user program.) This command will be deprecated
and should not be used anymore. Opcode will be executed as a GO command.
Description
Notes
260.If enabled, ACK will occur when data is ready for transmission for all BDM READ commands, and will occur after the write is complete for
all BDM WRITE commands.
261.When the firmware command READ_NEXT or WRITE_NEXT is used to access the BDM address space, the BDM resources are
accessed, rather than user code. Writing BDM firmware is not possible.
262.System stop disables the ACK function and ignored commands will have no ACK-pulse (e.g., CPU in stop or wait mode). The GO_UNTIL
command will not get an Acknowledge, if the CPU executes the wait or stop instruction before the “UNTIL” condition (BDM active again)
is reached (see Section 5.21.4.7, “Serial Interface Hardware Handshake Protocol" last note).
5.21.4.5
BDM Command Structure
Hardware and firmware BDM commands start with an 8-bit opcode followed by a 16-bit address and/or a 16-bit data word,
depending on the command. All the read commands return 16 bits of data despite the byte or word implication in the command
name.
8-bit reads return 16-bits of data, only one byte of which contains valid data. If reading an
even address, the valid data will appear in the MSB. If reading an odd address, the valid data
will appear in the LSB.
16-bit misaligned reads and writes are generally not allowed. If attempted by BDM hardware
command, the BDM ignores the least significant bit of the address and assumes an even
address from the remaining bits.
For hardware data read commands, the external host must wait at least 150 bus clock cycles after sending the address before
attempting to obtain the read data. This is to be certain that valid data is available in the BDM shift register, ready to be shifted
out. For hardware write commands, the external host must wait 150 bus clock cycles after sending the data to be written, before
attempting to send a new command. This is to avoid disturbing the BDM shift register before the write has been completed. The
150 bus clock cycle delay, in both cases, includes the maximum 128 cycle delay that can be incurred, as the BDM waits for a
free cycle before stealing a cycle.
The external host should wait at least 48 bus clock cycles after sending the command opcode and before attempting to obtain
the read data for BDM firmware read commands. The 48 cycle wait allows enough time for the requested data to be made
available in the BDM shift register, ready to be shifted out.
The external host must wait 36 bus clock cycles after sending the data to be written, before attempting to send a new command
for BDM firmware write commands. This is to avoid disturbing the BDM shift register before the write has been completed.
The external host should wait for at least for 76 bus clock cycles, after a TRACE1 or GO command and before starting any new
serial command. This is to allow the CPU to exit gracefully from the standard BDM firmware lookup table and resume execution
of the user code. Disturbing the BDM shift register prematurely may adversely affect the exit from the standard BDM firmware
lookup table.
MM912_637, Rev. 3.0
Freescale Semiconductor
284
Background Debug Module (S12SBDMV1)
NOTE
If the bus rate of the target processor is unknown or could be changing, it is recommended
that the ACK (acknowledge function) is used to indicate when an operation is complete.
When using ACK, the delay times are automated.
Figure 82 represents the BDM command structure. The command blocks illustrate a series of eight bit times, starting with a falling
edge. The bar across the top of the blocks indicates that the BKGD line idles in the high state. The time for an 8-bit command is
8  16 target clock cycles.(263)
Notes
263.Target clock cycles are cycles measured using the target MCU’s serial clock rate. See Section 5.21.4.6, “BDM Serial Interface" and
Section 5.21.3.2.1, “BDM Status Register (BDMSTS)" for information on how serial clock rate is selected.
Hardware
Read
8-Bits
AT ~16 TC/Bit
16-Bits
AT ~16 TC/Bit
Command
Address
150-BC
Delay
16 Bits
AT ~16 TC/Bit
Data
Next
Command
150-BC
Delay
Hardware
Write
Command
Address
Data
Next
Command
48-BC
DELAY
Firmware
Read
Command
Data
Next
Command
36-BC
DELAY
Firmware
Write
Command
Next
Command
Data
76-BC
Delay
GO,
TRACE
Command
Next
Command
BC = Bus Clock Cycles
TC = Target Clock Cycles
Figure 82. BDM Command Structure
5.21.4.6
BDM Serial Interface
The BDM communicates with external devices serially via the BKGD pin. During reset, this pin is a mode select input which
selects between normal and special modes of operation. After reset, this pin becomes the dedicated serial interface pin for the
BDM.
The BDM serial interface is timed, based on the VCO clock (refer to the CPMU Block Guide for more details), which gets divided
by 8. This clock will be referred to as the target clock in the following explanation.
The BDM serial interface uses a clocking scheme in which the external host generates a falling edge on the BKGD pin to indicate
the start of each bit time. This falling edge is sent for every bit whether data is transmitted or received. Data is transferred, most
significant bit (MSB) first, at 16 target clock cycles per bit. The interface times out if 512 clock cycles occur between falling edges
from the host.
The BKGD pin is a pseudo open-drain pin and has an weak on-chip active pull-up that is enabled at all times. It is assumed that
there is an external pull-up and drivers connected to BKGD do not typically drive the high level. Since R-C rise time could be
unacceptably long, the target system and host provide brief driven-high (speedup) pulses to drive BKGD to a logic 1. The source
of this speedup pulse is the host for transmit cases and the target for receive cases.
The timing for host-to-target is shown in Figure 83, and that of target-to-host in Figure 84 and Figure 85. All four cases begin
when the host drives the BKGD pin low to generate a falling edge. Since the host and target are operating from separate clocks,
it can take the target system up to one full clock cycle to recognize this edge. The target measures delays from this perceived
MM912_637, Rev. 3.0
Freescale Semiconductor
285
Background Debug Module (S12SBDMV1)
start of the bit time, while the host measures delays from the point it actually drove BKGD low to start the bit up to one target
clock cycle earlier. Synchronization between the host and target is established in this manner at the start of every bit time.
Figure 83 shows an external host transmitting a logic 1 and transmitting a logic 0 to the BKGD pin of a target system. The host
is asynchronous to the target, so there is up to a one clock-cycle delay from the host-generated falling edge to where the target
recognizes this edge as the beginning of the bit time. Ten target clock cycles later, the target senses the bit level on the BKGD
pin. Internal glitch detect logic requires the pin be driven high no later that eight target clock cycles after the falling edge for a
logic 1 transmission.
Since the host drives the high speedup pulses in these two cases, the rising edges look like digitally driven signals.
BDM Clock
(Target MCU)
Host
Transmit 1
Host
Transmit 0
Perceived
Start of Bit Time
Target Senses Bit
Earliest
Start of
Next Bit
10 Cycles
Synchronization
Uncertainty
Figure 83. BDM Host-to-Target Serial Bit Timing
The receive cases are more complicated. Figure 84 shows the host receiving a logic 1 from the target system. Since the host is
asynchronous to the target, there is up to one clock cycle delay from the host-generated falling edge on BKGD to the perceived
start of the bit time in the target. The host holds the BKGD pin low long enough for the target to recognize it (at least two target
clock cycles). The host must release the low drive before the target drives a brief high speedup pulse seven target clock cycles
after the perceived start of the bit time. The host should sample the bit level about 10 target clock cycles after it started the bit time.
BDM Clock
(Target MCU)
Host
Drive to
BKGD Pin
Target System
Speedup
Pulse
High-impedance
High-impedance
High-impedance
Perceived
Start of Bit Time
R-C Rise
BKGD Pin
10 Cycles
10 Cycles
Host Samples
BKGD Pin
Figure 84. BDM Target-to-Host Serial Bit Timing (Logic 1)
Earliest
Start of
Next Bit
MM912_637, Rev. 3.0
Freescale Semiconductor
286
Background Debug Module (S12SBDMV1)
Figure 85 shows the host receiving a logic 0 from the target. Since the host is asynchronous to the target, there is up to a one
clock cycle delay from the host-generated falling edge on BKGD to the start of the bit time as perceived by the target. The host
initiates the bit time but the target finishes it. Since the target wants the host to receive a logic 0, it drives the BKGD pin low for
13 target clock cycles then briefly drives it high to speed up the rising edge. The host samples the bit level about 10 target clock
cycles after starting the bit time.
BDM Clock
(Target MCU)
Host
Drive to
BKGD Pin
High-impedance
Speedup Pulse
Target System
Drive and
Speedup Pulse
Perceived
Start of Bit Time
BKGD Pin
10 Cycles
10 Cycles
Host Samples
BKGD Pin
Earliest
Start of
Next Bit
Figure 85. BDM Target-to-Host Serial Bit Timing (Logic 0)
5.21.4.7
Serial Interface Hardware Handshake Protocol
BDM commands that require CPU execution are ultimately treated at the MCU bus rate. Since the BDM clock source can be
modified when changing the settings for the VCO frequency (CPMUSYNR), it is very helpful to provide a handshake protocol in
which the host could determine when an issued command is executed by the CPU. The BDM clock frequency is always VCO
frequency divided by 8. The alternative is to always wait the amount of time equal to the appropriate number of cycles at the
slowest possible rate the clock could be running. This sub-section will describe the hardware handshake protocol.
The hardware handshake protocol signals to the host controller when an issued command was successfully executed by the
target. This protocol is implemented by a 16 serial clock cycle low pulse followed by a brief speedup pulse in the BKGD pin. This
pulse is generated by the target MCU when a command, issued by the host, has been successfully executed (see Figure 86).
This pulse is referred to as the ACK pulse. After the ACK pulse has finished: the host can start the bit retrieval if the last issued
command was a read command, or start a new command if the last command was a write command or a control command
(BACKGROUND, GO, GO_UNTIL(262) or TRACE1). The ACK pulse is not issued earlier than 32 serial clock cycles after the
BDM command was issued. The end of the BDM command is assumed to be the 16th tick of the last bit. This minimum delay
assures enough time for the host to perceive the ACK pulse. Note also that, there is no upper limit for the delay between the
command and the related ACK pulse, since the command execution depends upon the CPU bus, which in some cases could be
very slow due to long accesses taking place.This protocol allows a great flexibility for the POD designers, since it does not rely
on any accurate time measurement or short response time to any event in the serial communication.
MM912_637, Rev. 3.0
Freescale Semiconductor
287
Background Debug Module (S12SBDMV1)
BDM Clock
(Target MCU)
16 Cycles
Target
Transmits
ACK Pulse
High-Impedance
High-Impedance
32 Cycles
Speedup Pulse
Minimum Delay
From the BDM Command
BKGD Pin
Earliest
Start of
Next Bit
16th Tick of the
Last Command Bit
Figure 86. Target Acknowledge Pulse (ACK)
NOTE
If the ACK pulse was issued by the target, the host assumes the previous command was
executed. If the CPU enters wait or stop prior to executing a hardware command, the ACK
pulse will not be issued meaning that the BDM command was not executed. After entering
wait or stop mode, the BDM command is no longer pending.
Figure 87 shows the ACK handshake protocol in a command level timing diagram. The READ_BYTE instruction is used as an
example. First, the 8-bit instruction opcode is sent by the host, followed by the address of the memory location to be read. The
target BDM decodes the instruction. A bus cycle is grabbed (free or stolen) by the BDM and it executes the READ_BYTE
operation. Having retrieved the data, the BDM issues an ACK pulse to the host controller, indicating that the addressed byte is
ready to be retrieved. After detecting the ACK pulse, the host initiates the byte retrieval process. Note that data is sent in the form
of a word, and the host needs to determine which is the appropriate byte, based on whether the address was odd or even.
Target
BKGD Pin READ_BYTE
Host
Host
(2) Bytes are
Retrieved
Byte Address
New BDM
Command
Host
Target
Target
BDM Issues the
ACK Pulse (out of scale)
BDM Executes the
READ_BYTE Command
BDM Decodes
the Command
Figure 87. Handshake Protocol at Command Level
Differently from the normal bit transfer (where the host initiates the transmission), the serial interface ACK handshake pulse is
initiated by the target MCU by issuing a negative edge on the BKGD pin. The hardware handshake protocol in Figure 86 specifies
the timing when the BKGD pin is being driven, so the host should follow this timing constraint to avoid the risk of an electrical
conflict on the BKGD pin.
NOTE
The only place the BKGD pin can have an electrical conflict is when one side is driving low
and the other side is issuing a speedup pulse (high). Other “highs” are pulled rather than
driven. The time of the speedup pulse can become lengthy at low rates, and so the potential
conflict time becomes longer as well.
MM912_637, Rev. 3.0
Freescale Semiconductor
288
Background Debug Module (S12SBDMV1)
The ACK handshake protocol does not support nested ACK pulses. If a BDM command is not acknowledge by an ACK pulse,
the host needs to abort the pending command first in order to be able to issue a new BDM command. When the CPU enters wait
or stop while the host issues a hardware command (e.g., WRITE_BYTE), the target discards the incoming command due to the
wait or stop being detected. Therefore, the command is not acknowledged by the target, which means that the ACK pulse will
not be issued. After a certain time the host (not aware of stop or wait) should decide to abort any possible pending ACK pulse,
to be sure a new command can be issued. The protocol provides a mechanism in which a command, and its corresponding ACK,
can be aborted.
NOTE
The ACK pulse does not provide a timeout. This means for the GO_UNTIL(262) command,
it cannot be distinguished if a stop or wait has been executed (command discarded and ACK
not issued), or if the “UNTIL” condition (BDM active) is just not reached yet. Therefore,
where the ACK pulse of a command is not issued, the possible pending command should
be aborted before issuing a new command. See the handshake abort procedure described
in Section 5.21.4.8, “Hardware Handshake Abort Procedure".
5.21.4.8
Hardware Handshake Abort Procedure
The abort procedure is based on the SYNC command. To abort a command which had not issued the corresponding ACK pulse,
the host controller should generate a low pulse on the BKGD pin by driving it low for at least 128 serial clock cycles, and then
driving it high for one serial clock cycle, providing a speedup pulse. By detecting this long low pulse on the BKGD pin, the target
executes the SYNC protocol, see Section 5.21.4.9, “SYNC — Request Timed Reference Pulse", and assumes that the pending
command, and therefore the related ACK pulse, are being aborted. Therefore, after the SYNC protocol has been completed, the
host is free to issue new BDM commands. For BDM firmware READ or WRITE commands, it can not be guaranteed that the
pending command is aborted, when issuing a SYNC before the corresponding ACK pulse. There is a short latency time from the
time the READ or WRITE access begins until it is finished and the corresponding ACK pulse is issued. The latency time depends
on the firmware READ or WRITE command that is issued and on the selected bus clock rate. When the SYNC command starts
during this latency time, the READ or WRITE command will not be aborted, but the corresponding ACK pulse will be aborted. A
pending GO, TRACE1 or GO_UNTIL(262) command can not be aborted. Only the corresponding ACK pulse can be aborted by
the SYNC command.
Although it is not recommended, the host could abort a pending BDM command by issuing a low pulse on the BKGD pin, shorter
than 128 serial clock cycles, which will not be interpreted as the SYNC command. The ACK is actually aborted when a negative
edge is perceived by the target in the BKGD pin. The short abort pulse should have at least 4 clock cycles keeping the BKGD
pin low, to allow the negative edge to be detected by the target. In this case, the target will not execute the SYNC protocol, but
the pending command will be aborted along with the ACK pulse. The potential problem with this abort procedure is when there
is a conflict between the ACK pulse and the short abort pulse, where the target may not perceive the abort pulse. The worst case
is when the pending command is a read command (i.e., READ_BYTE). If the abort pulse is not perceived by the target, the host
will attempt to send a new command after the abort pulse was issued, while the target expects the host to retrieve the accessed
memory byte. In this case, host and target will run out of synchronism. However, if the command to be aborted is not a read
command, the short abort pulse could be used. After a command is aborted, the target assumes the next negative edge, after
the abort pulse, is the first bit of a new BDM command.
NOTE
The details about the short abort pulse are being provided only as a reference for the reader
to better understand the BDM internal behavior. It is not recommended that this procedure
be used in a real application.
Since the host knows the target serial clock frequency, the SYNC command (used to abort a command) does not need to consider
the lower possible target frequency. The host could issue a SYNC very close to the 128 serial clock cycles length, providing a
small overhead on the pulse length, to assure the SYNC pulse will not be misinterpreted by the target. See Section 5.21.4.9,
“SYNC — Request Timed Reference Pulse".
Figure 88 shows a SYNC command being issued after a READ_BYTE, which aborts the READ_BYTE command. Note that, after
the command is aborted, a new command could be issued by the host computer.
MM912_637, Rev. 3.0
Freescale Semiconductor
289
Background Debug Module (S12SBDMV1)
SYNC Response
From the Target
(Out of Scale)
READ_BYTE CMD is Aborted
by the SYNC Request
(Out of Scale)
BKGD Pin READ_BYTE
Host
Memory Address
READ_STATUS
Target
Host
BDM Decode
and Starts to Execute
the READ_BYTE Command
Target
New BDM Command
Host
Target
New BDM Command
Figure 88. ACK Abort Procedure at the Command Level
NOTE
Figure 88 does not represent the signals in a true timing scale
Figure 89 shows a conflict between the ACK pulse and the SYNC request pulse. This conflict could occur if a POD device is
connected to the target BKGD pin and the target is already in debug active mode. Consider that the target CPU is executing a
pending BDM command at the exact moment the POD is being connected to the BKGD pin. In this case, an ACK pulse is issued
along with the SYNC command. In this case, there is an electrical conflict between the ACK speedup pulse and the SYNC pulse.
Since this is not a probable situation, the protocol does not prevent this conflict from happening.
At Least 128 Cycles
BDM Clock
(Target MCU)
ACK Pulse
Target MCU
Drives to
BKGD Pin
High-impedance
Host and
Target Drive
to BKGD Pin
Host
Drives SYNC
To BKGD Pin
Electrical Conflict
Speedup Pulse
Host SYNC Request Pulse
BKGD Pin
16 Cycles
Figure 89. ACK Pulse and SYNC Request Conflict
NOTE
This information is being provided so that the MCU integrator will be aware that such a
conflict could occur.
The hardware handshake protocol is enabled by the ACK_ENABLE and disabled by the ACK_DISABLE BDM commands. This
provides backwards compatibility with the existing POD devices, which are not able to execute the hardware handshake protocol.
It also allows for new POD devices supporting the hardware handshake protocol, to freely communicate with the target device.
If desired, without the need for waiting for the ACK pulse.
The commands are described as follows:
•
ACK_ENABLE — enables the hardware handshake protocol. The target will issue the ACK pulse when a CPU
command is executed by the CPU. The ACK_ENABLE command itself also has the ACK pulse as a response.
•
ACK_DISABLE — disables the ACK pulse protocol The host needs to use the worst case delay time at the appropriate
places in the protocol.
MM912_637, Rev. 3.0
Freescale Semiconductor
290
Background Debug Module (S12SBDMV1)
The default state of the BDM after reset is hardware handshake protocol disabled.
All the read commands will ACK (if enabled) when the data bus cycle has completed and the data is then ready for reading out
by the BKGD serial pin. All the write commands will ACK (if enabled) after the data has been received by the BDM through the
BKGD serial pin, and when the data bus cycle is complete. See Section 5.21.4.3, “BDM Hardware Commands" and
Section 5.21.4.4, “Standard BDM Firmware Commands" for more information on the BDM commands.
The ACK_ENABLE sends an ACK pulse when the command has been completed. This feature could be used by the host to
evaluate if the target supports the hardware handshake protocol. If an ACK pulse is issued in response to this command, the host
knows that the target supports the hardware handshake protocol. If the target does not support the hardware handshake protocol
the ACK pulse is not issued. In this case, the ACK_ENABLE command is ignored by the target since it is not recognized as a
valid command.
The BACKGROUND command issues an ACK pulse when the CPU changes from normal to background mode. The ACK pulse
related to this command could be aborted using the SYNC command.
The GO command issues an ACK pulse when the CPU exits from background mode. The ACK pulse related to this command
could be aborted using the SYNC command.
The GO_UNTIL(262) command is equivalent to a GO command with exception that the ACK pulse, in this case, is issued when
the CPU enters into background mode. This command is an alternative to the GO command and should be used when the host
wants to trace if a breakpoint match occurs and causes the CPU to enter active background mode. Note that the ACK is issued
whenever the CPU enters BDM, which could be caused by a breakpoint match or by a BGND instruction being executed. The
ACK pulse related to this command could be aborted using the SYNC command.
The TRACE1 command has the related ACK pulse issued when the CPU enters background active mode after one instruction
of the application program is executed. The ACK pulse related to this command could be aborted using the SYNC command.
5.21.4.9
SYNC — Request Timed Reference Pulse
The SYNC command is unlike other BDM commands, because the host does not necessarily know the correct communication
speed to use for BDM communications until after it has analyzed the response to the SYNC command. To issue a SYNC
command, the host should perform the following steps:
1. Drive the BKGD pin low for at least 128 cycles at the lowest possible BDM serial communication frequency (The lowest
serial communication frequency is determined by the settings for the VCO clock (CPMUSYNR). The BDM clock
frequency is always VCO clock frequency divided by 8.)
2. Drive BKGD high for a brief speedup pulse to get a fast rise time (this speedup pulse is typically one cycle of the host
clock.)
3. Remove all drive to the BKGD pin so it reverts to high-impedance.
4. Listen to the BKGD pin for the sync response pulse.
Upon detecting the SYNC request from the host, the target performs the following steps:
1. Discards any incomplete command received or bit retrieved.
2. Waits for BKGD to return to a logic one.
3. Delays 16 cycles to allow the host to stop driving the high speedup pulse.
4. Drives BKGD low for 128 cycles at the current BDM serial communication frequency.
5. Drives a one-cycle high speedup pulse to force a fast rise time on BKGD.
6. Removes all drive to the BKGD pin so it reverts to high-impedance.
The host measures the low time of this 128 cycle SYNC response pulse and determines the correct speed for subsequent BDM
communications. Typically, the host can determine the correct communication speed within a few percent of the actual target
speed, and the communication protocol can easily tolerate speed errors of several percent.
As soon as the SYNC request is detected by the target, any partially received command or bit retrieved is discarded. This is
referred to as a soft-reset, equivalent to a time-out in the serial communication. After the SYNC response, the target will consider
the next negative edge (issued by the host) as the start of a new BDM command or the start of new SYNC request.
Another use of the SYNC command pulse is to abort a pending ACK pulse. The behavior is exactly the same as in a regular
SYNC command. Note that one of the possible causes for a command to not be acknowledged by the target is a host-target
synchronization problem. In this case, the command may not have been understood by the target, so an ACK response pulse
will not be issued.
MM912_637, Rev. 3.0
Freescale Semiconductor
291
Background Debug Module (S12SBDMV1)
5.21.4.10 Instruction Tracing
When a TRACE1 command is issued to the BDM in active BDM, the CPU exits the standard BDM firmware and executes a single
instruction in the user code. Once this has occurred, the CPU is forced to return to the standard BDM firmware, the BDM is active,
and ready to receive a new command. If the TRACE1 command is issued again, the next user instruction will be executed. This
facilitates stepping or tracing through the user code one instruction at a time.
If an interrupt is pending when a TRACE1 command is issued, the interrupt stacking operation occurs but no user instruction is
executed. Once back in standard BDM firmware execution, the program counter points to the first instruction in the interrupt
service routine.
Be aware when tracing through the user code that the execution of the user code is done step by step, but peripherals are free
running. Hence possible timing relations between CPU code execution and occurrence of events of other peripherals no longer
exist.
Do not trace the CPU instruction BGND used for soft breakpoints. Tracing over the BGND instruction will result in a return address
pointing to BDM firmware address space.
When tracing through user code which contains stop or wait instructions the following will happen when the stop or wait instruction
is traced:
The CPU enters stop or wait mode and the TRACE1 command can not be finished before leaving the low power mode.
This is the case because BDM active mode can not be entered after the CPU executed the stop instruction. However,
all BDM hardware commands except the BACKGROUND command are operational after tracing a stop or wait
instruction, and still being in stop or wait mode. If system stop mode is entered (all bus masters are in stop mode), no
BDM command is operational.
As soon as stop or wait mode is exited, the CPU enters BDM active mode and the saved PC value points to the entry
of the corresponding interrupt service routine.
If the handshake feature is enabled, the corresponding ACK pulse of the TRACE1 command will be discarded when
tracing a stop or wait instruction. Hence, there is no ACK pulse when BDM active mode is entered as part of the TRACE1
command, after CPU exited from stop or wait mode. All valid commands sent during CPU being in stop or wait mode or
after CPU exited from stop or wait mode will have an ACK pulse. The handshake feature becomes disabled only when
system stop mode has been reached. After a system stop mode, the handshake feature must be enabled again by
sending the ACK_ENABLE command.
5.21.4.11 Serial Communication Timeout
The host initiates a host-to-target serial transmission by generating a falling edge on the BKGD pin. If BKGD is kept low for more
than 128 target clock cycles, the target understands that a SYNC command was issued. In this case, the target will keep waiting
for a rising edge on BKGD, to answer the SYNC request pulse. If the rising edge is not detected, the target will keep waiting
forever without any timeout limit.
Consider now the case where the host returns BKGD to a logic one before 128 cycles. This is interpreted as a valid bit
transmission, and not as a SYNC request. The target will keep waiting for another falling edge, marking the start of a new bit. If,
a new falling edge is not detected by the target within 512 clock cycles, since the last falling edge, a timeout occurs and the current
command is discarded without affecting memory or the operating mode of the MCU. This is referred to as a soft-reset.
If a read command is issued, but the data is not retrieved within 512 serial clock cycles, a soft-reset will occur causing the
command to be disregarded. The data is not available for retrieval after the timeout has occurred. This is expected behavior if
the handshake protocol is not enabled. To allow the data to be retrieved, even with a large clock frequency mismatch (between
BDM and CPU) when the hardware handshake protocol is enabled, the timeout between a read command and the data retrieval
is disabled. Therefore, the host could wait for more then 512 serial clock cycles, and still be able to retrieve the data from an
issued read command. However, once the handshake pulse (ACK pulse) is issued, the timeout feature is re-activated, meaning
that the target will timeout after 512 clock cycles. The host needs to retrieve the data within a 512 serial clock cycles time frame
after the ACK pulse had been issued. After that period, the read command is discarded and the data is no longer available for
retrieval. Any negative edge in the BKGD pin after the timeout period is considered to be a new command or a SYNC request.
Note that whenever a partially issued command, or partially retrieved data has occurred, the timeout in the serial communication
is active. This means that if a time frame higher than 512 serial clock cycles is observed between two consecutive negative edges
and the command being issued or data being retrieved is not complete, a soft-reset will occur causing the partially received
command or data retrieved to be disregarded. The next negative edge in the BKGD pin, after a soft-reset has occurred, is
considered by the target as the start of a new BDM command, or the start of a SYNC request pulse.
MM912_637, Rev. 3.0
Freescale Semiconductor
292
S12 Clock, Reset, and Power Management Unit (S12CPMU)
5.22
S12 Clock, Reset, and Power Management Unit
(S12CPMU)
MCU
5.22.1
ANALOG
Introduction
This specification describes the function of the Clock, Reset, and Power Management Unit (S12CPMU).
•
The Pierce oscillator (OSCLCP) provides a robust, low noise and low power external clock source. It is designed for
optimal start-up margin with typical crystal oscillators
•
The voltage regulator (IVREG) operates from the range 3.13 to 5.5 V. It provides all the required chip internal voltages
and voltage monitors
•
The Phase Locked Loop (PLL) provides a highly accurate frequency multiplier with internal filter
•
The Internal Reference Clock (IRC1M) provides a1.0 MHz clock
5.22.1.1
Features
The Pierce Oscillator (OSCLCP) contains circuitry to dynamically control current gain in the output amplitude. This ensures a
signal with low harmonic distortion, low power, and good noise immunity.
•
Supports crystals or resonators from 4.0 to 16 MHz
•
High noise immunity due to input hysteresis and spike filtering
•
Low RF emissions with peak-to-peak swing limited dynamically
•
Transconductance (gm) sized for optimum start-up margin for typical crystals
•
Dynamic gain control eliminates the need for external current limiting resistor
•
Integrated resistor eliminates the need for external bias resistor
•
Low power consumption: Operates from an internal 1.8 V (nominal) supply, amplitude control limits power
The Voltage Regulator (IVREG) has the following features:
•
Input voltage range from 3.13 to 5.5 V
•
Low voltage detect (LVD) with low voltage interrupt (LVI)
•
Power-on reset (POR)
•
Low voltage reset (LVR)
The Phase Locked Loop (PLL) has the following features:
•
Highly accurate and phase locked frequency multiplier
•
Configurable internal filter for best stability and lock time
•
Frequency modulation for defined jitter and reduced emission
•
Automatic frequency lock detector
•
Interrupt request on entry or exit from locked condition
•
Reference clock either external (crystal) or internal square wave (1.0 MHz IRC1M) based
•
PLL stability is sufficient for LIN communication, even if using IRC1M as reference clock
The Internal Reference Clock (IRC1M) has the following features:
•
Trimmable in frequency
•
Factory trimmed value for 1.0 MHz in Flash memory, can be overwritten by application if required
Other features of the S12CPMU include
•
Clock monitor to detect loss of crystal
•
Bus Clock Generator
— Clock switch to select either PLLCLK or external crystal/resonator based bus clock
— PLLCLK divider to adjust system speed
•
System Reset generation from the following possible sources:
— Power-on reset (POR)
— Low voltage reset (LVR)
— Illegal address access
— COP timeout
MM912_637, Rev. 3.0
Freescale Semiconductor
293
S12 Clock, Reset, and Power Management Unit (S12CPMU)
—
—
5.22.1.2
Loss of oscillation (clock monitor fail)
External pin RESET
Modes of Operation
This subsection lists and briefly describes all operating modes supported by the S12CPMU.
5.22.1.2.1
Run Mode
The voltage regulator is in Full Performance mode (FPM).
The Phase Locked Loop (PLL) is on.
The Internal Reference Clock (IRC1M) is on.
•
PLL Engaged Internal (PEI)
— This is the default mode after system reset and power-on reset.
— The bus clock is based on the PLLCLK.
— After reset the PLL is configured for 64 MHz VCOCLK operation. Post divider is 0x03, so PLLCLK is VCOCLK
divided by 4, that is 16 MHz and bus clock is 8.0 MHz. The PLL can be re-configured for other bus frequencies.
— The reference clock for the PLL (REFCLK) is based on internal reference clock IRC1M
•
PLL Engaged External (PEE)
— The bus clock is based on the PLLCLK.
— This mode can be entered from default mode PEI by performing the following steps:
– Configure the PLL for desired bus frequency.
– Program the reference divider (REFDIV[3:0] bits) to divide down oscillator frequency if necessary.
– Enable the external oscillator (OSCE bit)
•
PLL Bypassed External (PBE)
— The bus clock is based on the oscillator clock (OSCCLK).
— This mode can be entered from default mode PEI by performing the following steps:
– Enable the external oscillator (OSCE bit)
– Wait for oscillator to start up (UPOSC=1)
– Select the oscillator clock (OSCCLK) as bus clock (PLLSEL=0).
— The PLLCLK is still on to filter possible spikes of the external oscillator clock.
5.22.1.2.2
Wait Mode
For S12CPMU Wait mode is the same as Run mode.
5.22.1.2.3
Stop Mode
This mode is entered by executing the CPU STOP instruction.
The voltage regulator is in Reduced Power mode (RPM).
The Phase Locked Loop (PLL) is off.
The internal reference clock (IRC1M) is off.
Core clock, bus clock and BDM clock are stopped.
Depending on the setting of the PSTP and the OSCE bit, Stop mode can be differentiated between Full Stop mode (PSTP = 0 or
OSCE=0) and Pseudo Stop mode (PSTP = 1 and OSCE=1).
•
Full Stop mode (PSTP = 0 or OSCE=0)
The external oscillator (OSCLCP) is disabled.
After wake-up from Full Stop mode the core clock and bus clock are running on PLLCLK (PLLSEL=1). After wake-up
from Full Stop mode the COP and RTI are running on IRCCLK (COPOSCSEL=0, RTIOSCSEL=0).
•
Pseudo Stop Mode (PSTP = 1 and OSCE=1)
The external oscillator (OSCLCP) continues to run. If the respective enable bits are set the COP and RTI will continue
to run. The clock configuration bits PLLSEL, COPOSCSEL, RTIOSCSEL are unchanged.
MM912_637, Rev. 3.0
Freescale Semiconductor
294
S12 Clock, Reset, and Power Management Unit (S12CPMU)
NOTE
When starting up the external oscillator (either by programming OSCE bit to 1 or on exit from
Full Stop mode with OSCE bit already 1), the software must wait for a minimum time
equivalent to the startup-time of the external oscillator tUPOSC before entering Pseudo Stop
mode.
5.22.1.3
S12CPMU Block Diagram
Illegal Address Access
MMC
VDD, VDDF
ILAF
(core supplies)
Low Voltage Interrupt VDDRX
VDDRX
VSS
LVDS
Low Voltage Interrupt
LVIE
Low Voltage Reset VDDRX
VSSRX
Voltage
Regulator
3.13 to 5.5V
LVRF
Power-On Detect
monitor fail
OSCBW
REFDIV[3:0]
Internal
Reference
Clock
(IRC1M)
OSCE
Power-On Reset
Reset
Generator
System Reset
Oscillator status Interrupt
UPOSC
OSCIE
UPOSC=0 sets PLLSEL bit
CAN_OSCCLK
OSCCLK
adaptive
&
(to MSCAN)
spike
OSCFILT[4:0]
filter
PLLSEL
IRCTRIM[9:0]
Reference
Divider
PSTP
S12CPMU
PORF
RESET
Clock
Monitor
Loop
Controlled
EXTAL
Pierce
Oscillator
(OSCLCP)
XTAL
4.0 MHz16 MH
COP timeout
POSTDIV[4:0]
ECLK2X
(Core Clock)
Post
Divider
1,2,...,32
divide
by 4
PLLCLK
divide
ECLK
by 2 (Bus Clock)
IRCCLK
(to LCD)
VCOFRQ[1:0]
divide
by 8
VCOCLK
Lock
detect
REFCLK
FBCLK
Phase
locked
Loop with
internal
Filter (PLL)
BDM Clock
REFFRQ[1:0]
LOCK
LOCKIE
PLL Lock Interrupt
Divide by
2*(SYNDIV+1)
UPOSC
SYNDIV[5:0]
RTIE
UPOSC=0 clears
IRCCLK
OSCCLK
IRCCLK
COP timeout
COPCLK COP
to
Reset
Watchdog Generator
OSCCLK
COPOSCSEL
PCE
CPMUCOP
RTI Interrupt
Real Time
RTICLK Interrupt (RTI)
RTIOSCSEL
PRE
CPMURTI
Figure 90. Block Diagram of S12CPMU
MM912_637, Rev. 3.0
Freescale Semiconductor
295
S12 Clock, Reset, and Power Management Unit (S12CPMU)
Figure 91 shows a block diagram of the OSCLCP.
OSCCLK
Peak
Detector
Gain Control
VDD = 1.8 V
VSS
Rf
XTAL
EXTAL
Figure 91. OSCLCP Block Diagram
5.22.2
Signal Description
This section lists and describes the signals that connect off chip.
5.22.2.1
RESET
Pin RESET is an active-low bidirectional pin. As an input, it initializes the MCU asynchronously to a known start-up state. As an
open-drain output, it indicates that an MCU-internal reset has been triggered.
5.22.2.2
EXTAL and XTAL
These pins provide the interface for a crystal to control the internal clock generator circuitry. EXTAL is the external clock input or
the input to the crystal oscillator amplifier. XTAL is the output of the crystal oscillator amplifier. The MCU internal OSCCLK is
derived from the EXTAL input frequency. If OSCE=0, the EXTAL pin is pulled down by an internal resistor of approximately
200 k, and the XTAL pin is pulled down by an internal resistor of approximately 700 k.
NOTE
Freescale recommends an evaluation of the application board and chosen resonator or
crystal by the resonator or crystal supplier. Loop controlled circuit is not suited for overtone
resonators and crystals.
MM912_637, Rev. 3.0
Freescale Semiconductor
296
S12 Clock, Reset, and Power Management Unit (S12CPMU)
5.22.2.3
VSS — Ground Pin
VSS must be grounded.
5.22.2.4
VDDRX, VSSRX— Regulator Power Input Pin and Pad Supply Pins
VDDRX is the power input of IVREG and the PAD positive supply pin. All currents sourced into the regulator loads flow through
this pin.The VDDRX/VSSX supply domain is monitored by the low voltage reset circuit.
An off-chip decoupling capacitor (100 nF...220 nF, X7R ceramic) between VDDRX and VSSX can further improve the quality of
this supply.
5.22.2.5
VDD — Internal Regulator Output Supply (Core Logic)
Node VDD is a device internal supply output of the voltage regulator that provides the power supply for the core logic. This supply
domain is monitored by the low voltage reset circuit.
5.22.2.6
VDDF — Internal Regulator Output Supply (NVM Logic)
Node VDDF is a device internal supply output of the voltage regulator that provides the power supply for the NVM logic. This
supply domain is monitored by the low voltage reset circuit
5.22.3
Memory Map and Registers
This section provides a detailed description of all registers accessible in the S12CPMU.
5.22.3.1
Module Memory Map
The S12CPMU registers are shown in Table 401.
Table 401. CPMU Register Summary
Address
Name
Bit 7
0x0034
CPMU
SYNR
W
0x0035
CPMU
REFDIV
W
0x0036
CPMU
POSTDIV
W
0x0037
CPMUFLG
0x0038
CPMUINT
0x0039
CPMUCLKS
0x003A
CPMUPLL
0x003B
CPMURTI
R
R
R
R
W
R
W
R
W
R
6
R
4
VCOFRQ[1:0]
REFFRQ[1:0]
0
0
0
RTIF
PORF
LVRF
0
0
RTIE
PLLSEL
PSTP
0
0
RTDEC
RTR6
3
2
1
Bit 0
SYNDIV[5:0]
0
W
W
5
0
REFDIV[3:0]
POSTDIV[4:0]
LOCKIF
LOCKIE
0
0
FM1
FM0
RTR5
RTR4
LOCK
ILAF
0
0
PRE
PCE
0
RTR3
OSCIF
OSCIE
UPOSC
0
RTI
COP
OSCSEL
OSCSEL
0
0
0
RTR2
RTR1
RTR0
= Unimplemented or Reserved
MM912_637, Rev. 3.0
Freescale Semiconductor
297
S12 Clock, Reset, and Power Management Unit (S12CPMU)
Table 401. CPMU Register Summary
Address
Name
0x003C
CPMUCOP
0x003D
RESERVEDC
0x003E
RESERVEDC
0x003F
CPMU
ARMCOP
0x02F0
RESERVED
0x02F1
CPMU
LVCTL
RESERVED
0x02F2
R
W
R
Bit 7
6
WCOP
RSBCK
0
0
0
0
5
4
3
2
1
Bit 0
0
0
0
CR2
CR1
CR0
0
0
0
0
0
0
0
0
0
0
0
0
WRTMASK
W
R
W
R
0
0
0
0
0
0
0
0
W
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
R
0
0
0
0
0
0
0
0
0
0
0
0
0
LVDS
LVIE
LVIF
0
0
0
0
W
R
W
R
W
RESERVED
0x02F3
R
W
RESERVED
0x02F4
R
W
RESERVED
0x02F5
R
W
R
0x02F6
RESERVEDC
0x02F7
RESERVED
0x02F8
CPMU
IRCTRIMH
W
0x02F9
CPMU
IRCTRIML
W
0x02FA
CPMUOSC
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
R
W
R
R
R
0
TCTRIM[4:0]
IRCTRIM[9:8]
IRCTRIM[7:0]
OSCE
OSCBW
OSCPINS_
EN
0
0
0
0
0
0
0
0
0
0
0
0
0
0
OSCFILT[4:0]
W
0x02FB
CPMUPROT
0x02FC
RESERVEDC
R
W
R
PROT
0
W
= Unimplemented or Reserved
5.22.3.2
Register Descriptions
This section describes all the S12CPMU registers and their individual bits.
Address order is as listed in Table 401.
5.22.3.2.1
S12CPMU Synthesizer Register (CPMUSYNR)
The CPMUSYNR register controls the multiplication factor of the PLL and selects the VCO frequency range.
MM912_637, Rev. 3.0
Freescale Semiconductor
298
S12 Clock, Reset, and Power Management Unit (S12CPMU)
Table 402. S12CPMU Synthesizer Register (CPMUSYNR)
0x0034
7
R
6
5
4
3
VCOFRQ[1:0]
W
Reset
0
2
1
0
1
1
1
SYNDIV[5:0]
1
0
1
1
Read: Anytime
Write: Anytime if PROT=0 (CPMUPROT register) and PLLSEL=1 (CPMUCLKS register), Else write has no effect.
NOTE
Writing to this register clears the LOCK and UPOSC status bits.
f VCO = 2  f REF   SYNDIV + 1 
If PLL has locked (LOCK=1)
NOTE
fVCO must be within the specified VCO frequency lock range. Bus frequency fBUS must not
exceed the specified maximum.
The VCOFRQ[1:0] bits are used to configure the VCO gain for optimal stability and lock time. For correct PLL operation, the
VCOFRQ[1:0] bits have to be selected according to the actual target VCOCLK frequency, as shown in Table 403. Setting the
VCOFRQ[1:0] bits incorrectly can result in a non functional PLL (no locking and/or insufficient stability).
Table 403. VCO Clock Frequency Selection
5.22.3.2.2
VCOCLK Frequency Ranges
VCOFRQ[1:0]
32 MHz <= fVCO<= 48 MHz
00
48 MHz < fVCO<= 64 MHz
01
Reserved
10
Reserved
11
S12CPMU Reference Divider Register (CPMUREFDIV)
The CPMUREFDIV register provides a finer granularity for the PLL multiplier steps when using the external oscillator as
reference.
Table 404. S12CPMU Reference Divider Register (CPMUREFDIV)
0x0035
7
R
REFFRQ[1:0]
W
Reset
6
0
0
5
4
0
0
0
0
3
2
1
0
1
1
REFDIV[3:0]
1
1
Read: Anytime
Write: Anytime if PROT=0 (CPMUPROT register) and PLLSEL=1 (CPMUCLKS register), else write has no effect.
NOTE
Write to this register clears the LOCK and UPOSC status bits.
MM912_637, Rev. 3.0
Freescale Semiconductor
299
S12 Clock, Reset, and Power Management Unit (S12CPMU)
If OSCLCP is enabled (OSCE=1)
f OSC
f REF = ------------------------------------- REFDIV + 1 
If OSCLCP is disabled (OSCE=0)
f REF = f IRC1M
The REFFRQ[1:0] bits are used to configure the internal PLL filter for optimal stability and lock time. For correct PLL operation,
the REFFRQ[1:0] bits have to be selected according to the actual REFCLK frequency as shown in Table 405.
If IRC1M is selected as REFCLK (OSCE=0) the PLL filter is fixed configured for the 1.0 MHz <= fREF <= 2.0 MHz range. The bits
can still be written but will have no effect on the PLL filter configuration.
For OSCE=1, setting the REFFRQ[1:0] bits incorrectly can result in a non functional PLL (no locking and/or insufficient stability).
Table 405. Reference Clock Frequency Selection if OSC_LCP Is Enabled
5.22.3.2.3
REFCLK Frequency Ranges
(OSCE=1)
REFFRQ[1:0]
1.0 MHz <= fREF <= 2.0 MHz
00
2.0 MHz < fREF <= 6.0 MHz
01
6.0 MHz < fREF <= 12.0 MHz
10
fREF >12.0 MHz
11
S12CPMU Post Divider Register (CPMUPOSTDIV)
The POSTDIV register controls the frequency ratio between the VCOCLK and the PLLCLK.
Table 406. S12CPMU Post Divider Register (CPMUPOSTDIV)
0x0036
R
7
6
5
0
0
0
0
0
0
4
3
1
0
1
1
POSTDIV[4:0]
W
Reset
2
0
0
0
= Unimplemented or Reserved
Read: Anytime
Write: Anytime if PLLSEL=1. Else write has no effect.
If PLL is locked (LOCK=1)
f VCO
f PLL = ------------------------------------------ POSTDIV + 1 
If PLL is not locked (LOCK=0)
f VCO
f PLL = --------------4
If PLL is selected (PLLSEL=1)
f PLL
f bus = ------------2
MM912_637, Rev. 3.0
Freescale Semiconductor
300
S12 Clock, Reset, and Power Management Unit (S12CPMU)
5.22.3.2.4
S12CPMU Flags Register (CPMUFLG)
This register provides S12CPMU status bits and flags.
Table 407. S12CPMU Flags Register (CPMUFLG)
0x0037
7
R
W
Reset
6
5
4
3
RTIF
PORF
LVRF
LOCKIF
0
(264)
(265)
0
LOCK
0
2
1
ILAF
OSCIF
(266)
0
0
UPOSC
0
= Unimplemented or Reserved
Notes
264.1. PORF is set to 1 when a power on reset occurs. Unaffected by System Reset.
265.2. LVRF is set to 1 when a low voltage reset occurs. Unaffected by System Reset. Set by power on reset.
266.3. ILAF is set to 1 when an illegal address reset occurs. Unaffected by System Reset. Cleared by power on reset.
Read: Anytime
Write: Refer to each bit for individual write conditions
Table 408. CPMUFLG Field Descriptions
Field
7
RTIF
6
PORF
5
LVRF
4
LOCKIF
3
LOCK
2
ILAF
1
OSCIF
0
UPOSC
Description
Real Time Interrupt Flag — RTIF is set to 1 at the end of the RTI period. This flag can only be cleared by writing a 1. Writing
a 0 has no effect. If enabled (RTIE=1), RTIF causes an interrupt request.
0 RTI timeout has not yet occurred.
1 RTI timeout has occurred.
Power on Reset Flag — PORF is set to 1 when a power on reset occurs. This flag can only be cleared by writing a 1. Writing
a 0 has no effect.
0 Power on reset has not occurred.
1 Power on reset has occurred.
Low Voltage Reset Flag — LVRF is set to 1 when a low voltage reset occurs. This flag can only be cleared by writing a 1.
Writing a 0 has no effect.
0 Low voltage reset has not occurred.
1 Low voltage reset has occurred.
PLL Lock Interrupt Flag — LOCKIF is set to 1 when LOCK status bit changes. This flag can only be cleared by writing a 1.
Writing a 0 has no effect.If enabled (LOCKIE=1), LOCKIF causes an interrupt request.
0 No change in LOCK bit.
1 LOCK bit has changed.
Lock Status Bit — LOCK reflects the current state of PLL lock condition. Writes have no effect. While PLL is unlocked
(LOCK=0) fPLL is fVCO / 4 to protect the system from high core clock frequencies during the PLL stabilization time tlock.
0 VCOCLK is not within the desired tolerance of the target frequency. fPLL = fVCO/4.
1 VCOCLK is within the desired tolerance of the target frequency. fPLL = fVCO/(POSTDIV+1).
Illegal Address Reset Flag — ILAF is set to 1 when an illegal address reset occurs. Refer to MMC chapter for details. This
flag can only be cleared by writing a 1. Writing a 0 has no effect.
0 Illegal address reset has not occurred.
1 Illegal address reset has occurred.
Oscillator Interrupt Flag — OSCIF is set to 1 when UPOSC status bit changes. This flag can only be cleared by writing a 1.
Writing a 0 has no effect.If enabled (OSCIE=1), OSCIF causes an interrupt request.
0 No change in UPOSC bit.
1 UPOSC bit has changed.
Oscillator Status Bit — UPOSC reflects the status of the oscillator. Writes have no effect. While UPOSC=0 the OSCCLK going
to the MSCAN module is off. Entering Full Stop Mode UPOSC is cleared.
0 The oscillator is off or oscillation is not qualified by the PLL.
1 The oscillator is qualified by the PLL.
MM912_637, Rev. 3.0
Freescale Semiconductor
301
S12 Clock, Reset, and Power Management Unit (S12CPMU)
NOTE
The adaptive oscillator filter uses the VCO clock as a reference to continuously qualify the
external oscillator clock. As a result, the PLL is always active and a valid PLL configuration
is required for the system to work properly. Furthermore, the adaptive oscillator filter is used
to determine the status of the external oscillator (reflected in the UPOSC bit). Since this
function also relies on the VCO clock, loosing PLL lock status (LOCK=0, except for entering
Pseudo Stop mode) means loosing the oscillator status information as well (UPOSC=0).
5.22.3.2.5
S12CPMU Interrupt Enable Register (CPMUINT)
This register enables S12CPMU interrupt requests.
Table 409. S12CPMU Interrupt Enable Register (CPMUINT)
0x0038
7
R
RTIE
W
Reset
0
6
5
0
0
0
4
LOCKIE
0
0
3
2
0
0
0
0
1
OSCIE
0
0
0
0
= Unimplemented or Reserved
Read: Anytime
Write: Anytime
Table 410. CRGINT Field Descriptions
Field
Description
Real Time Interrupt Enable Bit
0 Interrupt requests from RTI are disabled.
1 Interrupt will be requested whenever RTIF is set.
7
RTIE
PLL Lock Interrupt Enable Bit
0 PLL LOCK interrupt requests are disabled.
1 Interrupt will be requested whenever LOCKIF is set.
4
LOCKIE
Oscillator Corrupt Interrupt Enable Bit
0 Oscillator Corrupt interrupt requests are disabled.
1 Interrupt will be requested whenever OSCIF is set.
1
OSCIE
5.22.3.2.6
S12CPMU Clock Select Register (CPMUCLKS)
This register controls S12CPMU clock selection.
Table 411. S12CPMU Clock Select Register (CPMUCLKS)
0x0039
R
W
7
6
PLLSEL
PSTP
1
0
Reset
5
4
0
0
0
0
3
2
1
0
PRE
PCE
RTI
OSCSEL
COP
OSCSEL
0
0
0
0
= Unimplemented or Reserved
Read: Anytime
Write:
1.
2.
3.
Only possible if PROT=0 (CPMUPROT register) in all MCU modes (Normal and Special mode).
All bits in Special mode (if PROT=0).
PLLSEL, PSTP, PRE, PCE, RTIOSCSEL: In Normal mode (if PROT=0).
MM912_637, Rev. 3.0
Freescale Semiconductor
302
4.
COPOSCSEL: In Normal mode (if PROT=0) until CPMUCOP write once is taken. If COPOSCSEL was cleared by
UPOSC=0 (entering Full Stop mode with COPOSCSEL=1 or insufficient OSCCLK quality), then COPOSCSEL can be
set again once.
NOTE
After writing CPMUCLKS register, it is strongly recommended to read back CPMUCLKS
register to make sure that write of PLLSEL, RTIOSCSEL and COPOSCSEL was successful.
Table 412. CPMUCLKS Descriptions
Field
7
PLLSEL
6
PSTP
3
PRE
2
PCE
1
RTIOSCSEL
Description
PLL Select Bit
This bit selects the PLLCLK as source of the system clocks (core clock and bus clock).
PLLSEL can only be set to 0, if UPOSC=1.
UPOSC= 0 sets the PLLSEL bit.
Entering Full Stop mode sets the PLLSEL bit.
0 System clocks are derived from OSCCLK if oscillator is up (UPOSC=1, fBUS = fOSC / 2.
1 System clocks are derived from PLLCLK, fBUS = fPLL / 2.
Pseudo Stop Bit
This bit controls the functionality of the oscillator during Stop mode.
0 Oscillator is disabled in Stop mode (Full Stop mode).
1 Oscillator continues to run in Stop mode (Pseudo Stop mode), option to run RTI and COP.
Note: Pseudo Stop mode allows for faster STOP recovery and reduces the mechanical stress and aging of the resonator in
case of frequent STOP conditions at the expense of a slightly increased power consumption.
Note: When starting up the external oscillator (either by programming OSCE bit to 1 or on exit from Full Stop mode with OSCE
bit is already 1) the software must wait for a minimum time equivalent to the startup time of the external oscillator tUPOSC
before entering Pseudo Stop mode.
RTI Enable During Pseudo Stop Bit — PRE enables the RTI during Pseudo Stop mode.
0 RTI stops running during Pseudo Stop mode.
1 RTI continues running during Pseudo Stop mode if RTIOSCSEL=1.
Note: If PRE=0 or RTIOSCSEL=0 then the RTI will go static while Stop mode is active. The RTI counter will not be reset.
COP Enable During Pseudo Stop Bit — PCE enables the COP during Pseudo Stop mode.
0 COP stops running during Pseudo Stop mode
1 COP continues running during Pseudo Stop mode if COPOSCSEL=1
Note: If PCE=0 or COPOSCSEL=0 then the COP will go static while Stop mode is active. The COP counter will not be reset.
RTI Clock Select— RTIOSCSEL selects the clock source to the RTI. Either IRCCLK or OSCCLK. Changing the RTIOSCSEL
bit re-starts the RTI timeout period.
RTIOSCSEL can only be set to 1, if UPOSC=1.
UPOSC= 0 clears the RTIOSCSEL bit.
0 RTI clock source is IRCCLK.
1 RTI clock source is OSCCLK.
COP Clock Select— COPOSCSEL selects the clock source to the COP. Either IRCCLK or OSCCLK. Changing the
COPOSCSEL bit re-starts the COP timeout period.
0
COPOSCSEL can only be set to 1, if UPOSC=1.
COPOSCSEL UPOSC= 0 clears the COPOSCSEL bit.
0 COP clock source is IRCCLK.
1 COP clock source is OSCCLK
MM912_637, Rev. 3.0
Freescale Semiconductor
303
5.22.3.2.7
S12CPMU PLL Control Register (CPMUPLL)
This register controls the PLL functionality.
Table 413. S12CPMU PLL Control Register (CPMUPLL)
0x003A
R
7
6
0
0
0
0
W
Reset
5
4
FM1
FM0
0
0
3
2
1
0
0
0
0
0
0
0
0
0
Read: Anytime
Write: Anytime if PROT=0 (CPMUPROT register) and PLLSEL=1 (CPMUCLKS register). Else write has no effect.
NOTE
Write to this register clears the LOCK and UPOSC status bits.
NOTE
Care should be taken to ensure that the bus frequency does not exceed the specified
maximum when frequency modulation is enabled.
NOTE
The frequency modulation (FM1 and FM0) can not be used if the Adaptive Oscillator Filter
is enabled.
Table 414. CPMUPLL Field Descriptions
Field
Description
5, 4
PLL Frequency Modulation Enable Bits — FM1 and FM0 enable frequency modulation on the VCOCLK. This is to reduce
noise emission. The modulation frequency is fREF divided by 16. See Table 415 for coding.
FM1, FM0
Table 415. FM Amplitude selection
5.22.3.2.8
FM1
FM0
FM Amplitude /
fVCO Variation
0
0
FM off
0
1
1%
1
0
2%
1
1
4%
S12CPMU RTI Control Register (CPMURTI)
This register selects the timeout period for the Real Time Interrupt.
The clock source for the RTI is either IRCCLK or OSCCLK depending on the setting of the RTIOSCSEL bit. In Stop mode with
PSTP=1 (Pseudo Stop mode) and RTIOSCSEL=1 the RTI continues to run, else the RTI counter halts in Stop mode.
MM912_637, Rev. 3.0
Freescale Semiconductor
304
Table 416. S12CPMU RTI Control Register (CPMURTI)
0x003B
R
W
7
6
5
4
3
2
1
0
RTDEC
RTR6
RTR5
RTR4
RTR3
RTR2
RTR1
RTR0
0
0
0
0
0
0
0
0
Reset
Read: Anytime
Write: Anytime
NOTE
A write to this register starts the RTI timeout period. A change of the RTIOSCSEL bit (writing
a different value or loosing UPOSC status) re-starts the RTI timeout period.
Table 417. CPMURTI Field Descriptions
Field
7
RTDEC
6–4
RTR[6:4]
3–0
RTR[3:0]
Description
Decimal or Binary Divider Select Bit — RTDEC selects decimal or binary based prescaler values.
0 Binary based divider value. See Table 418
1 Decimal based divider value. See Table 419
Real Time Interrupt Prescale Rate Select Bits — These bits select the prescale rate for the RTI. See Table 418 and
Table 419.
Real Time Interrupt Modulus Counter Select Bits — These bits select the modulus counter target value to provide additional
granularity.Table 418 and Table 419 show all possible divide values selectable by the CPMURTI register.
Table 418. RTI Frequency Divide Rates for RTDEC = 0
RTR[6:4] =
RTR[3:0]
000
(OFF)
001
(210)
010
(211)
011
(212)
100
(213)
101
(214)
110
(215)
111
(216)
0000 (1)
OFF(267)
210
211
212
213
214
215
216
0001 (2)
OFF
2x210
2x211
2x212
2x213
2x214
2x215
2x216
0010 (3)
OFF
3x210
3x211
3x212
3x213
3x214
3x215
3x216
0011 (4)
OFF
4x210
4x211
4x212
4x213
4x214
4x215
4x216
0100 (5)
OFF
5x210
5x211
5x212
5x213
5x214
5x215
5x216
0101 (6)
OFF
6x210
6x211
6x212
6x213
6x214
6x215
6x216
0110 (7)
OFF
7x210
7x211
7x212
7x213
7x214
7x215
7x216
0111 (8)
OFF
8x210
8x211
8x212
8x213
8x214
8x215
8x216
1000 (9)
OFF
9x210
9x211
9x212
9x213
9x214
9x215
9x216
1001 (10)
OFF
10x210
10x211
10x212
10x213
10x214
10x215
10x216
1010 (11)
OFF
11x210
11x211
11x212
11x213
11x214
11x215
11x216
1011 (12)
OFF
12x210
12x211
12x212
12x213
12x214
12x215
12x216
1100 (13)
OFF
13x210
13x211
13x212
13x213
13x214
13x215
13x216
1101 (14)
OFF
14x210
14x211
14x212
14x213
14x214
14x215
14x216
MM912_637, Rev. 3.0
Freescale Semiconductor
305
Table 418. RTI Frequency Divide Rates for RTDEC = 0
RTR[6:4] =
RTR[3:0]
000
(OFF)
001
(210)
010
(211)
011
(212)
100
(213)
101
(214)
110
(215)
111
(216)
1110 (15)
OFF
15x210
15x211
15x212
15x213
15x214
15x215
15x216
1111 (16)
OFF
16x210
16x211
16x212
16x213
16x214
16x215
16x216
Notes
267.Denotes the default value out of reset.This value should be used to disable the RTI to ensure future backwards compatibility.
Table 419. RTI Frequency Divide Rates for RTDEC=1
RTR[6:4] =
RTR[3:0]
000
(1x103)
001
(2x103)
010
(5x103)
011
(10x103)
100
(20x103)
101
(50x103)
110
(100x103)
111
(200x103)
0000 (1)
1x103
2x103
5x103
10x103
20x103
50x103
100x103
200x103
0001 (2)
2x103
4x103
10x103
20x103
40x103
100x103
200x103
400x103
0010 (3)
3x103
6x103
15x103
30x103
60x103
150x103
300x103
600x103
0011 (4)
4x103
8x103
20x103
40x103
80x103
200x103
400x103
800x103
0100 (5)
5x103
10x103
25x103
50x103
100x103
250x103
500x103
1x106
0101 (6)
6x103
12x103
30x103
60x103
120x103
300x103
600x103
1.2x106
0110 (7)
7x103
14x103
35x103
70x103
140x103
350x103
700x103
1.4x106
0111 (8)
8x103
16x103
40x103
80x103
160x103
400x103
800x103
1.6x106
1000 (9)
9x103
18x103
45x103
90x103
180x103
450x103
900x103
1.8x106
1001 (10)
10 x103
20x103
50x103
100x103
200x103
500x103
1x106
2x106
1010 (11)
11 x103
22x103
55x103
110x103
220x103
550x103
1.1x106
2.2x106
1011 (12)
12x103
24x103
60x103
120x103
240x103
600x103
1.2x106
2.4x106
1100 (13)
13x103
26x103
65x103
130x103
260x103
650x103
1.3x106
2.6x106
1101 (14)
14x103
28x103
70x103
140x103
280x103
700x103
1.4x106
2.8x106
1110 (15)
15x103
30x103
75x103
150x103
300x103
750x103
1.5x106
3x106
1111 (16)
16x103
32x103
80x103
160x103
320x103
800x103
1.6x106
3.2x106
MM912_637, Rev. 3.0
Freescale Semiconductor
306
5.22.3.2.9
S12CPMU COP Control Register (CPMUCOP)
This register controls the COP (Computer Operating Properly) watchdog.
The clock source for the COP is either IRCCLK or OSCCLK depending on the setting of the COPOSCSEL bit. In Stop mode with
PSTP=1(Pseudo Stop mode), COPOSCSEL=1 and PCE=1 the COP continues to run, else the COP counter halts in Stop mode.
Table 420. S12CPMU COP Control Register (CPMUCOP)
0x003C
R
W
7
6
WCOP
RSBCK
F
0
Reset
5
4
3
0
0
0
0
0
WRTMASK
0
2
1
0
CR2
CR1
CR0
F
F
F
After de-assert of System Reset the values are automatically loaded from the Flash memory. See Device specification for details.
= Unimplemented or Reserved
Read: Anytime
Write:
1.
2.
RSBCK: anytime in Special Mode; write to “1” but not to “0” in Normal mode
WCOP, CR2, CR1, CR0:
— Anytime in Special mode, when WRTMASK is 0, otherwise it has no effect
— Write once in Normal mode, when WRTMASK is 0, otherwise it has no effect.
– Writing CR[2:0] to “000” has no effect, but counts for the “write once” condition.
– Writing WCOP to “0” has no effect, but counts for the “write once” condition.
When a non-zero value is loaded from Flash to CR[2:0] the COP timeout period is started.
A change of the COPOSCSEL bit (writing a different value or loosing UPOSC status) re-starts the COP timeout period.
In Normal mode the COP timeout period is restarted if either of these conditions is true:
1. Writing a non-zero value to CR[2:0] (anytime in Special mode, once in Normal mode) with WRTMASK = 0.
2. Writing WCOP bit (anytime in Special mode, once in Normal mode) with WRTMASK = 0.
3. Changing RSBCK bit from “0” to “1”.
In Special mode, any write access to CPMUCOP register restarts the COP timeout period.
Table 421. CPMUCOP Field Descriptions
Field
7
WCOP
6
RSBCK
Description
Window COP Mode Bit — When set, a write to the CPMUARMCOP register must occur in the last 25% of the selected period.
A write during the first 75% of the selected period generates a COP reset. As long as all writes occur during this window, $55
can be written as often as desired. Once $AA is written after the $55, the timeout logic restarts and the user must wait until the
next window before writing to CPMUARMCOP. Table 422 shows the duration of this window for the seven available COP rates.
0 Normal COP operation
1 Window COP operation
COP and RTI Stop in Active BDM Mode Bit
0 Allows the COP and RTI to keep running in Active BDM mode.
1 Stops the COP and RTI counters whenever the part is in Active BDM mode.
MM912_637, Rev. 3.0
Freescale Semiconductor
307
Table 421. CPMUCOP Field Descriptions (continued)
Field
5
WRTMASK
2–0
CR[2:0]
Description
Write Mask for WCOP and CR[2:0] Bit — This write-only bit serves as a mask for the WCOP and CR[2:0] bits while writing
the CPMUCOP register. It is intended for BDM writing the RSBCK without changing the content of WCOP and CR[2:0].
0 Write of WCOP and CR[2:0] has an effect with this write of CPMUCOP
1 Write of WCOP and CR[2:0] has no effect with this write of CPMUCOP. (Does not count for “write once”.)
COP Watchdog Timer Rate Select — These bits select the COP timeout rate (see Table 422). Writing a nonzero value to
CR[2:0] enables the COP counter and starts the timeout period. A COP counter timeout causes a System Reset. This can be
avoided by periodically (before timeout) initializing the COP counter via the CPMUARMCOP register.
While all of the following four conditions are true the CR[2:0], WCOP bits are ignored and the COP operates at highest timeout
period (2 24 cycles) in normal COP mode (Window COP mode disabled):
1) COP is enabled (CR[2:0] is not 000)
2) BDM mode active
3) RSBCK = 0
4) Operation in Special mode
Table 422. COP Watchdog Rates
CR2
CR1
CR0
COPCLK
Cycles to Time-out
(COPCLK is either IRCCLK or
OSCCLK depending on the
COPOSCSEL bit)
0
0
0
COP disabled
0
0
1
2 14
0
1
0
2 16
0
1
1
2 18
1
0
0
2 20
1
0
1
2 22
1
1
0
2 23
1
1
1
2 24
5.22.3.2.10 Reserved Register CPMUTEST0
NOTE
This reserved register is designed for factory test purposes only, and is not intended for
general user access. Writing to this register when in Special mode can alter the S12CPMU’s
functionality.
Table 423. Reserved Register (CPMUTEST0)
0x003D
R
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
Reset
= Unimplemented or Reserved
Read: Anytime
Write: Only in Special mode
MM912_637, Rev. 3.0
Freescale Semiconductor
308
5.22.3.2.11
Reserved Register CPMUTEST1
NOTE
This reserved register is designed for factory test purposes only, and is not intended for
general user access. Writing to this register when in Special mode can alter the S12CPMU’s
functionality.
Table 424. Reserved Register (CPMUTEST1)
0x003E
R
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
W
Reset
= Unimplemented or Reserved
Read: Anytime
Write: Only in Special Mode
5.22.3.2.12 S12CPMU COP Timer Arm/Reset Register (CPMUARMCOP)
This register is used to restart the COP timeout period.
Table 425. S12CPMU CPMUARMCOP Register
0x003F
7
6
5
4
3
2
R
0
0
0
0
0
0
0
0
W
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
0
0
0
0
0
0
0
0
Read: Always reads $00
Write: Anytime
When the COP is disabled (CR[2:0] = “000”) writing to this register has no effect.
When the COP is enabled by setting CR[2:0] nonzero, the following applies:
Writing any value other than $55 or $AA causes a COP reset. To restart the COP timeout period write $55 followed by
a write of $AA. These writes do not need to occur back-to-back, but the sequence ($55, $AA) must be completed prior
to COP end of timeout period to avoid a COP reset. Sequences of $55 writes are allowed. When the WCOP bit is set,
$55 and $AA writes must be done in the last 25% of the selected timeout period; writing any value in the first 75% of
the selected period will cause a COP reset.
MM912_637, Rev. 3.0
Freescale Semiconductor
309
5.22.3.2.13 Low Voltage Control Register (CPMULVCTL)
The CPMULVCTL register allows the configuration of the low-voltage detect features.
Table 426. Low Voltage Control Register (CPMULVCTL)
0x02F1
R
7
6
5
4
3
2
0
0
0
0
0
LVDS
0
0
0
0
0
U
W
Reset
1
0
LVIE
LVIF
0
U
The Reset state of LVDS and LVIF depends on the external supplied VDDXR level
= Unimplemented or Reserved
Read: Anytime
Write: LVIE and LVIF are write anytime, LVDS is read only
Table 427. CPMULVCTL Field Descriptions
Field
2
LVDS
1
LVIE
0
LVIF
Description
Low-voltage Detect Status Bit — This read-only status bit reflects the voltage level on VDDXR. Writes have no effect.
0 Input voltage VDDXR is above level VLVID or RPM.
1 Input voltage VDDRX is below level VLVIA and FPM.
Low-voltage Interrupt Enable Bit
0 Interrupt request is disabled.
1 Interrupt will be requested whenever LVIF is set.
Low-voltage Interrupt Flag — LVIF is set to 1 when LVDS status bit changes. This flag can only be cleared by writing a 1.
Writing a 0 has no effect. If enabled (LVIE = 1), LVIF causes an interrupt request.
0 No change in LVDS bit.
1 LVDS bit has changed.
5.22.3.2.14 Reserved Register CPMUTEST3
NOTE
This reserved register is designed for factory test purposes only, and is not intended for
general user access. Writing to this register when in Special mode can alter the S12CPMU’s
functionality.
Table 428. Reserved Register (CPMUTEST3)
0x02F6
R
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
Reset
= Unimplemented or Reserved
Read: Anytime
Write: Only in Special mode
MM912_637, Rev. 3.0
Freescale Semiconductor
310
5.22.3.2.15 S12CPMU IRC1M Trim Registers (CPMUIRCTRIMH / CPMUIRCTRIML)
Table 430. S12CPMU IRC1M Trim High Register (CPMUIRCTRIMH)
0x02F8
15
14
R
12
11
F
F
F
10
9
0
TCTRIM[4:0]
W
Reset
13
F
0
0
8
IRCTRIM[9:8]
F
F
After de-assert of System Reset a factory programmed trim value is automatically loaded from the Flash memory to provide trimmed Internal
Reference Frequency fIRC1M_TRIM.
Table 431. S12CPMU IRC1M Trim Low Register (CPMUIRCTRIML)
0x02F9
7
6
5
4
R
2
1
0
F
F
F
F
IRCTRIM[7:0]
W
Reset
3
F
F
F
F
After de-assert of System Reset a factory programmed trim value is automatically loaded from the Flash memory to provide trimmed Internal
Reference Frequency fIRC1M_TRIM.
Read: Anytime
Write: Anytime if PROT=0 (CPMUPROT register). Else write has no effect
NOTE
Writes to these registers while PLLSEL=1 clears the LOCK and UPOSC status bits.
Table 432. CPMUIRCTRIMH/L Field Descriptions
Field
15-11
TCTRIM
9-0
IRCTRIM
Description
IRC1M temperature coefficient Trim Bits
Trim bits for the Temperature Coefficient (TC) of the IRC1M frequency.
Figure 93 shows the influence of the bits TCTRIM4:0] on the relationship between frequency and temperature.
Figure 93 shows an approximate TC variation, relative to the nominal TC of the IRC1M (i.e. for TCTRIM[4:0]=0x00000 or
0x10000).
IRC1M Frequency Trim Bits — Trim bits for Internal Reference Clock
After System Reset the factory programmed trim value is automatically loaded into these registers, resulting in a
Internal Reference Frequency fIRC1M_TRIM. See device electrical characteristics for value of fIRC1M_TRIM.
The frequency trimming consists of two different trimming methods:
A rough trimming controlled by bits IRCTRIM[9:6] can be done with frequency leaps of about 6% in average.
A fine trimming controlled by the bits IRCTRIM[5:0] can be done with frequency leaps of about 0.3% (this trimming determines
the precision of the frequency setting of 0.15%, i.e. 0.3% is the distance between two trimming values).
Figure 92 shows the relationship between the trim bits and the resulting IRC1M frequency.
MM912_637, Rev. 3.0
Freescale Semiconductor
311
IRC1M frequency (IRCCLK)
IRCTRIM[9:6]
1.5 MHz
......
IRCTRIM[5:0]
1.0 MHz
600 kHz
IRCTRIM[9:0]
$000
$1FF
$3FF
Figure 92. IRC1M Frequency Trimming Diagram
frequency
111
x11
0
=
0x11111
...
0x10101
T
0x10100 TC increases
TC
0x10011
0x10010
0x10001
TCTRIM[4:0] = 0x10000 or 0x00000 (nominal TC)
]
[4:0
RIM
T CT
RIM
[4:0
]
0x00001
0x00010
0x00011
0x00100 TC decreases
0x00101
...
0x01111
= 0x
011
11
$1FF
150 C
- 40 C
temperature
Figure 93. Influence of TCTRIM[4:0] on the Temperature Coefficient
NOTE
The frequency is not necessarily linear with the temperature (in most cases it will not be).
The above diagram is meant only to give the direction (positive or negative) of the variation
of the TC, relative to the nominal TC.
Setting TCTRIM[4:0] at 0x00000 or 0x10000 does not mean that the temperature coefficient
will be zero. These two combinations basically switch off the TC compensation module,
which result in the nominal TC of the IRC1M.
Table 433. TC Trimming of the Frequency of the IRC1M
TCTRIM[4:0]
IRC1M indicative relative
TC variation
IRC1M indicative frequency drift for
relative TC variation
00000
0 (nominal TC of the IRC)
0%
00001
-0.27%
-0.5%
00010
-0.54%
-0.9%
MM912_637, Rev. 3.0
Freescale Semiconductor
312
Table 433. TC Trimming of the Frequency of the IRC1M
TCTRIM[4:0]
IRC1M indicative relative
TC variation
IRC1M indicative frequency drift for
relative TC variation
00011
-0.81%
-1.3%
00100
-1.08%
-1.7%
00101
-1.35%
-2.0%
00110
-1.63%
-2.2%
00111
-1.9%
-2.5%
01000
-2.20%
-3.0%
01001
-2.47%
-3.4%
01010
-2.77%
-3.9%
01011
-3.04
-4.3%
01100
-3.33%
-4.7%
01101
-3.6%
-5.1%
01110
-3.91%
-5.6%
01111
-4.18%
-5.9%
10000
0 (nominal TC of the IRC)
0%
10001
+0.27%
+0.5%
10010
+0.54%
+0.9%
10011
+0.81%
+1.3%
10100
+1.07%
+1.7%
10101
+1.34%
+2.0%
10110
+1.59%
+2.2%
10111
+1.86%
+2.5%
11000
+2.11%
+3.0%
11001
+2.38%
+3.4%
11010
+2.62%
+3.9%
11011
+2.89%
+4.3%
11100
+3.12%
+4.7%
11101
+3.39%
+5.1%
11110
+3.62%
+5.6%
11111
+3.89%
+5.9%
NOTE
Since the IRC1M frequency is not a linear function of the temperature, but more like a
parabola, the above relative variation is only an indication and should be considered with
care.
Be aware that the output frequency varies with the TC trimming. A frequency trimming
correction is therefore necessary. The values provided in Table 433 are typical values at
ambient temperature which can vary from device to device.
MM912_637, Rev. 3.0
Freescale Semiconductor
313
5.22.3.2.16 S12CPMU Oscillator Register (CPMUOSC)
This register configures the external oscillator (OSCLCP).
Table 434. S12CPMU Oscillator Register (CPMUOSC)
0x02FA
7
R
W
6
OSCE
OSCBW
0
0
Reset
5
4
3
OSCPINS_EN
0
2
1
0
0
0
OSCFILT[4:0]
0
0
0
Read: Anytime
Write: Anytime if PROT=0 (CPMUPROT register) and PLLSEL=1 (CPMUCLKS register), else write has no effect.
NOTE.
Write to this register clears the LOCK and UPOSC status bits.
NOTE.
If the chosen VCOCLK-to-OSCCLK ratio divided by two ((fVCO / fOSC)/2) is not an integer
number, the filter can not be used and the OSCFILT[4:0] bits must be set to 0.
NOTE
The frequency modulation (FM1 and FM0) can not be used if the Adaptive Oscillator Filter
is enabled.
Table 435. CPMUOSC Field Descriptions
Field
7
OSCE
6
OSCBW
Description
Oscillator Enable Bit — This bit enables the external oscillator (OSCLCP). The UPOSC status bit in the CPMUFLG register
indicates when the oscillation is stable and OSCCLK can be selected as bus clock or source of the COP or RTI. A loss of
oscillation will lead to a clock monitor reset.
0 External oscillator is disabled.
REFCLK for PLL is IRCCLK.
1 External oscillator is enabled.Clock monitor is enabled.
REFCLK for PLL is external oscillator clock divided by REFDIV.
Note: When starting up the external oscillator (either by programming OSCE bit to 1 or on exit from Full Stop mode with OSCE
bit already 1) the software must wait for a minimum time equivalent to the startup time of the external oscillator tUPOSC
before entering Pseudo Stop mode.
Oscillator Filter Bandwidth Bit — If the VCOCLK frequency exceeds 25 MHz wide bandwidth must be selected. The
Oscillator Filter is described in more detail in Section 5.22.4.5.2, “The Adaptive Oscillator Filter"
0 Oscillator filter bandwidth is narrow (window for expected OSCCLK edge is one VCOCLK cycle).
1 Oscillator filter bandwidth is wide (window for expected OSCCLK edge is three VCOCLK cycles).
Oscillator Pins EXTAL and XTAL Enable Bit
If OSCE=1 this read-only bit is set. It can only be cleared with the next reset.
Enabling the external oscillator reserves the EXTAL and XTAL pins exclusively for oscillator application.
OSCPINS_EN 0 EXTAL and XTAL pins are not reserved for oscillator.
1 EXTAL and XTAL pins exclusively reserved for oscillator.
5
4-0
OSCFILT
Oscillator Filter Bits — When using the oscillator a noise filter can be enabled, which filters noise from the incoming external
oscillator clock and detects if the external oscillator clock is qualified or not (quality status shown by bit UPOSC).
The VCOCLK-to-OSCCLK ratio divided by two ((fVCO / fOSC)/2) must be an integer value. This value must be written to the
OSCFILT[4:0] bits to enable the Adaptive Oscillator Filter.
0x0000 Adaptive Oscillator Filter disabled, else Adaptive Oscillator Filter enabled]
MM912_637, Rev. 3.0
Freescale Semiconductor
314
5.22.3.2.17 S12CPMU Protection Register (CPMUPROT)
This register protects the following clock configuration registers from accidental overwrite:
CPMUSYNR, CPMUREFDIV, CPMUCLKS, CPMUPLL, CPMUIRCTRIMH/L, and CPMUOSC
Table 436. S12CPMU Protection Register (CPMUPROT)
0x02FB
R
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
Reset
0
PROT
0
Read: Anytime
Write: Anytime
Table 437. CPMUPROT Field Description
Field
Description
0
Clock Configuration Registers Protection Bit — This bit protects the clock configuration registers from accidental overwrite
(see list of protected registers above).
Writing 0x26 to the CPMUPROT register clears the PROT bit, other write accesses set the PROT bit.
0 Protection of clock configuration registers is disabled.
1 Protection of clock configuration registers is enabled. (see list of protected registers above)
5.22.3.2.18 Reserved Register CPMUTEST2
NOTE
This reserved register is designed for factory test purposes only, and is not intended for
general user access. Writing to this register when in Special mode can alter the S12CPMU’s
functionality.
Table 438. Reserved Register CPMUTEST2
0x02FC
R
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
Reset
= Unimplemented or Reserved
Read: Anytime
Write: Only in Special mode
5.22.4
5.22.4.1
Functional Description
Phase Locked Loop with Internal Filter (PLL)
The PLL is used to generate a high speed PLLCLK based on a low frequency REFCLK.
The REFCLK is by default the IRCCLK which is trimmed to fIRC1M_TRIM=1.0 MHz.
If using the oscillator (OSCE=1) REFCLK will be based on OSCCLK. For increased flexibility, OSCCLK can be divided in a range
of 1 to 16 to generate the reference frequency REFCLK using the REFDIV[3:0] bits. Based on the SYNDIV[5:0] bits, the PLL
generates the VCOCLK by multiplying the reference clock by a 2, 4, 6,... 126, 128. Based on the POSTDIV[4:0] bits, the VCOCLK
can be divided in a range of 1,2, 3, 4, 5, 6,... to 32 to generate the PLLCLK.
MM912_637, Rev. 3.0
Freescale Semiconductor
315
If Oscillator is enabled (OSCE=1)
f OSC
f REF = ------------------------------------- REFDIV + 1 
If Oscillator is disabled (OSCE=0)
f REF = f IRC1M
f VCO = 2  f REF   SYNDIV + 1 
If PLL is locked (LOCK=1)
f VCO
f PLL = ------------------------------------------ POSTDIV + 1 
If PLL is not locked (LOCK=0)
f VCO
f PLL = --------------4
If PLL is selected (PLLSEL=1)
f PLL
f bus = ------------2
.
NOTE
Although it is possible to set the dividers to command a very high clock frequency, do not
exceed the specified bus frequency limit for the MCU.
Several examples of PLL divider settings are shown in Table 439. The following rules help to achieve optimum stability and
shortest lock time:
•
Use lowest possible fVCO / fREF ratio (SYNDIV value).
•
Use highest possible REFCLK frequency fREF.
Table 439. Examples of PLL Divider Settings
fosc
REFDIV[3:0]
fREF
REFFRQ[1:0] SYNDIV[5:0]
fVCO
VCOFRQ[1:0] POSTDIV[4:0]
fPLL
fbus
off
$00
1.0 MH
z
00
$1F
64 MHz
01
$03
16 MHz
8.0 MHz
off
$00
1.0 MH
z
00
$1F
64 MHz
01
$00
64 MHz
32 MHz
off
$00
1.0 MH
z
00
$0F
32 MHz
00
$00
32 MHz
16 MHz
4.0 MH
z
$00
4.0 MH
z
01
$03
32 MHz
01
$00
32 MHz
16 MHz
The phase detector inside the PLL compares the feedback clock (FBCLK = VCOCLK/(SYNDIV+1) with the reference clock
(REFCLK = (IRC1M or OSCCLK)/(REFDIV+1)). Correction pulses are generated based on the phase difference between the two
signals. The loop filter alters the DC voltage on the internal filter capacitor, based on the width and direction of the correction
pulse, which leads to a higher or lower VCO frequency.
The user must select the range of the REFCLK frequency (REFFRQ[1:0] bits) and the range of the VCOCLK frequency
(VCOFRQ[1:0] bits) to ensure that the correct PLL loop bandwidth is set.
The lock detector compares the frequencies of the FBCLK and the REFCLK. Therefore, the speed of the lock detector is directly
proportional to the reference clock frequency. The circuit determines the lock condition based on this comparison.
If PLL LOCK interrupt requests are enabled, the software can wait for an interrupt request and for instance check the LOCK bit.
If interrupt requests are disabled, software can poll the LOCK bit continuously (during PLL start-up) or at periodic intervals. In
either case, only when the LOCK bit is set, the VCOCLK will have stabilized to the programmed frequency.
•
The LOCK bit is a read-only indicator of the locked state of the PLL.
•
The LOCK bit is set when the VCO frequency is within the tolerance, LOCK, and is cleared when the VCO frequency
is out of the tolerance, UNl.
•
Interrupt requests can occur if enabled (LOCKIE = 1) when the lock condition changes, toggling the LOCK bit.
MM912_637, Rev. 3.0
Freescale Semiconductor
316
5.22.4.2
Startup from Reset
An example of startup of clock system from Reset is given in Figure 94.
System
Reset
768 cycles
PLLCLK
fPLL increasing
fVCORST
fPLL=32 MHz
fPLL=16MHz
)(
tlock
LOCK
SYNDIV
$1F (default target fVCO=64MHz)
POSTDIV
$03 (default target fPLL=fVCO/4 = 16MHz)
CPU
reset state
$01
vector fetch, program execution
example change
of POSTDIV
Figure 94. Startup of Clock System After Reset
5.22.4.3
Stop Mode using PLLCLK as Bus Clock
An example of what happens going into Stop mode and exiting Stop mode after an interrupt is shown in Figure 95. Disable PLL
Lock interrupt (LOCKIE=0) before going into Stop mode.
wake-up
CPU
execution
interrupt
STOP instruction
continue execution
tSTP_REC
PLLCLK
tlock
LOCK
Figure 95. Stop Mode using PLLCLK as Bus Clock
5.22.4.4
Full Stop Mode Using Oscillator Clock as Bus Clock
An example of what happens going into Full Stop mode and exiting Full Stop mode after an interrupt is shown in Figure 96.
Disable PLL Lock interrupt (LOCKIE=0) and oscillator status change interrupt (OSCIE=0) before going into Full Stop mode.
MM912_637, Rev. 3.0
Freescale Semiconductor
317
wake-up
CPU
execution
interrupt
STOP instruction
Core
Clock
continue execution
tSTP_REC
tlock
PLLCLK
OSCCLK
UPOSC
select OSCCLK as Core/Bus Clock by writing PLLSEL to “0”
PLLSEL
automatically set when going into Full Stop Mode
Figure 96. Full Stop Mode Using Oscillator Clock as Bus Clock
5.22.4.5
5.22.4.5.1
External Oscillator
Enabling the External Oscillator
An example of how to use the oscillator as Bus Clock is shown in Figure 97.
enable external oscillator by writing OSCE bit to one.
OSCE
crystal/resonator starts oscillating
EXTAL
UPOSC flag is set upon successful start of oscillation
UPOSC
OSCCLK
select OSCCLK as Core/Bus Clock by writing PLLSEL to zero
PLLSEL
Core
Clock
based on PLLCLK
based on OSCCLK
Figure 97. Enabling the external oscillator
MM912_637, Rev. 3.0
Freescale Semiconductor
318
5.22.4.5.2
The Adaptive Oscillator Filter
A spike in the oscillator clock can disturb the function of the modules driven by this clock.
The Adaptive Oscillator Filter includes two features:
1. Filter noise (spikes) from the incoming external oscillator clock. The filter feature is illustrated in Figure 98.
enable external oscillator
OSCE
configure the Adaptive Oscillator Filter
OSC
FILT
0
>0
crystal/resonator starts oscillating
EXTAL
LOCK
UPOSC
filtered
filtered
OSCCLK
(filtered)
Figure 98. Noise filtered by the Adaptive Oscillator Filter
2.
Detect severe noise disturbance on external oscillator clock which can not be filtered and indicate the critical situation
to the software by clearing the UPOSC and LOCK status bit and setting the OSCIF and LOCKIF flag. An example for
the detection of critical noise is illustrated in Figure 99.
enable external oscillator
OSCE
configure the Adaptive Oscillator Filter
OSC
FILT
0
>0
crystal/resonator starts oscillating
phase shift can not be filtered but detected
EXTAL
LOCK
UPOSC
OSCCLK
(filtered)
Figure 99. Critical Noise Detected by the Adaptive Oscillator Filter
NOTE
If the LOCK bit is clear due to severe noise disturbance on the external oscillator clock, the
PLLCLK is derived from the VCO clock (with its actual frequency) divided by four (see
Section 5.22.3.2.3, “S12CPMU Post Divider Register (CPMUPOSTDIV)").
The use of the filter function is only possible if the VCOCLK-to-OSCCLK ratio divided by two ((fVCO / fOSC)/2) is an integer number.
This integer value must be written to the OSCFILT[4:0] bits.
If enabled, the Adaptive Oscillator Filter samples the incoming external oscillator clock signal (EXTAL) with the VCOCLK
frequency.
MM912_637, Rev. 3.0
Freescale Semiconductor
319
Using VCOCLK, a time window is defined of which an edge of the OSCCLK is expected. In case of OSCBW = 1, the width of this
window is three VCOCLK cycles, if the OSCBW = 0 it is one VCOCLK cycle.
The noise detection is active for certain combinations of OSCFILT[4:0] and OSCBW bit settings, as shown in Table 440.
Table 440. Noise Detection Settings
OSCFILT[4:0]
OSCBW
Detection
Filter
0
x
disabled
disabled
1
x
disabled
active
0
active
active
1
disabled
active
x
active
active
2 or 3
>=4
NOTE
If the VCOCLK frequency is higher than 25 MHz the wide bandwidth must be selected
(OSCBW = 1).
5.22.4.6
5.22.4.6.1
System Clock Configurations
PLL Engaged Internal Mode (PEI)
This mode is the default mode after System Reset or Power-on Reset.
The Bus Clock is based on the PLLCLK, the reference clock for the PLL is internally generated (IRC1M). The PLL is configured
to 64 MHz VCOCLK with POSTDIV set to 0x03. If locked (LOCK=1) this results in a PLLCLK of 16 MHz and a Bus Clock of
8.0 MHz. The PLL can be re-configured to other bus frequencies.
The clock sources for COP and RTI are based on the internal reference clock generator (IRC1M).
5.22.4.6.2
PLL Engaged External Mode (PEE)
In this mode, the Bus Clock is based on the PLLCLK as well (like PEI). The reference clock for the PLL is based on the external
oscillator. The adaptive spike filter and detection logic which uses the VCOCLK to filter and qualify the external oscillator clock
can be enabled.
The clock sources for COP and RTI can be based on the internal reference clock generator or on the external oscillator clock.
This mode can be entered from default mode PEI by performing the following steps:
1. Configure the PLL for desired bus frequency.
2. Optionally the adaptive spike filter and detection logic can be enabled by calculating the integer value for the
OSCFIL[4:0] bits and setting the bandwidth (OSCBW) accordingly.
3. Enable the external Oscillator (OSCE bit).
4. Wait for the PLL being locked (LOCK = 1) and the oscillator to start-up and additionally being qualified if the Adaptive
Oscillator Filter is enabled (UPOSC =1).
5. Clear all flags in the CPMUFLG register to be able to detect any future status bit change.
6. Optionally status interrupts can be enabled (CPMUINT register).
Since the Adaptive Oscillator Filter (adaptive spike filter and detection logic) uses the VCOCLK to continuously filter and qualify
the external oscillator clock, losing PLL lock status (LOCK=0), means losing the oscillator status information as well (UPOSC=0).
The impact of losing the oscillator status in PEE mode is as follows:
•
The PLLCLK is derived from the VCO clock (with its actual frequency) divided by four until the PLL locks again.
Application software needs to be prepared to deal with the impact of losing the oscillator status at any time.
MM912_637, Rev. 3.0
Freescale Semiconductor
320
5.22.4.6.3
PLL Bypassed External Mode (PBE)
In this mode, the Bus Clock is based on the external oscillator clock. The reference clock for the PLL is based on the external
oscillator. The adaptive spike filter and detection logic can be enabled which uses the VCOCLK to filter and qualify the external
oscillator clock.
The clock sources for COP and RTI can be based on the internal reference clock generator or on the external oscillator clock.
This mode can be entered from default mode PEI by performing the following steps:
1. Make sure the PLL configuration is valid.
2. Optionally, the adaptive spike filter and detection logic can be enabled by calculating the integer value for the
OSCFIL[4:0] bits and setting the bandwidth (OSCBW) accordingly.
3. Enable the external Oscillator (OSCE bit)
4. Wait for the PLL being locked (LOCK = 1) and the oscillator to start-up, and additionally being qualified if the Adaptive
Oscillator Filter is enabled (UPOSC=1).
5. Clear all flags in the CPMUFLG register to be able to detect any status bit change.
6. Optionally status interrupts can be enabled (CPMUINT register).
7. Select the Oscillator Clock (OSCCLK) as Bus Clock (PLLSEL=0)
Since the Adaptive Oscillator Filter (adaptive spike filter and detection logic) uses the VCOCLK to continuously filter and qualify
the external oscillator clock, losing PLL lock status (LOCK=0) means losing the oscillator status information as well (UPOSC=0).
The impact of losing the oscillator status in PBE mode is as follows:
•
PLLSEL is set automatically and the Bus Clock is switched back to the PLLCLK.
•
The PLLCLK is derived from the VCO clock (with its actual frequency) divided by four until the PLL locks again.
Application software needs to be prepared to deal with the impact of loosing the oscillator status at any time.
In the PBE mode, not every noise disturbance can be indicated by bits LOCK and UPOSC (both bits are based on the Bus Clock
domain). There are clock disturbances possible, after which UPOSC and LOCK both stay asserted, while occasional pauses on
the filtered OSCCLK and resulting Bus Clock occur. The adaptive spike filter is still functional and protects the Bus Clock from
frequency overshoot due to spikes on the external oscillator clock. The filtered OSCCLK and resulting Bus Clock will pause until
the PLL has stabilized again.
5.22.5
5.22.5.1
Resets
General
All reset sources are listed in Table 441. Refer to MCU specification for related vector addresses and priorities.
Table 441. Reset Summary
5.22.5.2
Reset Source
Local Enable
Power-On Reset (POR)
None
Low Voltage Reset (LVR)
None
External pin RESET
None
Illegal Address Reset
None
Clock Monitor Reset
OSCE Bit in CPMUOSC register
COP Reset
CR[2:0] in CPMUCOP register
Description of Reset Operation
Upon detection of any reset in Table 441, an internal circuit drives the RESET pin low for 512 PLLCLK cycles. After 512 PLLCLK
cycles, the RESET pin is released. The reset generator of the S12CPMU waits for additional 256 PLLCLK cycles and then
samples the RESET pin to determine the originating source. Table 442 shows which vector will be fetched.
MM912_637, Rev. 3.0
Freescale Semiconductor
321
Table 442. Reset Vector Selection
Sampled RESET Pin
Oscillator monitor
(256 cycles after release)
fail pending
COP timeout
pending
Vector Fetch
POR
LVR
1
0
0
1
1
X
Clock Monitor Reset
1
0
1
COP Reset
Illegal Address Reset
External pin RESET
POR
0
X
X
LVR
Illegal Address Reset
External pin RESET
NOTE
While System Reset is asserted, the PLLCLK runs with the frequency fVCORST.
The internal reset of the MCU remains asserted while the reset generator completes the 768 PLLCLK cycles long reset
sequence. In case the RESET pin is externally driven low for more than these 768 PLLCLK cycles (External Reset), the internal
reset remains asserted longer.
RESET
S12_CPMU drives
RESET pin low
fVCORST
PLLCLK
S12_CPMU releases
RESET pin
fVCORST
)
)
(
512 cycles
)
(
(
256 cycles
possibly RESET
driven low externally
Figure 100. RESET Timing
5.22.5.2.1
Clock Monitor Reset
When the external oscillator is enabled (OSCE=1), in case of a loss of oscillation or the oscillator frequency is below the failure
assert frequency fCMFA (see device electrical characteristics for values), the S12CPMU generates a clock monitor reset. In Full
Stop mode the external oscillator and the clock monitor are disabled.
5.22.5.2.2
Computer Operating Properly Watchdog (COP) Reset
The COP (free running watchdog timer) enables the user to check that a program is running and sequencing properly. When the
COP is being used, software is responsible for keeping the COP from timing out. If the COP times out, it is an indication that the
software is no longer being executed in the intended sequence, and a COP reset is generated.
The clock source for the COP is either IRCCLK or OSCCLK, depending on the setting of the COPOSCSEL bit. In Stop mode with
PSTP=1 (Pseudo Stop mode), COPOSCSEL=1 and PCE=1 the COP continues to run, else the COP counter halts in Stop mode.
Three control bits in the CPMUCOP register allow selection of seven COP timeout periods.
MM912_637, Rev. 3.0
Freescale Semiconductor
322
When COP is enabled, the program must write $55 and $AA (in this order) to the CPMUARMCOP register during the selected
timeout period. Once this is done, the COP timeout period is restarted. If the program fails to do this and the COP times out, a
COP reset is generated. Also, if any value other than $55 or $AA is written, a COP reset is generated.
Windowed COP operation is enabled by setting WCOP in the CPMUCOP register. In this mode, writes to the CPMUARMCOP
register to clear the COP timer must occur in the last 25% of the selected timeout period. A premature write will immediately reset
the part.
5.22.5.3
Power-on Reset (POR)
The on-chip POR circuitry detects when the internal supply VDD drops below an appropriate voltage level. The POR is
deasserted if the internal supply VDD exceeds an appropriate voltage level (voltage levels are not specified in this document,
because this internal supply is not visible on device pins).
5.22.5.4
Low-voltage Reset (LVR)
The on-chip LVR circuitry detects when one of the supply voltages VDD, VDDF, or VDDX, drops below an appropriate voltage
level. If LVR is deasserted, the MCU is fully operational at the specified maximum speed. The LVR assert and deassert levels for
the supply voltage VDDX are VLVRXA and VLVRXD, and are specified in the device reference manual.
5.22.6
Interrupts
The interrupt/reset vectors requested by the S12CPMU are listed in Table 443. Refer to MCU specification for related vector
addresses and priorities.
Table 443. S12CPMU Interrupt Vectors
5.22.6.1
5.22.6.1.1
Interrupt Source
CCR
Mask
Local Enable
RTI timeout interrupt
I bit
CPMUINT (RTIE)
PLL lock interrupt
I bit
CPMUINT (LOCKIE)
Oscillator status interrupt
I bit
CPMUINT (OSCIE)
Low voltage interrupt
I bit
CPMULVCTL (LVIE)
Description of Interrupt Operation
Real Time Interrupt (RTI)
The clock source for the RTI is either IRCCLK or OSCCLK, depending on the setting of the RTIOSCSEL bit. In Stop mode with
PSTP=1 (Pseudo Stop mode), RTIOSCSEL=1 and PRE=1 the RTI continues to run, else the RTI counter halts in Stop mode.
The RTI can be used to generate hardware interrupts at a fixed periodic rate. If enabled (by setting RTIE=1), this interrupt will
occur at the rate selected by the CPMURTI register. At the end of the RTI timeout period, the RTIF flag is set to one and a new
RTI timeout period starts immediately.
A write to the CPMURTI register restarts the RTI timeout period.
5.22.6.1.2
PLL Lock Interrupt
The S12CPMU generates a PLL Lock interrupt when the lock condition (LOCK status bit) of the PLL changes, either from a locked
state to an unlocked state, or vice versa. Lock interrupts are locally disabled by setting the LOCKIE bit to zero. The PLL Lock
interrupt flag (LOCKIF) is set to 1 when the lock condition has changed, and is cleared to 0 by writing a 1 to the LOCKIF bit.
MM912_637, Rev. 3.0
Freescale Semiconductor
323
5.22.6.1.3
Oscillator Status Interrupt
The Adaptive Oscillator filter contains two different features:
1. Filters spikes of the external oscillator clock.
2. Qualify the external oscillator clock.
When the OSCE bit is 0, then UPOSC stays 0. When OSCE=1 and OSCFILT = 0, then the filter is transparent and no spikes are
filtered. The UPOSC bit is then set after the LOCK bit is set.
Upon detection of a status change (UPOSC), where an unqualified oscillation becomes qualified or vice versa, the OSCIF flag is
set. Going into Full Stop mode or disabling the oscillator can also cause a status change of UPOSC.
Since the Adaptive Oscillator Filter is based on the PLLCLK, any change in PLL configuration or any other event which causes
the PLL lock status to be cleared, leads to a loss of the oscillator status information as well (UPOSC=0).
Oscillator status change interrupts are locally enabled with the OSCIE bit.
NOTE
Losing the oscillator status (UPOSC=0) affects the clock configuration of the system(268).
This needs to be addressed in application software.
Notes
268.For details refer to “Section 5.22.4.6, “System Clock Configurations”
5.22.6.1.4
Low-voltage Interrupt (LVI)
In FPM, the input voltage VDDXR is monitored. Whenever VDDXR drops below level VLVIA, the status bit LVDS is set to 1. When
VDDXR rises above level VLVID, the status bit LVDS is cleared to 0. An interrupt, indicated by flag LVIF = 1, is triggered by any
change of the status bit LVDS if interrupt enable bit LVIE = 1.
5.22.7
5.22.7.1
Initialization/Application Information
General Initialization information
Usually applications run in MCU Normal mode.
It is recommended to write the CPMUCOP register from the application program initialization routine after reset, regardless if the
COP is used in the application, even if a configuration is loaded via the flash memory after reset. By doing a “controlled” write
access in MCU Normal mode (with the right value for the application), the write once for the COP configuration bits
(WCOP,CR[2:0]) takes place, which protects these bits from further accidental change. If there is a program sequencing issue
(code runaway), the COP configuration cannot be accidentally modified.
MM912_637, Rev. 3.0
Freescale Semiconductor
324
MCU - Serial Peripheral Interface (S12SPIV5)
5.23
MCU - Serial Peripheral Interface (S12SPIV5)
MCU
5.23.1
ANALOG
Introduction
The SPI module allows a duplex, synchronous, serial communication, between the MCU and peripheral devices. Software can
poll the SPI status flags or the SPI operation can be interrupt driven.
5.23.1.1
Glossary of Terms
Table 444. Term Definition
5.23.1.2
SPI
Serial Peripheral Interface
SS
Slave Select
SCK
Serial Clock
MOSI
Master Output, Slave Input
MISO
Master Input, Slave Output
MOMI
Master Output, Master Input
SISO
Slave Input, Slave Output
Features
The SPI includes these distinctive features:
•
Master mode and slave mode
•
Selectable 8 or 16-bit transfer width
•
Bidirectional mode
•
Slave select output
•
Mode fault error flag with CPU interrupt capability
•
Double-buffered data register
•
Serial clock with programmable polarity and phase
•
Control of SPI operation during Wait mode
5.23.1.3
Modes of Operation
The SPI functions in three modes: run, wait, and stop.
•
Run mode
This is the basic mode of operation.
•
Wait mode
SPI operation in Wait mode is a configurable low power mode, controlled by the SPISWAI bit located in the SPICR2
register. In Wait mode, if the SPISWAI bit is clear, the SPI operates like in Run mode. If the SPISWAI bit is set, the SPI
goes into a power conservative state, with the SPI clock generation turned off. If the SPI is configured as a master, any
transmission in progress stops, but is resumed after CPU goes into Run mode. If the SPI is configured as a slave,
reception and transmission of data continues, so that the slave stays synchronized to the master.
•
Stop mode
The SPI is inactive in stop mode for reduced power consumption. If the SPI is configured as a master, any transmission
in progress stops, but is resumed after CPU goes into Run mode. If the SPI is configured as a slave, reception and
transmission of data continues, so that the slave stays synchronized to the master.
For a detailed description of operating modes, refer to Section 5.23.4.7, “Low Power Mode Options".
5.23.1.4
Block Diagram
Figure 101 gives an overview on the SPI architecture. The main parts of the SPI are status, control and data registers, shifter
logic, baud rate generator, master/slave control logic, and port control logic.
MM912_637, Rev. 3.0
Freescale Semiconductor
325
MCU - Serial Peripheral Interface (S12SPIV5)
SPI
2
SPI Control Register 1
BIDIROE
2
SPI Control Register 2
SPC0
SPI Status Register
SPIF MODF SPTEF
Interrupt Control
SPI
Interrupt
Request
Baud Rate Generator
Slave
Control
CPOL
CPHA
Phase + SCK In
Slave Baud Rate Polarity
Control
Master Baud Rate
Phase + SCK Out
Polarity
Control
Master
Control
Counter
Bus Clock
Prescaler Clock Select
SPPR
3
SPR
MOSI
Port
Control
Logic
SCK
SS
Baud Rate
Shift
Clock
Sample
Clock
3
Shifter
SPI Baud Rate Register
Data In
LSBFE=1
LSBFE=0
LSBFE=1
MSB
SPI Data Register
LSBFE=0
LSBFE=0 LSB
LSBFE=1
Data Out
Figure 101. SPI Block Diagram
5.23.2
External Signal Description
This section lists the name and description of all ports including inputs and outputs that do, or may, connect off chip. The SPI
module has a total of four external pins.
5.23.2.1
MOSI — Master Out/Slave In Pin
This pin is used to transmit data out of the SPI module when it is configured as a master and receive data when it is configured
as slave.
5.23.2.2
MISO — Master In/Slave Out Pin
This pin is used to transmit data out of the SPI module when configured as a slave and receive data when configured as master.
MM912_637, Rev. 3.0
Freescale Semiconductor
326
MCU - Serial Peripheral Interface (S12SPIV5)
5.23.2.3
SS — Slave Select Pin
This pin is used to output the select signal from the SPI module to another peripheral, with which a data transfer is to take place
when it is configured as a master, and is used as an input to receive the slave select signal when the SPI is configured as a slave.
5.23.2.4
SCK — Serial Clock Pin
In master mode, this is the synchronous output clock. In slave mode, this is the synchronous input clock.
5.23.3
Memory Map and Register Definition
This section provides a detailed description of address space and registers used by the SPI.
5.23.3.1
Module Memory Map
The memory map for the SPI is given in Table 445. The address listed for each register is the sum of a base address and an
address offset. The base address is defined at the SoC level and the address offset is defined at the module level. Reads from
the reserved bits return zeros and writes to the reserved bits have no effect.
Table 445. SPI Register Summary
Register
Name
0x00E8
R
SPICR1
W
0x00E9
R
SPICR2
W
0x00EA
R
SPIBR
W
0x00EB
R
Bit 7
6
5
4
3
2
1
Bit 0
SPIE
SPE
SPTIE
MSTR
CPOL
CPHA
SSOE
LSBFE
MODFEN
BIDIROE
SPISWAI
SPC0
SPR2
SPR1
SPR0
0
0
0
XFRW
0
0
SPPR2
SPPR1
SPPR0
SPIF
0
SPTEF
MODF
0
0
0
0
R9
R8
SPISR
W
0x00EC
R
R15
R14
R13
R12
R11
R10
SPIDRH
W
T15
T14
T13
T12
T11
T10
T9
T8
0x00ED
R
R7
R6
R5
R4
R3
R2
R1
R0
SPIDRL
W
T7
T6
T5
T4
T3
T2
T1
T0
0x00EE
R
Reserved
W
0x00EF
R
Reserved
W
= Unimplemented or Reserved
5.23.3.2
Register Descriptions
This section consists of register descriptions in address order. Each description includes a standard register diagram with an
associated figure number. Details of register bit and field function follow the register diagrams, in bit order.
MM912_637, Rev. 3.0
Freescale Semiconductor
327
MCU - Serial Peripheral Interface (S12SPIV5)
5.23.3.2.1
SPI Control Register 1 (SPICR1)
Table 446. SPI Control Register 1 (SPICR1)
0x00E8
R
W
Reset
7
6
5
4
3
2
1
0
SPIE
SPE
SPTIE
MSTR
CPOL
CPHA
SSOE
LSBFE
0
0
0
0
0
1
0
0
Read: Anytime
Write: Anytime
Table 447. SPICR1 Field Descriptions
Field
7
SPIE
6
SPE
5
SPTIE
4
MSTR
3
CPOL
2
CPHA
1
SSOE
0
LSBFE
Description
SPI Interrupt Enable Bit — This bit enables SPI interrupt requests, if SPIF or MODF status flag is set.
0 SPI interrupts disabled.
1 SPI interrupts enabled.
SPI System Enable Bit — This bit enables the SPI system and dedicates the SPI port pins to SPI system functions. If SPE
is cleared, SPI is disabled and forced into idle state, status bits in SPISR register are reset.
0 SPI disabled (lower power consumption).
1 SPI enabled, port pins are dedicated to SPI functions.
SPI Transmit Interrupt Enable — This bit enables SPI interrupt requests, if SPTEF flag is set.
0 SPTEF interrupt disabled.
1 SPTEF interrupt enabled.
SPI Master/Slave Mode Select Bit — This bit selects whether the SPI operates in master or slave mode. Switching the SPI
from master to slave or vice versa forces the SPI system into idle state.
0 SPI is in slave mode.
1 SPI is in master mode.
SPI Clock Polarity Bit — This bit selects an inverted or non-inverted SPI clock. To transmit data between SPI modules, the
SPI modules must have identical CPOL values. In master mode, a change of this bit will abort a transmission in progress and
force the SPI system into idle state.
0 Active-high clocks selected. In idle state SCK is low.
1 Active-low clocks selected. In idle state SCK is high.
SPI Clock Phase Bit — This bit is used to select the SPI clock format. In master mode, a change of this bit will abort a
transmission in progress and force the SPI system into idle state.
0 Sampling of data occurs at odd edges (1,3,5,...) of the SCK clock.
1 Sampling of data occurs at even edges (2,4,6,...) of the SCK clock.
Slave Select Output Enable — The SS output feature is enabled only in master mode, if MODFEN is set, by asserting the
SSOE as shown in Table 448. In master mode, a change of this bit will abort a transmission in progress and force the SPI
system into idle state.
LSB-First Enable — This bit does not affect the position of the MSB and LSB in the data register. Reads and writes of the
data register always have the MSB in the highest bit position. In master mode, a change of this bit will abort a transmission in
progress and force the SPI system into idle state.
0 Data is transferred most significant bit first.
1 Data is transferred least significant bit first.
Table 448. SS Input / Output Selection
MODFEN
SSOE
Master Mode
Slave Mode
0
0
SS not used by SPI
SS input
0
1
SS not used by SPI
SS input
1
0
SS input with MODF feature
SS input
1
1
SS is slave select output
SS input
MM912_637, Rev. 3.0
Freescale Semiconductor
328
MCU - Serial Peripheral Interface (S12SPIV5)
5.23.3.2.2
SPI Control Register 2 (SPICR2)
Table 449. SPI Control Register 2 (SPICR2)
0x00E9
7
R
6
0
XFRW
W
Reset
5
0
0
0
0
4
3
MODFEN
BIDIROE
0
0
2
0
1
0
SPISWAI
SPC0
0
0
0
= Unimplemented or Reserved
Read: Anytime
Write: Anytime; writes to the reserved bits have no effect
Table 450. SPICR2 Field Descriptions
Field
6
XFRW
4
MODFEN
3
BIDIROE
1
SPISWAI
0
SPC0
Description
Transfer Width — This bit is used for selecting the data transfer width. If 8-bit transfer width is selected, SPIDRL becomes
the dedicated data register and SPIDRH is unused. If 16-bit transfer width is selected, SPIDRH and SPIDRL form a 16-bit data
register. Refer to Section 5.23.3.2.4, “SPI Status Register (SPISR)" for information about transmit/receive data handling and
the interrupt flag clearing mechanism. In master mode, a change of this bit will abort a transmission in progress and force the
SPI system into idle state.
0 8-bit Transfer Width (n = 8)(269)
1 16-bit Transfer Width (n = 16)(269)
Mode Fault Enable Bit — This bit allows the MODF failure to be detected. If the SPI is in master mode and MODFEN is
cleared, then the SS port pin is not used by the SPI. In slave mode, the SS is available only as an input regardless of the value
of MODFEN. For an overview on the impact of the MODFEN bit on the SS port pin configuration, refer to Table 448. In master
mode, a change of this bit will abort a transmission in progress and force the SPI system into idle state.
0 SS port pin is not used by the SPI.
1 SS port pin with MODF feature.
Output Enable in the Bidirectional Mode of Operation — This bit controls the MOSI and MISO output buffer of the SPI,
when in bidirectional mode of operation (SPC0 is set). In master mode, this bit controls the output buffer of the MOSI port, in
slave mode it controls the output buffer of the MISO port. In master mode, with SPC0 set, a change of this bit will abort a
transmission in progress and force the SPI into idle state.
0 Output buffer disabled.
1 Output buffer enabled.
SPI Stop in Wait Mode Bit — This bit is used for power conservation while in wait mode.
0 SPI clock operates normally in wait mode.
1 Stop SPI clock generation when in wait mode.
Serial Pin Control Bit 0 — This bit enables bidirectional pin configurations as shown in Table 451. In master mode, a change
of this bit will abort a transmission in progress and force the SPI system into idle state.
Notes
269.n is used later in this document as a placeholder for the selected transfer width.
Table 451. Bidirectional Pin Configurations
Pin Mode
SPC0
BIDIROE
MISO
MOSI
Master Mode of Operation
Normal
0
Bidirectional
1
X
0
1
Master In
MISO not used by SPI
Master Out
Master In
Master I/O
Slave Mode of Operation
Normal
0
X
Slave Out
Slave In
MM912_637, Rev. 3.0
Freescale Semiconductor
329
MCU - Serial Peripheral Interface (S12SPIV5)
Table 451. Bidirectional Pin Configurations
Pin Mode
SPC0
Bidirectional
1
5.23.3.2.3
BIDIROE
MISO
MOSI
0
Slave In
1
Slave I/O
MOSI not used by SPI
SPI Baud Rate Register (SPIBR)
Table 452. SPI Baud Rate Register (SPIBR)
0x00EA
7
R
0
W
Reset
0
6
5
4
SPPR2
SPPR1
SPPR0
0
0
0
3
0
0
2
1
0
SPR2
SPR1
SPR0
0
0
0
= Unimplemented or Reserved
Read: Anytime
Write: Anytime; writes to the reserved bits have no effect
Table 453. SPIBR Field Descriptions
Field
Description
6–4
SPI Baud Rate Preselection Bits — These bits specify the SPI baud rates as shown in Table 454. In master mode, a change
of these bits will abort a transmission in progress and force the SPI system into idle state.
SPPR[2:0]
2–0
SPR[2:0]
SPI Baud Rate Selection Bits — These bits specify the SPI baud rates as shown in Table 454. In master mode, a change of
these bits will abort a transmission in progress and force the SPI system into idle state.
The baud rate divisor equation is as follows:
BaudRateDivisor = (SPPR + 1)  2(SPR + 1)
Eqn. 4
The baud rate can be calculated with the following equation:
Baud Rate = BusClock / BaudRateDivisor
Eqn. 5
NOTE
For maximum allowed baud rates, refer to Section 4.6.2.5, “SPI Timing" of this data sheet.
Table 454. Example SPI Baud Rate Selection (25 MHz Bus Clock)
SPPR2
SPPR1
SPPR0
SPR2
SPR1
SPR0
Baud Rate
Divisor
Baud Rate
0
0
0
0
0
0
2
12.5 Mbit/s
0
0
0
0
0
1
4
6.25 Mbit/s
0
0
0
0
1
0
8
3.125 Mbit/s
0
0
0
0
1
1
16
1.5625 Mbit/s
0
0
0
1
0
0
32
781.25 kbit/s
0
0
0
1
0
1
64
390.63 kbit/s
0
0
0
1
1
0
128
195.31 kbit/s
0
0
0
1
1
1
256
97.66 kbit/s
0
0
1
0
0
0
4
6.25 Mbit/s
MM912_637, Rev. 3.0
Freescale Semiconductor
330
MCU - Serial Peripheral Interface (S12SPIV5)
Table 454. Example SPI Baud Rate Selection (25 MHz Bus Clock) (continued)
Baud Rate
Divisor
SPPR2
SPPR1
SPPR0
SPR2
SPR1
SPR0
Baud Rate
0
0
1
0
0
1
8
3.125 Mbit/s
0
0
1
0
1
0
16
1.5625 Mbit/s
0
0
1
0
1
1
32
781.25 kbit/s
0
0
1
1
0
0
64
390.63 kbit/s
0
0
1
1
0
1
128
195.31 kbit/s
0
0
1
1
1
0
256
97.66 kbit/s
0
0
1
1
1
1
512
48.83 kbit/s
0
1
0
0
0
0
6
4.16667 Mbit/s
0
1
0
0
0
1
12
2.08333 Mbit/s
0
1
0
0
1
0
24
1.04167 Mbit/s
0
1
0
0
1
1
48
520.83 kbit/s
0
1
0
1
0
0
96
260.42 kbit/s
0
1
0
1
0
1
192
130.21 kbit/s
0
1
0
1
1
0
384
65.10 kbit/s
0
1
0
1
1
1
768
32.55 kbit/s
0
1
1
0
0
0
8
3.125 Mbit/s
0
1
1
0
0
1
16
1.5625 Mbit/s
0
1
1
0
1
0
32
781.25 kbit/s
0
1
1
0
1
1
64
390.63 kbit/s
0
1
1
1
0
0
128
195.31 kbit/s
0
1
1
1
0
1
256
97.66 kbit/s
0
1
1
1
1
0
512
48.83 kbit/s
0
1
1
1
1
1
1024
24.41 kbit/s
1
0
0
0
0
0
10
2.5 Mbit/s
1
0
0
0
0
1
20
1.25 Mbit/s
1
0
0
0
1
0
40
625 kbit/s
1
0
0
0
1
1
80
312.5 kbit/s
1
0
0
1
0
0
160
156.25 kbit/s
1
0
0
1
0
1
320
78.13 kbit/s
1
0
0
1
1
0
640
39.06 kbit/s
1
0
0
1
1
1
1280
19.53 kbit/s
1
0
1
0
0
0
12
2.08333 Mbit/s
1
0
1
0
0
1
24
1.04167 Mbit/s
1
0
1
0
1
0
48
520.83 kbit/s
1
0
1
0
1
1
96
260.42 kbit/s
1
0
1
1
0
0
192
130.21 kbit/s
1
0
1
1
0
1
384
65.10 kbit/s
1
0
1
1
1
0
768
32.55 kbit/s
1
0
1
1
1
1
1536
16.28 kbit/s
1
1
0
0
0
0
14
1.78571 Mbit/s
1
1
0
0
0
1
28
892.86 kbit/s
1
1
0
0
1
0
56
446.43 kbit/s
MM912_637, Rev. 3.0
Freescale Semiconductor
331
MCU - Serial Peripheral Interface (S12SPIV5)
Table 454. Example SPI Baud Rate Selection (25 MHz Bus Clock) (continued)
Baud Rate
Divisor
Baud Rate
1
112
223.21 kbit/s
0
224
111.61 kbit/s
0
1
448
55.80 kbit/s
1
0
896
27.90 kbit/s
1
1
1
1792
13.95 kbit/s
0
0
0
16
1.5625 Mbit/s
1
0
0
1
32
781.25 kbit/s
1
0
1
0
64
390.63 kbit/s
1
1
0
1
1
128
195.31 kbit/s
1
1
1
0
0
256
97.66 kbit/s
1
1
1
1
0
1
512
48.83 kbit/s
1
1
1
1
1
0
1024
24.41 kbit/s
1
1
1
1
1
1
2048
12.21 kbit/s
SPPR2
SPPR1
SPPR0
SPR2
SPR1
SPR0
1
1
0
0
1
1
1
0
1
0
1
1
0
1
1
1
0
1
1
1
0
1
1
1
1
1
1
1
1
1
5.23.3.2.4
SPI Status Register (SPISR)
Table 455. SPI Status Register (SPISR)
0x00EB
R
7
6
5
4
3
2
1
0
SPIF
0
SPTEF
MODF
0
0
0
0
0
0
1
0
0
0
0
0
W
Reset
= Unimplemented or Reserved
Read: Anytime
Write: Has no effect
Table 456. SPISR Field Descriptions
Field
7
SPIF
5
SPTEF
4
MODF
Description
SPIF Interrupt Flag — This bit is set after received data has been transferred into the SPI data register. For information about
clearing SPIF Flag, refer to Table 457.
0 Transfer not yet complete.
1 New data copied to SPIDR.
SPI Transmit Empty Interrupt Flag — If set, this bit indicates that the transmit data register is empty. For information about
clearing this bit and placing data into the transmit data register, refer to Table 458.
0 SPI data register not empty.
1 SPI data register empty.
Mode Fault Flag — This bit is set if the SS input becomes low while the SPI is configured as a master and mode fault detection
is enabled, MODFEN bit of SPICR2 register is set. Refer to MODFEN bit description in Section 5.23.3.2.2, “SPI Control
Register 2 (SPICR2)"”. The flag is cleared automatically by a read of the SPI status register (with MODF set) followed by a
write to the SPI control register 1.
0 Mode fault has not occurred.
1 Mode fault has occurred.
MM912_637, Rev. 3.0
Freescale Semiconductor
332
MCU - Serial Peripheral Interface (S12SPIV5)
Table 457. SPIF Interrupt Flag Clearing Sequence
XFRW Bit
SPIF Interrupt Flag Clearing Sequence
0
Read SPISR with SPIF == 1
then
Read SPIDRL
Byte Read SPIDRL (270)
or
1
Read SPISR with SPIF == 1
then
Byte Read SPIDRH (271)
Byte Read SPIDRL
or
Word Read (SPIDRH:SPIDRL)
Notes
270.Data in SPIDRH is lost, in this case.
271.SPIDRH can be read repeatedly without any effect on SPIF. SPIF Flag is cleared only by the read of SPIDRL after reading SPISR with
SPIF == 1.
Table 458. SPTEF Interrupt Flag Clearing Sequence
XFRW Bit
SPTEF Interrupt Flag Clearing Sequence
0
Read SPISR with SPTEF == 1
Write to SPIDRL (272)
then
Byte Write to SPIDRL (272) (273)
or
1
Read SPISR with SPTEF == 1
then
Byte Write to SPIDRH
(272) (274)
Byte Write to SPIDRL (272)
or
Word Write to (SPIDRH:SPIDRL) (272)
Notes
272.Any write to SPIDRH or SPIDRL with SPTEF == 0 is effectively ignored.
273.Data in SPIDRH is undefined in this case.
274.SPIDRH can be written repeatedly without any effect on SPTEF. SPTEF Flag is cleared only by writing to SPIDRL after reading SPISR with
SPTEF == 1.
5.23.3.2.5
SPI Data Register (SPIDR = SPIDRH:SPIDRL)
Table 459. SPI Data Register High (SPIDRH)
0x00EC
7
6
5
4
3
2
1
0
R
R15
R14
R13
R12
R11
R10
R9
R8
W
T15
T14
T13
T12
T11
T10
T9
T8
Reset
0
0
0
0
0
0
0
0
Table 460. SPI Data Register Low (SPIDRL)
0x00ED
7
6
5
4
3
2
1
0
R
R7
R6
R5
R4
R3
R2
R1
R0
W
T7
T6
T5
T4
T3
T2
T1
T0
Reset
0
0
0
0
0
0
0
0
Read: Anytime; read data only valid when SPIF is set 
Write: Anytime
MM912_637, Rev. 3.0
Freescale Semiconductor
333
MCU - Serial Peripheral Interface (S12SPIV5)
The SPI data register is both the input and output register for SPI data. A write to this register allows data to be queued
and transmitted. For an SPI configured as a master, queued data is transmitted immediately after the previous
transmission has completed. The SPI transmitter empty flag SPTEF in the SPISR register indicates when the SPI data
register is ready to accept new data.
Received data in the SPIDR is valid when SPIF is set.
If SPIF is cleared and data has been received, the received data is transferred from the receive shift register to the
SPIDR and SPIF is set.
If SPIF is set and not serviced, and a second data value has been received, the second received data is kept as valid
data in the receive shift register until the start of another transmission. The data in the SPIDR does not change.
If SPIF is set and valid data is in the receive shift register, and SPIF is serviced before the start of a third transmission,
the data in the receive shift register is transferred into the SPIDR and SPIF remains set (see Figure 102).
If SPIF is set and valid data is in the receive shift register, and SPIF is serviced after the start of a third transmission,
the data in the receive shift register has become invalid and is not transferred into the SPIDR (see Figure 103).
Data A Received
Data B Received
Data C Received
SPIF Serviced
Receive Shift Register
Data B
Data A
Data C
SPIF
SPI Data Register
Data B
Data A
= Unspecified
Data C
= Reception in progress
Figure 102. Reception with SPIF Serviced in Time
Data A Received
Data B Received
Data C Received
Data B Lost
SPIF Serviced
Receive Shift Register
Data B
Data A
Data C
SPIF
SPI Data Register
Data A
= Unspecified
Data C
= Reception in progress
Figure 103. Reception with SPIF Serviced Too Late
MM912_637, Rev. 3.0
Freescale Semiconductor
334
MCU - Serial Peripheral Interface (S12SPIV5)
5.23.4
Functional Description
The SPI module allows a duplex, synchronous, serial communication between the MCU and peripheral devices. Software can
poll the SPI status flags or SPI operation can be interrupt driven.
The SPI system is enabled by setting the SPI enable (SPE) bit in SPI control register 1. While SPE is set, the four associated
SPI port pins are dedicated to the SPI function as:
•
Slave select (SS)
•
Serial clock (SCK)
•
Master out/slave in (MOSI)
•
Master in/slave out (MISO)
The main element of the SPI system is the SPI data register. The n-bit(275) data register in the master and the n-bit(275) data
register in the slave are linked by the MOSI and MISO pins to form a distributed 2n-bit(275) register. When a data transfer operation
is performed, this 2n-bit(275) register is serially shifted n(275) bit positions by the S-clock from the master, so data is exchanged
between the master and the slave. Data written to the master SPI data register becomes the output data for the slave, and data
read from the master SPI data register after a transfer operation is the input data from the slave.
Notes
275.n depends on the selected transfer width, refer to Section 5.23.3.2.2, “SPI Control Register 2 (SPICR2)"
A read of SPISR with SPTEF = 1 followed by a write to SPIDR, puts data into the transmit data register. When a transfer is
complete and SPIF is cleared, received data is moved into the receive data register. This data register acts as the SPI receive
data register for reads and as the SPI transmit data register for writes. A common SPI data register address is shared for reading
data from the read data buffer and for writing data to the transmit data register.
The clock phase control bit (CPHA) and a clock polarity control bit (CPOL) in the SPI control register 1 (SPICR1) select one of
four possible clock formats to be used by the SPI system. The CPOL bit simply selects a non-inverted or inverted clock. The
CPHA bit is used to accommodate two fundamentally different protocols by sampling data on odd numbered SCK edges or on
even numbered SCK edges (see Section 5.23.4.3, “Transmission Formats").
The SPI can be configured to operate as a master or as a slave. When the MSTR bit in SPI control register1 is set, master mode
is selected, when the MSTR bit is clear, slave mode is selected.
NOTE
A change of CPOL or MSTR bit while there is a received byte pending in the receive shift
register will destroy the received byte and must be avoided.
5.23.4.1
Master Mode
The SPI operates in master mode when the MSTR bit is set. Only a master SPI module can initiate transmissions. A transmission
begins by writing to the master SPI data register. If the shift register is empty, data immediately transfers to the shift register. Data
begins shifting out on the MOSI pin under the control of the serial clock.
•
Serial clock
The SPR2, SPR1, and SPR0 baud rate selection bits, in conjunction with the SPPR2, SPPR1, and SPPR0 baud rate
preselection bits in the SPI baud rate register, control the baud rate generator and determine the speed of the
transmission. The SCK pin is the SPI clock output. Through the SCK pin, the baud rate generator of the master controls
the shift register of the slave peripheral.
•
MOSI, MISO pin
In master mode, the function of the serial data output pin (MOSI) and the serial data input pin (MISO) is determined by
the SPC0 and BIDIROE control bits.
•
SS pin
If MODFEN and SSOE are set, the SS pin is configured as slave select output. The SS output becomes low during each
transmission and is high when the SPI is in idle state.
If MODFEN is set and SSOE is cleared, the SS pin is configured as input for detecting mode fault error. If the SS input
becomes low, this indicates a mode fault error where another master tries to drive the MOSI and SCK lines. In this case,
the SPI immediately switches to slave mode, by clearing the MSTR bit and also disables the slave output buffer MISO
(or SISO in bidirectional mode). The result is that all outputs are disabled and SCK, MOSI, and MISO are inputs. If a
transmission is in progress when the mode fault occurs, the transmission is aborted and the SPI is forced into idle state.
MM912_637, Rev. 3.0
Freescale Semiconductor
335
MCU - Serial Peripheral Interface (S12SPIV5)
This mode fault error also sets the mode fault (MODF) flag in the SPI status register (SPISR). If the SPI interrupt enable
bit (SPIE) is set when the MODF flag becomes set, then an SPI interrupt sequence is also requested.
When a write to the SPI data register in the master occurs, there is a half SCK-cycle delay. After the delay, SCK is started
within the master. The rest of the transfer operation differs slightly, depending on the clock format specified by the SPI
clock phase bit, CPHA, in SPI control register 1 (see Section 5.23.4.3, “Transmission Formats").
NOTE
A change of the bits CPOL, CPHA, SSOE, LSBFE, XFRW, MODFEN, SPC0, or BIDIROE
with SPC0 set, SPPR2-SPPR0, and SPR2-SPR0 in master mode, will abort a transmission
in progress and force the SPI into idle state. The remote slave cannot detect this, therefore
the master must ensure that the remote slave is returned to idle state.
5.23.4.2
Slave Mode
The SPI operates in slave mode when the MSTR bit in SPI control register 1 is clear.
•
Serial clock
In slave mode, SCK is the SPI clock input from the master.
•
MISO, MOSI pins
In slave mode, the function of the serial data output pin (MISO) and serial data input pin (MOSI) is determined by the
SPC0 bit and BIDIROE bit in SPI control register 2.
•
SS pin
The SS pin is the slave select input. Before a data transmission occurs, the SS pin of the slave SPI must be low. SS
must remain low until the transmission is complete. If SS goes high, the SPI is forced into idle state.
The SS input also controls the serial data output pin. If SS is high (not selected), the serial data output pin is high
impedance, and, if SS is low, the first bit in the SPI data register is driven out of the serial data output pin. Also, if the
slave is not selected (SS is high), then the SCK input is ignored and no internal shifting of the SPI shift register occurs.
Although the SPI is capable of duplex operation, some SPI peripherals are capable of only receiving SPI data in a slave
mode. For these simpler devices, there is no serial data out pin.
NOTE
When peripherals with duplex capability are used, take care not to simultaneously enable
two receivers whose serial outputs drive the same system slave’s serial data output line.
As long as no more than one slave device drives the system slave’s serial data output line, it is possible for several slaves to
receive the same transmission from a master, although the master would not receive return information from all of the receiving
slaves.
If the CPHA bit in SPI control register 1 is clear, odd numbered edges on the SCK input cause the data at the serial data input
pin to be latched. Even numbered edges cause the value previously latched from the serial data input pin to shift into the LSB or
MSB of the SPI shift register, depending on the LSBFE bit.
If the CPHA bit is set, even numbered edges on the SCK input cause the data at the serial data input pin to be latched. Odd
numbered edges cause the value previously latched from the serial data input pin to shift into the LSB or MSB of the SPI shift
register, depending on the LSBFE bit.
When CPHA is set, the first edge is used to get the first data bit onto the serial data output pin. When CPHA is clear and the SS
input is low (slave selected), the first bit of the SPI data is driven out of the serial data output pin. After the nth(276) shift, the transfer
is considered complete and the received data is transferred into the SPI data register. To indicate transfer is complete, the SPIF
flag in the SPI status register is set.
Notes
276.n depends on the selected transfer width, refer to Section 5.23.3.2.2, “SPI Control Register 2 (SPICR2)"
NOTE
A change of the bits CPOL, CPHA, SSOE, LSBFE, MODFEN, SPC0, or BIDIROE with
SPC0 set in slave mode, will corrupt a transmission in progress and must be avoided.
MM912_637, Rev. 3.0
Freescale Semiconductor
336
MCU - Serial Peripheral Interface (S12SPIV5)
5.23.4.3
Transmission Formats
During an SPI transmission, data is transmitted (shifted out serially) and received (shifted in serially) simultaneously. The serial
clock (SCK) synchronizes shifting and sampling of the information on the two serial data lines. A slave select line allows selection
of an individual slave SPI device; slave devices that are not selected do not interfere with SPI bus activities. Optionally, on a
master SPI device, the slave select line can be used to indicate multiple-master bus contention.
MASTER SPI
SHIFT REGISTER
BAUD RATE
GENERATOR
SLAVE SPI
MISO
MISO
MOSI
MOSI
SCK
SCK
SS
VDD
SHIFT REGISTER
SS
Figure 104. Master/Slave Transfer Block Diagram
5.23.4.3.1
Clock Phase and Polarity Controls
Using two bits in the SPI control register 1, software selects one of four combinations of serial clock phase and polarity.
The CPOL clock polarity control bit specifies an active high or low clock and has no significant effect on the transmission format.
The CPHA clock phase control bit selects one of two fundamentally different transmission formats.
Clock phase and polarity should be identical for the master SPI device and the communicating slave device. In some cases, the
phase and polarity are changed between transmissions to allow a master device to communicate with peripheral slaves having
different requirements.
5.23.4.3.2
CPHA = 0 Transfer Format
The first edge on the SCK line is used to clock the first data bit of the slave into the master and the first data bit of the master into
the slave. In some peripherals, the first bit of the slave’s data is available at the slave’s data out pin as soon as the slave is
selected. In this format, the first SCK edge is issued a half cycle after SS has become low.
A half SCK cycle later, the second edge appears on the SCK line. When this second edge occurs, the value previously latched
from the serial data input pin is shifted into the LSB or MSB of the shift register, depending on LSBFE bit.
After this second edge, the next bit of the SPI master data is transmitted out of the serial data output pin of the master to the serial
input pin on the slave. This process continues for a total of 16 edges on the SCK line, with data being latched on odd numbered
edges and shifted on even numbered edges.
Data reception is double buffered. Data is shifted serially into the SPI shift register during the transfer and is transferred to the
parallel SPI data register after the last bit is shifted in.
After 2n(277) (last) SCK edges:
•
Data that was previously in the master SPI data register should now be in the slave data register and the data that was
in the slave data register should be in the master.
•
The SPIF flag in the SPI status register is set, indicating that the transfer is complete.
Notes
277.n depends on the selected transfer width, refer to Section 5.23.3.2.2, “SPI Control Register 2 (SPICR2)"
Figure 105 is a timing diagram of an SPI transfer where CPHA = 0. SCK waveforms are shown for CPOL = 0 and CPOL = 1. The
diagram may be interpreted as a master or slave timing diagram because the SCK, MISO, and MOSI pins are connected directly
between the master and the slave. The MISO signal is the output from the slave and the MOSI signal is the output from the
master. The SS pin of the master must be either high or reconfigured as a general purpose output not affecting the SPI.
MM912_637, Rev. 3.0
Freescale Semiconductor
337
MCU - Serial Peripheral Interface (S12SPIV5)
End of Idle State
Begin
1
SCK Edge Number
2
3
4
5
6
7
8
Begin of Idle State
End
Transfer
9
10
11
12
13 14
15
16
Bit 1
Bit 6
LSB Minimum 1/2 SCK
for tT, tl, tL
MSB
SCK (CPOL = 0)
SCK (CPOL = 1)
If next transfer begins here
SAMPLE I
MOSI/MISO
CHANGE O
MOSI pin
CHANGE O
MISO pin
SEL SS (O)
Master only
SEL SS (I)
tT
tL
MSB first (LSBFE = 0): MSB
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
LSB first (LSBFE = 1): LSB
Bit 1
Bit 2
Bit 3
Bit 4
Bit 5
tL = Minimum leading time before the first SCK edge
tT = Minimum trailing time after the last SCK edge
tI = Minimum idling time between transfers (minimum SS high time)
tL, tT, and tI are guaranteed for the master mode and required for the slave mode.
tI
tL
Figure 105. SPI Clock Format 0 (CPHA = 0), with 8-bit Transfer Width Selected (XFRW = 0)
MM912_637, Rev. 3.0
Freescale Semiconductor
338
MCU - Serial Peripheral Interface (S12SPIV5)
End of Idle State
SCK Edge Number
Begin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Begin of Idle State
End
Transfer
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
SCK (CPOL = 0)
SCK (CPOL = 1)
If next transfer begins here
SAMPLE I
MOSI/MISO
CHANGE O
MOSI pin
CHANGE O
MISO pin
SEL SS (O)
Master only
SEL SS (I)
MSB first (LSBFE = 0)
LSB first (LSBFE = 1)
tL
tT tI tL
MSB Bit 14Bit 13Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 LSB
Minimum 1/2 SCK
LSB Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 Bit 7 Bit 8 Bit 9 Bit 10 Bit 11Bit 12Bit 13Bit 14 MSB
for tT, tl, tL
tL = Minimum leading time before the first SCK edge
tT = Minimum trailing time after the last SCK edge
tI = Minimum idling time between transfers (minimum SS high time)
tL, tT, and tI are guaranteed for the master mode and required for the slave mode.
Figure 106. SPI Clock Format 0 (CPHA = 0), with 16-Bit Transfer Width Selected (XFRW = 1)
In slave mode, if the SS line is not deasserted between the successive transmissions, then the content of the SPI data register
is not transmitted; instead the last received data is transmitted. If the SS line is deasserted for at least minimum idle time (half
SCK cycle) between successive transmissions, then the content of the SPI data register is transmitted.
In master mode, with slave select output enabled, the SS line is always deasserted and reasserted between successive transfers
for at least minimum idle time.
5.23.4.3.3
CPHA = 1 Transfer Format
Some peripherals require the first SCK edge before the first data bit becomes available at the data out pin, the second edge
clocks data into the system. In this format, the first SCK edge is issued by setting the CPHA bit at the beginning of the n(278)-cycle
transfer operation.
Notes
278.n depends on the selected transfer width, refer to Section 5.23.3.2.2, “SPI Control Register 2 (SPICR2)"
The first edge of SCK occurs immediately after the half SCK clock cycle synchronization delay. This first edge commands the
slave to transfer its first data bit to the serial data input pin of the master.
A half SCK cycle later, the second edge appears on the SCK pin. This is the latching edge for both the master and slave.
When the third edge occurs, the value previously latched from the serial data input pin is shifted into the LSB or MSB of the SPI
shift register, depending on LSBFE bit. After this edge, the next bit of the master data is coupled out of the serial data output pin
of the master to the serial input pin on the slave.
This process continues for a total of n4 edges on the SCK line with data being latched on even numbered edges and shifting
taking place on odd numbered edges.
MM912_637, Rev. 3.0
Freescale Semiconductor
339
MCU - Serial Peripheral Interface (S12SPIV5)
Data reception is double buffered, data is serially shifted into the SPI shift register during the transfer and is transferred to the
parallel SPI data register after the last bit is shifted in.
After 2n4 SCK edges:
•
Data that was previously in the SPI data register of the master is now in the data register of the slave, and data that was
in the data register of the slave is in the master.
•
The SPIF flag bit in SPISR is set indicating that the transfer is complete.
Figure 107 shows two clocking variations for CPHA = 1. The diagram may be interpreted as a master or slave timing diagram,
because the SCK, MISO, and MOSI pins are connected directly between the master and the slave. The MISO signal is the output
from the slave, and the MOSI signal is the output from the master. The SS line is the slave select input to the slave. The SS pin
of the master must be either high or reconfigured as a general purpose output not affecting the SPI.
End of Idle State
Begin
SCK Edge Number
1
2
3
4
End
Transfer
5
6
7
8
9
10
11
12
13 14
Begin of Idle State
15
16
SCK (CPOL = 0)
SCK (CPOL = 1)
If next transfer begins here
SAMPLE I
MOSI/MISO
CHANGE O
MOSI pin
CHANGE O
MISO pin
SEL SS (O)
Master only
SEL SS (I)
tT
tL
tI
tL
MSB first (LSBFE = 0):
LSB first (LSBFE = 1):
MSB
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
LSB Minimum 1/2 SCK
for tT, tl, tL
LSB
Bit 1
Bit 2
Bit 3
Bit 4
Bit 5
Bit 6
MSB
tL = Minimum leading time before the first SCK edge, not required for back-to-back transfers
tT = Minimum trailing time after the last SCK edge
tI = Minimum idling time between transfers (minimum SS high time), not required for back-to-back transfers
Figure 107. SPI Clock Format 1 (CPHA = 1), with 8-Bit Transfer Width Selected (XFRW = 0)
MM912_637, Rev. 3.0
Freescale Semiconductor
340
MCU - Serial Peripheral Interface (S12SPIV5)
End of Idle State
SCK Edge Number
Begin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Begin of Idle State
End
Transfer
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
SCK (CPOL = 0)
SCK (CPOL = 1)
If next transfer begins here
SAMPLE I
MOSI/MISO
CHANGE O
MOSI pin
CHANGE O
MISO pin
SEL SS (O)
Master only
SEL SS (I)
tT tI tL
Minimum 1/2 SCK
for tT, tl, tL
tL
MSB first (LSBFE = 0)
LSB first (LSBFE = 1)
MSB Bit 14Bit 13Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 LSB
LSB Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 Bit 7 Bit 8 Bit 9 Bit 10 Bit 11Bit 12Bit 13Bit 14 MSB
tL = Minimum leading time before the first SCK edge, not required for back-to-back transfers
tT = Minimum trailing time after the last SCK edge
tI = Minimum idling time between transfers (minimum SS high time), not required for back-to-back transfers
Figure 108. SPI Clock Format 1 (CPHA = 1), with 16-Bit Transfer Width Selected (XFRW = 1)
The SS line can remain active low between successive transfers (can be tied low at all times). This format is sometimes preferred
in systems having a single fixed master and a single slave that drive the MISO data line.
•
Back-to-back transfers in master mode
In master mode, if a transmission has completed and new data is available in the SPI data register, this data is sent out
immediately without a trailing and minimum idle time.
The SPI interrupt request flag (SPIF) is common to both the master and slave modes. SPIF gets set one half SCK cycle after the
last SCK edge.
5.23.4.4
SPI Baud Rate Generation
Baud rate generation consists of a series of divider stages. Six bits in the SPI baud rate register (SPPR2, SPPR1, SPPR0, SPR2,
SPR1, and SPR0) determine the divisor to the SPI module clock which results in the SPI baud rate.
The SPI clock rate is determined by the product of the value in the baud rate preselection bits (SPPR2–SPPR0) and the value
in the baud rate selection bits (SPR2–SPR0). The module clock divisor equation is shown in Equation 6.
BaudRateDivisor = (SPPR + 1)  2(SPR + 1)
Eqn. 6
When all bits are clear (the default condition), the SPI module clock is divided by 2. When the selection bits (SPR2–SPR0) are
001 and the preselection bits (SPPR2–SPPR0) are 000, the module clock divisor becomes 4. When the selection bits are 010,
the module clock divisor becomes 8, etc.
When the preselection bits are 001, the divisor determined by the selection bits is multiplied by 2. When the preselection bits are
010, the divisor is multiplied by 3, etc. See Table 454 for baud rate calculations for all bit conditions, based on a 25 MHz bus
clock. The two sets of selects allows the clock to be divided by a non-power of two to achieve other baud rates such as divide by
6, divide by 10, etc.
MM912_637, Rev. 3.0
Freescale Semiconductor
341
MCU - Serial Peripheral Interface (S12SPIV5)
The baud rate generator is activated only when the SPI is in master mode and a serial transfer is taking place. In the other cases,
the divider is disabled to decrease IDD current.
NOTE
For maximum allowed baud rates, refer to Section 4.6.2.5, “SPI Timing" of this data sheet.
5.23.4.5
5.23.4.5.1
Special Features
SS Output
The SS output feature automatically drives the SS pin low during transmission, to select external devices and drives it high during
idle to deselect external devices. When SS output is selected, the SS output pin is connected to the SS input pin of the external
device.
The SS output is available only in master mode during normal SPI operation by asserting SSOE and MODFEN bit as shown in
Table 448.
The mode fault feature is disabled while SS output is enabled.
NOTE
Care must be taken when using the SS output feature in a multimaster system because the
mode fault feature is not available for detecting system errors between masters.
5.23.4.5.2
Bidirectional Mode (MOMI or SISO)
The bidirectional mode is selected when the SPC0 bit is set in SPI control register 2 (see Table 461). In this mode, the SPI uses
only one serial data pin for the interface with external device(s). The MSTR bit decides which pin to use. The MOSI pin becomes
the serial data I/O (MOMI) pin for the master mode, and the MISO pin becomes serial data I/O (SISO) pin for the slave mode.
The MISO pin in master mode and MOSI pin in slave mode are not used by the SPI.
Table 461. Normal Mode and Bidirectional Mode
When SPE = 1
Master Mode MSTR = 1
Serial Out
Normal Mode
SPC0 = 0
MOSI
MOSI
Serial In
SPI
SPI
Serial In
Bidirectional Mode
SPC0 = 1
Slave Mode MSTR = 0
MISO
Serial Out
MOMI
Serial Out
MISO
Serial In
BIDIROE
SPI
SPI
BIDIROE
Serial In
Serial Out
SISO
The direction of each serial I/O pin depends on the BIDIROE bit. If the pin is configured as an output, serial data from the shift
register is driven out on the pin. The same pin is also the serial input to the shift register.
•
The SCK is output for the master mode and input for the slave mode.
•
The SS is the input or output for the master mode, and it is always the input for the slave mode.
•
The bidirectional mode does not affect SCK and SS functions.
MM912_637, Rev. 3.0
Freescale Semiconductor
342
MCU - Serial Peripheral Interface (S12SPIV5)
NOTE
In bidirectional master mode, with mode fault enabled, both data pins MISO and MOSI can
be occupied by the SPI, though MOSI is normally used for transmissions in bidirectional
mode and MISO is not used by the SPI. If a mode fault occurs, the SPI is automatically
switched to slave mode. In this case, MISO becomes occupied by the SPI and MOSI is not
used. This must be considered, if the MISO pin is used for another purpose.
5.23.4.6
Error Conditions
The SPI has one error condition: Mode fault error
5.23.4.6.1
Mode Fault Error
If the SS input becomes low while the SPI is configured as a master, it indicates a system error where more than one master may
be trying to drive the MOSI and SCK lines simultaneously. This condition is not permitted in normal operation, the MODF bit in
the SPI status register is set automatically, provided the MODFEN bit is set.
In the special case where the SPI is in master mode and MODFEN bit is cleared, the SS pin is not used by the SPI. In this special
case, the mode fault error function is inhibited and MODF remains cleared. In case the SPI system is configured as a slave, the
SS pin is a dedicated input pin. Mode fault error doesn’t occur in slave mode.
If a mode fault error occurs, the SPI is switched to slave mode, with the exception that the slave output buffer is disabled. So
SCK, MISO, and MOSI pins are forced to be high-impedance inputs to avoid any possibility of conflict with another output driver.
A transmission in progress is aborted and the SPI is forced into idle state.
If the mode fault error occurs in the bidirectional mode for a SPI system configured in master mode, output enable of the MOMI
(MOSI in bidirectional mode) is cleared if it was set. No mode fault error occurs in the bidirectional mode for SPI system
configured in slave mode.
The mode fault flag is cleared automatically by a read of the SPI status register (with MODF set) followed by a write to SPI control
register 1. If the mode fault flag is cleared, the SPI becomes a normal master or slave again.
NOTE
If a mode fault error occurs and a received data byte is pending in the receive shift register,
this data byte will be lost.
5.23.4.7
5.23.4.7.1
Low Power Mode Options
SPI in Run Mode
In run mode with the SPI system enable (SPE) bit in the SPI control register clear, the SPI system is in a low-power, disabled
state. SPI registers remain accessible, but clocks to the core of this module are disabled.
5.23.4.7.2
SPI in Wait Mode
SPI operation in wait mode depends upon the state of the SPISWAI bit in SPI control register 2.
•
If SPISWAI is clear, the SPI operates normally when the CPU is in wait mode
•
If SPISWAI is set, SPI clock generation ceases and the SPI module enters a power conservation state when the CPU
is in wait mode.
— If SPISWAI is set and the SPI is configured for master, any transmission and reception in progress stops at wait
mode entry. The transmission and reception resumes when the SPI exits wait mode.
— If SPISWAI is set and the SPI is configured as a slave, any transmission and reception in progress continues if the
SCK continues to be driven from the master. This keeps the slave synchronized to the master and the SCK.
If the master transmits several bytes while the slave is in wait mode, the slave will continue to send out bytes
consistent with the operation mode at the start of wait mode (i.e., if the slave is currently sending its SPIDR to the
master, it will continue to send the same byte. Else if the slave is currently sending the last received byte from the
master, it will continue to send each previous master byte).
MM912_637, Rev. 3.0
Freescale Semiconductor
343
MCU - Serial Peripheral Interface (S12SPIV5)
NOTE
Care must be taken when expecting data from a master while the slave is in wait or stop
mode. Even though the shift register will continue to operate, the rest of the SPI is shut down
(i.e., a SPIF interrupt will not be generated until exiting stop or wait mode). Also, the byte
from the shift register will not be copied into the SPIDR register until after the slave SPI has
exited wait or stop mode. In slave mode, a received byte pending in the receive shift register
will be lost when entering wait or stop mode. An SPIF flag and SPIDR copy is generated only
if wait mode is entered or exited during a transmission. If the slave enters wait mode in idle
mode and exits wait mode in idle mode, neither a SPIF nor a SPIDR copy will occur.
5.23.4.7.3
SPI in Stop Mode
Stop mode is dependent on the system. The SPI enters stop mode when the module clock is disabled (held high or low). If the
SPI is in master mode and exchanging data when the CPU enters stop mode, the transmission is frozen until the CPU exits stop
mode. After stop, data to and from the external SPI is exchanged correctly. In slave mode, the SPI will stay synchronized with
the master.
The stop mode is not dependent on the SPISWAI bit.
5.23.4.7.4
Reset
The reset values of registers and signals are described in Section 5.23.3, “Memory Map and Register Definition", which details
the registers and their bit fields.
•
If a data transmission occurs in slave mode after reset without a write to SPIDR, it will transmit garbage, or the data last
received from the master before the reset.
•
Reading from the SPIDR after reset will always read zeros.
5.23.4.7.5
Interrupts
The SPI only originates interrupt requests when the SPI is enabled (SPE bit in SPICR1 set). The following is a description of how
the SPI makes a request and how the MCU should acknowledge that request. The interrupt vector offset and interrupt priority
are chip dependent.
The interrupt flags MODF, SPIF, and SPTEF are logically ORed to generate an interrupt request.
5.23.4.7.5.1 MODF
MODF occurs when the master detects an error on the SS pin. The master SPI must be configured for the MODF feature (see
Table 448). After MODF is set, the current transfer is aborted and the following bit is changed: MSTR = 0, The master bit in
SPICR1 resets.
The MODF interrupt is reflected in the status register MODF flag. Clearing the flag will also clear the interrupt. This interrupt will
stay active while the MODF flag is set. MODF has an automatic clearing process which is described in Section 5.23.3.2.4, “SPI
Status Register (SPISR)".
5.23.4.7.5.2 SPIF
SPIF occurs when new data has been received and copied to the SPI data register. After SPIF is set, it does not clear until it is
serviced. SPIF has an automatic clearing process, which is described in Section 5.23.3.2.4, “SPI Status Register (SPISR)".
5.23.4.7.5.3 SPTEF
SPTEF occurs when the SPI data register is ready to accept new data. After SPTEF is set, it does not clear until it is serviced.
SPTEF has an automatic clearing process, which is described in Section 5.23.3.2.4, “SPI Status Register (SPISR)".
MM912_637, Rev. 3.0
Freescale Semiconductor
344
128 kByte Flash Module (S12FTMRC128K1V1)
5.24
128 kByte Flash Module (S12FTMRC128K1V1)
MCU
5.24.1
ANALOG
Introduction
The FTMRC128K1 module implements the following:
•
128 kbytes of P-Flash (Program Flash) memory
•
4.0 kbytes of D-Flash (Data Flash) memory
The 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. The user interface to the memory controller consists of the indexed Flash Common Command Object
(FCCOB) register which is written to with the command, global address, data, and any required command parameters. The
memory controller must complete the execution of a command before the FCCOB register can be written to with a new command.
CAUTION
A Flash word or phrase must be in the erased state before being programmed. Cumulative
programming of bits within a Flash word or phrase is not allowed.
The Flash memory may be read as bytes, aligned words, or misaligned words. Read access time is one bus cycle for bytes and
aligned words, and two bus cycles for misaligned words. For Flash memory, an erased bit reads 1 and a programmed bit reads 0.
It is possible to read from P-Flash memory while some commands are executing on D-Flash memory. It is not possible to read
from D-Flash memory while a command is executing on P-Flash memory. Simultaneous P-Flash and D-Flash operations are
discussed in Section 5.24.4.4, “Allowed Simultaneous P-Flash and D-Flash Operations".
Both P-Flash and D-Flash memories are implemented with Error Correction Codes (ECC) that can resolve single bit faults and
detect double bit faults. For P-Flash memory, the ECC implementation requires that programming be done on an aligned 8-byte
basis (a Flash phrase). Since P-Flash memory is always read by half-phrase, only one single bit fault in an aligned 4-byte
half-phrase containing the byte or word accessed will be corrected.
5.24.1.1
Glossary
Command Write Sequence — An MCU instruction sequence to execute built-in algorithms (including program and erase) on
the Flash memory.
D-Flash Memory — The D-Flash memory constitutes the nonvolatile memory store for data.
D-Flash Sector — The D-Flash sector is the smallest portion of the D-Flash memory that can be erased. The D-Flash sector
consists of four 64-byte rows for a total of 256-bytes.
NVM Command Mode — An NVM mode using the CPU to setup the FCCOB register to pass parameters required for Flash
command execution.
Phrase — An aligned group of four 16-bit words within the P-Flash memory. Each phrase includes two sets of aligned double
words with each set, including 7 ECC bits for single bit fault correction and double bit fault detection within each double word.
P-Flash Memory — The P-Flash memory constitutes the main nonvolatile memory store for applications.
P-Flash Sector — The P-Flash sector is the smallest portion of the P-Flash memory that can be erased. Each P-Flash sector
contains 512-bytes.
Program IFR — Nonvolatile information register located in the P-Flash block that contains the Device ID, Version ID, and the
Program Once field.
MM912_637, Rev. 3.0
Freescale Semiconductor
345
128 kByte Flash Module (S12FTMRC128K1V1)
5.24.1.2
5.24.1.2.1
•
•
•
•
•
•
D-Flash Features
4.0 kbytes of D-Flash memory composed of one 4.0 kbyte Flash block divided into 16 sectors of 256-bytes
Single bit fault correction and double bit fault detection within a word during read operations
Automated program and erase algorithm with verify and generation of ECC parity bits
Fast sector erase and word program operation
Protection scheme to prevent accidental program or erase of D-Flash memory
Ability to program up to four words in a burst sequence
5.24.1.2.3
•
•
•
P-Flash Features
128 kbytes of P-Flash memory composed of one 128 kbyte Flash block divided into 256 sectors of 512-bytes
Single bit fault correction and double bit fault detection within a 32-bit double word during read operations
Automated program and erase algorithm with verify and generation of ECC parity bits
Fast sector erase and phrase program operation
Ability to read the P-Flash memory while programming a word in the D-Flash memory
Flexible protection scheme to prevent accidental program or erase of P-Flash memory
5.24.1.2.2
•
•
•
•
•
•
Features
Other Flash Module Features
No external high-voltage power supply required for Flash memory program and erase operations
Interrupt generation on Flash command completion and Flash error detection
Security mechanism to prevent unauthorized access to the Flash memory
5.24.1.3
Block Diagram
The block diagram of the Flash module is shown in Figure 109.
Command
Interrupt
Request
Error
Interrupt
Request
Flash
Interface
Registers
Protection
16-bit
internal
bus
sector 0
sector 1
Security
Bus
Clock
CPU
Clock
Divider FCLK
Memory
Controller
P-Flash
32Kx39
sector 255
D-Flash
2Kx22
sector 0
sector 1
Scratch RAM
384x16
sector 15
Figure 109. FTMRC128K1 Block Diagram
MM912_637, Rev. 3.0
Freescale Semiconductor
346
128 kByte Flash Module (S12FTMRC128K1V1)
5.24.2
External Signal Description
The Flash module contains no signals that connect off-chip.
5.24.3
Memory Map and Registers
This section describes the memory map and registers for the Flash module. Read data from unimplemented memory space in
the Flash module is undefined. Write access to unimplemented or reserved memory space in the Flash module will be ignored
by the Flash module.
5.24.3.1
Module Memory Map
The S12 architecture places the P-Flash memory between global addresses 0x2_0000 and 0x3_FFFF, as shown in
Table 462.The P-Flash memory map is shown in Figure 110.
Table 462. P-Flash Memory Addressing
Global Address
Size
(Bytes)
Description
0x2_0000 – 0x3_FFFF
128 k
P-Flash Block Contains Flash Configuration Field
(see Table 463)
The FPROT register, described in Section 5.24.3.2.9, “P-Flash Protection Register (FPROT)", can be set to protect regions in
the Flash memory from accidental program or erase. Three separate memory regions, one growing upward from global address
0x3_8000 in the Flash memory (called the lower region), one growing downward from global address 0x3_FFFF in the Flash
memory (called the higher region), and the remaining addresses in the Flash memory, can be activated for protection. The Flash
memory addresses covered by these protectable regions are shown in the P-Flash memory map. The higher address region is
mainly targeted to hold the boot loader code since it covers the vector space. Default protection settings as well as security
information that allows the MCU to restrict access to the Flash module are stored in the Flash configuration field as described in
Table 463.
Table 463. Flash Configuration Field
Global Address
Size (Bytes)
Description
0x3_FF00-0x3_FF07
8
Backdoor Comparison Key
Refer to Section 5.24.4.5.11, “Verify Backdoor Access Key Command", and
Section 5.24.5.1, “Unsecuring the MCU using Backdoor Key Access".
0x3_FF08-0x3_FF0B(279)
4
Reserved
0x3_FF0C(279)
1
P-Flash Protection byte.
Refer to Section 5.24.3.2.9, “P-Flash Protection Register (FPROT)".
0x3_FF0D(279)
1
D-Flash Protection byte.
Refer to Section 5.24.3.2.10, “D-Flash Protection Register (DFPROT)".
0x3_FF0E(279)
1
Flash Nonvolatile byte
Refer to Section 5.24.3.2.16, “Flash Option Register (FOPT)".
0x3_FF0F(279)
1
Flash Security byte
Refer to Section 5.24.3.2.2, “Flash Security Register (FSEC)".
Notes
279.0x3FF08-0x3_FF0F form a Flash phrase and must be programmed in a single command write sequence. Each byte in the 0x3_FF08 0x3_FF0B reserved field should be programmed to 0xFF.
MM912_637, Rev. 3.0
Freescale Semiconductor
347
128 kByte Flash Module (S12FTMRC128K1V1)
P-Flash START = 0x2_0000
Flash Protected/Unprotected Region
96 kbytes
0x3_8000
0x3_8400
0x3_8800
0x3_9000
Flash Protected/Unprotected Lower Region
1.0, 2.0, 4.0, 8.0 kbytes
Protection
Fixed End
0x3_A000
Flash Protected/Unprotected Region
8.0 kbytes (up to 29 kbytes)
Protection
Movable End
0x3_C000
Protection
Fixed End
Flash Protected/Unprotected Higher Region
2.0, 4.0, 8.0, 16 kbytes
0x3_E000
0x3_F000
0x3_F800
Flash Configuration Field
16 bytes (0x3_FF00 - 0x3_FF0F)
P-Flash END = 0x3_FFFF
Figure 110. P-Flash Memory Map
Table 464. Program IFR Fields
Global Address
Size (Bytes)
Field Description
0x0_4000 – 0x0_4007
8
Reserved
0x0_4008 – 0x0_40B5
174
Reserved
0x0_40B6 – 0x0_40B7
2
Version ID(280)
0x0_40B8 – 0x0_40BF
8
Reserved
0x0_40C0 – 0x0_40FF
64
Program Once Field. Refer to Section 5.24.4.5.6, “Program Once Command".
Notes
280.Used to track firmware patch versions, see Section 5.24.4.2, “IFR Version ID Word".
MM912_637, Rev. 3.0
Freescale Semiconductor
348
128 kByte Flash Module (S12FTMRC128K1V1)
Table 465. D-Flash and Memory Controller Resource Fields
Global Address
Size (Bytes)
Description
0x0_4000 – 0x0_43FF
1,024
Reserved
0x0_4400 – 0x0_53FF
4,096
D-Flash Memory
Reserved
0x0_5400 – 0x0_57FF
1,024
0x0_5800 – 0x0_5AFF
768
0x0_5B00 – 0x0_5FFF
1,280
Reserved
0x0_6000 – 0x0_67FF
2,048
Reserved
0x0_6800 – 0x0_7FFF
6,144
Reserved
Memory Controller Scratch RAM (RAMON(281) = 1)
Notes
281.MMCCTL1 register bit
0x0_4000
0x0_40FF
P-Flash IFR 1.0 kbyte
D-Flash Start = 0x0_4400
D-Flash Memory
4.0 kbytes
D-Flash End = 0x0_53FF
Reserved 1.0 kbyte
RAM Start = 0x0_5800
RAM End = 0x0_5AFF
Scratch Ram 768 bytes (RAMON)
Reserved 1280 bytes
0x0_6000
Reserved 2.0 kbytes
0x0_6800
Reserved 6.0 kbytes
0x0_7FFF
Figure 111. D-Flash and Memory Controller Resource Memory Map
5.24.3.2
Register Descriptions
The Flash module contains a set of 20 control and status registers located between 0x0100 and 0x0113. A summary of the Flash
module registers is given in Table 466 with detailed descriptions in the following subsections.
CAUTION
Writes to any Flash register must be avoided while a Flash command is active (CCIF=0) to
prevent corruption of Flash register contents and adversely affect Memory Controller
behavior.
MM912_637, Rev. 3.0
Freescale Semiconductor
349
128 kByte Flash Module (S12FTMRC128K1V1)
Table 466. FTMRC128K1 Register Summary
Address
& Name
7
0x0100
R
FCLKDIV
W
0x0101
R
FSEC
W
0x0102
R
FCCOBIX
W
0x0103
R
FRSV0
W
0x0104
R
FCNFG
W
0x0105
R
FERCNFG
W
0x0106
R
FSTAT
W
0x0107
R
FERSTAT
W
0x0108
R
FPROT
W
0x0109
R
DFPROT
W
0x010A
R
FCCOBHI
W
0x010B
R
FCCOBLO
W
0x010C
R
FRSV1
W
0x010D
R
FRSV2
W
0x010E
R
FRSV3
W
0x010F
R
FRSV4
W
0x0110
R
FOPT
W
0x0111
R
FRSV5
W
0x0112
R
FRSV6
W
0x01103
R
FRSV7
W
6
5
4
3
2
1
0
FDIVLCK
FDIV5
FDIV4
FDIV3
FDIV2
FDIV1
FDIV0
KEYEN1
KEYEN0
RNV5
RNV4
RNV3
RNV2
SEC1
SEC0
0
0
0
0
0
CCOBIX2
CCOBIX1
CCOBIX0
0
0
0
0
0
0
0
0
0
0
0
0
FDFD
FSFD
0
0
0
0
0
DFDIE
SFDIE
ACCERR
FPVIOL
MGBUSY
RSVD
MGSTAT1
MGSTAT0
0
0
0
0
DFDIF
SFDIF
FPHDIS
FPHS1
FPHS0
FPLDIS
FPLS1
FPLS0
0
0
0
DPS3
DPS2
DPS1
DPS0
CCOB15
CCOB14
CCOB13
CCOB12
CCOB11
CCOB10
CCOB9
CCOB8
CCOB7
CCOB6
CCOB5
CCOB4
CCOB3
CCOB2
CCOB1
CCOB0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
NV7
NV6
NV5
NV4
NV3
NV2
NV1
NV0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
FDIVLD
CCIE
0
CCIF
0
FPOPEN
DPOPEN
0
0
RNV6
IGNSF
= Unimplemented or Reserved
MM912_637, Rev. 3.0
Freescale Semiconductor
350
128 kByte Flash Module (S12FTMRC128K1V1)
5.24.3.2.1
Flash Clock Divider Register (FCLKDIV)
The FCLKDIV register is used to control timed events in program and erase algorithms.
Table 467. Flash Clock Divider Register (FCLKDIV)
Address: 0x0100
7
R
6
FDIVLD
W
Reset
0
5
4
3
FDIVLCK
0
2
1
0
0
0
0
FDIV[5:0]
0
0
0
= Unimplemented or Reserved
All bits in the FCLKDIV register are readable, bit 7 is not writable, bit 6 is write-once-hi and controls the writability of the FDIV field.
CAUTION
The FCLKDIV register must never be written to while a Flash command is executing
(CCIF=0). The FCLKDIV register is writable during the Flash reset sequence even though
CCIF is clear.
Table 468. FCLKDIV Field Descriptions
Field
7
FDIVLD
6
FDIVLCK
5–0
FDIV[5:0]
Description
Clock Divider Loaded
0 FCLKDIV register has not been written since the last reset
1 FCLKDIV register has been written since the last reset
Clock Divider Locked
0 FDIV field is open for writing
1 FDIV value is locked and cannot be changed. Once the lock bit is set high, only reset can clear this bit and restore writability
to the FDIV field.
Clock Divider Bits — FDIV[5:0] must be set to effectively divide BUSCLK down to 1.0 MHz to control timed events during
Flash program and erase algorithms. Table 469 shows recommended values for FDIV[5:0] based on the BUSCLK frequency.
Refer to Section 5.24.4.3, “Flash Command Operations", for more information.
MM912_637, Rev. 3.0
Freescale Semiconductor
351
128 kByte Flash Module (S12FTMRC128K1V1)
Table 469. FDIV Values for Various BUSCLK Frequencies
BUSCLK Frequency
(MHz)
MIN(282)
MAX(283)
1.0
1.6
1.6
2.6
BUSCLK Frequency
(MHz)
FDIV[5:0]
FDIV[5:0]
MIN(282)
MAX(283)
0x00
16.6
17.6
2.6
0x01
17.6
18.6
0x11
3.6
0x02
18.6
19.6
0x12
3.6
4.6
0x03
19.6
20.6
0x13
4.6
5.6
0x04
20.6
21.6
0x14
5.6
6.6
0x05
21.6
22.6
0x15
6.6
7.6
0x06
22.6
23.6
0x16
7.6
8.6
0x07
23.6
24.6
0x17
8.6
9.6
0x08
24.6
25.6
0x18
0x10
9.6
10.6
0x09
25.6
26.6
0x19
10.6
11.6
0x0A
26.6
27.6
0x1A
11.6
12.6
0x0B
27.6
28.6
0x1B
12.6
13.6
0x0C
28.6
29.6
0x1C
13.6
14.6
0x0D
29.6
30.6
0x1D
14.6
15.6
0x0E
30.6
31.6
0x1E
15.6
16.6
0x0F
31.6
32.6
0x1F
Notes
282.BUSCLK is Greater Than this value.
283.BUSCLK is Less Than or Equal to this value.
5.24.3.2.2
Flash Security Register (FSEC)
The FSEC register holds all bits associated with the security of the MCU and Flash module.
Table 470. Flash Security Register (FSEC)
Address: 0x0101
7
R
6
5
4
KEYEN[1:0]
3
2
1
RNV[5:2]
0
SEC[1:0]
W
Reset
F
F
F
F
F
F
F
F
= Unimplemented or Reserved
All bits in the FSEC register are readable, but not writable.
During the reset sequence, the FSEC register is loaded with the contents of the Flash security byte in the Flash configuration
field at global address 0x3_FF0F located in P-Flash memory (see Table 463), as indicated by reset condition F in Figure 470. If
a double bit fault is detected, while reading the P-Flash phrase containing the Flash security byte during the reset sequence, all
bits in the FSEC register will be set to leave the Flash module in a secured state with backdoor key access disabled.
MM912_637, Rev. 3.0
Freescale Semiconductor
352
128 kByte Flash Module (S12FTMRC128K1V1)
Table 471. FSEC Field Descriptions
Field
Description
7–6
Backdoor Key Security Enable Bits — The KEYEN[1:0] bits define the enabling of backdoor key access to the Flash module
as shown in Table 472.
KEYEN[1:0]
5–2
Reserved Nonvolatile Bits — The RNV bits should remain in the erased state for future enhancements.
RNV[5:2}
1–0
SEC[1:0]
Flash Security Bits — The SEC[1:0] bits define the security state of the MCU as shown in Table 473. If the Flash module is
unsecured using backdoor key access, the SEC bits are forced to 10.
Table 472. Flash KEYEN States
KEYEN[1:0]
Status of Backdoor Key Access
00
DISABLED
01
DISABLED(284)
10
ENABLED
11
DISABLED
Notes
284.Preferred KEYEN state to disable backdoor key access.
Table 473. Flash Security States
SEC[1:0]
Status of Security
00
SECURED
01
SECURED(285)
10
UNSECURED
11
SECURED
Notes
285.Preferred SEC state to set MCU to secured state.
The security function in the Flash module is described in Section 5.24.5, “Security".
5.24.3.2.3
Flash CCOB Index Register (FCCOBIX)
The FCCOBIX register is used to index the FCCOB register for Flash memory operations.
Table 474. FCCOB Index Register (FCCOBIX)
Address: 0x0102
R
7
6
5
4
3
0
0
0
0
0
0
0
0
0
0
2
0
CCOBIX[2:0]
W
Reset
1
0
0
0
= Unimplemented or Reserved
CCOBIX bits are readable and writable while remaining bits read 0 and are not writable.
Table 475. FCCOBIX Field Descriptions
Field
Description
2–0
Common Command Register Index— The CCOBIX bits are used to select to which word of the FCCOB register array is
being read or written. See Section 5.24.3.2.11, “Flash Common Command Object Register (FCCOB)" for more details.
CCOBIX[1:0]
MM912_637, Rev. 3.0
Freescale Semiconductor
353
128 kByte Flash Module (S12FTMRC128K1V1)
5.24.3.2.4
Flash Reserved0 Register (FRSV0)
This Flash register is reserved for factory testing.
Table 476. Flash Reserved0 Register (FRSV0)
Address: 0x0103
R
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
Reset
= Unimplemented or Reserved
All bits in the FRSV0 register read 0 and are not writable.
5.24.3.2.5
Flash Configuration Register (FCNFG)
The FCNFG register enables the Flash command complete interrupt and forces ECC faults on Flash array read access from the
CPU.
Table 477. Flash Configuration Register (FCNFG)
Address: 0x0104
7
R
CCIE
W
Reset
0
6
5
0
0
0
0
4
IGNSF
0
3
2
0
0
0
0
1
0
FDFD
FSFD
0
0
= Unimplemented or Reserved
CCIE, IGNSF, FDFD, and FSFD bits are readable and writable while remaining bits read 0 and are not writable.
Table 478. FCNFG Field Descriptions
Field
7
CCIE
4
IGNSF
1
FDFD
0
FSFD
Description
Command Complete Interrupt Enable — The CCIE bit controls interrupt generation when a Flash command has completed.
0 Command complete interrupt disabled
1 An interrupt will be requested whenever the CCIF flag in the FSTAT register is set (see Section 5.24.3.2.7, “Flash Status
Register (FSTAT)")
Ignore Single Bit Fault — The IGNSF controls single bit fault reporting in the FERSTAT register (see Section 5.24.3.2.8,
“Flash Error Status Register (FERSTAT)").
0 All single bit faults detected during array reads are reported
1 Single bit faults detected during array reads are not reported and the single bit fault interrupt will not be generated
Force Double Bit Fault Detect — The FDFD bit allows the user to simulate a double bit fault during Flash array read
operations, and check the associated interrupt routine. The FDFD bit is cleared by writing a 0 to FDFD. The FECCR registers
will not be updated during the Flash array read operation with FDFD set unless an actual double bit fault is detected.
0 Flash array read operations will set the DFDIF flag in the FERSTAT register only if a double bit fault is detected
1 Any Flash array read operation will force the DFDIF flag in the FERSTAT register to be set (see Section 5.24.3.2.7, “Flash
Status Register (FSTAT)") and an interrupt will be generated, as long as the DFDIE interrupt enable in the FERCNFG
register is set (see Section 5.24.3.2.6, “Flash Error Configuration Register (FERCNFG)")
Force Single Bit Fault Detect — The FSFD bit allows the user to simulate a single bit fault during Flash array read
operations, and check the associated interrupt routine. The FSFD bit is cleared by writing a 0 to FSFD. The FECCR registers
will not be updated during the Flash array read operation with FSFD set unless an actual single bit fault is detected.
0 Flash array read operations will set the SFDIF flag in the FERSTAT register only if a single bit fault is detected
1 Flash array read operation will force the SFDIF flag in the FERSTAT register to be set (see Section 5.24.3.2.7, “Flash Status
Register (FSTAT)"), and an interrupt will be generated as long as the SFDIE interrupt enable in the FERCNFG register is
set (see Section 5.24.3.2.6, “Flash Error Configuration Register (FERCNFG)")
MM912_637, Rev. 3.0
Freescale Semiconductor
354
5.24.3.2.6
Flash Error Configuration Register (FERCNFG)
The FERCNFG register enables the Flash error interrupts for the FERSTAT flags.
Table 479. Flash Error Configuration Register (FERCNFG)
Address: 0x0105
R
7
6
5
4
3
2
0
0
0
0
0
0
0
0
0
0
0
0
W
Reset
1
0
DFDIE
SFDIE
0
0
= Unimplemented or Reserved
All assigned bits in the FERCNFG register are readable and writable.
Table 480. FERCNFG Field Descriptions
Field
1
DFDIE
0
SFDIE
Description
Double Bit Fault Detect Interrupt Enable — The DFDIE bit controls interrupt generation when a double bit fault is detected
during a Flash block read operation.
0 DFDIF interrupt disabled
1 An interrupt will be requested whenever the DFDIF flag is set (see Section 5.24.3.2.8, “Flash Error Status Register
(FERSTAT)")
Single Bit Fault Detect Interrupt Enable — The SFDIE bit controls interrupt generation when a single bit fault is detected
during a Flash block read operation.
0 SFDIF interrupt disabled whenever the SFDIF flag is set (see Section 5.24.3.2.8, “Flash Error Status Register (FERSTAT)")
1 An interrupt will be requested whenever the SFDIF flag is set (see Section 5.24.3.2.8, “Flash Error Status Register
(FERSTAT)")
5.24.3.2.7
Flash Status Register (FSTAT)
The FSTAT register reports the operational status of the Flash module.
Table 481. Flash Status Register (FSTAT)
Address: 0x0106
7
R
W
Reset
CCIF
1
6
0
0
5
4
ACCERR
FPVIOL
0
0
3
2
MGBUSY
RSVD
0
0
1
0
MGSTAT[1:0]
0(286)
0(286)
= Unimplemented or Reserved
Notes
286.Reset value can deviate from the value shown if a double bit fault is detected during the reset sequence (see Section 5.24.6, “Initialization").
CCIF, ACCERR, and FPVIOL bits are readable and writable, MGBUSY and MGSTAT bits are readable but not writable, while
remaining bits read 0 and are not writable.
MM912_637, Rev. 3.0
Freescale Semiconductor
355
Table 482. FSTAT Field Descriptions
Field
7
CCIF
5
ACCERR
4
FPVIOL
3
MGBUSY
2
Description
Command Complete Interrupt Flag — The CCIF flag indicates that a Flash command has completed. The CCIF flag is
cleared by writing a 1 to CCIF to launch a command and CCIF will stay low until command completion or command violation.
0 Flash command in progress
1 Flash command has completed
Flash Access Error Flag — The ACCERR bit indicates an illegal access has occurred to the Flash memory caused by either
a violation of the command write sequence (see Section 5.24.4.3.2, “Command Write Sequence") or issuing an illegal Flash
command. While ACCERR is set, the CCIF flag cannot be cleared to launch a command. The ACCERR bit is cleared by
writing a 1 to ACCERR. Writing a 0 to the ACCERR bit has no effect on ACCERR.
0 No access error detected
1 Access error detected
Flash Protection Violation Flag —The FPVIOL bit indicates an attempt was made to program or erase an address in a
protected area of P-Flash or D-Flash memory during a command write sequence. The FPVIOL bit is cleared by writing a 1
to FPVIOL. Writing a 0 to the FPVIOL bit has no effect on FPVIOL. 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 detected
Memory Controller Busy Flag — The MGBUSY flag reflects the active state of the Memory Controller.
0 Memory Controller is idle
1 Memory Controller is busy executing a Flash command (CCIF = 0)
Reserved Bit — This bit is reserved and always reads 0.
RSVD
1–0
MGSTAT[1:0]
Memory Controller Command Completion Status Flag — One or more MGSTAT flag bits are set if an error is detected
during execution of a Flash command or during the Flash reset sequence. See Section 5.24.4.5, “Flash Command
Description", and Section 5.24.6, “Initialization", for details.
5.24.3.2.8
Flash Error Status Register (FERSTAT)
The FERSTAT register reflects the error status of internal Flash operations.
Table 483. Flash Error Status Register (FERSTAT)
Address: 0x0107
R
7
6
5
4
3
2
0
0
0
0
0
0
0
0
0
0
0
0
W
Reset
1
0
DFDIF
SFDIF
0
0
= Unimplemented or Reserved
All flags in the FERSTAT register are readable and only writable to clear the flag.
MM912_637, Rev. 3.0
Freescale Semiconductor
356
Table 484. FERSTAT Field Descriptions
Field
Description
Double Bit Fault Detect Interrupt Flag — The setting of the DFDIF flag indicates that a double bit fault was detected in the
stored parity and data bits during a Flash array read operation, or that a Flash array read operation was attempted on a Flash
block that was under a Flash command operation.(287) The DFDIF flag is cleared by writing a 1 to DFDIF. Writing a 0 to DFDIF
has no effect on DFDIF.
0 No double bit fault detected
1 Double bit fault detected or an invalid Flash array read operation attempted
1
DFDIF
Single Bit Fault Detect Interrupt Flag — With the IGNSF bit in the FCNFG register clear, the SFDIF flag indicates that a
single bit fault was detected in the stored parity and data bits during a Flash array read operation, or that a Flash array read
operation was attempted on a Flash block that was under a Flash command operation.(287) The SFDIF flag is cleared by writing
a 1 to SFDIF. Writing a 0 to SFDIF has no effect on SFDIF.
0 No single bit fault detected
1 Single bit fault detected and corrected or an invalid Flash array read operation attempted
0
SFDIF
Notes
287.The single bit fault and double bit fault flags are mutually exclusive for parity errors (an ECC fault occurrence can be either single fault or
double fault but never both). A simultaneous access collision (read attempted while command running) is indicated when both SFDIF
and DFDIF flags are high.
5.24.3.2.9
P-Flash Protection Register (FPROT)
The FPROT register defines which P-Flash sectors are protected against program and erase operations.
Table 485. Flash Protection Register (FPROT)
Address: 0x0108
7
R
FPOPEN
W
Reset
F
6
5
RNV6
F
4
FPHDIS
3
FPHS[1:0]
F
F
2
1
FPLDIS
F
F
0
FPLS[1:0]
F
F
= Unimplemented or Reserved
The (unreserved) bits of the FPROT register are writable with the restriction that the size of the protected region can only be
increased (see Section 5.24.3.2.9.1, “P-Flash Protection Restrictions", and Table 490).
During the reset sequence, the FPROT register is loaded with the contents of the P-Flash protection byte in the Flash
configuration field at global address 0x3_FF0C located in P-Flash memory (see Table 463), as indicated by reset condition ‘F’ in
Figure 485. To change the P-Flash protection that will be loaded during the reset sequence, the upper sector of the P-Flash
memory must be unprotected, then the P-Flash protection byte must be reprogrammed. If a double bit fault is detected while
reading the P-Flash phrase containing the P-Flash protection byte during the reset sequence, the FPOPEN bit will be cleared
and remaining bits in the FPROT register will be set to leave the P-Flash memory fully protected.
Trying to alter data in any protected area in the P-Flash memory will result in a protection violation error and the FPVIOL bit will
be set in the FSTAT register. The block erase of a P-Flash block is not possible if any of the P-Flash sectors contained in the
same P-Flash block are protected.
Table 486. FPROT Field Descriptions
Field
7
FPOPEN
6
Description
Flash Protection Operation Enable — The FPOPEN bit determines the protection function for program or erase operations
as shown in Table 487, for the P-Flash block.
0 When FPOPEN is clear, the FPHDIS and FPLDIS bits define unprotected address ranges as specified by the corresponding
FPHS and FPLS bits
1 When FPOPEN is set, the FPHDIS and FPLDIS bits enable protection for the address range specified by the corresponding
FPHS and FPLS bits
Reserved Nonvolatile Bit — The RNV bit should remain in the erased state for future enhancements.
RNV[6]
MM912_637, Rev. 3.0
Freescale Semiconductor
357
Table 486. FPROT Field Descriptions (continued)
Field
5
FPHDIS
4–3
FPHS[1:0]
2
FPLDIS
1–0
FPLS[1:0]
Description
Flash Protection Higher Address Range Disable — The FPHDIS bit determines whether there is a protected/unprotected
area in a specific region of the P-Flash memory ending with global address 0x3_FFFF.
0 Protection/Unprotection enabled
1 Protection/Unprotection disabled
Flash Protection Higher Address Size — The FPHS bits determine the size of the protected/unprotected area in P-Flash
memory as shown inTable 488. The FPHS bits can only be written to while the FPHDIS bit is set.
Flash Protection Lower Address Range Disable — The FPLDIS bit determines whether there is a protected/unprotected
area in a specific region of the P-Flash memory beginning with global address 0x3_8000.
0 Protection/Unprotection enabled
1 Protection/Unprotection disabled
Flash Protection Lower Address Size — The FPLS bits determine the size of the protected/unprotected area in P-Flash
memory as shown in Table 489. The FPLS bits can only be written to while the FPLDIS bit is set.
Table 487. P-Flash Protection Function
Function(288)
FPOPEN
FPHDIS
FPLDIS
1
1
1
No P-Flash Protection
1
1
0
Protected Low Range
1
0
1
Protected High Range
1
0
0
Protected High and Low Ranges
0
1
1
Full P-Flash Memory Protected
0
1
0
Unprotected Low Range
0
0
1
Unprotected High Range
0
0
0
Unprotected High and Low Ranges
Notes
288.For range sizes, refer to Table 488 and Table 489.
Table 488. P-Flash Protection Higher Address Range
FPHS[1:0]
Global Address Range
Protected Size
00
0x3_F800–0x3_FFFF
2.0 kbytes
01
0x3_F000–0x3_FFFF
4.0 kbytes
10
0x3_E000–0x3_FFFF
8.0 kbytes
11
0x3_C000–0x3_FFFF
16 kbytes
Table 489. P-Flash Protection Lower Address Range
FPLS[1:0]
Global Address Range
Protected Size
00
0x3_8000–0x3_83FF
1.0 kbyte
01
0x3_8000–0x3_87FF
2.0 kbytes
10
0x3_8000–0x3_8FFF
4.0 kbytes
11
0x3_8000–0x3_9FFF
8.0 kbytes
All possible P-Flash protection scenarios are shown in Figure 112. Although the protection scheme is loaded from the Flash
memory at global address 0x3_FF0C during the reset sequence, it can be changed by the user. The P-Flash protection scheme
can be used by applications requiring reprogramming in single chip mode while providing as much protection as possible, if
reprogramming is not required.
MM912_637, Rev. 3.0
Freescale Semiconductor
358
Scenario
FPHDIS = 1
FPLDIS = 1
FPHDIS = 1
FPLDIS = 0
FPHDIS = 0
FPLDIS = 1
FPHDIS = 0
FPLDIS = 0
7
6
5
4
3
2
1
0
0x3_FFFF
Scenario
FPOPEN = 1
0x3_8000
FPHS[1:0]
FPLS[1:0]
FLASH START
FPHS[1:0]
0x3_8000
FPOPEN = 0
FPLS[1:0]
FLASH START
0x3_FFFF
Unprotected region
Protected region with size
defined by FPLS
Protected region
not defined by FPLS, FPHS
Protected region with size
defined by FPHS
Figure 112. P-Flash Protection Scenarios
5.24.3.2.9.1 P-Flash Protection Restrictions
The general guideline is that P-Flash protection can only be added and not removed. Table 490 specifies all valid transitions
between P-Flash protection scenarios. Any attempt to write an invalid scenario to the FPROT register will be ignored. The
contents of the FPROT register reflect the active protection scenario. See the FPHS and FPLS bit descriptions for additional
restrictions.
MM912_637, Rev. 3.0
Freescale Semiconductor
359
Table 490. P-Flash Protection Scenario Transitions
To Protection Scenario(289)
From
Protection
Scenario
0
1
2
3
0
X
X
X
X
1
X
2
4
X
4
X
X
X
X
X
X
X
X
X
X
7
X
X
7
X
3
6
6
X
X
5
5
X
X
X
X
X
X
Notes
289.Allowed transitions marked with X, see Figure 112 for a definition of the scenarios.
5.24.3.2.10 D-Flash Protection Register (DFPROT)
The DFPROT register defines which D-Flash sectors are protected against program and erase operations.
Table 491. D-Flash Protection Register (DFPROT)
Address: 0x0109
7
R
DPOPEN
W
Reset
F
6
5
4
0
0
0
0
0
0
3
2
1
0
F
F
DPS[3:0]
F
F
= Unimplemented or Reserved
The (unreserved) bits of the DFPROT register are writable with the restriction that protection can be added but not removed.
Writes must increase the DPS value and the DPOPEN bit can only be written from a 1 (protection disabled) to a 0 (protection
enabled). If the DPOPEN bit is set, the state of the DPS bits is irrelevant.
During the reset sequence, the DFPROT register is loaded with the contents of the D-Flash protection byte in the Flash
configuration field at global address 0x3_FF0D located in P-Flash memory (see Table 463) as indicated by reset condition F in
Figure 491. To change the D-Flash protection that will be loaded during the reset sequence, the P-Flash sector containing the
D-Flash protection byte must be unprotected, then the D-Flash protection byte must be programmed. If a double bit fault is
detected while reading the P-Flash phrase containing the D-Flash protection byte during the reset sequence, the DPOPEN bit
will be cleared and DPS bits will be set to leave the D-Flash memory fully protected.
Trying to alter data in any protected area in the D-Flash memory will result in a protection violation error, and the FPVIOL bit will
be set in the FSTAT register. Block erase of the D-Flash memory is not possible if any of the D-Flash sectors are protected.
Table 492. DFPROT Field Descriptions
Field
7
DPOPEN
3–0
DPS[3:0]
Description
D-Flash Protection Control
0 Enables D-Flash memory protection from program and erase with protected address range defined by DPS bits
1 Disables D-Flash memory protection from program and erase
D-Flash Protection Size — The DPS[3:0] bits determine the size of the protected area in the D-Flash memory as shown in
Table 493.
MM912_637, Rev. 3.0
Freescale Semiconductor
360
Table 493. D-Flash Protection Address Range
5.24.3.2.11
DPS[3:0]
Global Address Range
Protected Size
0000
0x0_4400 – 0x0_44FF
256 bytes
0001
0x0_4400 – 0x0_45FF
512 bytes
0010
0x0_4400 – 0x0_46FF
768 bytes
0011
0x0_4400 – 0x0_47FF
1024 bytes
0100
0x0_4400 – 0x0_48FF
1280 bytes
0101
0x0_4400 – 0x0_49FF
1536 bytes
0110
0x0_4400 – 0x0_4AFF
1792 bytes
0111
0x0_4400 – 0x0_4BFF
2048 bytes
1000
0x0_4400 – 0x0_4CFF
2304 bytes
1001
0x0_4400 – 0x0_4DFF
2560 bytes
1010
0x0_4400 – 0x0_4EFF
2816 bytes
1011
0x0_4400 – 0x0_4FFF
3072 bytes
1100
0x0_4400 – 0x0_50FF
3328 bytes
1101
0x0_4400 – 0x0_51FF
3584 bytes
1110
0x0_4400 – 0x0_52FF
3840 bytes
1111
0x0_4400 – 0x0_53FF
4096 bytes
Flash Common Command Object Register (FCCOB)
The FCCOB is an array of six words addressed via the CCOBIX index found in the FCCOBIX register. Byte wide reads and writes
are allowed to the FCCOB register.
Table 494. Flash Common Command Object High Register (FCCOBHI)
Address: 0x010A
7
6
5
4
R
2
1
0
0
0
0
0
CCOB[15:8]
W
Reset
3
0
0
0
0
Table 495. Flash Common Command Object Low Register (FCCOBLO)
Address: 0x010B
7
6
5
4
R
2
1
0
0
0
0
0
CCOB[7:0]
W
Reset
3
0
0
0
0
5.24.3.2.11.1 FCCOB - NVM Command Mode
NVM command mode uses the indexed FCCOB register to provide a command code and its relevant parameters to the Memory
Controller. The user first sets up all required FCCOB fields and then initiates the command’s execution by writing a 1 to the CCIF
bit in the FSTAT register (a 1 written by the user clears the CCIF command completion flag to 0). When the user clears the CCIF
bit in the FSTAT register all FCCOB parameter fields are locked and cannot be changed by the user until the command completes
(as evidenced by the Memory Controller returning CCIF to 1). Some commands return information to the FCCOB register array.
The generic format for the FCCOB parameter fields in NVM command mode is shown in Table 496. The return values are
available for reading after the CCIF flag in the FSTAT register has been returned to 1 by the Memory Controller. Writes to the
unimplemented parameter fields (CCOBIX = 110 and CCOBIX = 111) are ignored with reads from these fields returning 0x0000.
MM912_637, Rev. 3.0
Freescale Semiconductor
361
Table 496 shows the generic Flash command format. The high byte of the first word in the CCOB array contains the command
code, followed by the parameters for this specific Flash command. For details on the FCCOB settings required by each
command, see the Flash command descriptions in Section 5.24.4.5, “Flash Command Description".
Table 496. FCCOB - NVM Command Mode (Typical Usage)
CCOBIX[2:0]
000
001
010
011
100
101
Byte
FCCOB Parameter Fields (NVM Command Mode)
HI
FCMD[7:0] defining Flash command
LO
6’h0, Global address [17:16]
HI
Global address [15:8]
LO
Global address [7:0]
HI
Data 0 [15:8]
LO
Data 0 [7:0]
HI
Data 1 [15:8]
LO
Data 1 [7:0]
HI
Data 2 [15:8]
LO
Data 2 [7:0]
HI
Data 3 [15:8]
LO
Data 3 [7:0]
5.24.3.2.12 Flash Reserved1 Register (FRSV1)
This Flash register is reserved for factory testing.
Table 497. Flash Reserved1 Register (FRSV1)
Address: 0x010C
R
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
Reset
= Unimplemented or Reserved
All bits in the FRSV1 register read 0 and are not writable.
5.24.3.2.13 Flash Reserved2 Register (FRSV2)
This Flash register is reserved for factory testing.
Table 498. Flash Reserved2 Register (FRSV2)
Address: 0x010D
R
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
Reset
= Unimplemented or Reserved
All bits in the FRSV2 register read 0 and are not writable.
MM912_637, Rev. 3.0
Freescale Semiconductor
362
5.24.3.2.14 Flash Reserved3 Register (FRSV3)
This Flash register is reserved for factory testing.
Table 499. Flash Reserved3 Register (FRSV3)
Address: 0x010E
R
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
Reset
= Unimplemented or Reserved
All bits in the FRSV3 register read 0 and are not writable.
5.24.3.2.15 Flash Reserved4 Register (FRSV4)
This Flash register is reserved for factory testing.
Table 500. Flash Reserved4 Register (FRSV4)
Address: 0x010F
R
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
2
1
0
F
F
F
F
W
Reset
= Unimplemented or Reserved
All bits in the FRSV4 register read 0 and are not writable.
5.24.3.2.16 Flash Option Register (FOPT)
The FOPT register is the Flash option register.
Table 501. Flash Option Register (FOPT)
Address: 0x0110
7
6
5
4
R
NV[7:0]
W
Reset
F
F
F
F
= Unimplemented or Reserved
All bits in the FOPT register are readable but are not writable.
During the reset sequence, the FOPT register is loaded from the Flash nonvolatile byte in the Flash configuration field, at global
address 0x3_FF0E located in P-Flash memory (see Table 463), as indicated by reset condition F in Figure 501. If a double bit
fault is detected while reading the P-Flash phrase containing the Flash nonvolatile byte during the reset sequence, all bits in the
FOPT register will be set.
Table 502. FOPT Field Descriptions
Field
Description
7–0
Nonvolatile Bits — The NV[7:0] bits are available as nonvolatile bits. Refer to the device user guide for proper use of the NV
bits.
NV[7:0]
MM912_637, Rev. 3.0
Freescale Semiconductor
363
5.24.3.2.17 Flash Reserved5 Register (FRSV5)
This Flash register is reserved for factory testing.
Table 503. Flash Reserved5 Register (FRSV5)
Address: 0x0111
R
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
Reset
= Unimplemented or Reserved
All bits in the FRSV5 register read 0 and are not writable.
5.24.3.2.18 Flash Reserved6 Register (FRSV6)
This Flash register is reserved for factory testing.
Table 504. Flash Reserved6 Register (FRSV6)
Address: 0x0112
R
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
Reset
= Unimplemented or Reserved
All bits in the FRSV6 register read 0 and are not writable.
5.24.3.2.19 Flash Reserved7 Register (FRSV7)
This Flash register is reserved for factory testing.
Table 505. Flash Reserved7 Register (FRSV7)
Address: 0x0113
R
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
Reset
= Unimplemented or Reserved
All bits in the FRSV7 register read 0 and are not writable.
5.24.4
5.24.4.1
Functional Description
Modes of Operation
The FTMRC128K1 module provides the modes of operation, as shown in Table 506. The operating mode is determined by
module-level inputs and affects the FCLKDIV, FCNFG, and DFPROT registers, Scratch RAM writes, and the command set
availability (see Table 508).
MM912_637, Rev. 3.0
Freescale Semiconductor
364
Table 506. Modes and Mode Control Inputs
FTMRC Input
Operating
Mode
5.24.4.2
mmc_mode_ss_t2
Normal:
0
Special:
1
IFR Version ID Word
The version ID word is stored in the IFR at address 0x0_40B6. The contents of the word are defined in Table 507.
Table 507. IFR Version ID Fields
[15:4]
[3:0]
Reserved
VERNUM
VERNUM: Version number. The first version is number 0b_0001 with both 0b_0000 and 0b_1111 meaning ‘none’.
5.24.4.3
Flash Command Operations
Flash command operations are used to modify Flash memory contents.
The next sections describe:
•
How to write the FCLKDIV register that is used to generate a time base (FCLK) derived from BUSCLK for Flash program
and erase command operations
•
The command write sequence used to set Flash command parameters and launch execution
•
Valid Flash commands available for execution
5.24.4.3.1
Writing the FCLKDIV Register
Prior to issuing any Flash program or erase command after a reset, the user is required to write the FCLKDIV register to divide
BUSCLK down to a target FCLK of 1.0 MHz. Table 469 shows recommended values for the FDIV field based on BUSCLK
frequency.
NOTE
Programming or erasing the Flash memory cannot be performed if the bus clock runs at less
than 0.8 MHz. Setting FDIV too high can destroy the Flash memory due to overstress.
Setting FDIV too low can result in incomplete programming or erasure of the Flash memory
cells.
When the FCLKDIV register is written, the FDIVLD bit is set automatically. If the FDIVLD bit is 0, the FCLKDIV register has not
been written since the last reset. If the FCLKDIV register has not been written, any Flash program or erase command loaded
during a command write sequence will not execute and the ACCERR bit in the FSTAT register will set.
5.24.4.3.2
Command Write Sequence
The Memory Controller will launch all valid Flash commands entered using a command write sequence.
Before launching a command, the ACCERR and FPVIOL bits in the FSTAT register must be clear (see Section 5.24.3.2.7, “Flash
Status Register (FSTAT)") and the CCIF flag should be tested to determine the status of the current command write sequence.
If CCIF is 0, the previous command write sequence is still active and a new command write sequence cannot be started, and all
writes to the FCCOB register are ignored.
CAUTION
Writes to any Flash register must be avoided while a Flash command is active (CCIF=0) to
prevent corruption of Flash register contents and Memory Controller behavior.
MM912_637, Rev. 3.0
Freescale Semiconductor
365
5.24.4.3.2.1 Define FCCOB Contents
The FCCOB parameter fields must be loaded with all required parameters for the Flash command being executed. Access to the
FCCOB parameter fields is controlled via the CCOBIX bits in the FCCOBIX register (see Section 5.24.3.2.3, “Flash CCOB Index
Register (FCCOBIX)").
The contents of the FCCOB parameter fields are transferred to the Memory Controller when the user clears the CCIF command
completion flag in the FSTAT register (writing 1 clears the CCIF to 0). The CCIF flag will remain clear until the Flash command
has completed. Upon completion, the Memory Controller will return CCIF to 1 and the FCCOB register will be used to
communicate any results. The flow for a generic command write sequence is shown in Figure 113.
START
Read: FCLKDIV register
Clock Divider
Value Check
FDIV
Correct?
no
no
Read: FSTAT register
yes
FCCOB
Availability Check
CCIF
Set?
yes
Read: FSTAT register
Note: FCLKDIV must be
set after each reset
Write: FCLKDIV register
no
CCIF
Set?
yes
Results from previous Command
ACCERR/
FPVIOL
Set?
no
Access Error and
Protection Violation
Check
yes
Write: FSTAT register
Clear ACCERR/FPVIOL 0x30
Write to FCCOBIX register
to identify specific command
parameter to load.
Write to FCCOB register
to load required command parameter.
More
Parameters?
yes
no
Write: FSTAT register (to launch command)
Clear CCIF 0x80
Read: FSTAT register
Bit Polling for
Command Completion
Check
CCIF Set?
no
yes
EXIT
Figure 113. Generic Flash Command Write Sequence Flowchart
MM912_637, Rev. 3.0
Freescale Semiconductor
366
5.24.4.3.3
Valid Flash Module Commands
Table 508. Flash Commands by Mode
Unsecured
FCMD
Command
Secured
NS(290) SS(291) NS(292) SS(293)
0x01
Erase Verify All Blocks




0x02
Erase Verify Block




0x03
Erase Verify P-Flash Section



0x04
Read Once



0x06
Program P-Flash



0x07
Program Once



0x08
Erase All Blocks
0x09
Erase Flash Block



0x0A
Erase P-Flash Sector



0x0B
Unsecure Flash
0x0C
Verify Backdoor Access Key

0x0D
Set User Margin Level

0x0E
Set Field Margin Level
0x10
Erase Verify D-Flash Section



0x11
Program D-Flash



0x12
Erase D-Flash Sector











Notes
290.Unsecured Normal Single Chip mode.
291.Unsecured Special Single Chip mode.
292.Secured Normal Single Chip mode.
293.Secured Special Single Chip mode.
5.24.4.3.4
P-Flash Commands
Table 509 summarizes the valid P-Flash commands along with the effects of the commands on the P-Flash block and other
resources within the Flash module.
Table 509. P-Flash Commands
FCMD
Command
0x01
Erase Verify All Blocks
0x02
0x03
Erase Verify Block
Function on P-Flash Memory
Verify that all P-Flash (and D-Flash) blocks are erased.
Verify that a P-Flash block is erased.
Erase Verify P-Flash Section Verify that a given number of words starting at the address provided are erased.
0x04
Read Once
0x06
Program P-Flash
0x07
Program Once
0x08
Erase All Blocks
0x09
Erase Flash Block
Read a dedicated 64-byte field in the nonvolatile information register in P-Flash block that was
previously programmed using the Program Once command.
Program a phrase in a P-Flash block.
Program a dedicated 64-byte field in the nonvolatile information register in P-Flash block that is
allowed to be programmed only once.
Erase all P-Flash (and D-Flash) blocks.
An erase of all Flash blocks is only possible when the FPLDIS, FPHDIS, and FPOPEN bits in the
FPROT register and the DPOPEN bit in the DFPROT register are set prior to launching the command.
Erase a P-Flash (or D-Flash) block.
An erase of the full P-Flash block is only possible when FPLDIS, FPHDIS and FPOPEN bits in the
FPROT register are set prior to launching the command.
MM912_637, Rev. 3.0
Freescale Semiconductor
367
Table 509. P-Flash Commands
FCMD
Command
0x0A
Erase P-Flash Sector
0x0B
Unsecure Flash
0x0C
Function on P-Flash Memory
Erase all bytes in a P-Flash sector.
Supports a method of releasing MCU security by erasing all P-Flash (and D-Flash) blocks and
verifying that all P-Flash (and D-Flash) blocks are erased.
Verify Backdoor Access Key Supports a method of releasing MCU security by verifying a set of security keys.
0x0D
Set User Margin Level
Specifies a user margin read level for all P-Flash blocks.
0x0E
Set Field Margin Level
Specifies a field margin read level for all P-Flash blocks (special modes only).
5.24.4.3.5
D-Flash Commands
Table 510 summarizes the valid D-Flash commands along with the effects of the commands on the D-Flash block.
Table 510. D-Flash Commands
FCMD
Command
Function on D-Flash Memory
0x01
Erase Verify All Blocks
0x02
Erase Verify Block
0x08
Erase All Blocks
Erase all D-Flash (and P-Flash) blocks.
An erase of all Flash blocks is only possible when the FPLDIS, FPHDIS, and FPOPEN bits in the
FPROT register and the DPOPEN bit in the DFPROT register are set prior to launching the command.
0x09
Erase Flash Block
Erase a D-Flash (or P-Flash) block.
An erase of the full D-Flash block is only possible when DPOPEN bit in the DFPROT register is set
prior to launching the command.
0x0B
Unsecure Flash
Verify that all D-Flash (and P-Flash) blocks are erased.
Verify that the D-Flash block is erased.
Supports a method of releasing MCU security by erasing all D-Flash (and P-Flash) blocks and
verifying that all D-Flash (and P-Flash) blocks are erased.
0x0D
Set User Margin Level
Specifies a user margin read level for the D-Flash block.
0x0E
Set Field Margin Level
Specifies a field margin read level for the D-Flash block (special modes only).
0x10
Erase Verify D-Flash
Section
Verify that a given number of words starting at the address provided are erased.
0x11
Program D-Flash
Program up to four words in the D-Flash block.
0x12
Erase D-Flash Sector
Erase all bytes in a sector of the D-Flash block.
5.24.4.4
Allowed Simultaneous P-Flash and D-Flash Operations
Only the operations marked ‘OK’ in Table 511 are permitted to be run simultaneously on the Program Flash and Data Flash
blocks. Some operations cannot be executed simultaneously because certain hardware resources are shared by the two
memories. The priority has been placed on permitting Program Flash reads while program and erase operations execute on the
Data Flash, providing read (P-Flash) while write (D-Flash) functionality.
Table 511. Allowed P-Flash and D-Flash Simultaneous Operations
Data Flash
Margin
Read(294)
Program
Sector
Erase
Read
OK
OK
OK
Margin Read(294)
OK(295)
Program Flash
Read
Mass
Erase(296)
Program
Sector Erase
OK
MM912_637, Rev. 3.0
Freescale Semiconductor
368
Table 511. Allowed P-Flash and D-Flash Simultaneous Operations
Data Flash
Program Flash
Read
Margin
Read(294)
Sector
Erase
Program
Mass Erase(296)
Mass
Erase(296)
OK
Notes
294.A ‘Margin Read’ is any read after executing the margin setting commands ‘Set User Margin
Level’, or ‘Set Field Margin Level’ with anything but the ‘normal’ level specified.
295.See the Note on margin settings in Section 5.24.4.5.12, “Set User Margin Level Command"
and Section 5.24.4.5.13, “Set Field Margin Level Command".
296.The ‘Mass Erase’ operations are commands ‘Erase All Blocks’ and ‘Erase Flash Block’.
5.24.4.5
Flash Command Description
This section provides details of all available Flash commands launched by a command write sequence. The ACCERR bit in the
FSTAT register will be set during the command write sequence if any of the following illegal steps are performed, causing the
command not to be processed by the Memory Controller:
•
Starting any command write sequence that programs or erases Flash memory before initializing the FCLKDIV register
•
Writing an invalid command as part of the command write sequence
•
For additional possible errors, refer to the error handling table provided for each command
If a Flash block is read during execution of an algorithm (CCIF = 0) on that same block, the read operation will return invalid data.
If the SFDIF or DFDIF flags were not previously set when the invalid read operation occurred, both the SFDIF and DFDIF flags
will be set.
If the ACCERR or FPVIOL bits are set in the FSTAT register, the user must clear these bits before starting any command write
sequence (see Section 5.24.3.2.7, “Flash Status Register (FSTAT)").
CAUTION
A Flash word or phrase must be in the erased state before being programmed. Cumulative
programming of bits within a Flash word or phrase is not allowed.
5.24.4.5.1
Erase Verify All Blocks Command
The Erase Verify All Blocks command will verify that all P-Flash and D-Flash blocks have been erased.
Table 512. Erase Verify All Blocks Command FCCOB Requirements
CCOBIX[2:0]
FCCOB Parameters
000
0x01
Not required
Upon clearing CCIF to launch the Erase Verify All Blocks command, the Memory Controller will verify that the entire Flash
memory space is erased. The CCIF flag will set after the Erase Verify All Blocks operation has completed.
Table 513. Erase Verify All Blocks Command Error Handling
Register
Error Bit
ACCERR
FSTAT
FPVIOL
Error Condition
Set if CCOBIX[2:0]!= 000 at command launch
None
MGSTAT1
Set if any errors have been encountered during the read
MGSTAT0
Set if any non-correctable errors have been encountered during the read
MM912_637, Rev. 3.0
Freescale Semiconductor
369
5.24.4.5.2
Erase Verify Block Command
The Erase Verify Block command allows the user to verify that an entire P-Flash or D-Flash block has been erased. The FCCOB
upper global address bits determine which block must be verified.
Table 514. Erase Verify Block Command FCCOB Requirements
CCOBIX[2:0]
FCCOB Parameters
000
0x02
Global address [17:16] of the
Flash block to be verified.
Upon clearing CCIF to launch the Erase Verify Block command, the Memory Controller will verify that the selected P-Flash or
D-Flash block is erased. The CCIF flag will set after the Erase Verify Block operation has completed.
Table 515. Erase Verify Block Command Error Handling
Register
Error Bit
ACCERR
FSTAT
5.24.4.5.3
FPVIOL
Error Condition
Set if CCOBIX[2:0]!= 000 at command launch
Set if an invalid global address [17:16] is supplied
None
MGSTAT1
Set if any errors have been encountered during the read
MGSTAT0
Set if any non-correctable errors have been encountered during the read
Erase Verify P-Flash Section Command
The Erase Verify P-Flash Section command will verify that a section of code in the P-Flash memory is erased. The Erase Verify
P-Flash Section command defines the starting point of the code to be verified and the number of phrases.
Table 516. Erase Verify P-Flash Section Command FCCOB Requirements
CCOBIX[2:0]
000
FCCOB Parameters
0x03
Global address [17:16] of a
P-Flash block
001
Global address [15:0] of the first phrase to be verified
010
Number of phrases to be verified
Upon clearing CCIF to launch the Erase Verify P-Flash Section command, the Memory Controller will verify the selected section
of Flash memory is erased. The CCIF flag will set after the Erase Verify P-Flash Section operation has completed.
Table 517. Erase Verify P-Flash Section Command Error Handling
Register
Error Bit
Error Condition
Set if CCOBIX[2:0]!= 010 at command launch
Set if command not available in current mode (see Table 508)
ACCERR
Set if an invalid global address [17:0] is supplied
Set if a misaligned phrase address is supplied (global address [2:0]!= 000)
FSTAT
Set if the requested section crosses a 128 kbyte boundary
FPVIOL
None
MGSTAT1
Set if any errors have been encountered during the read
MGSTAT0
Set if any non-correctable errors have been encountered during the read
MM912_637, Rev. 3.0
Freescale Semiconductor
370
5.24.4.5.4
Read Once Command
The Read Once command provides read access to a reserved 64-byte field (8 phrases) located in the nonvolatile information
register of P-Flash. The Read Once field is programmed using the Program Once command described in Section 5.24.4.5.6,
“Program Once Command". The Read Once command must not be executed from the Flash block containing the Program Once
reserved field to avoid code runaway.
Table 518. Read Once Command FCCOB Requirements
CCOBIX[2:0]
FCCOB Parameters
000
0x04
Not Required
001
Read Once phrase index (0x0000 - 0x0007)
010
Read Once word 0 value
011
Read Once word 1 value
100
Read Once word 2 value
101
Read Once word 3 value
Upon clearing CCIF to launch the Read Once command, a Read Once phrase is fetched and stored in the FCCOB indexed
register. The CCIF flag will set after the Read Once operation has completed. Valid phrase index values for the Read Once
command range from 0x0000 to 0x0007. During execution of the Read Once command, any attempt to read addresses within
P-Flash block will return invalid data.
Table 519. Read Once Command Error Handling
Register
Error Bit
Error Condition
Set if CCOBIX[2:0]!= 001 at command launch
ACCERR
Set if an invalid phrase index is supplied
FSTAT
5.24.4.5.5
Set if command not available in current mode (see Table 508)
FPVIOL
None
MGSTAT1
Set if any errors have been encountered during the read
MGSTAT0
Set if any non-correctable errors have been encountered during the read
Program P-Flash Command
The Program P-Flash operation will program a previously erased phrase in the P-Flash memory using an embedded algorithm.
CAUTION
A P-Flash phrase must be in the erased state before being programmed. Cumulative
programming of bits within a Flash phrase is not allowed.
Table 520. Program P-Flash Command FCCOB Requirements
CCOBIX[2:0]
000
FCCOB Parameters
0x06
Global address [17:16] to identify
P-Flash block
001
Global address [15:0] of phrase location to be programmed(297)
010
Word 0 program value
011
Word 1 program value
100
Word 2 program value
101
Word 3 program value
Notes
297.Global address [2:0] must be 000
MM912_637, Rev. 3.0
Freescale Semiconductor
371
Upon clearing CCIF to launch the Program P-Flash command, the Memory Controller will program the data words to the supplied
global address and will then proceed to verify the data words read back as expected. The CCIF flag will set after the Program
P-Flash operation has completed.
Table 521. Program P-Flash Command Error Handling
Register
Error Bit
Error Condition
Set if CCOBIX[2:0]!= 101 at command launch
ACCERR
FSTAT
Set if an invalid global address [17:0] is supplied
Set if a misaligned phrase address is supplied (global address [2:0]!= 000)
FPVIOL
5.24.4.5.6
Set if command not available in current mode (see Table 508)
Set if the global address [17:0] points to a protected area
MGSTAT1
Set if any errors have been encountered during the verify operation
MGSTAT0
Set if any non-correctable errors have been encountered during the verify operation
Program Once Command
The Program Once command restricts programming to a reserved 64-byte field (8 phrases) in the nonvolatile information register
located in P-Flash. The Program Once reserved field can be read using the Read Once command as described in
Section 5.24.4.5.4, “Read Once Command". The Program Once command must only be issued once, since the nonvolatile
information register in P-Flash cannot be erased. The Program Once command must not be executed from the Flash block
containing the Program Once reserved field to avoid code runaway.
Table 522. Program Once Command FCCOB Requirements
CCOBIX[2:0]
000
FCCOB Parameters
0x07
Not Required
001
Program Once phrase index (0x0000 - 0x0007)
010
Program Once word 0 value
011
Program Once word 1 value
100
Program Once word 2 value
101
Program Once word 3 value
Upon clearing CCIF to launch the Program Once command, the Memory Controller first verifies that the selected phrase is
erased. If erased, then the selected phrase will be programmed and then verified with read back. The CCIF flag will remain clear,
setting only after the Program Once operation has completed.
The reserved nonvolatile information register accessed by the Program Once command cannot be erased and any attempt to
program one of these phrases a second time will not be allowed. Valid phrase index values for the Program Once command range
from 0x0000 to 0x0007. During execution of the Program Once command, any attempt to read addresses within P-Flash will
return invalid data.
MM912_637, Rev. 3.0
Freescale Semiconductor
372
Table 523. Program Once Command Error Handling
Register
Error Bit
Error Condition
Set if CCOBIX[2:0]!= 101 at command launch
ACCERR
Set if command not available in current mode (see Table 508)
Set if an invalid phrase index is supplied
Set if the requested phrase has already been programmed(298)
FSTAT
FPVIOL
None
MGSTAT1
Set if any errors have been encountered during the verify operation
MGSTAT0
Set if any non-correctable errors have been encountered during the verify operation
Notes
298.If a Program Once phrase is initially programmed to 0xFFFF_FFFF_FFFF_FFFF, the Program Once command will be allowed
to execute again on that same phrase.
5.24.4.5.7
Erase All Blocks Command
The Erase All Blocks operation will erase the entire P-Flash and D-Flash memory space.
Table 524. Erase All Blocks Command FCCOB Requirements
CCOBIX[2:0]
000
FCCOB Parameters
0x08
Not required
Upon clearing CCIF to launch the Erase All Blocks command, the Memory Controller will erase the entire Flash memory space
and verify that it is erased. If the Memory Controller verifies that the entire Flash memory space was properly erased, security
will be released. During the execution of this command (CCIF=0) the user must not write to any Flash module register. The CCIF
flag will set after the Erase All Blocks operation has completed.
Table 525. Erase All Blocks Command Error Handling
Register
Error Bit
ACCERR
FSTAT
5.24.4.5.8
FPVIOL
Error Condition
Set if CCOBIX[2:0]!= 000 at command launch
Set if command not available in current mode (see Table 508)
Set if any area of the P-Flash or D-Flash memory is protected
MGSTAT1
Set if any errors have been encountered during the verify operation
MGSTAT0
Set if any non-correctable errors have been encountered during the verify operation
Erase Flash Block Command
The Erase Flash Block operation will erase all addresses in a P-Flash or D-Flash block.
Table 526. Erase Flash Block Command FCCOB Requirements
CCOBIX[2:0]
000
001
FCCOB Parameters
0x09
Global address [17:16] to identify
Flash block
Global address [15:0] in Flash block to be erased
Upon clearing CCIF to launch the Erase Flash Block command, the Memory Controller will erase the selected Flash block and
verify that it is erased. The CCIF flag will set after the Erase Flash Block operation has completed.
MM912_637, Rev. 3.0
Freescale Semiconductor
373
Table 527. Erase Flash Block Command Error Handling
Register
Error Bit
Error Condition
Set if CCOBIX[2:0]!= 001 at command launch
Set if command not available in current mode (see Table 508)
ACCERR
Set if an invalid global address [17:16] is supplied
Set if the supplied P-Flash address is not phrase-aligned or if the D-Flash address is not
word-aligned
FSTAT
FPVIOL
5.24.4.5.9
Set if an area of the selected Flash block is protected
MGSTAT1
Set if any errors have been encountered during the verify operation
MGSTAT0
Set if any non-correctable errors have been encountered during the verify operation
Erase P-Flash Sector Command
The Erase P-Flash Sector operation will erase all addresses in a P-Flash sector.
Table 528. Erase P-Flash Sector Command FCCOB Requirements
CCOBIX[2:0]
FCCOB Parameters
000
0x0A
Global address [17:16] to identify
P-Flash block to be erased
Global address [15:0] anywhere within the sector to be erased.
001
Refer to Section 5.24.1.2.1, “P-Flash Features" for the P-Flash sector size.
Upon clearing CCIF to launch the Erase P-Flash Sector command, the Memory Controller will erase the selected Flash sector
and then verify that it is erased. The CCIF flag will be set after the Erase P-Flash Sector operation has completed.
Table 529. Erase P-Flash Sector Command Error Handling
Register
Error Bit
Error Condition
Set if CCOBIX[2:0]!= 001 at command launch
ACCERR
Set if command not available in current mode (see Table 508)
Set if an invalid global address [17:16] is supplied
Set if a misaligned phrase address is supplied (global address [2:0]!= 000)
FSTAT
FPVIOL
Set if the selected P-Flash sector is protected
MGSTAT1
Set if any errors have been encountered during the verify operation
MGSTAT0
Set if any non-correctable errors have been encountered during the verify operation
5.24.4.5.10 Unsecure Flash Command
The Unsecure Flash command will erase the entire P-Flash and D-Flash memory space and, if the erase is successful, will
release security.
Table 530. Unsecure Flash Command FCCOB Requirements
CCOBIX[2:0]
000
FCCOB Parameters
0x0B
Not required
Upon clearing CCIF to launch the Unsecure Flash command, the Memory Controller will erase the entire P-Flash and D-Flash
memory space and verify that it is erased. If the Memory Controller verifies that the entire Flash memory space was properly
erased, security will be released. If the erase verify is not successful, the Unsecure Flash operation sets MGSTAT1 and
terminates without changing the security state. During the execution of this command (CCIF=0) the user must not write to any
Flash module register. The CCIF flag is set after the Unsecure Flash operation has completed.
MM912_637, Rev. 3.0
Freescale Semiconductor
374
Table 531. Unsecure Flash Command Error Handling
Register
Error Bit
Error Condition
Set if CCOBIX[2:0]!= 000 at command launch
ACCERR
FSTAT
5.24.4.5.11
Set if command not available in current mode (see Table 508)
FPVIOL
Set if any area of the P-Flash or D-Flash memory is protected
MGSTAT1
Set if any errors have been encountered during the verify operation
MGSTAT0
Set if any non-correctable errors have been encountered during the verify operation
Verify Backdoor Access Key Command
The Verify Backdoor Access Key command will only execute if it is enabled by the KEYEN bits in the FSEC register (see
Table 472). The Verify Backdoor Access Key command releases security if user-supplied keys match those stored in the Flash
security bytes of the Flash configuration field (see Table 463). The Verify Backdoor Access Key command must not be executed
from the Flash block containing the backdoor comparison key to avoid code runaway.
Table 532. Verify Backdoor Access Key Command FCCOB Requirements
CCOBIX[2:0]
000
FCCOB Parameters
0x0C
Not required
001
Key 0
010
Key 1
011
Key 2
100
Key 3
Upon clearing CCIF to launch the Verify Backdoor Access Key command, the Memory Controller will check the FSEC KEYEN
bits to verify that this command is enabled. If not enabled, the Memory Controller sets the ACCERR bit in the FSTAT register and
terminates. If the command is enabled, the Memory Controller compares the key provided in FCCOB to the backdoor comparison
key in the Flash configuration field with Key 0 compared to 0x3_FF00, etc. If the backdoor keys match, security will be released.
If the backdoor keys do not match, security is not released and all future attempts to execute the Verify Backdoor Access Key
command are aborted (set ACCERR) until a reset occurs. The CCIF flag is set after the Verify Backdoor Access Key operation
has completed.
Table 533. Verify Backdoor Access Key Command Error Handling
Register
Error Bit
Error Condition
Set if CCOBIX[2:0]!= 100 at command launch
ACCERR
FSTAT
Set if an incorrect backdoor key is supplied
Set if backdoor key access has not been enabled (KEYEN[1:0]!= 10, see Section 5.24.3.2.2)
Set if the backdoor key has mismatched since the last reset
FPVIOL
None
MGSTAT1
None
MGSTAT0
None
5.24.4.5.12 Set User Margin Level Command
The Set User Margin Level command causes the Memory Controller to set the margin level for future read operations of the
P-Flash or D-Flash block.
MM912_637, Rev. 3.0
Freescale Semiconductor
375
Table 534. Set User Margin Level Command FCCOB Requirements
CCOBIX[2:0]
FCCOB Parameters
000
0x0D
001
Global address [17:16] to identify the Flash block
Margin level setting
Upon clearing CCIF to launch the Set User Margin Level command, the Memory Controller will set the user margin level for the
targeted block and then set the CCIF flag.
NOTE
When the D-Flash block is targeted, the D-Flash user margin levels are applied only to the
D-Flash reads. However, when the P-Flash block is targeted, the P-Flash user margin levels
are applied to both P-Flash and D-Flash reads. It is not possible to apply user margin levels
to the P-Flash block only.
Valid margin level settings for the Set User Margin Level command are defined in Table 535.
Table 535. Valid Set User Margin Level Settings
CCOB
(CCOBIX=001)
Level Description
0x0000
Return to Normal Level
0x0001
User Margin-1 Level(299)
0x0002
User Margin-0 Level(300)
Notes
299.Read margin to the erased state
300.Read margin to the programmed state
Table 536. Set User Margin Level Command Error Handling
Register
Error Bit
Error Condition
Set if CCOBIX[2:0]!= 001 at command launch
ACCERR
FSTAT
Set if command not available in current mode (see Table 508)
Set if an invalid global address [17:16] is supplied
Set if an invalid margin level setting is supplied
FPVIOL
None
MGSTAT1
None
MGSTAT0
None
NOTE
User margin levels can be used to check that Flash memory contents have adequate margin
for normal level read operations. If unexpected results are encountered when checking
Flash memory contents at user margin levels, a potential loss of information has been
detected.
5.24.4.5.13 Set Field Margin Level Command
The Set Field Margin Level command, valid in special modes only, causes the Memory Controller to set the margin level specified
for future read operations of the P-Flash or D-Flash block.
MM912_637, Rev. 3.0
Freescale Semiconductor
376
Table 537. Set Field Margin Level Command FCCOB Requirements
CCOBIX[2:0]
FCCOB Parameters
000
0x0E
001
Global address [17:16] to identify the Flash block
Margin level setting
Upon clearing CCIF to launch the Set Field Margin Level command, the Memory Controller will set the field margin level for the
targeted block and then set the CCIF flag.
NOTE
When the D-Flash block is targeted, the D-Flash field margin levels are applied only to the
D-Flash reads. However, when the P-Flash block is targeted, the P-Flash field margin levels
are applied to both P-Flash and D-Flash reads. It is not possible to apply field margin levels
to the P-Flash block only.
Valid margin level settings for the Set Field Margin Level command are defined in Table 538.
Table 538. Valid Set Field Margin Level Settings
CCOB
(CCOBIX=001)
Level Description
0x0000
Return to Normal Level
0x0001
User Margin-1 Level(301)
0x0002
User Margin-0 Level(302)
0x0003
Field Margin-1 Level(301)
0x0004
Field Margin-0 Level(302)
Notes
301.Read margin to the erased state
302.Read margin to the programmed state
Table 539. Set Field Margin Level Command Error Handling
Register
Error Bit
Error Condition
Set if CCOBIX[2:0]!= 001 at command launch
ACCERR
FSTAT
Set if command not available in current mode (see Table 508)
Set if an invalid global address [17:16] is supplied
Set if an invalid margin level setting is supplied
FPVIOL
None
MGSTAT1
None
MGSTAT0
None
CAUTION
Field margin levels must only be used during verify of the initial factory programming.
NOTE
Field margin levels can be used to check that Flash memory contents have adequate margin
for data retention at the normal level setting. If unexpected results are encountered when
checking Flash memory contents at field margin levels, the Flash memory contents should
be erased and reprogrammed.
5.24.4.5.14 Erase Verify D-Flash Section Command
The Erase Verify D-Flash Section command will verify that a section of code in the D-Flash is erased. The Erase Verify D-Flash
Section command defines the starting point of the data to be verified and the number of words.
MM912_637, Rev. 3.0
Freescale Semiconductor
377
Table 540. Erase Verify D-Flash Section Command FCCOB Requirements
CCOBIX[2:0]
000
FCCOB Parameters
Global address [17:16] to
identify the D-Flash block
0x10
001
Global address [15:0] of the first word to be verified
010
Number of words to be verified
Upon clearing CCIF to launch the Erase Verify D-Flash Section command, the Memory Controller will verify the selected section
of D-Flash memory is erased. The CCIF flag will set after the Erase Verify D-Flash Section operation has completed.
Table 541. Erase Verify D-Flash Section Command Error Handling
Register
Error Bit
Error Condition
Set if CCOBIX[2:0]!= 010 at command launch
Set if command not available in current mode (see Table 508)
ACCERR
Set if an invalid global address [17:0] is supplied
Set if a misaligned word address is supplied (global address [0]!= 0)
FSTAT
Set if the requested section breaches the end of the D-Flash block
FPVIOL
None
MGSTAT1
Set if any errors have been encountered during the read
MGSTAT0
Set if any non-correctable errors have been encountered during the read
5.24.4.5.15 Program D-Flash Command
The Program D-Flash operation programs one to four previously erased words in the D-Flash block. The Program D-Flash
operation will confirm that the targeted location(s) were successfully programmed upon completion.
CAUTION
A Flash word must be in the erased state before being programmed. Cumulative
programming of bits within a Flash word is not allowed.
Table 542. Program D-Flash Command FCCOB Requirements
CCOBIX[2:0]
000
FCCOB Parameters
0x11
Global address [17:16] to identify
the D-Flash block
001
Global address [15:0] of word to be programmed
010
Word 0 program value
011
Word 1 program value, if desired
100
Word 2 program value, if desired
101
Word 3 program value, if desired
Upon clearing CCIF to launch the Program D-Flash command, the user-supplied words will be transferred to the Memory
Controller and be programmed if the area is unprotected. The CCOBIX index value at Program D-Flash command launch
determines how many words will be programmed in the D-Flash block. The CCIF flag is set when the operation has completed.
MM912_637, Rev. 3.0
Freescale Semiconductor
378
Table 543. Program D-Flash Command Error Handling
Register
Error Bit
Error Condition
Set if CCOBIX[2:0] < 010 at command launch
Set if CCOBIX[2:0] > 101 at command launch
Set if command not available in current mode (see Table 508)
ACCERR
Set if an invalid global address [17:0] is supplied
FSTAT
Set if a misaligned word address is supplied (global address [0]!= 0)
Set if the requested group of words breaches the end of the D-Flash block
FPVIOL
Set if the selected area of the D-Flash memory is protected
MGSTAT1
Set if any errors have been encountered during the verify operation
MGSTAT0
Set if any non-correctable errors have been encountered during the verify operation
5.24.4.5.16 Erase D-Flash Sector Command
The Erase D-Flash Sector operation will erase all addresses in a sector of the D-Flash block.
Table 544. Erase D-Flash Sector Command FCCOB Requirements
CCOBIX[2:0]
FCCOB Parameters
000
0x12
Global address [17:16] to identify
D-Flash block
Global address [15:0] anywhere within the sector to be erased.
001
See Section 5.24.1.2.2, “D-Flash Features" for D-Flash sector size.
Upon clearing CCIF to launch the Erase D-Flash Sector command, the Memory Controller will erase the selected Flash sector
and verify that it is erased. The CCIF flag will set after the Erase D-Flash Sector operation has completed.
Table 545. Erase D-Flash Sector Command Error Handling
Register
Error Bit
Error Condition
Set if CCOBIX[2:0]!= 001 at command launch
ACCERR
FSTAT
Set if an invalid global address [17:0] is supplied
Set if a misaligned word address is supplied (global address [0]!= 0)
FPVIOL
5.24.4.6
Set if command not available in current mode (see Table 508)
Set if the selected area of the D-Flash memory is protected
MGSTAT1
Set if any errors have been encountered during the verify operation
MGSTAT0
Set if any non-correctable errors have been encountered during the verify operation
Interrupts
The Flash module can generate an interrupt when a Flash command operation has completed, or when a Flash command
operation has detected an ECC fault.
Table 546. Flash Interrupt Sources
Interrupt Source
Interrupt Flag
Local Enable
Global (CCR)
Mask
Flash Command Complete
CCIF (FSTAT register)
CCIE (FCNFG register)
I Bit
ECC Double Bit Fault on Flash Read
DFDIF (FERSTAT
register)
DFDIE (FERCNFG register)
I Bit
ECC Single Bit Fault on Flash Read
SFDIF (FERSTAT
register)
SFDIE (FERCNFG register)
I Bit
MM912_637, Rev. 3.0
Freescale Semiconductor
379
NOTE
Vector addresses and their relative interrupt priority are determined at the MCU level.
5.24.4.6.1
Description of Flash Interrupt Operation
The Flash module uses the CCIF flag in combination with the CCIE interrupt enable bit to generate the Flash command interrupt
request. The Flash module uses the DFDIF and SFDIF flags in combination with the DFDIE and SFDIE interrupt enable bits to
generate the Flash error interrupt request. For a detailed description of the register bits involved, refer to Section 5.24.3.2.5,
“Flash Configuration Register (FCNFG)", Section 5.24.3.2.6, “Flash Error Configuration Register (FERCNFG)",
Section 5.24.3.2.7, “Flash Status Register (FSTAT)", and Section 5.24.3.2.8, “Flash Error Status Register (FERSTAT)".
The logic used for generating the Flash module interrupts is shown in Figure 114.
Flash Command Interrupt Request
CCIE
CCIF
DFDIE
DFDIF
Flash Error Interrupt Request
SFDIE
SFDIF
Figure 114. Flash Module Interrupts Implementation
5.24.4.7
Wait Mode
The Flash module is not affected if the MCU enters wait mode. The Flash module can recover the MCU from wait via the CCIF
interrupt (see Section 5.24.4.6, “Interrupts").
5.24.4.8
Stop Mode
If a Flash command is active (CCIF = 0) when the MCU requests stop mode, the current Flash operation will be completed before
the CPU is allowed to enter stop mode.
5.24.5
Security
The Flash module provides security information to the MCU. The Flash security state is defined by the SEC bits of the FSEC
register (see Table 473). During reset, the Flash module initializes the FSEC register using data read from the security byte of
the Flash configuration field at global address 0x3_FF0F. The security state out of reset can be permanently changed by
programming the security byte, assuming that the MCU is starting from a mode where the necessary P-Flash erase and program
commands are available, and that the upper region of the P-Flash is unprotected. If the Flash security byte is successfully
programmed, its new value will take affect after the next MCU reset.
The following subsections describe these security-related subjects:
•
Unsecuring the MCU using Backdoor Key Access
•
Unsecuring the MCU in Special Single Chip Mode using BDM
•
Mode and Security Effects on Flash Command Availability
5.24.5.1
Unsecuring the MCU using Backdoor Key Access
The MCU may be unsecured by using the backdoor key access feature, which requires knowledge of the contents of the
backdoor keys (four 16-bit words programmed at addresses 0x3_FF00-0x3_FF07). If the KEYEN[1:0] bits are in the enabled
state (see Section 5.24.3.2.2, “Flash Security Register (FSEC)"), the Verify Backdoor Access Key command (see
MM912_637, Rev. 3.0
Freescale Semiconductor
380
Section 5.24.4.5.11, “Verify Backdoor Access Key Command") allows the user to present four prospective keys for comparison
to the keys stored in the Flash memory via the Memory Controller. If the keys presented in the Verify Backdoor Access Key
command match the backdoor keys stored in the Flash memory, the SEC bits in the FSEC register (see Table 473) will be
changed to unsecure the MCU. Key values of 0x0000 and 0xFFFF are not permitted as backdoor keys. While the Verify Backdoor
Access Key command is active, P-Flash memory, and D-Flash memory will not be available for read access and will return invalid
data.
The user code stored in the P-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 5.24.3.2.2, “Flash Security Register (FSEC)"), the MCU can be
unsecured by the backdoor key access sequence described below:
1. Follow the command sequence for the Verify Backdoor Access Key command as explained in Section 5.24.4.5.11,
“Verify Backdoor Access Key Command"
2. If the Verify Backdoor Access Key command is successful, the MCU is unsecured and the SEC[1:0] bits in the FSEC
register are forced to the unsecure state of 10
The Verify Backdoor Access Key command is monitored by the Memory Controller and an illegal key will prohibit future use of
the Verify Backdoor Access Key command. A reset of the MCU is the only method to re-enable the Verify Backdoor Access Key
command. The security as defined in the Flash security byte (0x3_FF0F) is not changed by using the Verify Backdoor Access
Key command sequence. The backdoor keys stored in addresses 0x3_FF00-0x3_FF07 are unaffected by the Verify Backdoor
Access Key command sequence. The Verify Backdoor Access Key command sequence has no effect on the program and erase
protections defined in the Flash protection register, FPROT.
After the backdoor keys have been correctly matched, the MCU will be unsecured. After the MCU is unsecured, the sector
containing the Flash security byte can be erased and the Flash security byte can be reprogrammed to the unsecure state, if
desired. In the unsecure state, the user has full control of the contents of the backdoor keys by programming addresses
0x3_FF00-0x3_FF07 in the Flash configuration field.
5.24.5.2
Unsecuring the MCU in Special Single Chip Mode using BDM
A secured MCU can be unsecured in special single chip mode by using the following method to erase the P-Flash and D-Flash
memory:
1. Reset the MCU into special single chip mode
2. Delay while the BDM executes the Erase Verify All Blocks command write sequence to check if the P-Flash and D-Flash
memories are erased
3. Send BDM commands to disable protection in the P-Flash and D-Flash memory
4. Execute the Erase All Blocks command write sequence to erase the P-Flash and D-Flash memory
5. After the CCIF flag sets to indicate that the Erase All Blocks operation has completed, reset the MCU into special single
chip mode
6. Delay while the BDM executes the Erase Verify All Blocks command write sequence to verify that the P-Flash and
D-Flash memory are erased
If the P-Flash and D-Flash memory are verified as erased, the MCU will be unsecured. All BDM commands will now be enabled
and the Flash security byte may be programmed to the unsecure state by continuing with the following steps:
7. Send BDM commands to execute the Program P-Flash command write sequence to program the Flash security byte to
the unsecured state
8. Reset the MCU
5.24.5.3
Mode and Security Effects on Flash Command Availability
The availability of Flash module commands depends on the MCU operating mode and security state as shown in Table 508.
5.24.6
Initialization
On each system reset the Flash module executes a reset sequence which establishes initial values for the Flash Block
Configuration Parameters, the FPROT and DFPROT protection registers, and the FOPT and FSEC registers. The Flash module
reverts to using built-in default values that leave the module in a fully protected and secured state if errors are encountered during
MM912_637, Rev. 3.0
Freescale Semiconductor
381
execution of the reset sequence. If a double bit fault is detected during the reset sequence, both MGSTAT bits in the FSTAT
register will be set.
CCIF remains clear throughout the reset sequence. The Flash module holds off all CPU access for the initial portion of the reset
sequence. While Flash memory reads and access to most Flash registers are possible when the hold is removed, writes to the
FCCOBIX, FCCOBHI, and FCCOBLO registers are ignored. Completion of the reset sequence is marked by setting CCIF high
which enables writes to the FCCOBIX, FCCOBHI, and FCCOBLO registers to launch any available Flash command.
If a reset occurs while any Flash command is in progress, that command will be immediately aborted. The state of the word being
programmed or the sector/block being erased is not guaranteed.
MM912_637, Rev. 3.0
Freescale Semiconductor
382
MCU - Die-to-Die Initiator (D2DIV1)
5.25
MCU - Die-to-Die Initiator (D2DIV1)
MCU
5.25.0.1
ANALOG
Acronyms and Abbreviations
Table 547 contains sample acronyms and abbreviations used in this document.
Table 547. Acronyms and Abbreviated Terms
Term
D2D
5.25.0.1.1
Meaning
Die-to-Die
Glossary
Table 548 shows a glossary of the major terms used in this document.
Table 548. Glossary
Term
Definition
Active low
The signal is asserted when it changes to logic-level zero.
Active high
The signal is asserted when it changes to logic-level one.
Asserted
Discrete signal is in active logic state.
Customer
The end user of an SoC design or device.
EOT
End of Transaction
Negated
A discrete signal is in inactive logic state.
Pin
External physical connection.
Revision
Revised or new version of a document. Revisions produce versions; there can be no ‘Rev 0.0.’
Signal
Electronic construct whose state or change in state conveys information.
Transfer
A read or write on the CPU bus following the IP-Bus protocol.
Transaction
Command, address and if required data sent on the D2D interface. A transaction is finished by the EOT acknowledge cycle.
Version
Particular form or variation of an earlier or original document.
5.25.1
Introduction
This section describes the functionality of the die-to-die (D2DIV1) initiator block especially designed for low cost connections
between a microcontroller die (Interface Initiator) and an analog die (Interface Target) located in the same package.
The D2DI block
•
realizes the initiator part of the D2D interface, including supervision and error interrupt generation
•
generates the clock for this interface
•
disables/enables the interrupt from the D2D interface
5.25.1.1
Overview
The D2DI is the initiator for a data transfer to and from a target, typically located on another die in the same package. It provides
a set of configuration registers and two memory mapped 256 Byte address windows. When writing to a window a transaction is
initiated, sending a write command followed, by an 8-bit address and the data byte or word to the target. When reading from a
window, a transaction is initiated, sending a read command, followed by an 8-bit address to the target. The target then responds
with the data. The basic idea is that a peripheral located on another die, can be addressed like an on-chip peripheral, except for
a small transaction delay.
MM912_637, Rev. 3.0
Freescale Semiconductor
383
MCU - Die-to-Die Initiator (D2DIV1)
D2DCW
Address and
Data Buffer
Address Bus
Write Data Bus
Read Data Bus
D2DDAT[7:0]
D2DIF
D2DINT
D2DINTI
D2DERR_INT
D2DIE
xfr_wait
D2DCLKDIV
Bus Clock
/n
n=1 … 8
D2DCLK
Figure 115. Die-to-Die Initiator (D2DI) Block Diagram
5.25.1.2
Features
The main features of this block are
•
Software transparent, memory mapped access to peripherals on target die
— 256 Byte address window
— Supports blocking read or write as well as non-blocking write transactions
•
Scalable interface clock divide by 1, 2, 3 and 4 of bus clock
•
Clock halt on system STOP
•
Configurable for 4- or 8-bit wide transfers
•
Configurable timeout period
•
Non-maskable interrupt on transaction errors
•
Transaction Status and Error Flags
•
Interrupt enable for receiving interrupt (from D2D target)
5.25.1.3
5.25.1.3.1
Modes of Operation
D2DI in STOP/WAIT Mode
The D2DI stops working in STOP/WAIT mode. The D2DCLK signal as well as the data signals used are driven low (only after the
end of the current high phase, as defined by D2DCLKDIV).
Waking from STOP/WAIT mode, the D2DCLK line starts clocking again and the data lines will be driven low until the first
transaction starts.
STOP and WAIT mode are entered by different CPU instructions. In the WAIT mode the behavior of the D2DI can be configured
(D2DSWAI). Every (enabled) interrupt can be used to leave the STOP and WAIT mode.
MM912_637, Rev. 3.0
Freescale Semiconductor
384
MCU - Die-to-Die Initiator (D2DIV1)
5.25.1.3.2
D2DI in Special Modes
The MCU can enter a special mode (used for test and debugging purposes as well as programming the FLASH). In the D2DI,
the “write-once” feature is disabled. See the MCU description for details.
5.25.2
External Signal Description
The D2DI optionally uses 6 or 10 port pins. The functions of those pins depends on the settings in the D2DCTL0 register, when
the D2DI module is enabled.
5.25.2.1
D2DCLK
When the D2DI is enabled, this pin is the clock output. This signal is low if the initiator is disabled, in STOP mode or in WAIT
mode (with D2DSWAI asserted), otherwise it is a continuos clock. This pin may be shared with general purpose functionality if
the D2DI is disabled.
5.25.2.2
D2DDAT[7:4]
When the D2DI is enabled and the interface connection width D2DCW is set to be 8-bit wide, those lines carry the data bits 7:4
acting as outputs or inputs. When they act as inputs pull-down elements are enabled. If the D2DI is disabled or if the interface
connection width is set as 4-bit wide, the pins may be shared with general purpose pin functionality.
5.25.2.3
D2DDAT[3:0]
When the D2DI is enabled those lines carry the data bits 3:0 acting as outputs or inputs. When they act as inputs pull-down
elements are enabled. If the D2DI is disabled the pins and may be shared with general purpose pin functionality.
5.25.2.4
D2DINT
The D2DINT is an active input interrupt input driven by the target device. The pin has an active pull-down device. If the D2DI is
disabled, the pin may be shared with general purpose pin functionality.
Table 549. Signal Properties
Name
Primary (D2DEN=1)
I/O
Secondary
Reset
(D2DEN=0)
Comment
Pull
down
Bidirectional Data Lines
I/O GPIO
0
driven low if in STOP mode
Active(303)
D2DCLK
Interface Clock Signal
O
GPIO
0
low if in STOP mode
—
D2DINT
Active High Interrupt
I
GPIO
—
—
Active(304)
D2DDAT[7:0]
Notes
303.Active if in input state, only if D2DEN=1
304.only if D2DEN=1
See the port interface module (PIM) guide for details of the GPIO function.
5.25.3
5.25.3.1
Memory Map and Register Definition
Memory Map
The D2DI memory map is split into three sections.
1. An eight byte set of control registers
2. A 256 byte window for blocking transactions
3. A 256 byte window for non-blocking transactions
MM912_637, Rev. 3.0
Freescale Semiconductor
385
MCU - Die-to-Die Initiator (D2DIV1)
See the chapter “Device Memory Map” for the register layout (distribution of these sections).
D2DREGS
8 Byte Control
Registers
D2DBLK
256 Byte Window
Blocking Access
D2DNBLK
256 Byte Window
Non-blocking Write
Figure 116. D2DI Top Level Memory Map
A summary of the registers associated with the D2DI block is shown in Table 550. Detailed descriptions of the registers and bits
are given in the subsections that follow.
Table 550. D2DI Register Summary
Offset
0x0
0x1
0x2
0x3
0x4
0x5
0x6
0x7
Register
Name
D2DCTL0
R
W
D2DCTL1
D2DSTAT0
D2DADRLO
D2DDATAHI
D2DDATALO
6
5
D2DEN
D2DCW
D2DSWAI
0
0
0
ACKERF
CNCLF
TIMEF
TERRF
PARF
PAR1
PAR0
D2DBSY
0
0
0
0
0
0
SZ8
0
NBLK
0
0
0
0
D2DIE
R
W
D2DSTAT1
D2DADRHI
Bit 7
ERRIF
D2DIF
R
RWB
4
3
2
0
0
0
1
Bit 0
D2DCLKDIV[1:0]
TIMEOUT[3:0]
W
R
ADR[7:0]
W
R
DATA[15:8]
W
R
DATA[7:0]
W
= Unimplemented or Reserved
MM912_637, Rev. 3.0
Freescale Semiconductor
386
MCU - Die-to-Die Initiator (D2DIV1)
5.25.3.2
Register Definition
5.25.3.3
D2DI Control Register 0 (D2DCTL0)
This register is used to enable and configure the interface width, the wait behavior and the frequency of the interface clock.
Table 551. D2DI Control Register 0 (D2DCTL0)
Offset 0x0
Access: User read/write
7
R
W
Reset
6
5
D2DEN
D2DCW
D2DSWAI
0
0
0
4
3
2
0
0
0
0
0
0
1
0
D2DCLKDIV[1:0]
0
0
Table 552. D2DCTL0 Register Field Descriptions
Field
7
D2DEN
6
D2DCW
5
D2DSWAI
4:2
Description
D2DI Enable — Enables the D2DI module. This bit is write-once in normal mode and can always be written in special modes.
0 D2DI initiator is disabled. No lines are not used, the pins have their GPIO (secondary) function.
1 D2DI initiator is enabled. After setting D2DEN=1 the D2DDAT[7:0] (or [3:0], see D2DCW) lines are driven low with the IDLE
command; the D2DCLK is driven by the divided bus clock.
D2D Connection Width — Sets the number of data lines used by the interface. This bit is write-once in normal modes and
can always be written in special modes.
0 Lines D2DDAT[3:0] are used for four line data transfer. D2DDAT[7:4] are unused.
1 All eight interface lines D2DDAT[7:0] are used for data transfer.
D2D Stop In Wait — Controls the WAIT behavior. This bit can be written at any time.
0 Interface clock continues to run if the CPU enters WAIT mode
1 Interface clock stops if the CPU enters WAIT mode.
Reserved, should be written to 0 to ensure compatibility with future versions of this interface.
1:0
D2DCLKDIV
Interface Clock Divider — Determines the frequency of the interface clock. These bits are write-once in normal modes and
can be always written in special modes. See Figure 117 for details on the clock waveforms
00 Encoding 0. Bus clock divide by 1.
01 Encoding 1. Bus clock divide by 2.
10 Encoding 2. Bus clock divide by 3.
11 Encoding 3. Bus clock divide by 4.
The Clock Divider will provide the waveforms as shown in Figure 117. The duty cycle of the clock is not always 50%, the high
cycle is shorter than 50% or equal but never longer, since this is beneficial for the transaction speed.
bus clock
00
01
10
11
Figure 117. Interface Clock Waveforms for Various D2DCLKDIV Encoding
MM912_637, Rev. 3.0
Freescale Semiconductor
387
MCU - Die-to-Die Initiator (D2DIV1)
5.25.3.4
D2DI Control Register 1 (D2DCTL1)
This register is used to enable the D2DI interrupt and set number of D2DCLK cycles before a timeout error is asserted.
Table 553. D2DI Control Register 1 (D2DCTL1)
Offset 0x1
Access: User read/write
7
R
D2DIE
W
Reset
0
6
5
4
0
0
0
0
0
0
3
2
1
0
0
0
TIMOUT[3:0]
0
0
Table 554. D2DCTL1 Register Field Descriptions
Field
7
D2DIE
6:4
3:0
TIMOUT
Description
D2D Interrupt Enable — Enables the external interrupt
0 External Interrupt is disabled
1 External Interrupt is enabled
Reserved, should be written to 0 to ensure compatibility with future versions of this interface.
Time-out Setting — Defines the number of D2DCLK cycles to wait after the last transaction cycle until a timeout is asserted. In
case of a timeout the TIMEF flag in the D2DSTAT0 register will be set.
These bits are write-once in normal modes and can always be written in special modes.
0000 The acknowledge is expected directly after the last transfer, i.e. the target must not insert a wait cycle.
0001 - 1111: The target may insert up to TIMOUT wait states before acknowledging a transaction until a timeout is asserted
NOTE
“Write-once” means that after writing D2DCNTL0.D2DEN=1 the write accesses to these bits
have no effect.
5.25.3.5
D2DI Status Register 0 (D2DSTAT0)
This register reflects the status of the D2DI transactions.
Table 555. D2DI Status Register 0 (D2DSTAT0)
Offset 0x2
Access: User read/write
7
R
W
Reset
ERRIF
0
6
5
4
3
2
1
0
ACKERF
CNCLF
TIMEF
TERRF
PARF
PAR1
PAR0
0
0
0
0
0
0
0
Table 556. D2DI Status Register 0 Field Descriptions
Field
7
ERRIF
6
ACKERF
5
CNCLF
4
TIMEF
Description
D2DI error interrupt flag — This status bit indicates that the D2D initiator has detected an error condition (summary of the
following five flags).This interrupt is not locally maskable. Write a 1 to clear the flag. Writing a 0 has no effect.
0 D2DI has not detected an error during a transaction.
1 D2DI has detected an error during a transaction.
Acknowledge Error Flag— This read-only flag indicates that in the acknowledge cycle not all data inputs are sampled high,
indicating a potential broken wire. This flag is cleared when the ERRIF bit is cleared by writing a 1 to the ERRIF bit.
CNCLF — This read-only flag indicates the initiator has canceled a transaction and replaced it by an IDLE command due to a
pending error flag (ERRIF). This flag is cleared when the ERRIF bit is cleared by writing a 1 to the ERRIF bit.
Time Out Error Flag — This read-only flag indicates the initiator has detected a time-out error. This flag is cleared when the ERRIF
bit is cleared by writing a 1 to the ERRIF bit.
MM912_637, Rev. 3.0
Freescale Semiconductor
388
MCU - Die-to-Die Initiator (D2DIV1)
Table 556. D2DI Status Register 0 Field Descriptions (continued)
Field
Description
3
Transaction Error Flag — This read-only flag indicates the initiator has detected the error signal during the acknowledge cycle of
the transaction. This flag is cleared when the ERRIF bit is cleared by writing a 1 to the ERRIF bit.
TERRF
2
PARF
1
Parity Error Flag — This read-only flag indicates the initiator has detected a parity error. Parity bits[1:0] contain further information.
This flag is cleared when the ERRIF bit is cleared by writing a 1 to the ERRIF bit.
Parity Bit — P[1] as received by the D2DI
PAR1
0
Parity Bit — P[0] as received by the D2DI
PAR0
5.25.3.6
D2DI Status Register 1 (D2DSTAT1)
This register holds the status of the external interrupt pin and an indicator about the D2DI transaction status.
Table 557. D2DI Status Register 1 (D2DSTAT1)
Offset 0x3
Access: User read
7
R
D2DIF
W
Reset
6
5
4
3
2
1
0
D2DBSY
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Table 558. D2DSTAT1 Register Field Descriptions
Field
7
D2DIF
6
D2DBSY
5:0
Description
D2D Interrupt Flag — This read-only flag reflects the status of the D2DINT Pin. The D2D interrupt flag can only be cleared by a
target specific interrupt acknowledge sequence.
0 External Interrupt is negated
1 External Interrupt is asserted
D2D Initiator Busy — This read-only status bit indicates that a D2D transaction is ongoing.
0 D2D initiator idle.
1 D2D initiator transaction ongoing.
Reserved, should be masked to ensure compatibility with future versions of this interface.
5.25.3.7
D2DI Address Buffer Register (D2DADR)
This read-only register contains information about the ongoing D2D interface transaction. The register content will be updated
when a new transaction starts. In error cases the user can track back, which transaction failed.
Table 559. D2DI Address Buffer Register (D2DADR)
Offset 0x4/0x5
R
Access: User read
15
14
13
12
11
10
9
8
RWB
SZ8
0
NBLK
0
0
0
0
0
0
0
0
0
0
0
0
7
6
5
4
3
2
1
0
0
0
0
ADR[7:0]
W
Reset
0
0
0
0
0
MM912_637, Rev. 3.0
Freescale Semiconductor
389
MCU - Die-to-Die Initiator (D2DIV1)
Table 560. D2DI Address Buffer Register Bit Descriptions
Field
15
RWB
14
SZ8
Description
Transaction Read-Write Direction — This read-only bit reflects the direction of the transaction
0 Write Transaction
1 Read Transaction
Transaction Size — This read-only bit reflects the data size of the transaction
0 16-bit transaction.
1 8-bit transaction.
13
Reserved, should be masked to ensure compatibility with future versions of this interface.
12
Transaction Mode — This read-only bit reflects the mode of the transaction
0 Blocking transaction.
1 Non-blocking transaction.
NBLK
11:8
Reserved, should be masked to ensure compatibility with future versions of this interface.
7:0
Transaction Address — Those read-only bits contain the address of the transaction
ADR[7:0]
5.25.3.8
D2DI Data Buffer Register (D2DDATA)
This read-only register contains information about the ongoing D2D interface transaction. For a write transaction, the data
becomes valid at the begin of the transaction. For a read transaction, the data will be updated during the transaction and is
finalized when the transaction is acknowledged by the target. In error cases, the user can track back what has happened.
Table 561. D2DI Data Buffer Register (D2DDATA)
Offset 0x6/0x7
15
Access: User read
14
13
12
11
10
9
8
R
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
DATA15:0
W
Reset
0
0
0
0
0
0
0
0
0
Table 562. D2DI Data Buffer Register Bit Descriptions
Field
15:0
Description
Transaction Data — Those read-only bits contain the data of the transaction
DATA
Both D2DDATA and D2DADR can be read with byte accesses.
5.25.4
5.25.4.1
Functional Description
Initialization
Out of reset the interface is disabled. The interface must be initialized by setting the interface clock speed, the timeout value, the
transfer width and finally enabling the interface. This should be done using a 16-bit write or if using 8-bit write D2DCTL1 must be
written before D2D2CTL0.D2DEN=1 is written. Once it is enabled in normal modes, only a reset can disable it again (write-once
feature).
5.25.4.2
Transactions
A transaction on the D2D Interface is triggered by writing to either the 256 byte address window or reading from the address
window (see STAA/LDAA 0/1 in the next figure). Depending on which address window is used, a blocking or a non-blocking
transaction is performed. The address for the transaction is the 8-bit wide window relative address. The data width of the CPU
MM912_637, Rev. 3.0
Freescale Semiconductor
390
MCU - Die-to-Die Initiator (D2DIV1)
read or write instructions determines if 8-bit or 16-bit wide data are transferred. There is always only one transaction active.
Figure 118 shows the various types of transactions explained in more detail below.
For all 16-bit read/write accesses of the CPU the addresses are assigned according the big-endian model:
word [15:8]: addr
word[7:0]: addr+1
addr: byte-address (8 bit wide) inside the blocking or non-blocking window, as provided by the CPU and transferred to the D2D
target word: CPU data, to be transferred from/to the D2D target
The application must care for the stretched CPU cycles (limited by the TIMOUT value, caused by blocking or consecutive
accesses), which could affect time limits, including COP (computer operates properly) supervision. The stretched CPU cycles
cause the “CPU halted” phases (see Figure 118).
CPU activity
Blocking
Write
STAA 0
Non-Blocking
Write
D2D activity
CPU activity
Blocking
Read
LDAA # STAA 1
CPU
STAA 0 LDAA # STAA 1 Halted
Write Transaction 0
LDAA 0
D2D activity
CPU Halted
CPU Halted
NOP
Write Transaction 1
Write Transaction 0
D2D activity
CPU activity
CPU Halted
NOP
Write Transaction 1
STAA
MEM LDAA 1
Transaction 0
CPU Halted
NOP
Transaction 1
Figure 118. Blocking and Non-Blocking Transfers.
5.25.4.2.1
Blocking Writes
When writing to the address window associated with blocking transactions, the CPU is held until the transaction is completed,
before completing the instruction. Figure 118 shows the behavior of the CPU for a blocking write transaction shown in the
following example.
STAA
BLK_WINDOW+OFFS0 ; WRITE0 8-bit as a blocking transaction
LDAA
#BYTE1
STAA
BLK_WINDOW+OFFS1 ; WRITE1 is executed after WRITE0 transaction is completed
NOP
Blocking writes should be used when clearing interrupt flags, located in the target or other writes which require that the operation
at the target, is completed before proceeding with the CPU instruction stream.
5.25.4.3
Non-Blocking Writes
When writing to the address window associated with non-blocking transactions, the CPU can continue before the transaction is
completed. However, if there was an ongoing transaction when doing the 2nd write, the CPU is held until the first one is
completed, and before executing the 2nd one. Figure 118 shows the behavior of the CPU for a blocking write transaction shown
in the following example.
STAA
NONBLK_WINDOW+OFFS0; write 8-bit as a blocking transaction
LDAA
#BYTE1
; load next byte
STAA
NONBLK_WINDOW+OFFS1; executed right after the first
NOP
As the figure illustrates, non-blocking writes have a performance advantage, but care must be taken that the following instructions
are not affected by the change in the target caused by the previous transaction.
MM912_637, Rev. 3.0
Freescale Semiconductor
391
MCU - Die-to-Die Initiator (D2DIV1)
5.25.4.4
Blocking Read
When reading from the address window associated with blocking transactions, the CPU is held until the data is returned from the
target, before completing the instruction. Figure 118 shows the behavior of the CPU for a blocking read transaction shown in the
following example.
LDAA
BLK_WINDOW+OFFS0 ; Read 8-bit as a blocking transaction
STAA
MEM
; Store result to local Memory
LDAA
BLK_WINDOW+OFFS1 ; Read 8-bit as a blocking transaction
5.25.4.5
Non-Blocking Read
Read access to the non-blocking window is reserved for future use. When reading from the address window associated with
non-blocking writes, the read returns an all 0s data byte or word. This behavior can change in future revisions.
5.25.4.6
Transfer Width
8-bit wide writes or reads are translated into 8-bit wide interface transactions. 16-bit wide, aligned writes or reads are translated
into a16-bit wide interface transactions. 16-bit wide, misaligned writes or reads are split up into two consecutive 8-bit transactions
with the transaction on the odd address first followed by the transaction on the next higher even address. Due to the much more
complex error handling (by the MCU), misaligned 16-bit transfers should be avoided.
5.25.4.7
Error Conditions and Handling Faults
Since the S12 CPU (as well as the S08) does not provide a method to abort a transfer once started, the D2DI asserts a
D2DERRINT. The ERRIF Flag is set in the D2DSTAT0 register. Depending on the error condition, further error flags will be set,
as described below. The content of the address and data buffers are frozen and all transactions will be replaced by an IDLE
command, until the error flag is cleared. If an error is detected during the read transaction of a read-modify-write instruction, or
a non-blocking write transaction was followed by another write or read transaction, the second transaction is cancelled. The
CNCLF is set in the D2DSTAT0 register to indicate that a transaction has been cancelled. The D2DERRINT handler can read
the address and data buffer register to assess the error situation. Any further transaction will be replaced by IDLE until the ERRIF
is cleared.
5.25.4.7.1
Missing Acknowledge
If the target detects a wrong command, it will not send back an acknowledge. The same situation occurs if the acknowledge is
corrupted. The D2DI detects this missing acknowledge after the timeout period configured in the TIMOUT parameter of the
D2DCTL1 register. In case of a timeout, the ERRIF and the TIMEF flags in the D2DSTAT0 register will be set.
5.25.4.7.2
Parity error
In the final acknowledge cycle of a transaction, the target sends two parity bits. If this parity does not match the parity calculated
by the initiator, the ERRIF and the PARF flags in the D2DSTAT0 register will be set. The PAR[1:0] bits contain the parity value
received by the D2DI.
5.25.4.7.3
Error Signal
During the acknowledge cycle the target can signal a target specific error condition. If the D2DI finds the error signal asserted
during a transaction, the ERRIF and the TERRF flags in the D2DSTAT0 register will be set.
MM912_637, Rev. 3.0
Freescale Semiconductor
392
MCU - Die-to-Die Initiator (D2DIV1)
5.25.4.8
5.25.4.8.1
Low Power Mode Options
D2DI in Run Mode
In run mode, with the D2D Interface enable (D2DEN) bit in the D2D control register 0 clear, the D2DI system is in a low-power,
disabled state. D2D registers remain accessible, but clocks to the core of this module are disabled. On D2D lines the GPIO
function is activated.
5.25.4.8.2
D2DI in Wait Mode
D2DI operation in wait mode depends upon the state of the D2DSWAI bit in D2D control register 0.
•
If D2DSWAI is clear, the D2DI operates normally when the CPU is in the wait mode
•
If D2DSWAI is set and the CPU enters the wait mode, any pending transmission is completed. When the D2DCLK
output is driven low then the clock generation is stopped, all internal clocks to the D2DI module are stopped as well and
the module enters a power saving state.
5.25.4.8.3
D2DI in Stop Mode
If the CPU enters the STOP mode, the D2DI shows the same behavior as for the wait mode with an activated D2DSWAI bit.
5.25.4.8.4
Reset
In case of reset any transaction is immediately stopped and the D2DI module is disabled.
5.25.4.8.5
Interrupts
The D2DI only originates interrupt requests when D2DI is enabled (D2DIE bit in D2DCTL0 set). There are two different interrupt
requests from the D2D module. The interrupt vector offset and interrupt priority are chip dependent.
5.25.4.8.5.1 D2D External Interrupt
This is a level sensitive active high external interrupt driven by the D2DINT input. This interrupt is enabled if the D2DIE bit in the
D2DCTL1 register is set. The interrupt must be cleared using an target specific clearing sequence. The status of the D2D input
pin can be observed by reading the D2DIF bit in the D2DSTAT1 register.
The D2DINIT signal is also asserted in the wait and stop mode; it can be used to leave these modes.
To read data bus (D2DSTAT1.D2DIF)
D2DINTI
D2DINT
D2DIE
Figure 119. D2D External Interrupt Scheme
5.25.4.8.5.2 D2D Error Interrupt
Those D2D interface specific interrupts are level sensitive and are all cleared by writing a 1 to the ERRIF flag in the D2DSTAT0
register. This interrupt is not locally maskable and should be tied to the highest possible interrupt level in the system, on an S12
architecture to the XIRQ. See the chapter “Vectors” of the MCU description for details.
MM912_637, Rev. 3.0
Freescale Semiconductor
393
MCU - Die-to-Die Initiator (D2DIV1)
ACKERF
CNCLF
ERRIF
1
TIMEF
TERRF
PARF
D2DERRINT
D2DEN
Figure 120. D2D Internal Interrupts
5.25.5
Initialization Information
During initialization, the transfer width, clock divider, and timeout value must be set according to the capabilities of the target
device before starting any transaction. See the D2D Target specification for details.
5.25.6
5.25.6.1
Application Information
Entering Low Power Mode
The D2DI module is typically used on a microcontroller along with an analog companion device containing the D2D target
interface and supplying the power. Interface specification does not provide special wires for signalling low power modes to the
target device. The CPU should determine when it is time to enter one of the above power modes.The basic flow is as follows:
1. CPU determines there is no more work pending.
2. CPU writes a byte to a register on the analog die using blocking write configuring which mode to enter.
3. Analog die acknowledges that write sending back an acknowledge symbol on the interface.
4. CPU executes WAIT or STOP command.
5. Analog die can enter low power mode - (S12 needs some more cycles to stack data!)
; Example shows S12 code
SEI
; disable interrupts during test
; check is there is work pending?
; if yes, branch off and re-enable interrupt
; else
LDAA
#STOP_ENTRY
STAA
MODE_REG
; store to the analog die mode reg (use blocking write here)
CLI
; re-enable right before the STOP instruction
STOP
; stack and turn off all clocks inc. interface clock
For wake-up from STOP the basic flow is as follows:
1. Analog die detects a wake-up condition e.g. on a switch input or start bit of a LIN message.
2. Analog die exits Voltage Regulator low power mode.
3. Analog die asserts the interrupt signal D2DINT.
4. CPU starts clock generation.
5. CPU enters interrupt handler routine.
6. CPU services interrupt and acknowledges the source on the analog die.
NOTE
Entering STOP mode or WAIT mode with D2DSWAI asserted, the clock will complete the
high duty cycle portion and settle at a low level.
MM912_637, Rev. 3.0
Freescale Semiconductor
394
MM912_637 - Trimming
6
MM912_637 - Trimming
6.1
Introduction
To ensure the high precision requirements over a wide temperature and lifetime range, the MM912_637 uses several trimming
and calibration techniques. Due to the advantage of the FLASH technology available in the microcontroller die, several factory
trimmed values can be used to increase the overall device accuracy.
Trimming will use factory measured and calculated values stored in the microcontroller IRF (Information Register) to be loaded
into specific registers in the MCU and analog die at system power up.
Calibration would be done during operation of the system using internal references or specific measurement procedures. As
calibration is an essential part of the signal acquisition, see Section 5.7.5, “Calibration" as part of Section 5.7, “Channel
Acquisition".
NOTE
The MM912_637 trimming is primarily used to achieve the specified analog die parameters.
The only valid trimming of the MCU die, the Internal Oscillator Trimming (ICG) will be
automatically stored into the MCU trimming register during power up. See
Section 5.22.3.2.15, “S12CPMU IRC1M Trim Registers (CPMUIRCTRIMH /
CPMUIRCTRIML)".
6.2
IFR Trimming Content and Location
All device trimming information are stored in the MCU Information Register (IFR) located at the following address. See also
Section 5.24, “128 kByte Flash Module (S12FTMRC128K1V1)".
Table 563. IFR Location
Global Address
(IFRON)
Size
(Bytes)
0x0_4000 – 0x0_4007
8
0x0_4008 – 0x0_40B5
174
0x0_40B6 – 0x0_40B7
2
Version ID(305)
0x0_40B8 – 0x0_40BF
8
Reserved
0x0_40C0 – 0x0_40FF
64
Analog Die Trimming Information (Program Once Field)
Field Description
Unique Device ID
Reserved
Notes
305.Used to track firmware patch versions, see Section 5.24.4.2, “IFR Version ID Word".
NOTE
The Program Once reserved field can be read using the Read Once command as described
in Section 5.24.4.5.4, “Read Once Command".
6.2.1
IFR - Trimming Content for Analog Die Functionality
The following table shows the details of the 64 byte (0x0_40C0 – 0x0_40FF) Program Once Field Content used to store the
Analog Die Trimming Information. Refer to Section 5.24.4.5.4, “Read Once Command", for access instructions.
MM912_637, Rev. 3.0
Freescale Semiconductor
395
MM912_637 - Trimming
Table 564. Analog Die Trimming Information
Global
Address
(IFRON)
OFFSET
HEX
DEC
0x0_40C0
00
00
0x0_40C1
01
01
0x0_40C2
02
02
0x0_40C3
03
03
0x0_40C4
04
04
0x0_40C5
05
05
0x0_40C6
06
06
0x0_40C7
07
07
0x0_40C8
08
08
0x0_40C9
09
09
0x0_40CA
0A
10
0x0_40CB
0B
11
0x0_40CC
0C
12
0x0_40CD
0D
13
0x0_40CE
0E
14
0x0_40CF
0F
15
0x0_40D0
10
16
0x0_40D1
11
17
Byte Description
7
6
5
4
3
Target Register
2
1
0
IGC4[9:8]
IGC4[7:0]
IGC8[7:0]
COMP_IG8 (hi)
COMP_IG8 (lo)
IGC16[9:8]
IGC16[7:0]
COMP_IG16 (hi)
COMP_IG16 (lo)
IGC32[9:8]
IGC32[7:0]
COMP_IG32 (hi)
COMP_IG32 (lo)
IGC64[9:8]
IGC64[7:0]
COMP_IG64 (hi)
COMP_IG64 (lo)
IGC128[9:8]
IGC128[7:0]
COMP_IG128 (hi)
COMP_IG128 (lo)
IGC256[9:8]
IGC256[7:0]
COMP_IG256 (hi)
COMP_IG256 (lo)
IGC512[9:8]
IGC512[7:0]
DBG
3
COMP_IG4 (hi)
COMP_IG4 (lo)
IGC8[9:8]
UBG
3
Name
COMP_IG512 (hi)
COMP_IG512 (lo)
Offset
0xB0
0xB2
0xB4
0xB6
0xB8
0xBA
0xBC
0xBE
TCIBG2[2:0]
SLPBG[2:0]
TRIM_BG0 (hi)
0xE0
IBG2[2:0]
IBG1[2:0]
TRIM_BG0 (lo)
0xE1
TCBG2[2:0]
TCBG1[2:0]
TRIM_BG1 (hi)
0xE2
SLPBG[2:0]
TRIM_BG1 (lo)
0xE3
0x0_40D2
12
18
0x0_40D3
13
19
0x0_40D4
14
20
V1P2BG2[3:0]
V1P2BG1[3:0]
TRIM_BG2 (hi)
0xE4
0x0_40D5
15
21
V2P5BG2[3:0]
V2P5BG1[3:0]
TRIM_BG2 (lo)
0xE5
0x0_40D6
16
22
LIN
TRIM_LIN
0xE6
0x0_40D7
17
23
LVT
TRIM_LVT
0xE7
0x0_40D8
18
24
TRIM_OSC (hi)
0xE8
0x0_40D9
19
25
LPOSC[7:0]
TRIM_OSC (lo)
0xE9
0x0_40DA
1A
26
VOC_S[7:0]
COMP_VOS
0xAA(306)
0x0_40DB
1B
27
VOC_O[7:0]
COMP_VOO
0xAA(306)
0x0_40DC
1C
28
VOC_S[7:0] (Chopper Mode)
COMP_VOS_CHOP
0xAA(306)
0x0_40DD
1D
29
VOC_O[7:0] (Chopper Mode)
COMP_VOO_CHOP
0xAA(306)
0x0_40DE
1E
30
0x0_40DF
1F
31
0x0_40E0
20
32
0x0_40E1
21
33
0x0_40E2
22
34
ITO[7:0]
COMP_ITO
0xD0
0x0_40E3
23
35
ITG[7:0]
COMP_ITG
0xD1
0x0_40E4
24
36
n.a.
25
37
BG3 diag measurement from Vsense channel after cal at
room
GAIN_CAL_VSENSE_ROOM (hi)
0x0_40E5
GAIN_CAL_VSENSE_ROOM (lo)
n.a.
0x0_40E6
26
38
GAIN_CAL_VOPT_ROOM (hi)
n.a.
0x0_40E7
27
39
GAIN_CAL_VOPT_ROOM (lo)
n.a.
LPOSC[12:8]
VSGC[9:8]
VSGC[7:0]
COMP_VSG (hi)
COMP_VSG (lo)
VOGC[9:8]
VOGC[7:0]
BG3 diag measurement from Vopt channel after cal at room
COMP_VOG (hi)
COMP_VOG (lo)
0xAC(306)
0xAC(306)
MM912_637, Rev. 3.0
Freescale Semiconductor
396
MM912_637 - Trimming
Table 564. Analog Die Trimming Information
Global
Address
(IFRON)
OFFSET
HEX
DEC
0x0_40E8
28
40
0x0_40E9
29
41
0x0_40EA
2A
42
0x0_40EB
2B
43
0x0_40EC
2C
44
0x0_40ED
2D
0x0_40EE
Byte Description
7
6
5
4
3
Target Register
2
1
0
Name
Offset
GAIN_CAL_IG4_ROOM (hi)
n.a.
GAIN_CAL_IG4_ROOM (med)
n.a.
GAIN_CAL_IG4_ROOM (lo)
n.a.
COMP_VSG_COLD[7:0]
VSENSE Channel Gain
Compensation - COLD Temp(307)
n.a.
45
COMP_VSG_HOT[7:0]
VSENSE Channel Gain
Compensation - HOT Temp(307)
n.a.
2E
46
COMP_VOG_COLD[7:0]
VOPT Channel Gain Compensation COLD Temp(307)
n.a.
0x0_40EF
2F
47
COMP_VOG_HOT[7:0]
VOPT Channel Gain Compensation HOT Temp(307)
n.a.
0x0_40F0
30
48
IGC4_COLD[7:0]
Current Channel Gain (4)
Compensation - COLD Temp(307)
n.a.
0x0_40F1
31
49
IGC4_HOT[7:0]
Current Channel Gain (4)
Compensation - HOT Temp(307)
n.a.
0x0_40F2
32
50
IGC8_COLD[7:0]
Current Channel Gain (8)
Compensation - COLD Temp(307)
n.a.
0x0_40F3
33
51
IGC8_HOT[7:0]
Current Channel Gain (8)
Compensation - HOT Temp(307)
n.a.
0x0_40F4
34
52
IGC16_COLD[7:0]
Current Channel Gain (16)
Compensation - COLD Temp(307)
n.a.
0x0_40F5
35
53
IGC16_HOT[7:0]
Current Channel Gain (16)
Compensation - HOT Temp(307)
n.a.
0x0_40F6
36
54
IGC32_COLD[7:0]
Current Channel Gain (32)
Compensation - COLD Temp(307)
n.a.
0x0_40F7
37
55
IGC32_HOT[7:0]
Current Channel Gain (32)
Compensation - HOT Temp(307)
n.a.
0x0_40F8
38
56
IGC64_COLD[7:0]
Current Channel Gain (64)
Compensation - COLD Temp(307)
n.a.
0x0_40F9
39
57
IGC64_HOT[7:0]
Current Channel Gain (64)
Compensation - HOT Temp(307)
n.a.
0x0_40FA
3A
58
IGC128_COLD[7:0]
Current Channel Gain (128)
Compensation - COLD Temp(307)
n.a.
0x0_40FB
3B
59
IGC128_HOT[7:0]
Current Channel Gain (128)
Compensation - HOT Temp(307)
n.a.
0x0_40FC
3C
60
IGC256_COLD[7:0]
Current Channel Gain (256)
Compensation - COLD Temp(307)
n.a.
0x0_40FD
3D
61
IGC256_HOT[7:0]
Current Channel Gain (256)
Compensation - HOT Temp(307)
n.a.
0x0_40FE
3E
62
IGC512_COLD[7:0]
Current Channel Gain (512)
Compensation - COLD Temp(307)
n.a.
0x0_40FF
3F
63
IGC512_HOT[7:0]
Current Channel Gain (512)
Compensation - HOT Temp(307)
n.a.
BG3 diag measurement from I channel (gain4) at room
Reserved
Notes
306.Based on the selection of the voltage measurement source (VSENSE or VOPT) and the activation of chopper mode.
307.7 Bit character with bit 7 (MSB) as sign (0 = “+”; 1 = “-”) with the difference to the corresponding room temperature value 
(e.g. 10000010 = “-2”).
MM912_637, Rev. 3.0
Freescale Semiconductor
397
MM912_637 - Trimming
6.2.2
6.2.2.1
Analog Die Trimming Overview
Current Channel Gain Compensation Trim (COMP_IG4-COMP_IG512)
To achieve the specified accuracy of the current acquisition, the optimum trim value is calculated during final test and stored into
the MCU FLASH memory. On device every power up, the corresponding trim value needs to be copied into the corresponding
analog register via D2D interface. See Section 5.7, “Channel Acquisition" for additional details.
6.2.2.2
Bandgap Reference Trimming (TRIM_BG0-TRIM_BG2)
To achieve the specified accuracy of the integrated voltage regulators on the analog die, the optimum trim value is calculated
during final test and stored into the MCU FLASH memory. On device every power up, the corresponding trim value needs to be
copied into the desired analog register via D2D interface.
6.2.2.3
LIN Slope Control Trimming (TRIM_LIN)
To achieve the specified slope of the LIN output signal, the optimum trim information is determined during final test and stored
into the IFR register block of the MCU FLASH memory. On device every power up, the corresponding trim value needs to be
copied into the desired analog register via D2D interface.
6.2.2.4
Low Voltage Threshold Trim (TRIM_LVT)
To achieve the specified low voltage behavior, on device every power up, the corresponding trim value (LVR) needs to be copied
into the corresponding analog trim register via D2D interface.
6.2.2.5
Low Power Oscillator Trimming (TRIM_OSC)
To achieve the specified accuracy of the analog low power reference frequency (fTOL_A), the optimum trim value is calculated
during final test and stored into the IFR register block of the MCU FLASH memory. On device every power up, the corresponding
trim value needs to be copied into the desired analog register via D2D interface.
6.2.2.6
Voltage Channel Compensation (COMP_VOx, COMP_VSG, COMP_VOG)
To achieve the specified accuracy of the voltage channels, gain and offset compensation are trimmed during final test and stored
into the IFR register block of the MCU FLASH memory. The information is used during the calibration procedure described in
Section 5.7.5, “Calibration".
MM912_637, Rev. 3.0
Freescale Semiconductor
398
MM912_637 - Trimming
6.2.2.7
Temperature Sense Module Trimming (COMP_ITO, COMP_ITG)
To achieve the specified accuracy of the internal temperature sense module, the optimum trim information is determined during
final test at hot / cold temperature and stored into the IFR register block of the MCU FLASH memory. On device every power up,
the corresponding trim value needs to be copied into the desired analog register via D2D interface.
6.2.2.8
Band Gap Reference - Diagnostic Measurements (GAIN_CAL_X_X)
To achieve the specified accuracy of the voltage and current channels, reference measurements are performed during final test
and stored for different temperatures into the IFR register block of the MCU FLASH memory. The information is used during the
calibration procedure described in Section 5.7.5, “Calibration".
6.2.2.9
HOT / COLD Gain Compensation Data (0x0_40EC...0x0_40FF)
To achieve the specified accuracy of the voltage and current channels, reference measurements are performed during final test
and stored for different temperatures into the IFR register block of the MCU FLASH memory. The information is used during the
calibration procedure described in Section 5.7.5, “Calibration".
6.3
6.3.1
Memory Map and Registers
Overview
This section provides a detailed description of the memory map and registers for the analog die trimming excluding registers used
for calibration located from offset 0xE0 to 0xEF. Refer to Section 5.7.5, “Calibration" for details on Current Channel Gain
Compensation Trim (COMP_IG4-COMP_IG512), Voltage Channel Compensation (COMP_VOx, COMP_VSG, COMP_VOG),
Temperature Sense Module Trimming (COMP_ITO, COMP_ITG), Band Gap Reference - Diagnostic Measurements
(GAIN_CAL_X_X) and HOT / COLD Gain Compensation Data (0x0_40EC...0x0_40FF).
6.3.2
Module Memory Map
The memory map for the Compensation module is given below in Table 565.
Table 565. Module Memory Map
Offset(308)
0xE0
0xE1
0xE2
0xE3
0xE4
0xE5
0xE6
Name
TRIM_BG0 (hi)
R
Trim bandgap 0
W
TRIM_BG0 (lo)
R
Trim bandgap 0
W
TRIM_BG1 (hi)
R
Trim bandgap 1
W
TRIM_BG1 (lo)
R
Trim bandgap 1
W
TRIM_BG2 (hi)
R
Trim bandgap 2
W
TRIM_BG2 (lo)
R
Trim bandgap 2
W
TRIM_LIN
R
Trim LIN
W
7
6
0
0
0
0
UBG3
DBG3
0
0
0
5
0
4
3
2
1
TCIBG2[2:0]
TCIBG1[2:0]
IBG2[2:0]
IBG1[2:0]
TCBG2[2:0]
TCBG1[2:0]
0
0
SLPBG[2:0]
V1P2BG2[3:0]
V1P2BG1[3:0]
V2P5BG2[3:0]
V2P5BG1[3:0]
0
0
0
0
0
0
0
LIN
MM912_637, Rev. 3.0
Freescale Semiconductor
399
MM912_637 - Trimming
Table 565. Module Memory Map
Offset
(308)
0xE7
Name
TRIM_LVT
R
Trim low voltage threshold
W
0xE8
0xE9
TRIM_OSC (hi)
R
Trim LP oscillator
W
TRIM_OSC (lo)
R
Trim LP oscillator
W
0xEA0xEF
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
0
LVT
LPOSC[12:0]
R
Reserved
7
0
0
0
0
0
0
W
Notes
308.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
6.3.2.1
Trim Bandgap 0 (TRIM_BG0 (hi))
Table 566. Trim Bandgap 0 (TRIM_BG0 (hi))
Offset(309)
0xE0
R
Access: User read/write
7
6
0
0
0
0
5
3
2
TCIBG2[2:0]
W
Reset
4
0
0
1
0
TCIBG1[2:0]
0
0
0
0
Notes
309.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 567. Trim Bandgap 0 (TRIM_BG0 (hi)) - Register Field Descriptions
Field
Description
5-3
The optimal content of this register is determined during final test and stored in the microcontroller IFR. For proper operation
of the MM912_637, the content has to be copied to this location. See Section 6.2.1, “IFR - Trimming Content for Analog Die
Functionality" for location information.
TCIBG2[2:0]
2-0
TCIBG1[2:0]
6.3.2.2
Trim Bandgap 0 (TRIM_BG0 (lo))
Table 568. Trim Bandgap 0 (TRIM_BG0 (lo))
Offset(310)
R
0xE1
Access: User read/write
7
6
0
0
0
0
5
3
2
IBG2[2:0]
W
Reset
4
0
0
1
0
IBG1[2:0]
0
0
0
0
Notes
310.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
MM912_637, Rev. 3.0
Freescale Semiconductor
400
MM912_637 - Trimming
Table 569. Trim Bandgap 0 (TRIM_BG0 (lo)) - Register Field Descriptions
Field
Description
5-3
The optimal content of this register is determined during final test and stored in the microcontroller IFR. For proper operation
of the MM912_637, the content has to be copied to this location. See Section 6.2.1, “IFR - Trimming Content for Analog Die
Functionality" for location information.
IBG2[2:0]
2-0
IBG1[2:0]
6.3.2.3
Trim Bandgap 1 (TRIM_BG1 (hi))
Table 570. Trim Bandgap 1 (TRIM_BG1 (hi))
Offset(311)
0xE2
R
W
Access: User read/write
7
6
UBG3
DBG3
0
0
Reset
5
4
3
2
TCBG2[2:0]
0
0
1
0
TCBG1[2:0]
0
0
0
0
Notes
311.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 571. Trim Bandgap 1 (TRIM_BG1 (hi)) - Register Field Descriptions
Field
Description
7
The optimal content of this register is determined during final test and stored in the microcontroller IFR. For proper operation
of the MM912_637, the content has to be copied to this location. See Section 6.2.1, “IFR - Trimming Content for Analog Die
Functionality" for location information.
UBG3
6
DBG3
5-3
TCBG2[2:0]
2-1
TCBG1[2:0]
6.3.2.4
Trim Bandgap 1 (TRIM_BG1 (lo))
Table 572. Trim Bandgap 1 (TRIM_BG1 (lo))
Offset(312)
0xE3
R
Access: User read/write
7
6
5
4
3
0
0
0
0
0
0
0
0
0
0
2
0
SLPBG[2:0]
W
Reset
1
0
0
0
Notes
312.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 573. Trim Bandgap 1 (TRIM_BG1 (lo)) - Register Field Descriptions
Field
Description
2-0
The optimal content of this register is determined during final test and stored in the microcontroller IFR. For proper operation
of the MM912_637, the content has to be copied to this location. See Section 6.2.1, “IFR - Trimming Content for Analog Die
Functionality" for location information.
SLPBG[2:0]
MM912_637, Rev. 3.0
Freescale Semiconductor
401
MM912_637 - Trimming
6.3.2.5
Trim Bandgap 2 (TRIM_BG2 (hi))
Table 574. Trim Bandgap 2 (TRIM_BG2 (hi))
Offset(313) 0xE4
Access: User read/write
7
6
R
5
4
3
V1P2BG2[3:0]
W
Reset
0
0
2
1
0
0
0
V1P2BG1[3:0]
0
0
0
0
Notes
313.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 575. Trim Bandgap 2 (TRIM_BG2 (hi)) - Register Field Descriptions
Field
Description
7-4
The optimal content of this register is determined during final test and stored in the microcontroller IFR. For proper operation
of the MM912_637, the content has to be copied to this location. See Section 6.2.1, “IFR - Trimming Content for Analog Die
Functionality" for location information.
V1P2BG2[3:0
3-0
V1P2BG1[3:0
6.3.2.6
Trim Bandgap 2 (TRIM_BG2 (lo))
Table 576. Trim Bandgap 2 (TRIM_BG2 (hi))
Offset(314)
0xE5
Access: User read/write
7
6
R
5
4
3
V2P5BG2[3:0]
W
Reset
0
0
2
1
0
0
0
V2P5BG1[3:0]
0
0
0
0
Notes
314.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 577. Trim Bandgap 2 (TRIM_BG2 (hi)) - Register Field Descriptions
Field
Description
7-4
The optimal content of this register is determined during final test and stored in the microcontroller IFR. For proper operation
of the MM912_637, the content has to be copied to this location. See Section 6.2.1, “IFR - Trimming Content for Analog Die
Functionality" for location information.
V2P5BG2[3:0
3-0
V2P5BG1[3:0
MM912_637, Rev. 3.0
Freescale Semiconductor
402
MM912_637 - Trimming
6.3.2.7
Trim LIN (TRIM_LIN)
Table 578. Trim LIN (TRIM_LIN)
Offset(315) 0xE6
R
Access: User read/write
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
Reset
0
LIN
0
Notes
315.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 579. Trim LIN (TRIM_LIN) - Register Field Descriptions
Field
Description
0
The optimal content of this register is determined during final test and stored in the microcontroller IFR. For proper operation
of the MM912_637, the content has to be copied to this location. See Section 6.2.1, “IFR - Trimming Content for Analog Die
Functionality" for location information.
LIN
6.3.2.8
Trim low voltage threshold (TRIM_LVT)
Table 580. Trim Low Voltage Threshold (TRIM_LVT)
Offset(316) 0xE7
R
Access: User read/write
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
W
Reset
0
LVT
0
Notes
316.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 581. Trim Low Voltage Threshold (TRIM_LVT) - Register Field Descriptions
Field
Description
0
The optimal content of this register is determined during final test and stored in the microcontroller IFR. For proper operation
of the MM912_637, the content has to be copied to this location. See Section 6.2.1, “IFR - Trimming Content for Analog Die
Functionality" for location information.
LVT
MM912_637, Rev. 3.0
Freescale Semiconductor
403
MM912_637 - Trimming
6.3.2.9
Trim LP Oscillator (TRIM_OSC (hi), TRIM_OSC (lo))
Table 582. Trim LP Oscillator (TRIM_OSC (hi), TRIM_OSC (lo))
Offset(317) 0xE8
Access: User read/write
7
6
5
4
3
R
0
0
0
0
R
0
0
0
0
0
1
1
1
1
LPOSC[7:0]
W
Reset
1
LPOSC[12:8]
W
Reset
2
0
0
1
1
Notes
317.Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
Table 583. Trim LP Oscillator (TRIM_OSC (hi), TRIM_OSC (lo)) - Register Field Descriptions
Field
Description
12-0
The optimal content of this register is determined during final test and stored in the microcontroller IFR. For proper operation
of the MM912_637, the content has to be copied to this location. See Section 6.2.1, “IFR - Trimming Content for Analog Die
Functionality" for location information.
LPOSC[12:0]
MM912_637, Rev. 3.0
Freescale Semiconductor
404
Packaging
7
Packaging
7.1
Package dimensions
For the most current package revision, visit www.freescale.com and perform a keyword search using the “98A” listed below.
EP SUFFIX
48 PIN QFN
QFN48LD-EP
REVISION D
MM912_637, Rev. 3.0
Freescale Semiconductor
405
Packaging
EP SUFFIX
48 PIN QFN
QFN48LD-EP
REVISION D
MM912_637, Rev. 3.0
Freescale Semiconductor
406
Packaging
EP SUFFIX
48 PIN QFN
QFN48LD-EP
REVISION D
MM912_637, Rev. 3.0
Freescale Semiconductor
407
Packaging
EP SUFFIX
48 PIN QFN
QFN48LD-EP
REVISION D
MM912_637, Rev. 3.0
Freescale Semiconductor
408
Packaging
EP SUFFIX
48 PIN QFN
QFN48LD-EP
REVISION D
MM912_637, Rev. 3.0
Freescale Semiconductor
409
Packaging
EP SUFFIX
48 PIN QFN
QFN48LD-EP
REVISION D
MM912_637, Rev. 3.0
Freescale Semiconductor
410
Packaging
EP SUFFIX
48 PIN QFN
QFN48LD-EP
REVISION D
MM912_637, Rev. 3.0
Freescale Semiconductor
411
Revision History
8
Revision History
REVISION
DATE
DESCRIPTION OF CHANGES
1.0
4/2011
•
Initial release
2.0
8/2011
•
Minor changes throughout the document
3.0
1/2012
•
Minor description changes and logo to align this data sheet to the Xtrinsic product platform. No content
was altered.
MM912_637, Rev. 3.0
Freescale Semiconductor
412
How to Reach Us:
Home Page:
www.freescale.com
Web Support:
http://www.freescale.com/support
USA/Europe or Locations Not Listed:
Freescale Semiconductor, Inc.
Technical Information Center, EL516
2100 East Elliot Road
Tempe, Arizona 85284
1-800-521-6274 or +1-480-768-2130
www.freescale.com/support
Europe, Middle East, and Africa:
Freescale Halbleiter Deutschland GmbH
Technical Information Center
Schatzbogen 7
81829 Muenchen, Germany
+44 1296 380 456 (English)
+46 8 52200080 (English)
+49 89 92103 559 (German)
+33 1 69 35 48 48 (French)
www.freescale.com/support
Japan:
Freescale Semiconductor Japan Ltd.
Headquarters
ARCO Tower 15F
1-8-1, Shimo-Meguro, Meguro-ku,
Tokyo 153-0064
Japan
0120 191014 or +81 3 5437 9125
[email protected]
Asia/Pacific:
Freescale Semiconductor China Ltd.
Exchange Building 23F
No. 118 Jianguo Road
Chaoyang District
Beijing 100022 
China 
+86 10 5879 8000
[email protected]
For Literature Requests Only:
Freescale Semiconductor Literature Distribution Center
P.O. Box 5405
Denver, Colorado 80217
1-800-441-2447 or +1-303-675-2140
Fax: +1-303-675-2150
[email protected]
Information in this document is provided solely to enable system and
software implementers to use Freescale Semiconductor products. There are
no express or implied copyright licenses granted hereunder to design or
fabricate any integrated circuits or integrated circuits based on the
information in this document.
Freescale Semiconductor reserves the right to make changes without further
to products herein. Freescale Semiconductor makes no warranty,
representation or regarding the suitability of its products for any particular
purpose, nor does Freescale Semiconductor assume any liability arising out
of the or use of any product or circuit, and specifically disclaims any and all
liability, including without limitation consequential or incidental damages.
“Typical” parameters that may be provided in Freescale Semiconductor data
sheets and/or specifications can and do vary in different applications and
actual performance may vary over time. All operating parameters, including
“Typicals”, be validated for each customer application by technical experts.
Freescale Semiconductor does not convey any license under its patent rights
nor the rights of others. Freescale Semiconductor products are designed,
intended, or authorized for use as components in systems intended for
surgical implant into the body, or other applications intended to support or
sustain life, or for any other application in which the failure of the Freescale
Semiconductor product could create a situation where personal injury or
death may occur. Should Buyer purchase or use Freescale Semiconductor
products for any such unintended or unauthorized application, Buyer shall
indemnify and hold Freescale Semiconductor and its officers, employees,
subsidiaries, affiliates, and harmless against all claims, costs, damages, and
expenses, and reasonable attorney fees arising out of, directly or indirectly,
any claim of personal injury or death associated with such unintended or
unauthorized use, even if such claim alleges that Freescale Semiconductor
was negligent regarding the design or manufacture of the part.
Freescale and the Freescale logo are trademarks of Freescale
Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Qorivva, S12 MagniV,
SMARTMOS and Xtrinsic are trademarks of Freescale
Semiconductor, Inc. ARM is the registered trademark of ARM
Limited. The Power Architecture and Power.org word marks and the
Power and Power.org logos and related marks are trademarks and
service marks licensed by Power.org. All other product or service
names are the property of their respective owners. ©2012 Freescale
Semiconductor, Inc.
MM912_637D1
Rev. 3.0
1/2012