To provide the most up-to-date information, the document revision on the Internet is the most current. A
printed copy may be an earlier revision. To verify you have the latest information available, refer to :
freescale.com.
The following revision history table summarizes changes contained in this document. The individual
module sections contain revision history tables with more detailed information.
This document containsinformation for all constituent modules, with the exception of the S12Z CPU. For
S12ZCPU information please refer to the CPU S12Z Reference Manual.
Revision History
Date
12 Dec 20131.2Replaced generic 8-channel TIM section with specific 4-channel TIM section
20 JAN 20141.3Updated Stop mode description for BDC enabled case
Freescale Semiconductor reserves the right to make changes without further notice to any products herein. Freescale Semiconductor makes no warranty,
representation or guaranteeregardingthe suitability of its products for any particular purpose, nor does Freescale Semiconductor assume any liability arising out of
the application or use of any product or circuit, and specifically disclaims anyand all liability, including without limitation consequential or incidental damages. “Typical”
parameters that may be provided in FreescaleSemiconductor data sheets and/or specifications can and do vary in different applications and actual performance may
vary over time. All operating parameters, including “Typicals”, must be validated for each customer application by customer’s technical experts. Freescale
Semiconductor does not convey any license under its patent rights nor the rights of others. Freescale Semiconductor products are not 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 injuryor death may occur. Should Buyer purchase or
useFreescaleSemiconductorproducts for any such unintended orunauthorized application, Buyer shall indemnifyand hold Freescale Semiconductor and its officers,
employees,subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly
or indirectly,anyclaim of personal injury or death associated with such unintended or unauthorized use, evenif such claim alleges that FreescaleSemiconductor was
negligent regarding the design or manufacture of the part.
Revision
Level
Description
Textual enhancements and corrections throughout
Updated electrical parameter section and added parameters for temperataures up to 175°C
- Added Table A-5
- Merged Table A-8 and A-9 into Table A-9. Values updated. .
- Table A-15. Parameter #2. max changed from 800uA to 1050uA
- Table A-15. Inserted new C class parameter ISUPS at 85C. typ. 80uA
- Appendices B,D and E. Updated parameter values based on characterization results.
- Appendix C. Added parameter values for range above T=150
- Table F-3. Merged rows 2a and 2b. Merged rows 6a and 6b.
- Appendix G. Merged tables G-1 and G-2.
- Tables H-1 and H-2 values updated.
Removed false reference to modified clock monitor assert frequency
Updated electricals for 175
- Removed temperature range disclaimer from electrical parameter spec.footer
- Added sentence above table A-3
- Table D-1. LINPHY parameters 12a and 12b replaced by 12a, 12b and 12c-
- Table D-2. LINPHY wake up pulse over whole temperature range
1.603.Jan.2014Section 1.2.2 • Removed false reference to modified clock monitor assert frequency
Revision
Date
Sections
Affected
Section 1.4.9
Section 1.2.1
Figure 1-5
Section 1.4.8
Section 1.6.1
Description of Changes
• Added LINPHY dominant timeout to feature list
• Changed SCI baud rate select to 16-bit
• Added S12ZVML32 to family
• Added S12ZVM pinout
• Documented differences between 0N95G and 1N95G masksets
• Updated LINPHY feature list
• Updated Part ID table
1.1Introduction
The MC9S12ZVM-Family is an automotive 16-bit microcontroller family using the NVM + UHV
technology that offers the capability to integrate 40 V analog components. This family reuses many
features from the existing S12/S12X portfolio. The particular differentiating features of this family are the
enhanced S12Z core, the combination of dual-ADC synchronized with PWM generation and the
integration of “high-voltage” analog modules, including the voltage regulator (VREG), Gate Driver Unit
(GDU) and a Local Interconnect Network (LIN) physical layer. These features enable a fully integrated
single chip solution to drive up to 6 external power MOSFETs for BLDC or PMSM motor drive
applications.
The MC9S12ZVM-Family includes error correction code (ECC) on RAM and flash memory, EEPROM
for diagnostic or data storage, a fast analog-to-digital converter (ADC) and a frequency modulated phase
locked loop (IPLL) that improves the EMC performance. The MC9S12ZVM-Family delivers an optimized
solution with the integration of several key system components into a single device, optimizing system
architecture and achieving significant space savings. The MC9S12ZVM-Family delivers all the
advantages and efficiencies of a 16-bit MCU while retaining the low cost, power consumption, EMC, and
code-size efficiency advantages currently enjoyed by users of existing S12(X) families. The
MC9S12ZVM-Family is available in two different pinout options, both using the 64-pin LQFP-EP
package to accommodate both LIN and CAN based applications. In addition to the I/O ports available in
each module, further I/O ports are available with interrupt capability allowing wake-up from stop or wait
modes.
The MC9S12ZVM-Family is a general-purpose family of devices suitable for a range of applications,
including:
•3-phase sensorless BLDC motor control for
— Fuel pump
MC9S12ZVM Family Reference Manual Rev.1.3
Freescale Semiconductor17
Page 18
Chapter 1 Device Overview MC9S12ZVM-Family
— Water pump
— Oil pump
— A/C compressor
— HVAC blower
— Engine cooling fan
— Electric vehicle battery cooling fan
•Brush DC motor control that need driving in 2 directions, along with PWM control for
— Reversible wiper
— Trunk opener
1.2Features
This section describes the key features of the MC9S12ZVM-Family.
1.2.1MC9S12ZVM-Family Member Comparison
Table 1-2 provides a summary of feature set differences within the MC9S12ZVM-Family. All other
features are common to all MC9S12ZVM-Family members.
layer
CAN VREG–––1–1
SCI21
SPI111111
ADC channels4+54+54+54+54+54+5
PMF channels666666
TIM channels444444
MSCAN
1. Options featuring a single SCI include the SCI1 instantiation
2. External CAN physical interface required
(2)
1–1–1–
(1)
––1111
2222
1.2.2Functional Differences Between N06E and 0N95G Masksets
NOTE
N95G also includes bug fixes that are not listed here because they do not constitute
MC9S12ZVM Family Reference Manual Rev. 1.3
18Freescale Semiconductor
Page 19
Chapter 1 Device Overview MC9S12ZVM-Family
specification changes. Please refer to the Mask Set Errata documents for details.
•Device Level
— Changed BDC fast clock source from core clock to bus clock
— Added exposed pad electrical connection to die VSS.
— Device level current injection immunity improved
— GDU register address range changed
— Removed mapping of VRL to PAD7
— Added ADC reference voltages to IFR
— Increased over voltage detect thresholds to allow operating range up to 26.5V
•GDU
— Added status flags for overvoltage on HD pin and low voltage on VLS
— Blanking time: start internal blanking time generator with HGx/LGx instead of PWM signal
— Added over current shutdown feature
— Added low pass filter to desaturation comparators
•SCI V6 replaces V5
— Enhanced baud rate options
•LINPHY
— Direct Power Injection (DPI) robustness improvements
— TX dominant timeout feature
— Internal pull-up adjusted to stay in 27KOhm to 40KOhm range
•OSC, CPMU:
— Added full swing Pierce mode
— Added a configuration bit OMRE (Oscillator Monitor Reset Enable) that will enable the
Monitor Reset. By default, clock monitor reset disabled (OMRE=0).
•PTU:
— Allow swapping the trigger list at every reload event with load_ok active
— Made the TG0LIST and TG1LIST writable if the associated TG0/TG1 is disabled
— Allow SW to clear the PTULDOK bit when the PTU is disabled
•FTMRZ:
— Added wait state configuration option bits for bus accesses
— Removed interdependency of DFDF and SFDIF bits
— Changed FTMRZ behavior when forbidden simultaneous P-flash/D-flash operations occur
•DBG:
— Added register access restrictions when DBG is disarmed but a profiling transmission is still
active
— Added a register bit to indicate that the profiling transmission is still active
•BDC
— Improved handling of attempted internal accesses during STOP mode
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor19
Page 20
Chapter 1 Device Overview MC9S12ZVM-Family
1.2.3Functional Differences Between 1N95G and 0N95G Masksets
•GDU version changed from V2 to V4
— Added low side driver shutdown flexibility in overvoltage case
– Switched off if overvoltage condition and GOCA1=1
– Switched on if overvoltage condition and GOCA1=0
— Changed time constant of HD overvoltage monitor to improve noise filtering
1.3Chip-Level Features
On-chip modules available within the family include the following features:
•S12Z CPU core
•128, 64 or 32 KB on-chip flash with ECC
•512 byte EEPROM with ECC
•8, 4 or 2 KB on-chip SRAM with ECC
•Phase locked loop (IPLL) frequency multiplier with internal filter
•1 MHz internal RC oscillator with +/-1.3% accuracy over rated temperature range
•4-20MHz amplitude controlled pierce oscillator
•Internal COP (watchdog) module
•6-channel, 15-bit pulse width modulator with fault protection (PMF)
•Low side and high side FET pre-drivers for each phase
— Gate drive pre-regulator
— LDO (Low Dropout Voltage Regulator) (typically 11V)
— High side gate supply generated using bootstrap circuit with external diode and capacitor
— Sustaining charge pump with two external capacitors and diodes
— High side drain (HD) monitoring on internal ADC channel using HD/5 voltage
•Two parallel analog-to-digital converters (ADC) with 12-bit resolution and up to 9 channels
available on external pins
•Programmable Trigger Unit (PTU) for synchronization of PMF and ADC
•One serial peripheral interface (SPI) module
•One serial communication interface (SCI) module with interface to internal LIN physical layer
transceiver (with RX connected to a timer channel for frequency calibration purposes, if desired)
•Up to one additional SCI (not connected to LIN physical layer)
•One on-chip LIN physical layer transceiver fully compliant with the LIN 2.2 standard
•4-channel timer module (TIM) with input capture/output compare
•MSCAN (1 Mbit/s, CAN 2.0 A, B software compatible) module
•On-chip voltage regulator (VREG) for regulation of input supply and all internal voltages
— Optional VREG ballast control output to supply an external CAN physical layer
•Two current sense circuits for overcurrent detection or torque measurement
MC9S12ZVM Family Reference Manual Rev. 1.3
20Freescale Semiconductor
Page 21
Chapter 1 Device Overview MC9S12ZVM-Family
•Autonomous periodic interrupt (API)
•20mA high-current output for use as Hall sensor supply
•Supply voltage sense with low battery warning
•Chip temperature sensor
1.4Module Features
The following sections provide more details of the integrated modules.
1.4.1S12Z Central Processor Unit (CPU)
The S12Z CPU is a revolutionary high-speed core, with code size and execution efficiencies over the S12X
CPU. The S12Z CPU also provides a linear memory map eliminating the inconvenience and performance
impact of page swapping.
•Harvard Architecture - parallel data and code access
•3 stage pipeline
•32-Bit wide instruction and databus
•32-Bit ALU
•24-bit addressing, of 16MB linear address space
•Instructions and Addressing modes optimized for C-Programming & Compiler
•Optimized address path so it is capable to run at 50MHz without Flash wait states
— MAC unit 32bit += 32bit*32bit
— Hardware divider
— Single cycle multi-bit shifts (Barrel shifter)
— Special instructions for fixed point math
•Unimplemented opcode traps
•Unprogrammed byte value (0xFF) defaults to SWI instruction
1.4.1.1Background Debug Controller (BDC)
•Background debug controller (BDC) with single-wire interface
— Non-intrusive memory access commands
— Supports in-circuit programming of on-chip nonvolatile memory
1.4.1.2Debugger (DBG)
•Enhanced DBG module including:
— Four comparators (A, B, C and D) each configurable to monitor PC addresses or addresses of
data accesses
— A and C compare full address bus and full 32-bit data bus with data bus mask register
— B and D compare full address bus only
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor21
Page 22
Chapter 1 Device Overview MC9S12ZVM-Family
— Three modes: simple address/data match, inside address range, or outside address range
— Tag-type or force-type hardware breakpoint requests
•State sequencer control
•64 x 64-bit circular trace buffer to capture change-of-flow addresses or address and data of every
access
— Begin, End and Mid alignment of tracing to trigger
•Profiling mode for external visibility of internal program flow
1.4.2Embedded Memory
1.4.2.1Memory Access Integrity
•Illegal address detection
•ECC support on embedded NVM and system RAM
1.4.2.2Flash
On-chip flash memory on the MC9S12ZVM-family on the features the following:
•Up to128 KB of program flash memory
— 32 data bits plus 7 syndrome ECC (error correction code) bits allow single bit fault 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
1.4.2.3EEPROM
•Up to 512 bytes EEPROM
— 16 data bits plus 6 syndrome ECC (error correction code) bits allow single bit error correction
and double fault detection
— Erase sector size 4 bytes
— Automated program and erase algorithm
— User margin level setting for reads
1.4.2.4SRAM
•Up to 8 KB of general-purpose RAM with ECC
— Single bit error correction and double bit error detection
MC9S12ZVM Family Reference Manual Rev. 1.3
22Freescale Semiconductor
Page 23
Chapter 1 Device Overview MC9S12ZVM-Family
1.4.3Clocks, Reset & Power Management Unit (CPMU)
•Real time interrupt (RTI)
•Clock monitor, supervising the correct function of the oscillator (CM)
•Computer operating properly (COP) watchdog
— Configurable as window COP for enhanced failure detection
— Can be initialized out of reset using option bits located in flash memory
•System reset generation
•Autonomous periodic interrupt (API) (combination with cyclic, watchdog)
•Low Power Operation
— RUN mode is the main full performance operating mode with the entire device clocked.
— WAIT mode when the internal CPU clock is switched off, so the CPU does not execute
instructions.
— Pseudo STOP - system clocks are stopped but the oscillator the RTI, the COP, and API modules
can be enabled
— STOP - the oscillator is stopped in this mode, all clocks are switched off and all counters and
dividers remain frozen, with the exception of the COP and API which can optionally run from
ACLK.
1.4.3.1Internal 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:
•Trimmable internal 1MHz reference clock.
— Trimmed accuracy over -40°C to 150°C junction temperature range: ±1.3%max.
1.4.4Main External Oscillator (XOSCLCP)
•Amplitude controlled Pierce oscillator using 4 MHz to 20 MHz crystal
— Current gain control on amplitude output
— Signal with low harmonic distortion
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor23
Page 24
Chapter 1 Device Overview MC9S12ZVM-Family
— Low power
— Good noise immunity
— Eliminates need for external current limiting resistor
— Trans conductance sized for optimum start-up margin for typical crystals
— Oscillator pins shared with GPIO functionality
1.4.5Timer (TIM)
•4 x 16-bit channels Timer module for input capture or output compare
•16-bit free-running counter with 8-bit precision prescaler
1.4.6Pulse width Modulator with Fault protection (PMF)
•6 x 15-bit channel PWM resolution
•Each pair of channels can be combined to generate a PWM signal (with independent control of
edges of PWM signal)
•Dead time insertion available for each complementary pair
•Center-aligned or edge-aligned outputs
•Programmable clock select logic with a wide range of frequencies
•Programmable fault detection
1.4.7Programmable Trigger Unit (PTU)
•Enables synchronization between PMF and ADC
•2 trigger input sources and software trigger source
•2 trigger outputs
•One 16-bit delay register pre-trigger output
•Operation in One-Shot or Continuous modes
1.4.8LIN physical layer transceiver
•Compliant with LIN Physical Layer 2.2 specification.
•Compliant with the SAE J2602-2 LIN standard.
•Standby mode with glitch-filtered wake-up.
•Slew rate selection optimized for the baud rates: 10.4kBit/s, 20kBit/s and Fast Mode (up to
250kBit/s).
•Switchable 34kW/330kW pull-ups (in shutdown mode, 330kW only)
•Current limitation for LIN Bus pin falling edge.
•Over-current protection.
•LIN TxD-dominant timeout feature monitoring the LPTxD signal.
•Automatic transmitter shutdown in case of an over-current or TxD-dominant timeout.
MC9S12ZVM Family Reference Manual Rev. 1.3
24Freescale Semiconductor
Page 25
Chapter 1 Device Overview MC9S12ZVM-Family
•Fulfills the OEM “Hardware Requirements for LIN (CAN and FlexRay) Interfaces in Automotive
Applications” v1.3.
1.4.9Serial Communication Interface Module (SCI)
•Full-duplex or single-wire operation
•Standard mark/space non-return-to-zero (NRZ) format
•Selectable IrDA 1.4 return-to-zero-inverted (RZI) format with programmable pulse widths
•16-bit baud rate selection
•Programmable character length
•Programmable polarity for transmitter and receiver
•Active edge receive wakeup
•Break detect and transmit collision detect supporting LIN
1.4.10Multi-Scalable Controller Area Network (MSCAN)
•Implementation of the CAN protocol — Version 2.0A/B
•Five receive buffers with FIFO storage scheme
•Three transmit buffers with internal prioritization using a “local priority” concept
•Flexible maskable identifier filter supports two full-size (32-bit) extended identifier filters, or four
16-bit filters, or either 8-bit filters
•Programmable wake-up functionality with integrated low-pass filter
1.4.11Serial 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
1.4.12Analog-to-Digital Converter Module (ADC)
•Dual ADC
— 12-bit resolution
— Up to 9 external channels & 8 internal channels
— 2.5us for single 12-bit resolution conversion
— Left or right aligned result data
— Continuous conversion mode
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor25
Page 26
Chapter 1 Device Overview MC9S12ZVM-Family
•Programmers model with list based command and result storage architecture
ADC directly writes results to RAM, preventing stall of further conversions
•Internal signals monitored with the ADC module
— VRH, VRL, (VRL+VRH)/2, Vsup monitor, Vbg, TempSense, GDU phase, GDU DC-link
•External pins can also be used as digital I/O
1.4.13Supply Voltage Sensor (BATS)
•Monitoring of supply (VSUP) voltage
•Internal ADC interface from an internal resistive divider
•Generation of low or high voltage interrupts
1.4.14On-Chip Voltage Regulator system (VREG)
•Voltage regulator
— Linear voltage regulator directly supplied by VSUP
— Low-voltage detect on VSUP
— Power-on reset (POR)
— Low-voltage reset (LVR) for VDDX domain
— External ballast device support to reduce internal power dissipation
— Capable of supplying both the MCU internally plus external components
— Over-temperature interrupt
•Internal voltage regulator
— Linear voltage regulator with bandgap reference
— Low-voltage detect on VDDA
— Power-on reset (POR) circuit
— Low-voltage reset for VDD domain
•Package option for VREG ballast control output to supply external CANPHY
1.4.15Gate Drive Unit (GDU)
•Low side and high side FET pre-drivers for each phase
•Gate drive pre-regulator LDO (Low Dropout Voltage Regulator)
•High side gate supply done via bootstrap circuit with external diode and capacitor
•Sustaining charge pump with two external capacitors and diodes
•Optional boost convertor configuration with voltage feedback
•FET-Predriver desaturation and error recognition
•Monitoring of FET High Side drain (HD) voltage
•Diagnostic failure management
MC9S12ZVM Family Reference Manual Rev. 1.3
26Freescale Semiconductor
Page 27
1.4.16Current Sense
•2 channel, integrated op-amp functionality
Chapter 1 Device Overview MC9S12ZVM-Family
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor27
Page 28
Chapter 1 Device Overview MC9S12ZVM-Family
1.5Block Diagram
5V Analog Supply
VDDA/VSSA
VDD
VSS2
VDDF
VSS1
VDDX1/VDDX2
VSUP
BCTL
VDDC
BCTLC
BKGD
PE0
PE1
RESET
TEST
LIN0
LGND
32K, 64K, 128KB Flash with ECC
2K, 4K, 8KB RAM with ECC
512 bytes EEPROM with ECC
CAN VREG
BATS
Voltage Supply Monitor
Interrupt Module
BDC
Background
Debug Controller
EXTAL
Low Power Pierce
PTE
Oscillator
XTAL
PLL with Frequency
Modulation option
Reset Generation
and Test Entry
LINPHY0
LIN0
LGND
Voltage Regulator
(Nominal 12V)
S12ZCPU
DBG
Debug Module
4 Comparators
Trace Buffer
Clock Monitor
COP Watchdog
Real Time Interrupt
Auton. Periodic Int.
Reserved register space shown above 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 zero.
MC9S12ZVM Family Reference Manual Rev. 1.3
30Freescale Semiconductor
Page 31
Chapter 1 Device Overview MC9S12ZVM-Family
Register Space
4 KB
RAM
max. 1 MByte - 4 KB
EEPROM
max. 1 MByte - 48 KB
Reserved
Reserved (read only)
NVM IFR
Unmapped
6 MByte
512 Byte
6 KB
256 Byte
0x00_0000
0x00_1000
0x10_0000
0x1F_4000
0x1F_8000
0x1F_C000
0x20_0000
Unmapped
address range
Low address aligned
High address aligned
0x80_0000
Program NVM
max. 8 MB
0xFF_FFFF
Figure 1-2. MC9S12ZVM-Family Global Memory Map. (See Table 1-2 for individual device details)
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor31
Page 32
Chapter 1 Device Overview MC9S12ZVM-Family
1.6.1Part ID Assignments
The part ID is located in four 8-bit registers at addresses 0x0000-0x0003. The read-only value is a unique
part ID for each revision of the chip. Table 1-4 shows the assigned part ID number and mask set number.
1. This version for Freescale internal engineering puirposes only
(1)
N56G0x00171xxxCAN-VREG / LIN
1.7Signal Description and Device Pinouts
This section describes signals that connect off-chip. It includes pin out diagrams a table of signal
properties, and detailed discussion of signals. Internal inter module signal mapping at device level is
described in 1.8 Internal Signal Mapping.
1.7.1Pin Assignment Overview
Table 1-5 provides a summary of which ports are available.
Table 1-5. Port Availability by Package Option
Port64 LQFP
Port ADPAD[8:0]
Port EPE[1:0]
Port PPP[2:0]
Port SPS[5:0]
Port TPT[3:0]
sum of ports24
MC9S12ZVM Family Reference Manual Rev. 1.3
32Freescale Semiconductor
Page 33
Chapter 1 Device Overview MC9S12ZVM-Family
NOTE
To avoid current drawn from floating inputs, all non-bonded pins should be
configured as output or configured as input with a pull up or pull down
device enabled
1.7.2Detailed External Signal Descriptions
This section describes the properties of signals available at device pins. Signal names associated with
modules that can be instantiated more than once on an S12 are indexed, even if the module is only
instantiated once on the
is inserted before the channel number. Thus ANx_y corresponds to AN instance x, channel number y.
1.7.2.1RESET — External Reset Signal
The RESET signal is an active low bidirectional control signal. It acts as an input to initialize the MCU to
a known start-up state, and an output when an internal MCU function causes a reset. The
an internal pull-up device.
1.7.2.2TEST — Test Pin
MC9S12ZVM-Family. If a signal already includes a channel number, then the index
RESET pin has
This input only pin is reserved for factory test. This pin has an internal pull-down device.
NOTE
The TEST pin must be tied to ground in all applications.
1.7.2.3MODC — Mode C Signal
The MODC signal is used as an MCU operating mode select during reset. The state of this signal is latched
to the MODC bit at the rising edge of
RESET. The signal has an internal pull-up device.
1.7.2.4PAD[8:0] / KWAD[8:0] — Port AD, Input Pins of ADC
PAD[8:0] are general-purpose input or output signals. The signals can be configured on per signal basis as
interrupt inputs with wake-up capability (KWAD[8:0]). These signals can have a pull-up or pull-down
device selected and enabled on per signal basis. During and out of reset the pull devices are disabled.
1.7.2.5PE[1:0] — Port E I/O Signals
PE[1:0] are general-purpose input or output signals. The signals can have a pull-down device, enabled by
on a per pin basis. Out of reset the pull-down devices are enabled.
1.7.2.6PP[2:0] / KWP[2:0] — Port P I/O Signals
PP[2:0] are general-purpose input or output signals. The signals can be configured on per signal basis as
interrupt inputs with wake-up capability (KWP[2:0]). They can have a pull-up or pull-down device
selected and enabled on per signal basis. During and out of reset the pull devices are disabled.
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor33
Page 34
Chapter 1 Device Overview MC9S12ZVM-Family
1.7.2.7PS[5:0] / KWS[5:0] — Port S I/O Signals
PS[5:0] are general-purpose input or output signals. The signals can be configured on per signal basis as
interrupt inputs with wake-up capability (KWS[5:0]). They can have a pull-up or pull-down device
selected and enabled on per signal basis. During and out of reset the pull-up devices are enabled.
1.7.2.8PT[3:0] — Port T I/O Signals
PT[3:0] are general-purpose input or output signals. They can have a pull-up or pull-down device selected
and enabled on per signal basis. During and out of reset the pull devices are disabled.
1.7.2.9AN0_[4:0], AN1_[3:0]— ADC Input Signals
These are the analog inputs of the Analog-to-Digital Converters. ADC0 has 5 analog input channels
connected to PAD port pins. ADC1 has 4 analog input channels connected to PAD port pins.
1.7.2.10VRH, VRL — ADC Reference Signals
VRH and VRL are the reference voltage input pins for the analog-to-digital converter.
1.7.2.11SPI0 Signals
1.7.2.11.1SS0 Signal
This signal is associated with the slave select SS functionality of the serial peripheral interface SPI0.
1.7.2.11.2SCK0 Signal
This signal is associated with the serial clock SCK functionality of the serial peripheral interface SPI0.
1.7.2.11.3MISO0 Signal
This signal is associated with the MISO functionality of the serial peripheral interface SPI0. This signal
acts as master input during master mode or as slave output during slave mode.
1.7.2.11.4MOSI0 Signal
This signal is associated with the MOSI functionality of the serial peripheral interface SPI0. This signal
acts as master output during master mode or as slave input during slave mode
1.7.2.12SCI[1:0] Signals
1.7.2.12.1RXD[1:0] Signals
These signals are associated with the receive functionality of the serial communication interfaces
(SCI[1:0]).
MC9S12ZVM Family Reference Manual Rev. 1.3
34Freescale Semiconductor
Page 35
Chapter 1 Device Overview MC9S12ZVM-Family
1.7.2.12.2TXD[1:0] Signals
These signals are associated with the transmit functionality of the serial communication interfaces
(SCI[1:0]).
1.7.2.13CAN0 Signals
1.7.2.13.1RXCAN0 Signal
This signal is associated with the receive functionality of the scalable controller area network controller
(MSCAN0).
1.7.2.13.2TXCAN0 Signal
This signal is associated with the transmit functionality of the scalable controller area network controller
(MSCAN0).
1.7.2.14Timer IOC0_[3:0] Signals
The signals IOC0_[3:0] are associated with the input capture or output compare functionality of the timer
(TIM0) module.
1.7.2.15PWM[5:0] Signals
The signals PWM[5:0] are associated with the PMF module digital channel outputs.
1.7.2.16PTU Signals
1.7.2.16.1PTUT[1:0] Signals
These signals are the PTU trigger output signals. These signals are routed to pins for debugging purposes.
1.7.2.16.2PTURE Signal
This signal is the PTU reload enable output signal. This signal is routed to a pin for debugging purposes.
1.7.2.17Interrupt Signals — IRQ and XIRQ
IRQ is a maskable level or falling edge sensitive input. XIRQ is a non-maskable level-sensitive interrupt.
1.7.2.18Oscillator and Clock Signals
1.7.2.18.1Oscillator Pins — EXTAL and XTAL
EXTAL and XTAL are the crystal driver and external clock pins. On reset all the device clocks are derived
from the internal PLLCLK, independent of EXTAL and XTAL. XTAL is the oscillator output.
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor35
Page 36
Chapter 1 Device Overview MC9S12ZVM-Family
1.7.2.18.2ECLK
This signal is associated with the output of the bus clock (ECLK).
NOTE
This feature is only intended for debug purposes at room temperature.
It must not be used for clocking external devices in an application.
1.7.2.19BDC and Debug Signals
1.7.2.19.1BKGD — Background Debug signal
The BKGD signal is used as a pseudo-open-drain signal for the background debug communication. The
BKGD signal has an internal pull-up device.
1.7.2.19.2PDO — Profiling Data Output
This is the profiling data output signal used when the DBG module profiling feature is enabled. This signal
is output only and provides a serial, encoded data stream that can be used by external development tools
to reconstruct the internal CPU code flow.
1.7.2.19.3PDOCLK — Profiling Data Output Clock
This is the PDO clock signal used when the DBG module profiling feature is enabled. This signal is output
only. During code profiling this is the clock signal that can be used by external development tools to sample
the PDO signal.
1.7.2.19.4DBGEEV — External Event Input
This signal is the DBG external event input. It is input only. Within the DBG module, it allows an external
event to force a state sequencer transition, or trace buffer entry, or to gate trace buffer entries. A falling
edge at the external event signal constitutes an event. Rising edges have no effect. The maximum frequency
of events is half the internal core bus frequency.
1.7.2.20FAULT5 — External Fault Input
This is the PMF fault input signal, with configurable polarity, that can be used to disable PMF operation
when asserted. Asynchronous shutdown of the GDU outputs HG[2:0] and LG[2:0] is not supported. Select
QSMPm[1:0] > 0 in PMF.
1.7.2.21LIN Physical Layer Signals
1.7.2.21.1LIN0
This pad is connected to the single-wire LIN data bus. This signal is only available on S12ZVML versions.
1.7.2.21.2LP0TXD
This is the LIN physical layer transmitter input signal.
MC9S12ZVM Family Reference Manual Rev. 1.3
36Freescale Semiconductor
Page 37
Chapter 1 Device Overview MC9S12ZVM-Family
1.7.2.21.3LP0RXD
This is the LIN physical layer receiver output signal.
1.7.2.21.4LP0DR1
This is the LIN LP0DR1 register bit, visible at the designated pin for debug purposes.
1.7.2.22Gate Drive Unit (GDU) Signals
These are associated with driving the external FETs.
1.7.2.22.1HD — FET predriver High side Drain Input
This is the drain connection of the external high-side FETs. The voltage present at this input is scaled down
by an internal voltage divider, and can be routed to the internal ADC via an analog multiplexer.
These signals are the bootstrap capacitor connections for phases HS[2:0]. The capacitor connected
between HS[2:0] and these signals provides the gate voltage and current to drive the external FET.
1.7.2.22.3HG[2:0] - High-Side Gate signals
The pins are the gate drives for the three high-side power FETs. The drivers provide a high current with
low impedance to turn on and off the high-side power FETs.
1.7.2.22.4HS[2:0] - High-Side Source signals
The pins are the source connection for the high-side power FETs and the drain connection for the low-side
power FETs. The low voltage end of the bootstrap capacitor is also connected to this pin.
1.7.2.22.5VLS[2:0] - Voltage Supply for Low -Side Drivers
The pins are the voltage supply pins for the three low-side FET pre-drivers. This pins should be connected
to the voltage regulator output pin VLS_OUT.
1.7.2.22.6LG[2:0] - Low-Side Gate signals
The pins are the gate drives for the low-side power FETs. The drivers provide a high current with low
impedance to turn on and off the low-side power FETs.
1.7.2.22.7LS[2:0] - Low-Side Source signals
The pins are the low-side source connections for the low-side power FETs. The pins are the power ground
pins used to return the gate currents from the low-side power FETs.
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor37
Page 38
Chapter 1 Device Overview MC9S12ZVM-Family
1.7.2.22.8CP - Charge Pump Output signal
This pin is the switching node of the charge pump circuit. The supply voltage for charge pump driver is
the output of the voltage regulator VLS_OUT. The output voltage of this pin switches typically between
0V and 11V. Must be left unconnected if not used.
1.7.2.22.9VCP - Charge Pump Input for High-Side Driver Supply
This is the charge pump input for the FET high-side gate drive supply circuit. The pin must be left
unconnected if not used.
1.7.2.22.10BST - Boost signal
This pin provides the basic switching elements required to implement a boost converter for low battery
voltage conditions. This requires external diodes, capacitors and a coil. This pin must be left unconnected
if not used.
1.7.2.22.11VSSB - Boost Ground signal
This pin is a separate ground pin for the on chip boost converter switching device.
1.7.2.22.12VLS_OUT - 11V Voltage Regulator Output
This pin is the output of the integrated voltage regulator. The output voltage is typically V
=11V. The
VLS
input voltage to the voltage regulator is the VSUP pin.
1.7.2.22.13AMPP[1:0] - Current Sense Amplifier Non-Inverting Input
These are the current sense amplifier non-inverting inputs.
1.7.2.22.14AMPM[1:0] - Current Sense Amplifier Inverting Input
These are the current sense amplifier inverting inputs.
1.7.2.22.15AMP[1:0] - Current Sense Amplifier Output
These are the current sense amplifier outputs.
1.7.2.23CAN Physical Interface Support
The MCU can supply an external CAN physical interface device directly, thus removing the need for an
external voltage regulator.
1.7.2.23.1BCTLC
BCTLC provides the base current of an external bipolar that supplies an external CAN physical interface.
This signal is only available on S12ZVMC versions.
MC9S12ZVM Family Reference Manual Rev. 1.3
38Freescale Semiconductor
Page 39
Chapter 1 Device Overview MC9S12ZVM-Family
1.7.2.23.2VDDC
VDDC is the CANPHY supply. This is the output voltage of the external bipolar, fed back to the MCU.
This signal is only available on S12ZVMC versions.
1.7.2.24High Current Output — EVDD1
This is a high current, low voltage drop output intended for supplying external devices in a range of up to
20mA. Configuring the pin direction as output automatically enables the high current capability.
1.7.2.25BCTL
BCTL is the ballast connection for the on chip voltage regulator. It provides the base current of an external
bipolar for the VDDX and VDDA supplies.
1.7.3Power Supply Pins
The power and ground pins are described below. Because fast signal transitions place high, short-duration
current demands on the power supply, use bypass capacitors with high-frequency characteristics and place
them as close to the MCU as possible.
NOTE
All ground pins must be connected together in the application.
1.7.3.1VDDX1, VDDX2, VSSX1 — Digital I/O Power and Ground Pins
VDDX1, VDDX2 are voltage regulator outputs to supply the digital I/O drivers.
The VSSX1 pin is the ground pin for the digital I/O drivers.
Bypass requirements on VDDX2, VDDX1, VSSX1 depend on how heavily the MCU pins are loaded.
1.7.3.2VDDA, VSSA — Power Supply Pins for ADC
These are the power supply and ground pins for the analog-to-digital converter and the voltage regulator.
1.7.3.3VDD, VSS2 — Core Power and Ground Pin
The VDD voltage supply of nominally 1.8V is generated by the internal voltage regulator. The return
current path is through the VSS2 pin.
1.7.3.4VDDF, VSS1 — NVM Power and Ground Pin
The VDDF voltage supply of nominally 2.8V is generated by the internal voltage regulator. The return
current path is through the VSS1 pin.
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor39
Page 40
Chapter 1 Device Overview MC9S12ZVM-Family
1.7.3.5LGND — LINPHY Ground Pin
LGND is the ground pin for the LIN physical layer LINPHY. This signal is only available on S12ZVM(L)
versions, for which it must be connected to board ground, even if the LINPHY is not used.
1.7.3.6VSUP — Voltage Supply Pin for Voltage Regulator
VSUP is the main supply pin typically coming from the car battery/alternator in the 12V supply voltage
range. This is the voltage supply input from which the voltage regulator generates the on chip voltage
supplies. It must be protected externally against a reverse battery connection.
1.7.4Package and Pinouts
The following package options are offered.
•64LQFP-EP (exposed pad) with internal LIN PHY.
•64LQFP-EP (exposed pad) without internal LIN PHY but with CAN VREG to support the addition
of a low cost external CAN PHY.
The exposed pad must be connected to a grounded contact pad on the PCB.
The exposed pad has an electrical connection within the package to VSSFLAG (VSSX die connection).
The pin out details are shown in the following diagrams. Signals in brackets denote routing options.
NOTE
For the S12ZVM32 derivative the pins 1 and 64 are unused. Pin 64 must be
connected to ground and pin1 left unconnected.
MC9S12ZVM Family Reference Manual Rev. 1.3
40Freescale Semiconductor
Page 41
The exposed pad on the package bottom must be
connected to a grounded contact pad on the PCB.
This section specifies the mapping of inter-module signals at device level.
1.8.1ADC Connectivity
1.8.1.1ADC Reference Voltages
For both ADC modules, VRH_1 is mapped to VDDA; VRH_0 is mapped to PAD[8]; VRL_0 and VRL_1
are both mapped to VSSA, whereby VRL_1 is the preferred reference for low noise.
MC9S12ZVM Family Reference Manual Rev. 1.3
46Freescale Semiconductor
Page 47
Chapter 1 Device Overview MC9S12ZVM-Family
1.8.1.2ADC Internal Channels
The ADC0 and ADC1 internal channel mapping is shown in Table 1-7 and Table 1-8 respectively.
The GDU current sense amplifier outputs are mapped to pins with ADC input functionality. Thus
configuring the ADC to convert these pin channels automatically converts the current sense outputs.
The ADC internal temperature sensors must be calibrated by the user. No electrical parameters are
specified for these sensors. The VREG temperature sensor electrical parameters are given in the
appendices.
Table 1-7. Usage of ADC0 Internal Channels
ADCCMD_1 CH_SEL[5:0]
001000Internal_0ADC0 temperature sensor
001001Internal_1VREG temperature sensor or bandgap (V
001010Internal_2GDU phase multiplexer voltage
001011Internal_3GDU DC link voltage monitor
001100Internal_4BATS VSUP sense voltage
001101Internal_5Reserved
001110Internal_6Reserved
001111Internal_7Reserved
1. Selectable in CPMU
ADC Channel
Usage
Table 1-8. Usage of ADC1 Internal Channels
ADCCMD_1 CH_SEL[5:0]
001000Internal_0ADC1 temperature sensor
001001Internal_1VREG temperature sensor or bandgap (V
001010Internal_2GDU phase multiplexer voltage
001011Internal_3GDU DC link voltage monitor
001100Internal_4Reserved
001101Internal_5Reserved
001110Internal_6Reserved
001111Internal_7Reserved
1. Selectable in CPMU
ADC Channel
Usage
BG
BG
(1)
)
(1)
)
1.8.2Motor Control Loop Signals
The motor control loop signals are described in 1.13.3.1 Motor Control Loop Overview
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor47
Page 48
Chapter 1 Device Overview MC9S12ZVM-Family
1.8.3Device Level PMF Connectivity
Table 1-9. Mapping of PMF signals
PMF Connection
Channel0High-Side Gate and Source Pins HG[0], HS[0]
Channel1Low-Side Gate and Source Pins LG[0], LS[0]
Channel2High-Side Gate and Source Pins HG[1], HS[1]
Channel3Low-Side Gate and Source Pins LG[1], LS[1]
Channel4High-Side Gate and Source Pins HG[2], HS[2]
Channel5Low-Side Gate and Source Pins LG[2], LS[2]
FAULT5External FAULT5 pin
FAULT4HD Over voltage or GDU over current
FAULT3VLS under voltage
FAULT2GDU Desaturation[2] or GDU over current
FAULT1GDU Desaturation[1] or GDU over current
FAULT0GDU Desaturation[0] or GDU over current
async_event_edge_sel[1:0]Tied to b11 (both edges active)
1.8.4BDC Clock Source Connectivity
Usage
The BDC clock, BDCCLK, is mapped to the IRCCLK generated in the CPMU module.
The BDC clock, BDCFCLK is mapped to the device bus clock, generated in the CPMU module.
1.8.5LINPHY Connectivity
The VLINPHY supply is connected to the device HD pin.
1.8.6FTMRZ Connectivity
The soc_erase_all_req input to the flash module is driven directly by a BDC erase flash request resulting
from the BDC ERASE_FLASH command.
The FTMRZ FCLKDIV register is forced to 0x05 by the BDC ERASE_FLASH command. This
configures the clock frequency correctly for the initial bus frequency on leaving reset. The bus frequency
must not be changed before launching the ERASE_FLASH command.
1.8.7CPMU Connectivity
The API clock generated in the CPMU is not mapped to a device pin in the MC9S12ZVM-Family.
MC9S12ZVM Family Reference Manual Rev. 1.3
48Freescale Semiconductor
Page 49
Chapter 1 Device Overview MC9S12ZVM-Family
1.9Modes of Operation
The MCU can operate in different modes. These are described in 1.9.1 Chip Configuration Modes.
The MCU can operate in different power modes to facilitate power saving when full system performance
is not required. These are described in 1.9.3 Low Power Modes.
Some modules feature a software programmable option to freeze the module status whilst the background
debug module is active to facilitate debugging. This is referred to as freeze mode at module level.
1.9.1Chip Configuration Modes
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 (Table 1-10).
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 1-10. Chip Modes
Chip ModesMODC
Normal single chip1
Special single chip0
1.9.1.1Normal 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.
1.9.1.2Special Single-Chip Mode
This mode is used for debugging operation, boot-strapping, or security related operations. The background
debug mode (BDM) is active on leaving reset in this mode.
1.9.2Debugging Modes
The background debug mode (BDM) can be activated by the BDC module or directly when resetting into
Special Single-Chip mode. Detailed information can be found in the BDC module section.
Writing to internal memory locations using the debugger, whilst code is running or at a breakpoint, can
change the flow of application code.
The MC9S12ZVM-Family supports BDC communication throughout the device Stop mode. During Stop
mode, writes to control registers can alter the operation and lead to unexpected results. It is thus
recommended not to reconfigure the peripherals during STOP using the debugger.
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor49
Page 50
Chapter 1 Device Overview MC9S12ZVM-Family
The DBG module supports breakpoint, tracing and profiling features. At board level the profiling pins can
use the same 6-pin connector typically used for the BDC BKGD pin. The connector pin mapping shown
in Figure 1-6 is supported by device evaluation boards and leading development tool vendors.
GNDBKGD
2
1
PDO
3
4
RST
5
PDOCLK
VDDX
Figure 1-6. Standard Debug Connector Pin Mapping
6
1.9.3Low Power Modes
The device has two dynamic-power modes (run and wait) and two static low-power modes stop and pseudo
stop). For a detailed description refer to the CPMU section.
•Dynamic power mode: Run
— Run mode is the main full performance operating mode with the entire device clocked. The user
can configure the device operating speed through selection of the clock source and the phase
locked loop (PLL) frequency. To save power, unused peripherals must not be enabled.
•Dynamic power mode: Wait
— This mode is entered when the CPU executes the WAI instruction. In this mode the CPU does
not execute instructions. The internal CPU clock is switched off. All peripherals can be active
in system wait mode. For further power consumption the peripherals can individually turn off
their local clocks. Asserting
RESET, XIRQ, IRQ, or any other interrupt that is not masked,
either locally or globally by a CCR bit, ends system wait mode.
•Static power modes:
Static power (Stop) modes are entered following the CPU STOP instruction unless an NVM
command is active. When no NVM commands are active, the Stop request is acknowledged and
the device enters either Stop or Pseudo Stop mode. Further to the general system aspects of Stop
mode discussed here, the motor control loop specific considerations are described in
Section 1.13.3.10.
— Pseudo-stop: In this mode the system clocks are stopped but the oscillator is still running and
the real time interrupt (RTI), watchdog (COP) and Autonomous Periodic Interrupt (API) may
be enabled. Other peripherals are turned off. This mode consumes more current than system
STOP mode but, as the oscillator continues to run, the full speed wake up time from this mode
is significantly shorter.
— Stop: In this mode the oscillator is stopped and clocks are switched off. The counters and
dividers remain frozen. The autonomous periodic interrupt (API) may remain active but has a
very low power consumption. The key pad, SCI and MSCAN transceiver modules can be
configured to wake the device, whereby current consumption is negligible.
If the BDC is enabled in Stop mode, the VREG remains in full performance mode and the
CPMU continues operation as in run mode. With BDC enabled and BDCCIS bit set, then all
clocks remain active to allow BDC access to internal peripherals. If the BDC is enabled and
MC9S12ZVM Family Reference Manual Rev. 1.3
50Freescale Semiconductor
Page 51
Chapter 1 Device Overview MC9S12ZVM-Family
BDCCIS is clear, then the BDCSI clock remains active, but bus and core clocks are disabled.
With the BDC enabled during Stop, the VREG full performance mode and clock activity lead
to higher current consumption than with BDC disabled. If the BDC is enabled in Stop mode,
then the BATS voltage monitoring remains enabled.
1.10Security
The MCU security mechanism prevents unauthorized access to the flash memory. It must be emphasized
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. Also, if an
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 response authentication before any code
can be downloaded.
Device security details are also described in the flash block description.
1.10.1Features
The security features of the S12Z chip family are:
•Prevent external access of the non-volatile memories (Flash, EEPROM) content
•Restrict execution of NVM commands
1.10.2Securing the Microcontroller
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 keep the device secured through reset and power-down.
This byte can be erased and programmed like any other Flash location. Two bits of this byte are used for
security (SEC[1:0]). The contents of this byte are copied into the Flash security register (FSEC) during a
reset sequence.
The meaning of the security bits SEC[1:0] is shown in Table 1-11. 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 1-11. Security Bits
SEC[1:0]Security State
001 (secured)
011 (secured)
100 (unsecured)
111 (secured)
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor51
Page 52
Chapter 1 Device Overview MC9S12ZVM-Family
NOTE
Please refer to the Flash block description for more security byte details.
1.10.3Operation of the Secured Microcontroller
By securing the device, unauthorized access to the EEPROM and Flash memory contents is prevented.
Secured operation has the following effects on the microcontroller:
1.10.3.1Normal Single Chip Mode (NS)
•Background debug controller (BDC) operation is completely disabled.
•Execution of Flash and EEPROM commands is restricted (described in flash block description).
1.10.3.2Special Single Chip Mode (SS)
•Background debug controller (BDC) commands are restricted
•Execution of Flash and EEPROM commands is restricted (described in flash block description).
In special single chip mode the device is in active BDM after reset. In special single chip mode on a secure
device, only the BDC mass erase and BDC control and status register commands are possible. BDC access
to memory mapped resources is disabled. The BDC can only be used to erase the EEPROM and Flash
memory without giving access to their contents.
1.10.4Unsecuring the Microcontroller
Unsecuring the microcontroller can be done using three different methods:
1. Backdoor key access
2. Reprogramming the security bits
3. Complete memory erase
1.10.4.1Unsecuring the MCU Using the Backdoor Key Access
In normal single chip mode, security can be temporarily disabled using the backdoor key access method.
This method requires that:
•The backdoor key has been programmed to a valid value
•The KEYEN[1:0] bits within the Flash options/security byte select ‘enabled’.
•The application program programmed into the microcontroller has 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.
MC9S12ZVM Family Reference Manual Rev. 1.3
52Freescale Semiconductor
Page 53
Chapter 1 Device Overview MC9S12ZVM-Family
NOTE
No backdoor key word is allowed to have the value 0x0000 or 0xFFFF.
1.10.5Reprogramming the Security Bits
Security can also be disabled by erasing and reprogramming the security bits within the flash
options/security byte to the unsecured value. Since the erase operation will erase the entire sector
(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). Thus Flash protection is a useful means of preventing this method. The
microcontroller enters 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.
•The Flash sector containing the Flash options/security byte is not protected.
1.10.6Complete Memory Erase
The microcontroller can be unsecured by erasing the entire EEPROM and Flash memory contents. If
ERASE_FLASH is successfully completed, then the Flash unsecures the device and programs the security
byte automatically.
1.11Resets and Interrupts
1.11.1Resets
Table 1-12. lists all reset sources and the vector locations. Resets are explained in detail in the Chapter 8,
“S12 Clock, Reset and Power Management Unit (S12CPMU_UHV_V6)”.
Table 1-12. Reset Sources and Vector Locations
Vector AddressReset Source
0xFFFFFCPower-On Reset (POR)NoneNone
Low Voltage Reset (LVR)NoneNone
External pin RESETNoneNone
CCR
Mask
Local Enable
Clock monitor resetNoneOSCE Bit in CPMUOSC register
COP watchdog resetNoneCR[2:0] in CPMUCOP register
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor53
Page 54
Chapter 1 Device Overview MC9S12ZVM-Family
1.11.2Interrupt Vectors
Table 1-13 lists all interrupt sources and vectors in the default order of priority. The interrupt module
description provides an interrupt vector base register (IVBR) to relocate the vectors.
Table 1-13. Interrupt Vector Locations (Sheet 1 of 4)
Vector Address
Vector base + 0x1F8Unimplemented page1 op-code trap
Vector base + 0x1F4Unimplemented page2 op-code trap
Vector base + 0x1F0Software interrupt instruction (SWI)NoneNone--
Vector base + 0x1ECSystem call interrupt instruction
Vector base + 0x1E8Machine exceptionNoneNone-Vector base + 0x1E4
Vector base + 0x1E0
Vector base + 0x1DCSpurious interrupt—None--
Vector base + 0x1D8
Vector base + 0x1D4
Vector base + 0x1D0RTI time-out interruptI bitCPMUINT (RTIE)
Vector base + 0x1CCTIM0 timer channel 0I bitTIM0TIE (C0I)NoYes
Vector base + 0x1C8TIM0 timer channel 1I bitTIM0TIE (C1I)NoYes
(1)
Interrupt Source
(SPARE)
(TRAP)
(SYS)
XIRQ interrupt requestX bitNoneYesYes
IRQ interrupt requestI bitIRQCR(IRQEN)YesYes
CCR
Mask
NoneNone--
NoneNone--
NoneNone--
Reserved
Reserved
Local Enable
Wake up
from STOP
SeeCPMU
section
Wake up
fromWAIT
Yes
Vector base + 0x1C4TIM0 timer channel 2I bitTIM0TIE (C2I)NoYes
Vector base + 0x1C0TIM0 timer channel 3I bitTIM0TIE (C3I)NoYes
Vector base + 0x1BC
to
Vector base + 0x1B0
Vector base + 0x1ACTIM0 timer overflowI bitTIM0TSCR2(TOI)NoYes
Vector base + 0x1A8
to
Vector base + 0x1A4
Vector base + 0x1A0SPI0I bitSPI0CR1 (SPIE, SPTIE)NoYes
Vector base + 0x19CSCI0I bitSCI0CR2
Vector base + 0x198SCI1I bitSCI1CR2
Vector base + 0x194
Vector base + 0x190
MC9S12ZVM Family Reference Manual Rev. 1.3
Reserved
Reserved
YesYes
(TIE, TCIE, RIE, ILIE)
YesYes
(TIE, TCIE, RIE, ILIE)
Reserved
Reserved
54Freescale Semiconductor
Page 55
Chapter 1 Device Overview MC9S12ZVM-Family
Table 1-13. Interrupt Vector Locations (Sheet 1 of 4)
Vector Address
(1)
Interrupt Source
CCR
Mask
Local Enable
Vector base + 0x18CADC0 ErrorI bitADC0EIE (IA_EIE,
Wake up
from STOP
NoYes
Wake up
fromWAIT
CMD_EIE, EOL_EIE,
TRIG_EIE, RSTAR_EIE,
LDOK_EIE)
ADC0IE(CONIF_OIE)
Vector base + 0x188ADC0 conversion sequence abortI bitADC0IE(SEQAD_IE)NoYes
Vector base + 0x184ADC0 conversion completeI bitADC0CONIE[15:0]NoYes
Vector base + 0x180
Oscillator status interruptI bit
CPMUINT (OSCIE)
NoYes
Vector base + 0x17C PLL lock interruptI bitCPMUINT (LOCKIE)NoYes
Vector base + 0x178
to
Reserved
Vector base + 0x174
Vector base + 0x170RAM errorI bit EECIE (SBEEIE)NoYes
Vector base + 0x16C
to
Reserved
Vector base + 0x168
Vector base + 0x164FLASH errorI bit FERCNFG (SFDIE)NoYes
Vector base + 0x160FLASH commandI bitFCNFG (CCIE)NoYes
Vector base + 0x15CCAN0 wake-upI bitCAN0RIER (WUPIE)YesYes
Vector base + 0x158CAN0 errorsI bitCAN0RIER (CSCIE, OVRIE)NoYes
Vector base + 0x154CAN0 receiveI bitCAN0RIER (RXFIE)NoYes
Vector base + 0x150CAN0 transmitI bitCAN0TIER (TXEIE[2:0])NoYes
Vector base + 0x14C
to
Reserved
Vector base + 0x148
Vector base + 0x144LINPHY over-current interruptI bitLPIE (LPDTIE,LPOCIE)NoYes
Vector base + 0x140 BATS supply voltagemonitor interruptI bitBATIE (BVHIE,BVLIE)NoYes
Vector base + 0x13CGDU Desaturation ErrorI bitGDUIE (GDSEIE)NoYes
Vector base + 0x138GDU Voltage Limit DetectedI bitGDUIE (GOCIE, GHHDFIE,
NoYes
GLVLSFIE)
Vector base + 0x134
to
Reserved
Vector base + 0x128
Vector base + 0x124Port S interruptI bitPIES[5:0]YesYes
Vector base + 0x120Reserved
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor55
Page 56
Chapter 1 Device Overview MC9S12ZVM-Family
Table 1-13. Interrupt Vector Locations (Sheet 1 of 4)
Vector Address
(1)
Interrupt Source
CCR
Mask
Local Enable
Vector base + 0x11CADC1 ErrorI bitADC1EIE (IA_EIE,
Wake up
from STOP
NoYes
Wake up
fromWAIT
CMD_EIE, EOL_EIE,
TRIG_EIE, RSTAR_EIE,
LDOK_EIE)
ADC1IE(CONIF_OIE)
Vector base + 0x118ADC1 conversion sequence abortI bitADC1IE(SEQAD_IE)NoYes
Vector base + 0x114ADC1 conversion completeI bitADC1CONIE[15:0]NoYes
Vector base + 0x110
Reserved
Vector base + 0x10CPort P interruptI bitPIEP[2:0]YesYes
Vector base + 0x108EVDD1 over-current interruptI bitPIEP(OCIE1)NoYes
Vector base + 0x104Low-voltage interrupt (LVI)I bitCPMULVCTL (LVIE)NoYes
Vector base + 0x100Autonomous periodical interrupt
(API)
I bit
CPMUAPICTRL (APIE)
YesYes
Vector base + 0xFCHigh temperature interruptI bitCPMUHTCTL(HTIE)YesYes
Vector base + 0xF8
Vector base + 0xF4Port AD interruptI bitPIEADH(PIEADH0)
Reserved
YesYes
PIEADL(PIEADL[7:0])
Vector base + 0xF0PTU Reload OverrunI bitPTUIEH(PTUROIE)NoYes
Vector base + 0xECPTU Trigger0 ErrorI bitPTUIEL(TG0AEIE,
NoYes
TG0REIE,TG0TEIE)
Vector base + 0xE8PTU Trigger1 ErrorI bitPTUIEL(TG1AEIE,TG1REIE,
NoYes
TG1TEIE)
Vector base + 0xE4PTU Trigger0 DoneI bitPTUIEL(TG0DIE)NoYes
Vector base + 0xE0PTU Trigger1 DoneI bitPTUIEL(TG1DIE)NoYes
Vector base + 0xDC
to
Reserved
Vector base + 0xD4
Vector base + 0xD0PMF Reload AI bitPMFENCA(PWMRIEA)NoYes
Vector base + 0xCCPMF Reload BI bitPMFENCB(PWMRIEB)NoYes
Vector base + 0xC8PMF Reload CI bitPMFENCC(PWMRIEC)NoYes
Vector base + 0xC4PMF FaultI bitPMFFIE(FIE[5:0])NoYes
Vector base + 0xC0PMF Reload OverrunI bitPMFROIE(PMFROIEA,PMF
NoYes
ROIEB,PMFROIEC)
Vector base + 0xBC
to
Reserved
Vector base + 0x10
1. 15 bits vector address based
MC9S12ZVM Family Reference Manual Rev. 1.3
56Freescale Semiconductor
Page 57
Chapter 1 Device Overview MC9S12ZVM-Family
1.11.3Effects 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.
1.11.3.1Flash Configuration Reset Sequence Phase
On each reset, the Flash module will hold CPU 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 description.
1.11.3.2Reset 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.
1.11.3.3I/O Pins
Refer to the PIM section for reset configurations of all peripheral module ports.
1.11.3.4RAM
The system RAM arrays, including their ECC syndromes, are initialized following a power on reset. All
other RAM arrays are not initialized out of any type of reset.
With the exception of a power-on-reset the RAM content is unaltered by a reset occurrence.
1.12Module device level dependencies
1.12.1CPMU COP Configuration
The COP time-out rate bits CR[2:0] and the WCOP bit in the CPMUCOP register are loaded from the
Flash configuration field byte at global address 0xFF_FE0E during the reset sequence. See Table 1-14 and
The value loaded from the flash into the CPMUHTTR register is a default value for the device family.
There is no device specific trimming carried out during production. The specified V
value that is part dependent and should thus be calibrated.
value is a typical
HT
1.12.3Flash IFR Mapping
Table 1-16. Flash IFR Mapping
1514131211109876543210IFR Byte Address
ADC0 reference conversion using VDDA/VSSA
ADC0 reference conversion using PAD8/VSSA
ADC1 reference conversion using VDDA/VSSA
ADC1 reference conversion using PAD8/VSSA
0x1F_C040 & 0x1F_C041
0x1F_C042 & 0x1F_C043
0x1F_C044 & 0x1F_C045
0x1F_C046 & 0x1F_C047
1.13Application Information
1.13.1ADC Calibration
For applications that do not provide external ADC reference voltages, the VDDA/VSSA supplies can be
used as sources for VRH/VRL respectively. Since the VDDA must be connected to VDDX at board level
in the application, the accuracy of the VDDA reference is limited by the internal voltage regulator
accuracy. In order to compensate for VDDA reference voltage variation in this case, the reference voltage
MC9S12ZVM Family Reference Manual Rev. 1.3
58Freescale Semiconductor
Page 59
Chapter 1 Device Overview MC9S12ZVM-Family
is measured during production test using the internal reference voltage VBG, which has a narrow variation
over temperature and external voltage supply. V
(Table 1-7,Table 1-8). The resulting 12-bit left justified ADC conversion results of V
is mapped to an internal channel of each ADC module
BG
are stored to the
BG
flash IFR for reference, as listed in Table 1-16.
The measurement conditions of the reference conversion are listed in the device electrical parameters
appendix. By measuring the voltage V
reference value in the IFR, it is possible to determine the current ADC reference voltage V
in the application environment and comparing the result to the
ConvertedADInput:Result of the analog to digital conversion of the desired pin
ConvertedReference:Result of internal channel conversion
StoredReference:Value in IFR location
n:ADC resolution (12 bit)
NOTE
The ADC reference voltage V
must remain at a constant level throughout
RH
the conversion process.
1.13.2SCI Baud Rate Detection
The baud rate for SCI0 and SCI1 is achieved by using a timer channel to measure the data rate on the RXD
signal.
1. Establish the link:
— For SCI0: Set [T0IC3RR1:T0IC3RR0]=0b01 to disconnect IOC0_3 from TIM0 input capture
channel 3 and reroute the timer input to the RXD0 signal of SCI0.
— For SCI1: Set [T0IC3RR1:T0IC3RR0]=0b10 to disconnect IOC0_3 from TIM0 input capture
channel 3 and reroute the timer input to the RXD1 signal of SCI1.
2. Determine pulse width of incoming data: Configure TIM0 IC3 to measure time between incoming
signal edges.
1.13.3Motor Control Application Overview
The following sections provide information for using the device in motor control applications. These
sections provide a description of motor control loop considerations that are not detailed in the individual
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor59
Page 60
Chapter 1 Device Overview MC9S12ZVM-Family
module sections, since they concern device level inter module operation specific for motor control. More
detailed information is available in application notes. The applications described are as follows:
1. BDCM - wiper pumps fans
2. BLDCM - pumps, fans and blowers
– based on Hall sensors
– sensorless based on back-EMF zero crossing comparators
– sensorless based on back-EMF ADC measurements
3. PMSM - high-end wiper, pumps, fans and blowers
– simple sinewave commutation with position sensor Hall effect, sine-cos
– FOC with sine-cos position sensor
– sensorless 3-phase sinewave control
MC9S12ZVM Family Reference Manual Rev. 1.3
60Freescale Semiconductor
Page 61
Chapter 1 Device Overview MC9S12ZVM-Family
1.13.3.1Motor Control Loop Overview
The mapping of motor control events at device level as depicted in Figure 1-7 is listed in Table 1-17,
whereby the columns list the names used in the module level descriptions
Figure 1-7. Internal Control Loop Configuration
TIM
OC0
GDU
commutation_event
zero crossing
comparators
PMF
reloada
reload
PTU
async_reload
If PTU enabled
async reload
async reload
reload
glb_ldok
trigger_0
If PTU enabled
async reload
reload
glb_ldok
ADC0
ADC1
GPHS
dc_bus_voltage
back-EMF
PHMUX
P1
P2
P3
SENSOR
M
dc_bus_current
trigger_1
reload
The control loop consists of the PMF, GDU, ADC and PTU modules. The control loop operates using
either static, dynamic or asynchronous timing. In the following text the event names given in bold type
correspond to those shown in Figure 1-7. The PTU and ADC operate using lists stored in memory. These
lists define trigger points for the PTU, commands for the ADC and results from the ADC. If the PTU is
enabled the reload and async_reload events are immediately passed through to the ADC and GDU
modules.
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor61
Page 62
Chapter 1 Device Overview MC9S12ZVM-Family
.
Table 1-17. Control Loop Events
Device Level EventTIMPMFPTUADC0ADC1
commutation_eventOC0
reload
async_reload
trigger_0
trigger_1
glb_ldok
1. TIM channel OC0 must be configured to toggle on both edges.
2. PMF events reloadb and reloadc are not connected at device level
(1)
—
—
——
——
—
commutation_event
reloada
async_reloadasync_reloadSeq_abortSeq_abort
(2)
glb_ldokglb_ldokLoadOKLoadOK
———
reloadRestartRestart
trigger_0Trigger
trigger_1
—
—
Trigger
Each control loop cycle is started by a PMF reload event. The PMF reload event restarts the PTU time
base. If the PTU is enabled, the reload is immediately passed through to the ADC and GDU modules.
The PMF generates the reload event at the required PWM reload frequency. The PMF reload event causes
the PTU time base to restart, to acquire the first trigger times from the list and the ADCs to start loading
the ADC conversion command from the Command Sequence List (CSL).
NOTE
In the PTU there is 7 bus cycle maximum time window after the reload
event assertion to access the first trigger times from the list. In this window
the trigger can not be generated. In the ADC there is 10 bus cycle maximum
time window after the reload event assertion to access the first ADC
command from the list. In this window the ADC conversion can not be
started. If the measurement is control loop related these delays are
negligible due to much larger delays in the PWM-GDU-feedback loop.
When the trigger time is encountered the corresponding PTU trigger generates the trigger_x event for the
associated ADC. For simultaneous sampling the PTU generates simultaneous trigger_x events for both
ADCs. At the trigger_x event the ADC starts the first conversion of the next conversion sequence in the
CSL (the first ADC command is already downloaded).
A commutation event is used by the PMF to generate an async_reload event. The async_reload is used by
the PTU to update lists and re-initialize the trigger lists. If the PTU is enabled the async_reload is
immediately passed through to the ADC.
1.13.3.2Control Loop Timing Considerations
Delays within the separate control loop elements require consideration to ensure correct synchronization.
Regarding the raw PWM signal as the starting point and stepping through the control loop stages, the
factors shown in Figure 1-8 contribute to delays within the control loop, starting with the deadtime
MC9S12ZVM Family Reference Manual Rev. 1.3
62Freescale Semiconductor
Page 63
Chapter 1 Device Overview MC9S12ZVM-Family
insertion, going through the external FETs and back into the internal ADC measurements of external
voltages and currents.
Figure 1-8. Control Loop Delay Overview
PWM cycle
PWM base
PWM with
deadtime
GDU
propagation
FET
turn on
Current sense
settling time
(tcslsst)
ADC delay
T
DEAD_x
t
delon
t
HGON
The PWM deadtime (T
DEAD_X
) is an integral number of bus clock cycles, configured by the PMF
deadtime registers.
The GDU propagation delays (t
The FET turn on times (t
HGON
, t
delon
) are load dependent but are specified for particular loads in the electrical
) are specified in the electrical parameter Table E-1.
deloff
parameter Table E-1.
The current sense amplifier delay is highly dependent on external components.
The ADC delay until a result is available is specified as the conversion period N
in Table C-1.
CONV
1.13.3.3Static Timing Operation
The timing frame is static if it is the same in every control cycle (defined by reload frequency) and is
relative to start of the control cycle. The only settings modified from one control cycle to the next one are
the PWM duty cycle registers.
The main control cycle synchronization event is the PMF reload event. The PMF reload event can be
generated every n PWM periods.
This mode can optionally be extended by a timer channel trigger to PMF to change the PWM channel
operation (e.g. used for BLDCM commutation). In this case, the PMF configuration can propagate the
trigger through the control loop or can prevent propagation so the static timing of the control cycle and
inter-block coherency are not affected by the trigger.
At the end of the conversion sequence the first ADC command from the new sequence is loaded and the
ADCx waits for the next trigger_x. The PTU continues to generate the trigger_x events for each trigger
time from the list until a new reload or async_reload occurs.
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor63
Page 64
Chapter 1 Device Overview MC9S12ZVM-Family
Before the upcoming reload event the CPU:
•reads the ADC results from the buffered Conversion Result List
•clears the conversion complete flag
•services the reload by setting new duty cycle values
•sets the PTULDOK bit (corresponding to glb_ldok) to signal the duty cycle coherence
The CPU actions are typically performed in an ISR triggered by the conversion complete flag.
1.13.3.4Static Timing Fault Handling
The following Faults and/or errors can occur:
•Desaturation error, Overvoltage, Undervoltage, Temperature sensor, External fault
The application run-time error is handled by the GDU without CPU interaction. Firstly the FETs are
disabled and the PMF signals switched to an inactive state. To re-enable the operation first the GDU fault
and then PWM fault must be cleared, to automatically re-enable the FET driving at the next PWM
boundary.
•PTU reload overrun error
This is an application run-time error caused by the CPU not setting PTULDOK on time. Servicing this
type of error is application dependent and may range from a further reload attempt to a total shut down.
Since all timing is static, this error should only occur during application debugging. This type of error
occurring in a static timing configuration indicates possible data corruption. This can be serviced by a
control loop shutdown.
•PTU memory access error, Memory access double bit ECC error
This type of error occurring in an application indicates data corruption. This can be serviced by a control
loop shutdown.
Since all timing is static, this error should only occur during application debugging. This type of error
occurring in an application indicates possible data corruption. This can be serviced by a control loop
shutdown.
1.13.3.5Dynamic Timing Operation
The timing frame is dynamic if the following are modified on a cycle by cycle basis:
•PMF - duty cycle value registers (PMF_VALx), modulo registers
•PTU - Trigger Event List (PTU_TELx)
•ADC - Command Sequence List (ADCx_CSL)
The main philosophy is that all cycle-by-cycle settings for cycle n need to be done within cycle n-1. The
main control cycle synchronization event is the PMF reload event, which can be generated every n PWM
periods.
MC9S12ZVM Family Reference Manual Rev. 1.3
64Freescale Semiconductor
Page 65
Chapter 1 Device Overview MC9S12ZVM-Family
This mode can optionally be extended by a timer channel trigger PMF to change PWM channel operation
(e.g. used for BLDCM commutation).
The event flow is the same as for static timing.
Before the upcoming reload event the CPU:
•reads the ADC results from the buffered Conversion Result List
•clears the conversion complete flag
•services the reload by setting new duty cycle values and a new PMF modulo value
•updates the non-active PTU_TELx
•updates the non-active ADCx_CSL
•sets the PTULDOK bit (corresponding to glb_ldok) to signal the duty cycle coherence
The CPU actions are typically performed in an ISR triggered by the conversion complete flag.
1.13.3.6Dynamic Timing Fault Handling
The following Faults and/or errors can occur:
•Desaturation error, Overvoltage, Undervoltage, Temperature sensor, External fault
The application run-time error is handled by the GDU without CPU interaction. Firstly the FETs are
disabled and the PMF signals switched to an inactive state. To re-enable the operation first the GDU fault
and then PWM fault must be cleared, to automatically re-enable the FET driving at the next PWM
boundary.
•PTU reload overrun error
This is an application run-time error caused by the CPU not setting PTULDOK on time. Servicing this
type of error is application dependent and may range from a further reload attempt to a total shut down.
This indicates an application run-time error caused by a settings mismatch. Servicing this type of error is
application dependent. In some cases, the ADC values for the current control cycle can be ignored.
•PTU memory access error, Memory access double bit ECC error
This type of error occurring in an application indicates possible data corruption. This can be serviced by a
control loop shutdown.
This indicates an application run-time error caused by a settings mismatch. Servicing this type of error is
application dependent. In some cases, the ADC values for the current control cycle can be ignored.
1.13.3.7Asynchronous Timing
This case is an extension of the dynamic timing case by an asynchronous event generated by the Timer.
Note the asynchronous term is referenced to the control cycle.
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor65
Page 66
Chapter 1 Device Overview MC9S12ZVM-Family
The timing frame is the same as in dynamic timing case plus it can be asynchronously restarted at any time
within the control cycle.
At the asynchronous commutation_event
•the PMF actions are:
1. counter re-start, re-initialization
2. PWM configuration re-initialization according to the selected PWM settings (center/edge-aligned
pattern, normal/inverted type etc.)
3. re-initialization of the dead time generators (in case the commutation takes place at a time when
one of the dead times is being generated)
4. re-initialization of the PWM outputs according to pre-set PWM channel output settings in double
buffered registers (mask, swap, output control)
5. re-initialization of the automatic fault clearing
6. generates async_reload event for the PTU
7. optionally updates the PWM duty cycle values based on LDOK state
•the PTU actions are:
1. abortion of the trigger_x event generation
2. re-initialization and re-start the PTU counter
3. update of the current list index TGxList based on the glb_ldok state
4. fetch first trigger time from updated TGxList
5. passes the async_reload event immediately to the ADC (if the PTU is enabled)
6. generates the reload event for the ADC
•the ADC actions are:
1. the conversion in progress is completed
2. the ADC conversion sequence is aborted and the SEQA flag is set to indicate that the final
conversion occurred during the abortion process (potentially coinciding with a commutation and is
thus less precise than under normal conditions)
3. update of the current lists index ADxLists
4. re-start of the conversion sequencing upon successful abortion - fetches the first ADC command
from the ADCx_CSL, re-sets the result pointer to the top of the list
Note: in case the lists index ADxLists is not updated at the sequence abortion the new restarted A/D
conversions will overwrite the previously converted results.
•the GDU actions are:
1. standard operation
1.13.3.8Control Loop Startup Guidelines
The sequence for control loop start up is to firstly configure the signal measurement (inputs/feedback).
Once the measurement is properly configured (correct value is measured at defined time) the output
actuation (control action) is configured. The following modules are involved in signal measurements.
The TIM OC0 channel identifies the commutation event and restarts the PMF counter. In order to establish
this link TIM and PMF need to be configured and started. Then to sample accurately within one PMF cycle
the PTU needs to be used, so the next step is to configure the PTU to establish PMF to PTU link. The PTU
sends triggers to the ADC to perform a measurement of control signals. So the next step is to configure the
ADC. In some cases the GDU involvement is required and therefore configured.
The control action involves the PMF (to generate the duty cycle for GDU) and the GDU (to propagate the
signal to the MOSFETs). Since the PMF has already been configured for the measurements, only the GDU
need be configured to complete startup. Sometimes the GDU can be configured earlier but the GDU output
is always enabled last.
The recommended startup sequence is summarized as follows:
•Configure TIM and PMF to establish the link between TIM OC0 commutation event and PMF
•Configure PTU to establish the PMF to PTU link and ensure correct sampling within PMF cycle
•Configure the ADC
•Configure the GDU
1.13.3.9Control Loop Shutdown Guidelines
1. Remove energy stored in the system after the power stage
kinetic energy - stop all rotating/moving mass
magnetic energy - gracefully drive currents to zero
2. Put GDU and PMF outputs to safe state
1.13.3.10Control Loop Stop Mode Considerations
In Stop mode the PWM, PTU, ADC can not run because the bus clock is not running. Thus the GDU must
transition to a disabled state. Before entering Stop mode the application must perform the following steps:
1. Remove energy stored in the system after the power stage
kinetic energy - stop all rotating/moving mass
magnetic energy - gracefully drive currents to zero
2. Put GDU and PMF outputs to safe state
3. Verify GDU and PMF safe states
4. Verify fault flags and service if necessary
5. Execute the STOP instruction
The return from stop is expected in reverse order:
1. On returning from Stop mode the clocks are automatically enabled coherently
2. Initialize and check device proper functionality (charge pump etc.)
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor67
Page 68
Chapter 1 Device Overview MC9S12ZVM-Family
3. Check functionality of the external system
4. Initializes control loop operation, however with PMF and GDU outputs still in safe state
5. Read the ADC values to check the system
6. Start driving energy into the system
based on the measurements from the previous step, the PWM duty cycle values are calculated
7. PMF and GDU outputs are enabled (actively driven)
The device does not support putting the FETs in an active driving state during STOP as the GDU charge
pump clock is not running. This means the device cannot be put in stop mode if the FETS need to be in an
active driving state to protect the system from external energy supply (e.g. externally driven motorgenerator).
NOTE
It is imperative, that whatever the modules perform on entering/exiting Stop
mode, the pre-set complementary mode of operation and dead time insertion
must be guaranteed all the times.
1.13.3.11Application Signal Visibility
In typical motor control applications, TIM OC0 is used internally to indicate commutation events. To
switch off OC0 visibility at port pin PT0:
•Disable output compare signal on pin PT0 in TIM: OCPD[OCPD0]=0b1.
1.13.3.12Debug Signal Visibility
Depending on required visibility of internal signals on port pins enable the following registers:
•Set [PWMPRR]=0b1 in PIM if monitoring of internal PWM waveforms is needed. PWM5-3 are
driven out on pins PT[2:0] and PWM2-0 on pins PP[2:0].
•Enable output compare channel OC0 to output commutation event on pin PT0 in TIM:
OCPD[OCPD0]=0b0.
•Set PTUDEBUG[PTUREPE]=0b1 in PTU to output the reload event.
•Set PTUDEBUG[PTUTxPE]=0b1 with x=0,1 in PTU to output the trigger events.
1.13.4BDCM Complementary Mode Operation
This section describes BDCM control using center aligned complementary mode with deadtime insertion.
The DC Brushed motor power stage topology is a classical full bridge as shown in Figure 1-9. The DC
Brushed motor is driven by the DC voltage source. A rotational field is created by means of commutator
and brushes on the motor. These drives are still very popular because sophisticated calculations and
algorithms such as commutation, waveform generation, or space vector modulation are not required.
MC9S12ZVM Family Reference Manual Rev. 1.3
68Freescale Semiconductor
Page 69
Chapter 1 Device Overview MC9S12ZVM-Family
Figure 1-9. DC Brushed Motor External Configuration
+ 1/2 U
PWM
0
A
PWM
1
- 1/2 U
PWM
2
B
PWM
3
Usually the control consists of an outer, speed control loop with inner current (torque) control loop. The
inner loop controls DC voltage applied onto the motor winding. The control loop is calculated regularly
within a given period. In most cases, this period matches the PWM reload period.
Driving the DC motor from a DC voltage source, the motor can work in all four quadrants. The
complementary mode of operation with deadtime insertion is needed for smooth reversal of the motor
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor69
Page 70
Chapter 1 Device Overview MC9S12ZVM-Family
current (motor torque), hence smooth full four quadrant control. Usually the center-aligned PWM is
chosen to lower electromagnetic emissions.
Figure 1-10. BDCM Control Loop Configuration
PMF
reloada
reload
GDU
dc_bus_voltage
M
sine/
cosine
sensor
dc_bus_current0
glb_ldok
trigger_0
PTU
ADC0
trigger_1
reload
ADC1
The PWM frequency selection is always a compromise between audible noise, electromagnetic emissions,
current ripples and power switching losses.
The BDCM control loop goal is to provide a controlled DC voltage to the motor winding, whereby it is
controlled cycle-by-cycle using a speed, current or torque feedback loop.
The center aligned PWM waveforms generated by the PMF module are applied to the bridge as shown in
Figure 1-11 whereby the base waveform for PWM0 and PWM1 is depicted at the top and the
complementary PWM0 and PWM1 waveforms are shown with deadtime insertion depicted by the gray
phases before the switching edges.
MC9S12ZVM Family Reference Manual Rev. 1.3
70Freescale Semiconductor
Page 71
Chapter 1 Device Overview MC9S12ZVM-Family
Figure 1-11. BDCM Complementary Mode Waveform
PWM0, PWM1 base
PWM0
PWM1
T
PWM
PWM2, PWM3 base
PWM2
PWM3
Assuming first quadrant operation, forward accelerating operation, the applied voltage at node A must
exceed the applied voltage at node B (Figure 1-9). Thus the PWM0 duty cycle must exceed the PWM2
duty cycle.
The PWM duty cycle of PWM0 defines the voltage at the first power stage branch.
The PWM duty cycle of PWM2 defines the voltage at the second power stage branch.
Modulating the PWM duty cycle every period using the function F
PWM0 duty-cycle = 0.5 + (0.5 * F
PWM2 duty-cycle = 0.5 - (0.5 * F
PWM
PWM
)
); For -1<=F
PWM
<= 1;
then the duty cycle is expressed as:
PWM
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor71
Page 72
Chapter 1 Device Overview MC9S12ZVM-Family
1.13.5BLDC Six-Step Commutation
1.13.5.1Hall Sensor Triggered Commutation
Figure 1-12. BLDC Configuration With Hall Sensors
TIM
PMF
reload
OC0
PTU
reload
IC1
commutation_event
async_reload
glb_ldok
trigger_0
async_reload
ADC0
PIM
XOR
GDU
PTIT
EVDD1
PT1
PT2
PT3
dc_bus_voltage
dc_bus_current
Hall
Sensor
M
This BLDC application uses Hall sensor signals to create commutation triggers. The integrated sense
amplifier and an ADC module are used to measure DC bus current, for torque calculation. The DC bus
voltage measurement is used in the control algorithm to counter-modulate the PWM such that the variation
of the DC-bus voltage does not affect the motor current closed loop. The configuration is as follows:
1. Connect the three Hall sensor signals from the motor to input pins PT3-1.
2. Set [T0IC1RR=1] in the register MODRR2 to establish the link from Hall sensor input pins to TIM
input capture channel 1.
3. Setup TIM IC1 for speed measurement of XORed Hall sensor signals. Enable interrupt on both
edges.
4. Enable TIM OC0 and select toggle action on output compare event: TCTL2[OM0:OL0]=01.
5. Configure PMF for edge-aligned PWM mode with or without restart at commutation:
PMFENCx[RSTRT]. If using the restart option, then select generator A as reload signal source and
keep the following configurations at their default setting: multi timebase generators
(PMFCFG0[MTG]=b0), reload frequency (PMFFQCx[LDFQx]=b0), prescaler
(PMFFQCx[PRSCx]=b00).
7. Read port register PTIT[3:1] to determine starting sector.
8. Startup motor by applying PWM to the related motor phase.
9. In IC1 interrupt ISR calculate the delay to next commutation and store value to output compare
register. Update registers with next values of mask and swap.
10. On next output compare event the buffered mask and swap information is transferred to the active
PWM registers to execute the commutation.
1.13.5.2Sensorless Commutation
Figure 1-13. Sensorless BLDC Configuration
GDU
TIM
OC0
commutation_event
zero crossing
comparators
GPHS
dc_bus_voltage
PMF
reloada
reload
reload
async_reload
async_reload
PTU
trigger_1
async_reload
glb_ldok
trigger_0
ADC0
ADC1
back-EMF
PHMUX
P1
P2
P3
dc_bus_current0
dc_bus_current1
M
To calculate the commutation time in a sensorless motor system the back-EMF zero crossing event of the
currently non-fed phase within an electrical rotation cycle must be determined. For fast motor rotation, the
ADC is used to measure the back-EMF voltage and the DC bus voltage to determine the zero crossing time.
For slow motor rotation the GPHS register can be polled. In either case the zero crossing event is handled
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor73
Page 74
Chapter 1 Device Overview MC9S12ZVM-Family
by the CPU monitoring flags or responding to interrupts. The TIM then generates the commutation_event
under CPU control, based on the zero crossing time.
1. Enable TIM OC0 and select toggle action on output compare event: TCTL2[OM0:OL0]=0b01.
3. Enable internal ADC channel for measuring the phase voltages from the muxed GDU outputs.
4. Align rotor to stator field. Initialize phase MUX using register GDUPHMUX.
5. Startup motor by applying PWM to an arbitrary motor phase.
6. Take samples of the phase voltages periodically based on PWM cycle to detect zero crossing.
7. Calculate the delay to next commutation and store value to output compare register. Update
registers with next values of mask and swap.
8. On next output compare event the buffered mask and swap information are transferred to the active
PWM register to execute the commutation.
1.13.6PMSM Control
PMSM control drives all 3 phases simultaneously with sinusoidal waveforms. Both sensorless and SineCosine position sensor control loop operation are supported.
1.13.6.1PMSM Sensorless Operation
In this configuration the PMSM stator winding currents are driven sinusoidally and the back EMF
waveform is also sinusoidal. Thus all 3 phases are active simultaneously. The rotor position and speed are
determined by the current and calculated voltages respectively. The back EMF voltage is calculated based
on the currents.
1. Configure PMF for complementary mode operation.
2. Configure PMF for center aligned or phase shifted operation.
3. Select correct PMF deadtime insertion based on external FET switches.
4. Enable GDU current sense opamps for measuring the phase currents from 2 external shunts.
5. Map the output pin of each current sense opamp to the ADC input.
6. Optionally use GDU phase comparators for zero crossing detection to correct deadtime distortion.
7. Fetch targeted motor speed parameter from external source (e.g. SCI)
8. Configure PMF period and duty cycle.
9. Startup motor by applying FOC startup algorithm.
10. Take samples of the phase currents periodically based on PWM cycle to determine motor speed.
11. Calculate FOC algorithm to determine back EMF and motor position.
MC9S12ZVM Family Reference Manual Rev. 1.3
74Freescale Semiconductor
Page 75
Chapter 1 Device Overview MC9S12ZVM-Family
Figure 1-14. Sensorless PMSM Control Loop Configuration
PMF
reloada
reload
PTU
IS0
IS1
IS2
glb_ldok
trigger_0
zero crossing
phase comparison
ADC0
GDU
dc_bus_voltage
dc_bus_current1
dc_bus_current0
M
trigger_1
reload
ADC1
1.13.6.2PMSM Operation With Sine-Cosine Position Sensor
In this configuration the PMSM stator winding currents are driven sinusoidally and the back EMF
waveform is also sinusoidal. Thus all 3 phases are active simultaneously. The back EMF voltage is
calculated based on the currents. The rotor position and speed are determined by a sine/cosine sensor,
which generates sinusoidal sine/cosine signals, indicating the angle of the rotor in relation to sensor
windings. The sensor is supplied by the EVDD1 pin.
1. Configure PMF for complementary mode operation.
2. Configure PMF for center aligned or phase shifted operation.
3. Select correct PMF deadtime insertion based on external FET switches.
4. Enable GDU current sense opamps for measuring the phase currents from external shunts.
5. Map the output pin of each current sense opamp to the ADC input.
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor75
Page 76
Chapter 1 Device Overview MC9S12ZVM-Family
6. Map the sine/cosine input signals to ADC input channels.
7. Configure the EVDD1 pin as output.
8. Optionally use GDU phase comparators for zero crossing detection to correct dead time distortion.
9. Fetch targeted motor speed parameter from external source (e.g. SCI)
10. Configure PMF period and duty cycle.
11. Start motor by applying startup algorithm.
12. Sample the sine/cosine voltages periodically based on PWM cycle to determine motor position.
13. Use FOC algorithm to determine back EMF and motor speed.
Figure 1-15. PMSM Sine/Cosine Control Loop Configuration
PMF
reload
PTU
IS0
IS1
IS2
glb_ldok
trigger_0
zero crossing
phase comparison
ADC0
GDU
dc_bus_voltage
sine/cosine
sensor
dc_bus_current1
dc_bus_current0
M
trigger_1
reload
MC9S12ZVM Family Reference Manual Rev. 1.3
76Freescale Semiconductor
ADC1
Page 77
Chapter 1 Device Overview MC9S12ZVM-Family
1.13.6.3Dead time Distortion Correction
PMSM motor control applications driven by sinusoidal voltages by default require zero crossing
information of phase currents to determine the point in time to change sign of deadtime compensation
value to be added to duty cycles.
The GDU phase comparator signals are connected internally to the PMF ISx inputs. This allows the dead
time distortion correction to be applied directly based on the phase status.
1. Align rotor to stator field.
2. Await phase comparator status change.
3. Switch to alternate duty cycle register to compensate distortion.
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor77
Page 78
Chapter 1 Device Overview MC9S12ZVM-Family
1.13.7Power Domain Considerations
The MC9S12ZVM-Family power domains are illustrated in Figure 1-16. More detailed information is
included in the individual module descriptions.
Figure 1-16. Power Domain Overview
OPT L = LINPHY package option
OPT C = CANPHY package option
VRBATP
L
VSSBBST
VSUP (12V/18V)
VRBATP
LGND
BCTLC
VDDC
VDDF
VDDA
PAD8
VSSA
HD
LIN
(5V)
VDD
GHHDF
(OPT L)
(OPT L)
(OPT C)
(OPT C)
LINPHY
VDDA
ADC
VSSA
PORF
VRH
VRL
INT
VRL_SEL
VRH_SEL
BOOST
GBOE
VREG_AUTO
1.8V
RES
CORE
RAM’s
PLL
IRC
OSC
INTXON
EXTXONEXTCON
2.8V
FLASH
BATS
ADC
5V
INT
GFDE
GCPE
INT
LDO
GLVLSF
GDU
LVRF
PADS
CPS
RES
VCP
CP
VLS_OUT
(11V)
VLS
LG
LS
BCTL
VDDX
GPIO
VSSX
VRBATP
VSS
The system supply voltage VRBATP is a reverse battery protected input voltage. It must be protected
against reverse battery connections and must not be connected directly to the battery voltage (VBAT).
The device supply voltage VSUP provides the input voltage for the internal regulator, VREG_AUTO,
which generates the voltages VDDX, VDD and VDDF. The VDDX domain supplies the device I/O pins,
VDDA supplies the ADC and internal bias current generators. The VDDA and VDDX pins must be
connected at board level, they are not connected directly internally. ESD protection diodes exist between
VDDX and VDDA, therefore forcing a common operating range. The VDD domain supplies the internal
device logic. The VDDF domain supplies sections of the internal Flash NVM circuitry.
MC9S12ZVM Family Reference Manual Rev. 1.3
78Freescale Semiconductor
Page 79
Chapter 1 Device Overview MC9S12ZVM-Family
The device supports the use of an external PNP to supplement the VDDX supply, for reducing on chip
power dissipation. In this configuration, most of the current flowing from VRBATP to VDDX, flows
through the external PNP. This configuration, using the BCTL pin, can be enabled by register bits
EXTXON and INTXON.
A supply for an external CANPHY is offered via external device pins BCTLC and VDDC, whereby
BCTLC provides the base current of an external PNP and VDDC is the CANPHY supply (output voltage
of the external PNP). This is only available in the CANPHY package option. This configuration can be
enabled by the register bit EXTCON.
The LINPHY pull-up resistor is internally connected to the HD voltage. This is chosen as opposed to
VSUP to ensure that the LINPHY is not disturbed by the internal VSUP boost circuit. The external
connections for the HD pin must ensure a reverse battery protection.
The ADC register bit VRH_SEL maps the ADC reference VRH to VDDA or to the device pad PAD8.
1.13.7.1Voltage Domain Monitoring
The BATS module monitors the voltage on the VSUP pin, providing status and flag bits, an interrupt and
a connection to the ADC, for accurate measurement of the scaled VSUP level.
The POR circuit monitors the VDD and VDDA domains, ensuring a reset assertion until an adequate
voltage level is attained. The LVR circuit monitors the VDD, VDDF and VDDX domains, generating a
reset when the voltage in any of these domains drops below the specified assert level. The VDDX LVR
monitor is disabled when the VREG is in reduced power mode. A low voltage interrupt circuit monitors
the VDDA domain.
The GDU high side drain voltage, pin HD, is monitored within the GDU and mapped to an interrupt. A
connection to the ADC is provided for accurate measurement of a scaled HD level.
1.13.7.2FET-Predriver (GDU) Supplies
A dedicated low drop regulator is used to generate the VLS_OUT voltage from VSUP. The VLS_OUT
voltage is used to supply the low side drivers and can be directly connected to the VLS inputs of each low
side driver. For FET-predriver operation at lower VSUP levels, a boost circuit can be enabled by the GBOE
register bit. The boost circuit requires Shottky diodes, a coil and capacitors, as shown in Figure 1-16. More
detailed information is included in the GDU module description.
1.13.7.2.1Bootstrap Precharge
The FET-predriver high side driver must provide a sufficient gate-source voltage and sufficient charge for
the gate capacitance of the external FETs. A bootstrap circuit is used to provide sufficient charge, whereby
the capacitor C
Figure 1-17. When the high side driver switches on, the charge on this capacitor, supplies the FET-
predriver via the VBSx pin. The C
a long period of inactivity of the low side driver, the C
low side driver must be switched on to charge C
to discharge the bootstrap capacitor C
the leakage current on VBSx pin.
is first charged to VLS_OUT via an external diode, when the low side driver is active
BS
capacitor can only be charged if the low side driver is active, so after
BS
capacitor becomes discharged. In this case, the
BS
before commencing high side driving. The time it takes
BS
can be calculated from the size of the bootstrap capacitor CBSand
BS
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor79
Page 80
Chapter 1 Device Overview MC9S12ZVM-Family
The bootstrap capacitors must be precharged before turning on the high-side drivers for the first time. This
can be done by using the PMF software output control mechanism:
PMFOUTC = 0x3F;// SW control on all outputs
PMFOUTB = 0x2A;// All high-sides off, all low-sides on
The PWM signals should be configured to start with turning on the low-side before the high-side drivers
in order to assure precharged bootstraps. Therefore invert the PWM signals:
PMFCINV = 0x3F;// Invert all channels to precharge bootstraps
1.13.7.2.2High Side Charge Pump For 100% Duty Cycle
A charge pump voltage is used to supply the high side FET-predriver with enough current to maintain the
gate source voltage. To generate this voltage an external charge pump is driven by the pin CP, switching
between 0V and 11V. The pumped voltage is then applied to the pin VCP.
At 100% duty cycle operation the low-side turn on time is zero during a masked commutation cycle before
the high-side gates are attempted to be turned on. This can cause bootstrap charge to decay.
In order to speed-up the high-side gate voltage level directly after commutation, the software should drive
the first PWM cycle with a duty cycle meeting an on-time of at least t
minpulse
for the low-side drivers and
then switch back to 100% again.
The recommended procedure is to use the manual correction method (PMFCCTL[ISENS]) as described
for the BLDC applications:
Set odd PMF values to alternative duty cycle. At commutation event when one of the three high-side
drivers it turned on (every 120˚) set the PMFCCTL[IPOLx] bits and clear them in at next PWM reload
event.
Given unipolar switching mode:
// TIM OC0 ISR:
if ((PMFOUTC == 0x1c) || (PMFOUTC == 0x07) || (PMFOUTC == 0x31)) // all high-side turn-on sectors
PMFCCTL = 0x17; // select odd PMF values
// PMF reload ISR:
PMFCCTL = 0x10; // select even PMF values
The GDU high side drain voltage, pin HD, is supplied from VBAT through a reverse battery protection
circuit. In a typical application the charge pump is used to switch on an external NMOS, N1, with source
connected to VBAT, by generating a voltage of VBAT+VLS-(2xVdiode). In a reverse battery scenario, the
external bipolar turns on, ensuring that the HD pin is isolated from VBAT by the external NMOS, N1.
MC9S12ZVM Family Reference Manual Rev. 1.3
80Freescale Semiconductor
Page 81
Chapter 1 Device Overview MC9S12ZVM-Family
Figure 1-17. High Side Supply and Charge Pump Concept
GCPCD
GCPE
VLS_OUT
10nF
CP
11V
0V
VCP
HD
VBSx
HGx
VBAT
(11V)
S
N1
D
1nF
1000µF
(Motor Dependent)
C
BS
HIGH SIDE
HSx
LOW SIDE
Diode voltage drop = Vdiode
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor81
Page 82
Chapter 1 Device Overview MC9S12ZVM-Family
MC9S12ZVM Family Reference Manual Rev. 1.3
82Freescale Semiconductor
Page 83
Chapter 2
Port Integration Module (S12ZVMPIMV1)
Revision History
Rev. No.
(Item No.)
V01.0011 Nov 2012 • Initial release
V01.0120 Feb 2013Table 2-1 • Removed VRL
Date (Submitted
By)
Sections
Affected
Substantial Change(s)
• Corrected typo
2.1Introduction
2.1.1Overview
The S12ZVM-family port integration module establishes the interface between the peripheral modules and
the I/O pins for all ports. It controls the electrical pin properties as well as the signal prioritization and
multiplexing on shared pins.
This document covers:
•2-pin port E associated with the external oscillator
•4-pin port T associated with either combination of 4 TIM channels, 3 PWM channels of PMF, 1
SPI and 1 SCI
•6-pin port S with pin interrupts and key-wakeup function; associated with 1 MSCAN, 1 SCI and 1
SPI modules
•3-pin port P with pin interrupts and key-wakeup function; associated with
IRQ, XIRQ interrupt inputs
—
— 3 PWM channels of PMF
— ECLK output
•9-pin port AD associated with 9 ADC channels shared among two ADC and two GDU AMP
modules - inputs can be used as an external interrupt and key-wakeup source
Most I/O pins can be configured by register bits to select data direction and to enable and select pullup or
pulldown devices.
MC9S12ZVM Family Reference Manual Rev.1.3
Freescale Semiconductor83
Page 84
Chapter 2 Port Integration Module (S12ZVMPIMV1)
NOTE
This document assumes the availability of all features offered in the largest
package option. Refer to the package and pinout section in the device
overview for functions not available in lower pin count packages.
2.1.2Features
The PIM includes these distinctive registers:
•Data registers and data direction registers for ports T, S, P and AD when used as general-purpose
I/O
•Control registers to enable pull devices and select pullups/pulldowns on ports E, T, S, P and AD
•Control register to enable open-drain (wired-or) mode on port S
•Control register to enable digital input buffers on port AD
•Interrupt flag register for pin interrupts and key-wakeup (KWU) on port S, P and AD
•Control register to configure
•Control register to enable ECLK output
•Routing registers to support signal relocation on external pins and control internal routings:
IRQ pin operation
— SPI0 to alternative pins
— Various SCI0-LINPHY0 routing options supporting standalone use and conformance testing
— Optional RXD0 to TIM0 link
— Optional RXD1 to TIM0 link
— PWM channels to GDU and/or pins
— 3 pin input mux to one TIM0 IC channel
A standard port pin has the following minimum features:
•Input/output selection
•5V output drive
•5V digital and analog input
•Input with selectable pullup or pulldown device
Optional features supported on dedicated pins:
•Open drain for wired-or connections
•Interrupt input with glitch filtering
2.2External Signal Description
This section lists and describes the signals that do connect off-chip.
Table 2-1 shows all pins with the pins and functions that are controlled by the PIM. Routing options are
denoted in parenthesis.
MC9S12ZVM Family Reference Manual Rev. 1.3
84Freescale Semiconductor
Page 85
Chapter 2 Port Integration Module (S12ZVMPIMV1)
NOTE
If there is more than one function associated with a pin, the
output priority
is indicated by the position in the table from top (highest priority) to bottom
(lowest priority).
Table 2-1. Pin Functions and Priorities
Port Pin Name
-BKGDMODC
EPE1XTAL-CPMU OSC signal—GPIO
PE0EXTAL-CPMU OSC signal—
Pin Function
& Priority
(2)
BKGDI/O S12ZBDC communication—
PTE[1]I/O General-purpose—
PTE[0]I/O General-purpose—
I/ODescription
(1)
IMODC input during RESET—BKGD
Routing
Register Bit
Pin Function
after Reset
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor85
Page 86
Chapter 2 Port Integration Module (S12ZVMPIMV1)
Port Pin Name
Pin Function
& Priority
(1)
I/ODescription
Routing
Register Bit
Pin Function
after Reset
ADPAD8VRHIADC0&1 voltage reference high—GPIO
AN1_3IADC1 analog input—
PTADH[0]/
I/O General-purpose; with interrupt and wakeup—
KWADH[0]
PAD7AMPP1IGDU AMP1 non-inverting input (+)—
AN1_2IADC1 analog input—
PTADL[7]/
I/O General-purpose; with interrupt and wakeup—
KWADL[7]
PAD6AMPM1IGDU AMP1 inverting input (-)
SS0)I/O SPI0 slave selectSPI0RR
(
SPI0SSRR
AN1_1IADC1 analog input—
PTADL[6]/
I/O General-purpose; with interrupt and wakeup—
KWADL[6]
PAD5AMP1O GDU AMP1 output—
AN1_0IADC1 analog input—
PTADL[5]/
I/O General-purpose; with interrupt and wakeup—
KWADL[5]
PAD4-3AN0_4:AN0_3IADC0 analog input—
PTADL[4:3]/
I/O General-purpose; with interrupt and wakeup—
KWADL[4:3]
PAD2AMPP0IGDU AMP0 non-inverting input (+)—
AN0_2IADC0 analog input—
PTADL[2]/
I/O General-purpose; with interrupt and wakeup—
KWADL[2]/
PAD1AMPM0IGDU AMP0 inverting input (-)—
AN0_1IADC0 analog input—
PTADL[1]/
I/O General-purpose; with interrupt and wakeup—
KWADL[1]
PAD0AMP0O GDU AMP0 output—
AN0_0IADC0 analog input—
PTADL[0]/
I/O General-purpose; with interrupt and wakeup—
KWADL[0]
MC9S12ZVM Family Reference Manual Rev. 1.3
86Freescale Semiconductor
Page 87
Chapter 2 Port Integration Module (S12ZVMPIMV1)
Port Pin Name
TPT3(
PT2(SCK0)I/O SPI0 serial clockSPI0RR
PT1PTUREO PTU reload event—
PT0(RXD0)ISCI0 receiveS0L0RR2-0
Pin Function
& Priority
(1)
I/ODescription
Routing
Register Bit
SS0)I/O SPI0 slave selectSPI0RR
SPI0SSRR
(3)
(IOC0_3)
I/O TIM0 channel 3T0IC3RR1-0
PTT[3]I/O General-purpose—
(PWM5)O PWM channel 5PWM54RR
PWMPRR
IOC0_2I/O TIM0 channel 2—
PTT[2]I/O General-purpose—
(TXD0)/
(LPDC0)
O SCI0 transmit/
LPTXD0 direct control by LP0DR[LP0DR1]
S0L0RR2-0
(MOSI0)I/O SPI0 master out/slave inSPI0RR
(PWM4)O PWM channel 4PWM54RR
PWMPRR
3
(IOC0_1)
I/O TIM0 channel 1T0IC1RR
PTT[1]I/O General-purpose—
(MISO0)I/O SPI0 master in/slave outSPI0RR
(PWM3)O PWM channel 3PWM32RR
PWMPRR
IOC0_0I/O TIM0 channel 0—
PTT[0]I/O General-purpose—
Pin Function
after Reset
GPIO
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor87
Page 88
Chapter 2 Port Integration Module (S12ZVMPIMV1)
Port Pin Name
Pin Function
& Priority
(1)
I/ODescription
Routing
Register Bit
Pin Function
after Reset
SPS5PDOO DBG profiling data output—GPIO
SS0I/O SPI0 slave selectSPI0RR
SPI0SSRR
PTS[5]/
I/O General-purpose; with interrupt and wakeup—
KWS[5]
PS4PDOCLKO DBG profiling clock—
SCK0I/O SPI0 serial clockSPI0RR
PTS[4]/
I/O General-purpose; with interrupt and wakeup—
KWS[4]
PS3MOSI0I/O SPI0 master out/slave inSPI0RR
(TXD1)O SCI1 transmitSCI1RR
DBGEEVIDBG external event—
PTS[3]/
I/O General-purpose; with interrupt and wakeup—
KWS[3]
PS2MISO0I/O SPI0 master in/slave outSPI0RR
(RXD1)ISCI1 receiveSCI1RR
PTS[2]/
I/O General-purpose; with interrupt and wakeup—
KWS[2]
PS1PTUT1O PTU trigger 1—
(LPTXD0)ILINPHY0 transmit inputS0L0RR2-0
TXCAN0O MSCAN0 transmit—
TXD1O SCI1 transmitSCI1RR
PTS[1]/
I/O General-purpose; with interrupt and wakeup—
KWS[1]
PS0PTUT0O PTU trigger 0—
(LPRXD0)O LINPHY0 receive outputS0L0RR2-0
RXCAN0IMSCAN0 receive—
RXD1ISCI1 receiveSCI1RR
PTS[0]/
I/O General-purpose; with interrupt and wakeup—
KWS[0]
MC9S12ZVM Family Reference Manual Rev. 1.3
88Freescale Semiconductor
Page 89
Chapter 2 Port Integration Module (S12ZVMPIMV1)
Port Pin Name
PPP2(PWM2)O PWM channel 2PWM32RR
PP1
PP0
1. Signals in parentheses denote alternative module routing pins.
Pin Function
& Priority
PTP[2]/
KWP[2]
IRQIMaskable level- or falling edge-sensitive
(PWM1)O PWM channel 1PWM10RR
PTP[1]/
KWP[1]
XIRQINon-maskable level-sensitive interrupt
FAULT5IPMF fault—
ECLKO Free-running clock—
(PWM0)O PWM channel 0 with over-current interrupt;
PTP[0]/
KWP[0]/
EVDD1
I/ODescription
(1)
I/O General-purpose; with interrupt and wakeup—
interrupt
I/O General-purpose; with interrupt and wakeup—
(4)
high-current capable (20 mA)
I/O General-purpose; with interrupt and wakeup
Switchable external power supply output with
over-current interrupt; high-current capable
(20 mA)
Routing
Register Bit
PWMPRR
PWMPRR
PWM10RR
PWMPRR
Pin Function
after Reset
GPIO
—
—
—
2. Function active when RESET asserted.
3. Routable input capture function.
4. The interrupt is enabled by clearing the X mask bit in the CPU CCR. The pin is forced to input upon first clearing of the X bit
and is held in this state until reset. A stop or wait recovery with the X bit set (refer to S12ZCPU reference manual) is not
available.
2.3Memory Map and Register Definition
This section provides a detailed description of all port integration module registers.
This section details the specific purposes of register implemented in address range 0x0200-0x020F. These
registers serve for specific PIM related functions not part of the generic port registers.
•If not stated differently, writing to reserved bits has no effect and read returns zero.
•All register read accesses are synchronous to internal clocks.
•Register bits can be written at any time if not stated differently.
2.3.2.1Module Routing Register 0 (MODRR0)
Address 0x0200Access: User read/write
76543210
R00
SPI0SSRRSPI0RRSCI1RRS0L0RR2-0
W
— —SPI0 SS0SPI0SCI1SCI0-LINPHY0 (see Figure 2-2)
Reset00000000
Figure 2-1. Module Routing Register 0 (MODRR0)
1. Read: Anytime
Write: Once in normal, anytime in special mode
(1)
MC9S12ZVM Family Reference Manual Rev. 1.3
94Freescale Semiconductor
Page 95
Table 2-2. MODRR0 Routing Register Field Descriptions
FieldDescription
Chapter 2 Port Integration Module (S12ZVMPIMV1)
5
SPI0SSR
4
SPI0RR
3
SCI1RR
2-0
S0L0RR2-0
Module Routing Register — SPI0 SS0 routing
1
SS0 on PAD6
0
SS0 based on SPI0RR
Module Routing Register — SPI0 routing
1 MISO0 on PT0; MOSI0 on PT1; SCK0 on PT2;
0 MISO0 on PS2; MOSI0 on PS3; SCK0 on PS4;
Module Routing Register — SCI1 routing
1 TXD1 on PS3; RXD1 on PS2
0 TXD1 on PS1; RXD1 on PS0
Module Routing Register — SCI0-LINPHY0 routing
Selection of SCI0-LINPHY0 interface routing options to support probing and conformance testing. Refer to
Figure 2-2 foran illustration and Table 2-3 for preferred settings. SCI0 must be enabled for TXD0 routing to take
effect on pins. LINPHY0 must be enabled for LPRXD0 and LPDC0 routings to take effect on pins.
LP0DR[LPDR1] register bit controls LPTXD0, interface internal
only
SCI0 connects to LINPHY0, interface accessibleon 2 external pins
Interface opened and all 4 signals routed externally
NOTE
For standalone usage of SCI0 on external pins set
[S0L0RR2:S0L0RR0]=0b110 and disable the LINPHY0 (LPCR[LPE]=0).
This releases PS0 and PS1 to other associated functions and maintains
TXD0 and RXD0 signals on PT1 and PT0, respectively, if no other function
with higher priority takes precedence.
MC9S12ZVM Family Reference Manual Rev. 1.3
96Freescale Semiconductor
Page 97
2.3.2.2Module Routing Register 1 (MODRR1)
Chapter 2 Port Integration Module (S12ZVMPIMV1)
Address 0x0201Access: User read/write
76543210
R0000
W
— — — —
Reset00000000
PWMPRRPWM54RRPWM32RRPWM10RR
PWM
probe
PWM4
PWM5
GDU/pins
PWM2
PWM3
GDU/pins
PWM0
PWM1
GDU/pins
Figure 2-3. Module Routing Register 1 (MODRR1)
1. Read: Anytime
Write: Once in normal, anytime in special mode
Table 2-4. MODRR1 Routing Register Field Descriptions
FieldDescription
3
PWMPRR
Module Routing Register — PWM probe
All six internal PWM outputs can be probed on related external pins.
1 All PWM channels connected to related PWM[5:0] pins
0 All PWM channels disconnected from related PWM[5:0] pins
(1)
2
PWM54RR
1
PWM32RR
0
PWM10RR
Module Routing Register — PWM4 and PWM5 routing
The PWM channel pair can be configured for internal use with the GDU or with its related external pins only. If set
the signal routing to the pins is established and the related GDU inputs are forced low.
1 PWM4 to PT1; PWM5 to PT2
0 PWM4 to GDU; PWM5 to GDU
Module Routing Register — PWM2 and PWM3 routing
The PWM channel pair can be configured for internal use with the GDU or with its related external pins only. If set
the signal routing to the pins is established and the related GDU inputs are forced low.
1 PWM2 to PP2; PWM3 to PT0
0 PWM2 to GDU; PWM3 to GDU
Module Routing Register — PWM0 and PWM1 routing
The PWM channel pair can be configured for internal use with the GDU or with its related external pins only. If set
the signal routing to the pins is established and the related GDU inputs are forced low.
1 PWM0 to PP0; PWM1 to PP1
0 PWM0 to GDU; PWM1 to GDU
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor97
Page 98
Chapter 2 Port Integration Module (S12ZVMPIMV1)
2.3.2.3Module Routing Register 2 (MODRR2)
Address 0x0202Access: User read/write
76543210
R0000
T0IC3RR1-0T0IC1RR
W
TIM0 IC3TIM0 IC1
Reset00000000
0
Figure 2-4. Module Routing Register 2 (MODRR2)
1. Read: Anytime
Write: Once in normal, anytime in special mode
Table 2-5. MODRR2 Routing Register Field Descriptions
FieldDescription
3-2
T0IC3RR1-0
Module Routing Register — TIM0 IC3 routing
One out of four different sources can be selected as input to timer channel 3.
11 TIM0 input capture channel 3 is connected to ACLK
10 TIM0 input capture channel 3 is connected to RXD1
01 TIM0 input capture channel 3 is connected to RXD0
00 TIM0 input capture channel 3 is connected to PT3
(1)
1
T0IC1RR
Module Routing Register — TIM0 IC1 routing
Timer input capture channel 1 can be used to determine the asynchronous commutation event in BLDC motor
applications with Hall sensors. An integrated XOR gate supportsdirect connection of the three sensor inputs to
the device.
1 TIM0 input capture channel 1 is connected to logically XORed input signals of pins PT3-1
0 TIM0 input capture channel 1 is connected to PT1
MC9S12ZVM Family Reference Manual Rev. 1.3
98Freescale Semiconductor
Page 99
2.3.2.4ECLK Control Register (ECLKCTL)
Chapter 2 Port Integration Module (S12ZVMPIMV1)
Address 0x0208Access: User read/write
76543210
R
NECLK
W
Reset:10000000
0000000
(1)
Figure 2-5. ECLK Control Register (ECLKCTL)
1. Read: Anytime
Write: Anytime
Table 2-6. ECLKCTL Register Field Descriptions
FieldDescription
7
NECLK
No ECLK — Disable ECLK output
This bit controls the availabilityof a free-running clock on the ECLK pin. This clock has a fixed rate equivalentto the
internal bus clock.
1 ECLK disabled
0 ECLK enabled
2.3.2.5IRQ Control Register (IRQCR)
Address 0x0209Access: User read/write
76543210
R
IRQEIRQEN
W
Reset00000000
000000
Figure 2-6. IRQ Control Register (IRQCR)
1. Read: Anytime
Write:
IRQE: Once in normal mode, anytime in special mode
IRQEN: Anytime
(1)
MC9S12ZVM Family Reference Manual Rev. 1.3
Freescale Semiconductor99
Page 100
Chapter 2 Port Integration Module (S12ZVMPIMV1)
Table 2-7. IRQCR Register Field Descriptions
FieldDescription
7
IRQE
6
IRQEN
IRQ select edge sensitive only —
1
IRQ pin configured to respond only to falling edges. Falling edges on the IRQ pin are detected anytime when
IRQE=1 and will be cleared only upon a reset or the servicing of the
0
IRQ configured for low level recognition
IRQ enable —
1
IRQ pin is connected to interrupt logic
0
IRQ pin is disconnected from interrupt logic
IRQ interrupt.
2.3.2.6PIM Miscellaneous Register (PIMMISC)
Address 0x020AAccess: User read/write
76543210
R000000
OCPE1
W
Reset00000000
Figure 2-7. PIM Miscellaneous Register (PIMMISC)
1. Read: Anytime
Write:Anytime
0
(1)
Table 2-8. PIM Miscellaneous Register Field Descriptions
FieldDescription
1
OCPE1
Over-Current Protection Enable — Activate over-current detector on PP0
Refer to Section 2.5.2, “Over-Current Protection on EVDD1”