DATASHEET SEARCH SITE | WWW.ALLDATASHEET.COM

Document overview

  • Manufacturer or author: Provided By ALLDATASHEET.COM(FREE DATASHEET DOWNLOAD SITE)
  • PDF pages: 345

Technical content

Features

  • 16-Bit S12 CPU, 64/48 kByte P-FLASH,
  • 6.0 kByte RAM; 4/2 kByte D-FLASH
  • Background debug (BDM) & debug module (DBG)
  • Die to Die bus interface for transparent memory mapping
  • On-chip oscillator & two independent watchdogs
  • LIN 2.1 Physical Layer Interface with integrated SCI
  • 10 digital MCU GPIOs shared with SPI (PA7…0, PE1…0)
  • 10-Bit, 15 Channel - Analog to Digital Converter (ADC)
  • 16-Bit, 4 Channel - Timer Module (TIM16B4C)
  • 8-Bit, 2 Channel - Pulse width modulation module (PWM)
  • Six high voltage / Wake-up inputs (L5…0)
  • Three low voltage GPIOs (PB2…0)
  • Low power modes with cyclic sense & forced wake-up
  • Current sense module with selectable gain
  • Reverse battery protected voltage sense module
  • Two protected low side outputs to drive inductive loads
  • Two protected high side outputs
  • Chip temperature sensor
  • Hall sensor supply & integrated voltage regulator(s)

Figure 1. Simplified Application Diagram

ORDERING INFORMATION

See Page 2. MM912_634 48-PIN LQFP, 7.0 mm x 7.0 mm AE SUFFIX: Exposed Pad Option AP SUFFIX: Non Exposed Pad Option MM912_634 VSENSE VS1 VS2 LIN VDD AGND RESET RESET_A PA0/MISO LS1 LS2 ISENSEH* HS1 HS2* TEST_A LGND Battery Sense M TCLK L4* ISENSEL* PGND L5* Hall Sensor HSUP Hall Sensor PTB0/AD0/RX/TIM0CH0 PTB1/AD1/TX/TIM0CH1 PTB2/AD2/PWM/TIM0CH2 PA1/MOSI PA2/SCK PA3/SS PA4 PA5 PA6 PA7 BKGD/MODC PE0/EXTAL PE1/XTAL TEST ADC25 VDDD2D VDDX VDDRX DGND VSSRX VSSD2D Power Supply LIN Interface ADC Supply

2.5 V Suppy

5.0 V Supply

5.0 V Digital I/O

  • Feature not availablre in all Analog Options Low Side Drivers Current Sense Moe Hall Sensor Supply

5.0 V GPI/O with optional

pull-up (shared with ADC, PWM, Timer, and SCI)

12 V Light/LED and

(High Voltage and Wake-up capable) Analog Test

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 2

1 Ordering Information

Table 1. ORDERING INFORMATION

  1. The 48 kB Flash option (MM912 G634) using the same S12I64 MCU with the tested FLASHSIZE reduced to 48 kB. This will limit the

usable Flash area to the first 48 kB (0x3_4000-0x3_FFFF).

  1. The 48 kB Flash option (MM912 G634) using the same S12I64 MCU with the tested Data - FLASHSIZE reduced to 2.0 kB. This will limit

the usable Data Flash area to the first 2.0 kB (0x0_4400-0x0_4BFF).

  1. The 48 kB Flash option (MM912 G634) using the same S12I64 MCU with the tested RAMSIZE reduced to 2.0 kB. This will limit the

usable RAM area to the first 2.0 kB (0x0_2800-0x0_2FFF). Table 2. Analog Options(5)

  1. This table only highlights the analog die differences between t he derivatives. Features highlighted as “NO” or the Lx Inputs not

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 3 The device part number is following the standard scheme in Table 3: Table 3. Part Numbering Scheme

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 4 Table of Contents

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 5

Figure 2. Device Block Diagram

4 Channel Timer

2 Channel

2 Pin Assignment

Figure 3. MM912_634 Pin Out

2.1 MM912_634 Pin Description

Table 4. MM912_634 Pin Description

2 PE0/EXTAL MCU Oscillator

and Section 4.28, “Port Integration Module (S12IPIMV1).

3 PE1/XTAL MCU Oscillator

and Section 4.28, “Port Integration Module (S12IPIMV1). pin must be tied to EVSS in user mode.

7 PA3 MCU PA3 / SS General purpose port A input or output pin 3, shared with the SS signal of the

integrated SPI Interface. See Section 4.28, “Port Integration Module (S12IPIMV1).

8 PA2 MCU PA2 / SCK General purpose port A input or output pin 2, shared with the SCLK signal of the

integrated SPI Interface. See Section 4.28, “Port Integration Module (S12IPIMV1).

9 PA1 MCU PA1 / MOSI General purpose port A input or output pin 1, shared with the MOSI signal of the

integrated SPI Interface. See Section 4.28, “Port Integration Module (S12IPIMV1).

10 PA0 MCU PA0 / MISO General-purpose port A input or output pin 0, shared with the MISO signal of the

integrated SPI Interface. See Section 4.28, “Port Integration Module (S12IPIMV1). 11 VSSRX MCU 5.0 V Ground Ground for the MCU 5.0 V power supply. “MM912_634 - MCU Die Overview. 13 VSSD2D MCU 2.5 V Ground Ground for the MCU 2.5 V power supply. “MM912_634 - MCU Die Overview.

15 VDD Voltage Regulator

16 VDDX Voltage Regulator Output

LGND, and AGND are internally connected to PGND via a back to back diode.

18 VSENSE Voltage Sense

  1. An optional filter capacitor CVSENSE is recommended to be placed between the board connector and DVSENSE to GND for increased

19 VS1 Power Supply Pin 1

20 VS2 Power Supply Pin 2 This pin is the device power supply pin 2. VS2 supplies the High Side Drivers (HSx).

21 HS1 High Side Output 1

22 HS2 High Side Output 2

23 HSUP Hall Sensor Supply Output

available on all device configurations.

24 LIN LIN Bus I/O

internally connected to PGND via a back to back diode.

26 PTB0 General Purpose I/O 0

  • PTB0 - Bidirectional 5.0 V (VDDX) digital port I/O with selectable internal pull-up resistor.
  • AD0 - Analog Input Channel 0, 0…2.5V (ADC2p5) analog input
  • TIM0CH0 - Timer Channel 0 Input/Output
  • Rx - Selectable connection to LIN / SCI See Section 4.18, “General Purpose I/O - PTB[0…2] .

27 PTB1 General Purpose I/O 1

  • PTB1 - Bidirectional 5.0 V (VDDX) digital port I/O with selectable internal pull-up resistor.
  • AD1 - Analog Input Channel 1, 0…2.5 V (ADC2p5) analog input
  • TIM0CH1 - Timer Channel 1 Input/Output
  • Tx - Selectable connection to LIN / SCI See Section 4.18, “General Purpose I/O - PTB[0…2] .

28 PTB2 General Purpose I/O 2

  • PTB2 - Bidirectional 5.0 V (VDDX) digital port I/O with selectable internal pull-up resistor.
  • AD2 - Analog Input Channel 2, 0…2.5V (ADC2p5) analog input
  • TIM0CH2 - Timer Channel 2 Input/Output
  • PWM - Selectable connection to PWM Channel 0 or 1 See Section 4.18, “General Purpose I/O - PTB[0…2] . 29 ADC2p5 ADC Reference Voltage This pin represents the ADC reference voltage and has to be connected to a filter capacitor. See Section 4.20, “Analog Digital Converter - ADC 30 AGND Analog Ground Pin This pin is the device Analog to Digital converter ground connection. DGND, LGND and AGND are internally connected to PGND via a back to back diode.

31 L0 High Voltage Input 0

  • L0 - Digital High Voltage Input 0. When used as digital input, a series resistor (RLX) must be used to protect against automotive transients.(7)
  • AD3 - Analog Input 3 with selectable divider for 0…5.0 V and 0…18 V measurement range.
  • WU0 - Selectable Wake-up input 0 fo r wake up and cyclic sense during low power mode. See Section 4.17, “High Voltage Inputs - Lx

32 L1 High Voltage Input 1

  • L1 - Digital High Voltage Input 1. When used as digital input, a series resistor (RLX) must be used to protect against automotive transients.(7)
  • AD4 - Analog Input 4 with selectable divider for 0…5.0 V and 0…18 V measurement range.
  • WU1 - Selectable Wake-up input 1 for wake-up and cyclic sense during low power mode. See Section 4.17, “High Voltage Inputs - Lx

33 L2 High Voltage Input 2

  • L2 - Digital High Voltage Input 2. When used as digital input, a series resistor (RLX) must be used to protect against automotive transients.(7)
  • AD5 - Analog Input 5 with selectable divider for 0…5.0 V and 0…18 V measurement range.
  • WU2 - Selectable Wake-up input 2 for wake-up and cyclic sense during low power mode. See Section 4.17, “High Voltage Inputs - Lx. Note: This pin function is not available on all device configurations.

34 L3 High Voltage Input 3

  • L3 - Digital High Voltage Input 3. When used as digital input, a series resistor (RLX) must be used to protect against automotive transients.(7)
  • AD6 - Analog Input 6 with selectable divider for 0…5.0 V and 0…18 V measurement range.
  • WU3 - Selectable Wake-up input 3 for wake-up and cyclic sense during low power mode. See Section 4.17, “High Voltage Inputs - Lx. Note: This pin function is not available on all device configurations.

35 L4 High Voltage Input 4

  • L4 - Digital High Voltage Input 4. When used as digital input, a series resistor (RLX) must be used to protect against automotive transients.(7)
  • AD7 - Analog Input 7 with selectable divider for 0…5.0 V and 0…18 V measurement range.
  • WU4 - Selectable Wake-up input 4 for wake-up and cyclic sense during low power mode. See Section 4.17, “High Voltage Inputs - Lx. Note: This pin function is not available on all device configurations.

36 L5 High Voltage Input 5

  • L5 - Digital High Voltage Input 5. When used as digital input, a series resistor (RLX) must be used to protect against automotive transients.(7)
  • AD8 - Analog Input 8 with selectable divider for 0…5.0 V and 0…18 V measurement range.
  • WU5 - Selectable Wake-up input 5 for wake-up and cyclic sense during low power mode. See Section 4.17, “High Voltage Inputs - Lx. Note: This pin function is not available on all device configurations. Note: 7. An optional filter capacitor CLX is recommended to be plac ed between the board connector and RLX to GND for increased ESD performance.

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 11

2.2 MCU Die Signal Properties

This section describes the external MCU signals. It includes a table of signal properties.

37 LS1 Low Side Output 1

Low Side output 1 used to drive small inductive loads like relays. The output is short-circuit protected, includes active clamp circuitry and can be also controlled by the PWM module. See Section 4.13, “Low Side Drivers - LSx 38 PGND Power Ground Pin This pin is the device Low Side Ground connection. DGND, LGND and AGND are internally connected to PGND via a back to back diode.

39 LS2 Low Side Output 2

Low Side output 2 used to drive small inductive loads like relays. The output is short-circuit protected, includes active clamp circuitry and can be also controlled by the PWM module. See Section 4.13, “Low Side Drivers - LSx

40 ISENSEL Current Sense Pin L

Current Sense differential input “Low”. This pin is used in combination with ISENSEH to measure the voltage drop across a shunt resistor. See Section 4.21, “Current Sense Module - ISENSE. Note: This pin function is not available on all device configurations.

41 ISENSEH Current Sense Pin H

Current Sense differential input “High”. This pin is used in combination with ISENSEL to measure the voltage drop across a shunt resistor. Section 4.21, “Current Sense Module - ISENSE. Note: This pin function is not available on all device configurations. 42 NC Not connected This pin is reserved for alter native function and should be left floating. 43 TEST_A Test Mode Analog die Test Mode pin for Test Mode only. This pin must be grounded in user mode!

44 TCLK Test Clock Input

Test Mode Clock Input pin for Test Mode only. The pin can be used to disable the internal watchdog for development purpose in user mode. See Section 4.10, “Window Watchdog. The pin is recommended to be grounded in user mode. 45 RESET_A Reset I/O Bidirectional Reset I/O pin of the analog die. Active low signal. Internal pull-up. VDDX based. See Section 4.8, “Resets. To be externally connected to the RESET pin.

46 RESET MCU Reset

The RESET pin 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 RESET pin has an internal pull-up device to EVDDX.

47 BKGD MCU Background Debug

The BKGD/MODC pin is used as a pseudo-open-drain pin for the background debug communication. It is used as MCU operating mode select pin during reset. The state of this pin is latched to the MODC bit at the rising edge of RESET . The BKGD pin has a pull-up device. 48 PA7 MCU PA7 General purpose port A input or output pin 7. See Section 4.28, “Port Integration Module (S12IPIMV1) Table 5. Signal Properties Summary

Description

OSCPINS_EN DOWN Port E I/O, Oscillator pin PE1 XTAL V DDRX PUPBE/ OSCPINS_EN DOWN Port E I/O, Oscillator pin RESET — VDDRX PULLUP External reset TEST — N.A. RESET pin DOWN Test input BKGD MODC VDDRX BKPUE UP Background debug PA7 — VDDRX NA NA Port A I/O

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 12 PA6 — VDDRX NA NA Port A I/O PA5 — VDDRX NA NA Port A I/O PA4 — VDDRX NA NA Port A I/O PA3 SS VDDRX NA NA Port A I/O, SPI PA2 SCK VDDRX NA NA Port A I/O, SPI PA1 MOSI VDDRX NA NA Port A I/O, SPI PA0 MISO VDDRX NA NA Port A I/O, SPI PC1 D2DINT VDDD2D PUPCE/ D2DEN Disabled Port C I/O, D2DI PC0 D2DCLK VDDD2D NA NA Port C I/O, D2DI PD7-0 D2DDAT7-0 VDDD2D PUPDE/ D2DEN Disabled Port D I/O, D2DI

3 Electrical Characteristics

3.1 General

3.2 Absolute Maximum Ratings

Absolute maximum ratings are stress ratings only. A functional operation under or outside those maxima is not guaranteed. Stress beyond those limits may affect the reliability or cause permanent damage of the device. to ground, unless otherwise noted. Table 6. Absolute Maximum Electrical Ratings - Analog Die

  1. See Section 3.9, “Additional Test Information ISO7637-2

3.3 Operating Conditions

Table 7. Maximum Electrical Ratings - MCU Die(9)

5.0 V Supply Voltage (Supplying the MCU internal regulator for core and

  1. All digital I/O pins are internally clamped to VSSRX and VDDRX.

Table 8. Maximum Thermal Ratings

  1. Pin soldering temperature limit is for 10 seconds maximum duration. Not designed for immersion soldering. Exceeding these limits may

cause malfunction or permanent damage to the device.

  1. Freescale’s Package Reflow capability meets Pb-free requi rements for JEDEC standard J-STD-020C. For Peak Package Reflow

and enter the core ID to view all orderable parts (i.e. MC33xxxD enter 33xxx), and review parametrics. Table 9. Operating Conditions

  1. During power up and power down sequence always V DDD2D < VDDRX
  2. f BUSMAX frequency ratings differ by device and is specified in Table 1

3.4 Supply Currents

This section describes the current consumption characteristics of the device as well as the conditions for the measurements.

3.4.1 Measurement Conditions

executed from RAM, unless otherwise noted.

3.5 Static Electrical Characteristics

  • 5 . 5 V  VSUP  18 V
  • - 4 0 ° C  TA  125 °C (MM912x634xMxxx)
  • - 4 0 ° C  TA  105 °C (MM912x634xVxxx) Typical values noted reflect the approximate parameter mean at TA = 25 °C under nominal conditions, unless otherwise noted. Operating Ambient Temperature MM912x634xMxxx MM912x634xVxxx TA -40 to 125 -40 to 105 Operating Junction Temperature - Analog Die T J_A -40 to 150 C Operating Junction Temperature - MCU Die T J_M -40 to 150 C

Table 10. Supply Currents

  1. Typical values noted reflect the approximate parameter mean at TA = 25 °C
  2. f BUSMAX frequency ratings differ by device and is specified in Table 1
  3. I RUN_M denotes the sum of the currents flowing into VDD and VDDX.
  4. I STOP_M denotes the sum of the currents flowing into VDD and VDDX.

Electrical Characteristics

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 16

3.5.1 Static Electrical Characteristics Analog Die

Table 11. Static Electrical Characteristics - Power Supply Table 12. Static Electrical Characteristics - Resets Table 13. Static Electrical Characteristics - Window Watchdog Table 14. Static Electrical Characteristics - Voltage Regulator 5.0 V (VDDX)

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 17 Load Regulation Normal Mode, 1.0 mA < IVDDX < 80 mA Normal Mode, VSUP = 3.6 V, 1.0 mA < I VDDX < 40 mA Stop Mode, 0.1 mA < IVDDX < 500 µA LDXRUN LDXCRK LDXSTOP 200 250 mV External Capacitor C VDDX 1.0 - 10 µF External Capacitor ESR C VDDX_R -- 1 0 O h m Table 15. Static Electrical Characteristics - Voltage Regulator 2.5 V (VDD) Table 16. Static Electrical Characteristics - Hall Sensor Supply Output - HSUP

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 18 Table 17. Static Electrical Characteristics - High Side Drivers - HS Table 18. Static Electrical Characteristics - Low Side Drivers - LS Table 19. Static Electrical Characteristics - LIN Physical Layer Interface - LIN

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 19 Table 20. Static Electrical Characteristics - High Voltage Inputs - Lx

  1. The ESD behavior specified in Section 3.8, “ESD Protection and Latch-up Immunity are guaranteed without the optional capacitor.

Table 21. Static Electrical Characteristics - General Purpose I/O - PTB[0…2]

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 20 Table 22. Static Electrical Characteristics - Analog Digital Converter - ADC(19)

5.5 V < VSUP < 27 V

  1. No external load allowed on the ADC2p5 pin.
  2. Reduced ADC frequency will lower measurement error.

Table 23. Static Electrical Characteristics - Current Sense Module - ISENSE

  1. RES = 2.44 mV/(GAIN*R SHUNT)

Table 24. Static Electrical Characteristics - Temperature Sensor - TSENSE

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 21

3.5.2 Static Electrical Characteristics MCU Die

3.5.2.1 I/O Characteristics

This section describes the characteristics of all I/O pins except EXTAL, XTAL, TEST and supply pins. Temperature represented by a ADCIN Voltage of 1.984 V(22) T1.984V 145 150 155 °C Note: 22. Guaranteed by design and characterization. Table 25. Static Electrical Characteristics - Supply Voltage Sense - VSENSE and VS1SENSE

  1. The ESD behavior specified in Section 3.8, “ESD Protection and Latch-up Immunity is guaranteed without the optional capacitor.

Table 26. 5.0 V I/O Characteristics for PTA, PTE, RESET and BKGD Pins

  1. Refer to Section 3.8, “ESD Protection and Latch-up Immunity” for more details.

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 22

3.5.2.2 Electrical Specification for MCU internal Voltage Regulator

The LVR monitors the voltages VDD_CORE, VDDFLASH and VDDRX. As soon as voltage drops on these supplies which would prohibit the correct function of the microcontroller, the LVR is triggering a reset.

3.5.2.3 Chip Power-up and Voltage Drops

LVI (low voltage interrupt), POR (power-on reset) and LVRs (low voltage reset) handle chip power-up or drops of the supply voltage. Figure 4. MC9S12I32 - Chip Power-up and Voltage Drops (not scaled) Table 27. IVREG Characteristics

  1. Device functionality is guaranteed on power down to the LVR assert level.
  2. Monitors VDDRX, active only in Full Performanc e mode. MCU is monitored by the POR in RPM (see Figure ).
  3. Monitors VDDRX, active only in Full Performance mode. V LVRA and VPORD.
  4. Monitors MCU_CORE_VDD . Active in all modes.

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 23

3.6 Dynamic Electrical Characteristics

Dynamic characteristics noted under conditions 5.5 V  VSUP  18 V, -40 °C  TA 125 °C, unless otherwise noted. Typical values noted reflect the approximate parameter mean at TA = 25 °C under nominal conditions, unless otherwise noted.

3.6.1 Dynamic Electrical Characteristics Analog Die

Table 28. Dynamic Electrical Characteristics - Modes of Operation Table 29. Dynamic Electrical Characteristics - Power Supply(29) Table 30. Dynamic Electrical Characteristics - Die to Die Interface - D2D

  1. f BUSMAX frequency ratings differ by device and is specified in Table 1

Table 31. Dynamic Electrical Characteristics - Resets Table 32. Dynamic Electrical Characteristics - Wake-up / Cyclic Sense

  1. No trimming possible in Sleep mode.

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 24 Table 33. Dynamic Electrical Characteristics - Window Watchdog Table 34. Dynamic Electrical Characteristics - High Side Drivers - HS Table 35. Dynamic Electrical Characteristics - Low Side Drivers - LS Table 36. Dynamic Electrical Characteristics - LIN Physical Layer Interface - LIN signal to LIN signal threshold defined at each parameter. See Figure 5 and Figure 6.

7.0 V VSUP18 V; tBit = 50 µs;

signal to LIN signal threshold defined at each parameter. See Figure 5 and Figure 8.

7.6 V VSUP18 V; tBIT = 50 µs

signal to LIN signal threshold defined at each parameter. See Figure 5 and Figure 7.

7.0 V VSUP18 V; tBIT = 96 µs

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 25 Figure 5. Test Circuit for Timing Measurements Figure 6. LIN Timing Measurements for Normal Baud Rate

7.6 V VSUP18 V; tBIT = 96 µs

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 27

3.6.2 Dynamic Electrical Characteristics MCU Die

3.6.2.1 NVM

3.6.2.1.1 Timing Parameters

The time base for all NVM program or erase operations is derived from the bus clock using the FCLKDIV register. The frequency of this derived clock must be set within the limits specified as fNVMOP. The NVM module does not have any means to monitor the frequency and will not prevent program or erase operations at frequencies above or below the specified minimum. When attempting to program or erase the NVM module at a lower frequency, a full program or erase transition is not assured. The following sections provide equations which can be used to determine the time required to execute specific flash commands. All timing parameters are a function of the bus clock frequency, fNVMBUS. All program and erase times are also a function of the NVM operating frequency, fNVMOP. A summary of key timing parameters can be found in Table . The time required to perform a blank check on all blocks is dependent on the location of the first non-blank word starting at relative address zero. It takes one bus cycle per phrase to verify plus a setup of the command. Assuming that no non-blank location is found, then the time to erase verify all blocks is given by: The time required to perform a blank check is dependent on the location of the first non-blank word starting at relative address zero. It takes one bus cycle per phrase to verify plus a setup of the command. Assuming that no non-blank location is found, then the time to erase verify a P-Flash block is given by: Assuming that no non-blank location is found, then the time to erase verify a D-Flash block is given by: Table 37. Dynamic Electrical Characteristics - General Purpose I/O - PTB[0…2] (34) Table 38. Dynamic Electrical Characteristics - Analog Digital Converter - ADC(36)

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 28 The maximum time to erase verify a section of P-Flash depends on the number of phrases being verified (NVP) and is given by: The maximum read once time is given by: The programming time for a single phrase of four P-Flash words and the two seven-bit ECC fields is dependent on the bus frequency, fNVMBUS, as well as on the NVM operating frequency, fNVMOP. The typical phrase programming time is given by: The maximum phrase programming time is given by: The maximum time required to program a P-Flash Program Once field is given by: The time required to erase all blocks is given by: The time required to erase the P-Flash block is given by: tdcheck 2800 1 fNVMBUS t 450 NVP+ 1 fNVMBUS t 400 1 fNVMBUS tppgm 164 1 fNVMOP fNVMBUS tppgm 164 1 fNVMOP fNVMBUS t 164 1 fNVMOP fNVMBUS tmass 100100 1 fNVMOP fNVMBUS tpmass 100100 1 fNVMOP fNVMBUS

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 29 The typical time to erase a 512-byte P-Flash sector is given by: The maximum time to erase a 512-byte P-Flash sector is given by: The maximum time required to erase and unsecure the Flash is given by: The maximum verify back door access key time is given by: The maximum set user margin level time is given by: The maximum set field margin level time is given by: The time required to Erase Verify D-Flash for a given number of words NW is given by: D-Flash programming time is dependent on the number of words being programmed and their location with respect to a row boundary, since programming across a row boundary requires extra steps. The D-Flash programming time is specified for different cases: 1,2,3,4 words and 4 words across a row boundary. The typical D-Flash programming time is given by the following equation, where NW denotes the number of words; BC=0 if no row boundary is crossed and BC=1 if a row boundary is crossed: tpera 20020 1 fNVMOP fNVMBUS tpera 20020 1 fNVMOP fNVMBUS tuns 100100 1 fNVMOP fNVMBUS t 400 1 fNVMBUS t 350 1 fNVMBUS t 350 1 fNVMBUS tdcheck 450 NW+ 1 fNVMBUS fNVMOP fNVMBUS +

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 30 The maximum D-Flash programming time is given by: Typical D-Flash sector erase times, expected on a new device where no margin verify fails occur, is given by: Maximum D-Flash sector erase times is given by: The D-Flash sector erase time is ~5.0 ms on a new device and can extend to ~20 ms as the flash is cycled.

3.6.2.1.2 NVM Reli ability Parameters

The reliability of the NVM blocks is guaranteed by stress test during qualification, constant process monitors, and burn-in to screen early life failures. The data retention and program/erase cycling failure rates are specified at the operating conditions noted. The program/erase cycle count on the sector is incremented every time a sector or mass erase event is executed. NOTE All values shown in Table 40 are preliminary and subject to further characterization. Table 39. NVM Timing Characteristics (FTMRC)

  1. Typical program and erase times are based on typical f NVMOP and maximum fNVMBUS.
  2. Maximum program and erase times are based on minimum f NVMOP and maximum fNVMBUS.
  3. The maximum device bus clo ck is specified as fBUS.
  4. Typical value for a new device.

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 31

3.6.2.2 Phase Locked Loop

3.6.2.2.1 Jitte r Definitions

With each transition of the feedback clock, the deviation from the reference clock is measured and input voltage to the VCO is adjusted accordingly.The adjustment is done continuously with no abrupt changes in the VCOCLK frequency. Noise, voltage, temperature, and other factors cause slight variations in the control loop resulting in a clock jitter. This jitter affects the real minimum and maximum clock periods, as illustrated in Figure 10. Figure 10. Jitter Definitions Table 40. NVM Reliability Characteristics

  1. T JAVG does not exceed 85 C in a typical temperature profile over the lifetime of a consumer, industrial or automotive application.
  2. Typical data retention values are based on intrinsic capability of the technology measured at high temperature and de-rated to 25 C
  3. Spec table quotes typical endurance evaluated at 25 C for this product family. For additional information on how Freescale defines

Typical Endurance, please refer to Engineering Bulletin EB619.

23 N - 1 N1

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 32 For N < 100, the following equation is a good fit for the maximum jitter: Figure 11. Maximum Bus Clock Jitter Approximation On timers and serial modules a prescaler will eliminate the effect of the jitter to a large extent.

3.6.2.2.2 Electri cal Characteristics for the PLL(45)

3.6.2.3 Electrical Characteristics for the IRC1M

Table 41. PLL Characteristics

  1. the maximum device bus cloc k is specified as fBUS.
  2. % deviation from target frequency.
  3. f REF = 1.0 MHz, fBUS = 32 MHz equivalent fPLL = 64 MHz, REFRQ=00, SYNDIV=$1F, VCOFRQ=01, POSTDIV=$00.

Table 42. IRC1M Characteristics

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 33

3.6.2.4 Electrical Characteristics for the Oscillator (OSCLCP)

3.6.2.5 Reset Characteristics

3.6.2.6 SPI Timing

This section provides electrical parametrics and ratings for the SPI. In Table 45 the measurement conditions are listed.

3.6.2.6.1 Master Mode

In Figure 12 the timing diagram for master mode with transmission format CPHA = 0 is depicted. Table 43. OSCLCP Characteristics

  1. These values apply for carefully designed PCB layouts with capacitors that match the crystal/resonator requirements.
  2. Only applies if EXTAL is externally driven.

Table 44. Reset and Stop Characteristics Table 45. Measurement Conditions

  1. Timing specified for equal load on all SP I output pins. Avoid asymmetric load.

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 35

3.6.2.6.2 Slave Mode

In Figure 14 the timing diagram for slave mode with transmission format CPHA = 0 is depicted. Figure 14. SPI Slave Timing (CPHA = 0) In Figure 15 the timing diagram for slave mode with transmission format CPHA = 1 is depicted. Table 46. SPI Master Mode Timing Characteristics

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 36 Figure 15. SPI Slave Timing (CPHA = 1) In Table 47 the timing characteristics for slave mode are listed.

3.7 Thermal Protection Characteristics

reflect the approximate parameter mean at TA = 25 °C under nominal conditions, unless otherwise noted. Table 47. SPI Slave Mode Timing Characteristics

  1. 0.5 t BUS added due to internal synchronization delay

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 37

3.8 ESD Protection a nd Latch-up Immunity

All ESD testing is in conformity with CDF-AEC-Q100 stress test qualification for automotive grade integrated circuits. During the device qualification, ESD stresses were performed for the Human Body Model (HBM), Machine Model (MM), Charge Device Model (CDM), as well as LIN transceiver specific specifications. A device will be defined as a failure if after exposure to ESD pulses, the device no longer meets the device specification. Complete DC parametric and functional testing is performed per the applicable device specification at room temperature, followed by hot temperature, unless specified otherwise in the device specification. Table 48. Thermal Characteristics - Voltage Regulators VDD (2.5 V) & VDDX (5.0 V)(52)

  1. Guaranteed by characteriza tion. Functionality tested.

Table 49. ESD and Latch-up Protection Characteristics discharge, CZAP= 150 pF, RZAP = 330 .

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 38 ESD GUN - following IEC 61000-4-2 Test Specification(56), unpowered, contact discharge, CZAP= 150 pF, RZAP = 330  - LIN (with or without bus filter CBUS=220 pF) - VSENSE with serial RVSENSE (54) - VS1, VS2 with CVS - Lx with serial RLX ±8000 ±8000 ±8000 ±8000 V ESD GUN - following ISO10605 Test Specification(56), unpowered, contact discharge, CZAP= 150 pF, RZAP =2 . 0k - LIN (with or without bus filter CBUS=220pF) - VSENSE with serial RVSENSE (54) - VS1, VS2 with CVS - Lx with serial RLX ±6000 ±6000 ±6000 ±6000 V ESD GUN - following ISO10605 Test Specification (56), powered, contact discharge, CZAP= 330 pF, RZAP =2 . 0k - LIN (with or without bus filter CBUS=220 pF) - VSENSE with serial RVSENSE (54) - VS1, VS2 with CVS - Lx with serial RLX ±8000 ±8000 ±8000 ±8000 V Note: 53. Input Voltage Limit = -2.5 to 7.5 V. 54. With C VBAT (10…100 nF) as part of the battery path. 55. Certification available on request 56. Tested internally only; certification pending Table 49. ESD and Latch-up Protection Characteristics (continued)

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 39

3.9 Additional Test In formation ISO7637-2

Immunity against transients for the LIN, Lx, and VBAT, is specified according to the LIN Conformance Test Specification - Section LIN EMC Test Specification refer to the LIN Conformance Test Certification Report - available as separate document.

4 Functional Description and Application Information

4.1 Introduction

Die Overview through Section 4.26, “MM912_634 - Analog Die Trimming.

  • MCU Die Overview through Section 4.39, “Serial Peripheral Interface (S12SPIV5).

Sections concerning both dies or the complete device will not have a specific indication.

4.2 Device Register Maps

Table 50 shows the device register memory map overview for the 64 kByte MCU die (MC9S12I64). Table 50. Device Register Memory Map Overview

4.2.1 Detailed Module Register Maps

Table 51 to Table 73 show the detailed module maps of the MC9S12I64 MCU die. Table 51. 0x0000–0x0007 Port Integration Module (PIM) Map 1 of 3 Table 52. 0x000A–0x000B Memory Map Control (MMC) Map 1 of 2 Table 53. 0x000C–0x000D Port Integration Module (PIM) Map 2 of 3 Table 54. 0x000E–0x000F Reserved Table 55. 0x0010–0x001B Memory Map Control (MMC) Map 2 of 2

Table 56. 0x0016–0x0019 Reserved Table 57. 0x001A–0x001B Device ID Register (PARTIDH/PARTIDL) Table 58. 0x001C–0x001E Reserved Table 59. 0x001F Interrupt Module (INT) Table 60. 0x0020–0x002F Debug Module (DBG)

Table 61. 0x0030–0x033 Reserved Table 62. 0x0034–0x003F Clock and Power Management (CPMU) Map 1 of 2

Table 63. 0x0040–0x0D7 Reserved Table 64. 0x00D8–0x00DF Die 2 Die Initiator (D2DI) Map 1 of 3

Table 65. 0x00E0–0x0E7 Reserved Table 66. 0x00E8–0x00EF Serial Peripheral Interface (SPI) Table 67. 0x00F0–0x0FF Reserved

Table 68. 0x0100–0x011F Flash Module (FTMRC)

Table 69. 0x0120 Port Integration Module (PIM) Map 3 of 3 Table 70. 0x0180–0x1EF Reserved Table 71. 0x01F0–0x01FF Clock and Power Management (CPMU) Map 2 of 2 Table 72. 0x01FD–0x1FF Reserved Table 73. 0x0200–0x03FF Die-To-Die Initiator Blocking and Non-Blocking Access Window

Table 74 shows the detailed module maps of the MM912_634 analog die. Table 74. Analog die Registers(57) - 0x0200–0x02FF D2D Blocking Access (D2DI) 2 of 3/

0 CTR3_E CTR3_2 CTR3_1 CTR3_0

  1. Registers not shown are reserved and must not be accessed.

4.3 MM912_634 - Analog Die Overview

4.3.1 Introduction

and delivers application specific actuator control as well as input capturing.

4.3.2 System Registers

4.3.2.1 Silicon Revision Register (SRR)

4.3.3 Analog Die Options

The following section describes the differences between analog die options 1 and 2.

4.3.3.1 Current Sense Module

For device options with the current sense module not available, the following considerations are to be made. Table 75. Silicon Revision Register (SRR)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 76. SRR - Register Field Descriptions mask change. Read only, writing will have no effect. The first Full Mask will have the count 00. tweaks applied to the full mask.Read only, writing will have no effect. The first Full Mask will have the count 00. Table 77. Analog Die Options

4.3.3.1.1 Pinout considerations

4.3.3.1.2 Register Considerations

The Current Sense Register must remain in default (0x00) state. The Conversion Control Register - Bit 9 must always be written 0. The Conversion Complete Register - Bit 9 must be ignored. The ADC Data Result Reg 9 must be ignored.

4.3.3.1.3 Functional Considerations

  • The complete Current Sense Module is not available.
  • The ADC Channel 9 is not available.

4.3.3.2 Wake-up Inputs (Lx)

For device options with reduced number of wake up inputs (Lx), the following considerations are to be made.

4.3.3.2.1 Pinout considerations

4.3.3.2.2 Register Considerations

The Lx - Bit for the not available Lx input in the Lx Status Register must be ignored. Table 78. ISENSE - Pin Considerations Table 79. Lx - Pin Considerations

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 56 The Lx Control register for the not available Lx input must be written 0. A not available Lx input can not be selected as Wake-up Source and must have its LxWE bit set to 0. The Wake-up Source Register for not available Lx inputs must be ignored. The Conversion Control Register for the not available Lx analog input (3…8) must always be written 0. The Conversion Complete Register for the not available Lx analog input (3.8) must be ignored. The ADC Data Result Register for the not available Lx analog input (3.8) must be ignored.

4.3.3.2.3 Functional Considerations

For the not available Lx inputs, the following functions are limited:

  • No Wake-up feature / Cyclic Sense
  • No Digital Input
  • No Analog Input and conversion via ADC O f f s e t N a m e 76543210 0x08 LXR R 0 0 L5 L4 L3 L2 L1 L0 Lx Status Register W 0x09 LXCR R 0 0 L5DS L4DS L3DS L2DS L1DS L0DS Lx Control Register W 0x12 WCR R CSSEL L5WE L4WE L3WE L2WE L1WE L0WE Wake Up Control Register W 0x14 WSR R FWU LINWU L5WU L4WU L3WU L2WU L1WU L0WU Wake Up Source Register W 0x82 ACCR (hi) R CH15 CH14 CH12 CH11 CH10 CH9 CH8 ADC Conversion Ctrl Reg W 0x83 ACCR (lo) R CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0 ADC Conversion Ctrl Reg W 0x84 ACCSR (hi) R CC15 CC14 0 CC12 CC11 CC10 CC9 CC8 ADC Conv Complete Reg W 0x85 ACCSR (lo) R CC7 CC6 CC5 CC4 CC3 CC2 CC1 CC0 ADC Conv Complete Reg W 0x8C-0 x97 ADRx (hi) R adrx 9 adrx 8 adrx 7 adrx 6 adrx 5 adrx 4 adrx 3 adrx 2 ADC Data Result Register x W ADRx (lo) R adrx 1 adrx 0 0 0 0 0 0 0 ADC Data Result Register x W

4.4 Modes of Operation

mode both voltage regulators are turned off (VDD =V DDX =0V ) . into reset mode while the voltage regulator is turned back on. The selection of the different modes is controlled by the Mode Control Register (MCR). Figure 16 describes how transitions are done between the different operating modes. Figure 16. Modes of Operation and Transitions

4.4.1 Power Down Mode

MM912_634 analog die will enter Reset mode with the condition “Power On Reset - POR”.

4.4.2 Reset Mode

Low Voltage VDDX Reset - LVRX, WDR - Watchdog Reset, EXR - External Reset, and WUR - Wake-up Sleep Reset). VLVRX with VS1 > (VLVI + VLVI_H) for more than tVTO, the MM912_634 analog die will transit directly to Sleep mode.

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 58 The Reset Status Register (RSR) will indicate the source of the reset by individual flags.

  • POR - Power On Reset
  • LVR - Low Voltage Reset VDD
  • LVRX - Low Voltage Reset VDDX
  • WDR - Watchdog Reset
  • EXR - External Reset
  • WUR - Wake-up Sleep Reset See also Section 4.8, “Resets.

4.4.3 Normal Mode

In Normal mode, all MM912_634 analog die user functions are active and can be controlled by the D2D Interface. Both regulators (VDD and VDDX) are active and operate with full current capability. Once entered in Normal mode, the Watchdog will operate as a simple non-window watchdog with an initial timeout (tIWDTO) to be reset via the D2D Interface. After the initial reset, the watchdog will operate in standard window mode. See Section 4.10, “Window Watchdog for details.

4.4.4 Stop Mode

The Stop mode will allow reduced current consumption with fast startup time. In this mode, both voltage regulators (VDD and VDDX) are active, with limited current drive capability. In this condition, the MCU is supposed to operate in Low Power mode (STOP). NOTE To avoid any pending analog die interrupts prevent the MCU from entering MCU stop resulting in unexpected system behavior, the analog die IRQ sources should be disabled and the corresponding flags be cleared before entering stop. The device can enter in Stop mode by configuring the Mode Control Register (MCR) via the D2D Interface. The MCU has to enter a Low Power mode immediately afterwards executing the STOP instruction. The Wake-up Source Register (WSR) has to be read after a wake-up condition in order to execute a new STOP mode command. Two base clock cycles (fBASE) delay are required between WSR read and MCR write. While in Stop mode, the MM912_634 analog die will wake up on the following sources:

  • Lx - Wake-up (maskable with selectable cyclic sense)
  • Forced Wake-up (configurable timeout)
  • LIN Wake-up
  • D2D Wake-up (special command) After Wake-up from the sources listed above, the device will transit to Normal mode. Reset will wake up the device directly to Reset mode. See Section 4.9, “Wake-up / Cyclic Sense for details.

4.4.5 Sleep Mode

The Sleep mode will allow very low current consumption. In this mode, both voltage regulators (VDD and VDDX) are inactive. The device can enter into Sleep mode by configuring the Mode Control Register (MCR) via the D2D- Interface. During Sleep mode, all unused internal blocks are deactivated to allow the lowest possible consumption. Power consumption will decrease further if the Cyclic Sense or Forced Wake-up feature are disabled. While in Sleep mode, the MM912_634 analog die will wake up on the following sources:

  • Lx - Wake-up (maskable with selectable cyclic sense)
  • Forced Wake-up (configurable timeout)
  • LIN Wake-up After Wake-up from the sources listed above or a reset condition, the device will transit to Reset mode. See Section 4.9, “Wake-up / Cyclic Sense for details.

4.4.6 Analog Die Functionality by Operation Mode

4.4.7 Register Definition

4.4.7.1 Mode Control Register (MCR)

Table 80. Operation Mode Overview

  1. Special init through non window watchdog.

Table 81. Mode Control Register (MCR)

  1. Offset related to 0x0200 for blocking access and 0x3 00 for non blocking access within the global address space.

Table 82. MCR - Register Field Descriptions Mode Select - These bits will issue a transition from to the selected Operating Mode. 00 - Normal Mode. Only with effect in Stop Mode. Will issue Wake Up and transition to Normal Mode. 10 - Sleep Mode. Will initiate transition to Sleep Mode.

  1. The Wake-up Source Register (WSR) has to be read after a wake-up condition in order to execute a new STOP mode command. Two

base clock cycles (fBASE) delay are required between WSR read and MCR write.

4.5 Power Supply

regulated supply. See Section 4.11, “Hall Sensor Supply Output - HSUP. ADC (VS1SENSE) to measure the VS1 pin voltage directly. See Section 4.24, “Internal Supply Voltage Sense - VS1SENSE. reference. See Section 4.25, “Internal Bandgap Reference Voltage Sense - BANDGAP. Section 4.20, “Analog Digital Converter - ADC.

  • LBI - Low Battery Interrupt, internally measured at VSENSE
  • LVI - Low Voltage Interrupt, internally measured at VS1
  • HVI - High Voltage Interrupt, internally measured at VS2
  • VROVI - Voltage Regulator Over-voltage Interrupt internally measured at VDD and VDDX
  • LVR - Low Voltage Reset, internally measured at VDD
  • LVRX - Low Voltage Reset, internally measured at VDDX
  • HTI - High Temperature Interrupt measured between the VDD and VDDX regulators
  • Over-temperature Shutdown measured between the VDD and VDDX regulators

Figure 17. MM912_634 Power Supply

VDD (2.5 V). External capacitors (CVDD) and (CVDDX) are required for proper regulation.

4.5.2 Power Up Behavior / Power Down Behavior - I64

To guarantee safe power up and down behavior, special dependencies are implemented to prevent unwanted MCU execution. Figure 18 shows a standard power up and power down sequence. Figure 18. Power Up / Down Sequence VDDX is to low to guarantee RESET_A active (3;6). This is achieved with the following implementation.

  • The VDD regulator is enabled after VDDX has reached the V LVRX threshold (1).
  • Once VDD reaches V LRV, the RESET_A is released (2).
  • The MCU is also protected by the MCU_LVR. Power Down:
  • Once VDDX has reached the V LVRX threshold (4), the VDD regulator is disabled and the regulator output is actively pulled down to discharge any VDD capacitance (5). RESET_A is activated as well.
  • The active discharge guarantees VDD to be below POR level before VDDX discharges below critical level for the reset circuity. NOTE The behavior explained previously is essential for the MC9S12I64 MCU die used, as this MCU does have an internal regulator stage, but the LVR function only active in normal modeMC9S12I64. The shutdown behavior should be considered when sizing the external capacitors CVDD and CVDDX for extended low voltage operation. MCU_POR VLBI / VLVI Normal Operating Range (not to scale) VLVRX VLVR VPOR_A RESET_A VDDX VDDVSUP VPOR_MCU VROVX VROX 1 4 / VLVR_MCU MCU_LVR MCU_LVR MCU_POR

4.5.3 Register Definition

4.5.3.1 Voltage Control Register (VCR)

4.5.3.2 Voltage Status Register (VSR)

Table 83. Voltage Control Register (VCR)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 84. VCR - Register Field Descriptions Voltage Regulator Over-voltage Interrupt Enable — Enables the interrupt for the Regulator Over-voltage Condition. High Temperature Interrupt Enable — Enables the interrupt for the Voltage Regulator (VDD/VDDX) Temperature Warning. High Voltage Interrupt Enable — Enables the interrupt for the VS2 - High Voltage Warning. Low Voltage Interrupt Enable — Enables the interrupt for the VS1 - Low Voltage Warning. Low Battery Interrupt Enable — Enables the interrupt for the VSENSE - Low Battery Voltage Warning. Table 85. Voltage Status Register (VSR)

  1. Offset related to 0x0200 for blocking access and 0x300 fo r non blocking access within the global address space.

Table 86. VSR - Register Field Descriptions 0 - No Voltage Regulator Over-voltage Condition present. 1 - Voltage Regulator Over-voltage Condition present. (VDD/VDDX). Reading the register will clear the HTI flag if present. See Section 4.7, “Interrupts for details. 0 - No High Temperature Condition present. 1 - High Temperature Condition present. HVI flag if present. See Section 4.7, “Interrupts for details. 0 - No High Voltage Condition present. 1 - High Voltage Condition present. LVI flag if present. See Section 4.7, “Interrupts for details. 0 - No Low Voltage Condition present. 1 - Low Voltage Condition present. the LBI flag if present. See Section 4.7, “Interrupts for details. 0 - No Low Battery Condition present. 1 - Low Battery Condition present.

Die to Die Interface - Target MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 64

4.6 Die to Die Interface - Target

The D2D Interface is the bus interface to the Microcontroller. Access to the MM912_634 analog die is controlled by the D2D Interface module. This section describes the functionality of the die-to-die target block (D2D).

4.6.1 Overview

The D2D is the target for a data transfer from the target to the initiator (MCU). The initiator provides a set of configuration registers and two memory mapped 256 Byte address windows. When writing to a window, a transaction is initiated sending a write command, followed by an 8-bit address, and the data byte or word is received from the initiator. When reading from a window, a transaction is received with the read command, followed by an 8-bit address. The target then responds with the data. The basic idea is that a peripheral located on the MM912_634 analog die, can be addressed like an on-chip peripheral. Features:

  • software transparent register access to peripherals on the MM912_634 analog die
  • 256 Byte address window
  • supports blocking read or write, as well as non-blocking write transactions
  • 4-bit physical bus width
  • automatic synchronization of the target when initiator starts driving the interface clock
  • generates transaction and error status as well as EOT acknowledge
  • providing single interrupt interface to D2D Initiator

4.6.2 Low Power Mode Operation

The D2D module is disabled in SLEEP mode. In Stop mode, the D2DINT signal is used to wake-up a powered down MCU. As the MCU could wake-up without the MM912_634 analog die, a special command will be recognized as a wake-up event during Stop mode. See Section 4.4, “Modes of Operation.

4.6.2.1 Normal Mode / Stop Mode

While in Normal or Stop mode, D2DCLK acts as input only with pull present. D2D[3:0] operates as an input/output with pull-down always present. D2DINT acts as output only. NOTE The maximum allowed clock speed of the interface is limited to fD2D.

4.6.2.2 Sleep Mode

While in Sleep mode, all Interface data pins are pulled down to DGND to reduce power consumption. ANALOGMCU

4.7 Interrupts

4.7.1 Interrupt Source Identification

Once an Interrupt is signalized, there are two options to identify the corresponding source(s).

4.7.1.1 Interrupt Source Mirror

access is necessary to serve the specific module. identified by reading the Voltage Status Register - VSR.

4.7.1.1.1 Interrupt Source Register (ISR)

Table 87. Interrupt Source Register (ISR)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 88. ISR - Register Field Descriptions

  • Low Battery Interrupt
  • Low Voltage Interrupt
  • High Voltage Interrupt
  • Voltage Regulator Over-voltage Interrupt
  • Voltage Regulator High Temperature Interrupt 1 - CH0 CH0 - TIM Channel 0 Interrupt 2 - CH1 CH1 - TIM Channel 1 Interrupt 3 - CH2 CH2 - TIM Channel 2 Interrupt 4 - CH3 CH3 - TIM Channel 3 Interrupt 5 - TOV TOV - Timer Overflow Interrupt 6 - ERR ERR - SCI Error Interrupt 7 - TX TX - SCI Transmit Interrupt 8 - RX RX - SCI Receive Interrupt 9 - SCI SCI - ADC Sequence Complete Interrupt 10 - LINOT LINOT - LIN Driver Over-temperature Interrupt 11 - HSOT HSOT - High Side Over-temperature Interrupt 12 - LSOT LSOT - Low Side Over-temperature Interrupt 13 - HOT HOT - HSUP Over-temperature Interrupt ANALOGMCU

4.7.1.2 Interrupt Vector Emulation by Priority

not acknowledge an interrupt. An additional D2D access is necessary to serve the specific module.

4.7.1.2.1 Interrupt Vector Register (IVR)

The following table is listing all MM912_634 analog die interrupt sources with the corresponding priority.

4.7.2 Interrupt Sources

4.7.2.1 Voltage Status Interrupt (VSI)

Table 89. Interrupt Vector Register (IVR)

  1. Offset related to 0x0200 for bloc king access and 0x300 for non blocking access within the global address space.

Table 90. IVR - Register Field Descriptions Represents the highest prioritized interrupt pending. See Table 91 In case no interrupt is pending, the result will be 0. Table 91. Interrupt Source Priority

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 67 interrupt, the condition has to vanish and occur again. See Section 4.5, “Power Supply for details on the Voltage Status Register including masking information.

4.7.2.2 Low Voltage Interrupt (LVI)

Acknowledge the interrupt by reading the Voltage Status Register - VSR. To issue a new interrupt, the condition has to vanish and occur again. See Section 4.5, “Power Supply for details on the Voltage Status Register including masking information.

4.7.2.3 Voltage Regulator High Temperature Interrupt (HTI)

Acknowledge the interrupt by reading the Voltage Status Register - VSR. To issue a new interrupt, the condition has to vanish and occur again. See Section 4.5, “Power Supply for details on the Voltage Status Register including masking information.

4.7.2.4 Low Battery Interrupt (LBI)

Acknowledge the interrupt by reading the Voltage Status Register - VSR. To issue a new interrupt, the condition has to vanish and occur again. See Section 4.5, “Power Supply for details on the Voltage Status Register including masking information.

4.7.2.5 TIM Channel 0 Interrupt (CH0)

See Section 4.19, “Basic Timer Module - TIM (TIM16B4C).

4.7.2.6 TIM Channel 1 Interrupt (CH1)

See Section 4.19, “Basic Timer Module - TIM (TIM16B4C).

4.7.2.7 TIM Channel 2 Interrupt (CH2)

See Section 4.19, “Basic Timer Module - TIM (TIM16B4C).

4.7.2.8 TIM Channel 3 Interrupt (CH3)

See Section 4.19, “Basic Timer Module - TIM (TIM16B4C).

4.7.2.9 TIM Timer Over flow Interrupt (TOV)

See Section 4.19, “Basic Timer Module - TIM (TIM16B4C).

4.7.2.10 SCI Error Interrupt (ERR)

See Section 4.16, “Serial Communication Interface (S08SCIV4).

4.7.2.11 SCI Transmit Interrupt (TX)

See Section 4.16, “Serial Communication Interface (S08SCIV4).

4.7.2.12 SCI Receive Interrupt (RX)

See Section 4.16, “Serial Communication Interface (S08SCIV4).

4.7.2.13 LIN Driver Over-temperature Interrupt (LINOT)

Acknowledge the interrupt by reading the LIN Register - LINR. To issue a new interrupt, the condition has to vanish and occur again. See Section 4.15, “LIN Physical Layer Interface - LIN for details on the LIN Register including masking information.

4.7.2.14 High Side Over-temperature Interrupt (HSOT)

Acknowledge the interrupt by reading the High Side Status Register - HSSR. To issue a new interrupt, the condition has to vanish and occur again. See Section 4.12, “High Side Drivers - HS for details on the High Side Status Register including masking information.

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 68

4.7.2.15 Low Side Over-temperature Interrupt (LSOT)

Acknowledge the interrupt by reading the Low Side Status Register - LSSR. To issue a new interrupt, the condition has to vanish and occur again. See Section 4.13, “Low Side Drivers - LSx for details on the Low Side Status Register including masking information.

4.7.2.16 HSUP Over-temperature Interrupt (HOT)

Acknowledge the interrupt by reading the Hall Supply Register - HSR. To issue a new interrupt, the condition has to vanish and occur again. See Section 4.11, “Hall Sensor Supply Output - HSUP for details on the Hall Supply Register including masking information.

4.7.2.17 High Voltage Interrupt (HVI)

Acknowledge the interrupt by reading the Voltage Status Register - VSR. To issue a new interrupt, the condition has to vanish and occur again. See Section 4.5, “Power Supply for details on the Voltage Status Register including masking information.

4.7.2.18 Voltage Regulator Over-voltage Interrupt (VROVI)

Acknowledge the interrupt by reading the Voltage Status Register - VSR. To issue a new interrupt, the condition has to vanish and occur again. See Section 4.5, “Power Supply for details on the Voltage Status Register including masking information.

4.8 Resets

MCU, the RESET_A pin is based on the VDDX voltage level. registers with valid information are the Reset Status Register (RSR) and the Wake-up Source Register (WUS).

4.8.1 Reset Sources

In the MM912_634 six reset sources exist.

4.8.1.1 POR - Analog Die Power On Reset

is set. See Section 4.4, “Modes of Operation.

4.8.1.2 LVR - Low Voltage Reset - VDD

VDDX regulator. See Section 4.5, “Power Supply.

4.8.1.3 LVRX - Low Voltage Reset - VDDX

4.8.1.4 WUR - Wake-up Reset

determine the wake-up source, refer to Section 4.9, “Wake-up / Cyclic Sense.

4.8.1.5 EXR - External Reset

4.8.1.6 WDR - Watchdog Reset

“Window Watchdog for details.

4.8.2 Register Definition

4.8.2.1 Reset Status Register (RSR)

Table 92. Reset Status Register (RSR)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 93. RSR - Register Field Descriptions 5 - WDR Watchdog Reset - Reset caused by an incorrect serving of the watchdog. 4 - EXR External Reset - Reset caused by the RESET_A pin driven low externally for > tRSTDF. 2 - LVRX Low Voltage Reset VDDX - Reset caused by a low voltage condition monitored at the VDDX output. 0 - POR Power On Reset - Supply Voltage was below V POR.

  1. As the VDD Regulator is shutdown once a LVRX condition is detected, The actual cause could be also a low voltage condition at the

4.9 Wake-up / Cyclic Sense

command. Two base clock cycles (fBASE) delay are required between the WSR read and MCR write.

  • Wake-up by a state change of one of the Lx inputs
  • Wake-up by a state change of one of the Lx inputs during a cyclic sense
  • Wake-up due to a forced wake-up
  • Wake-up by the LIN module
  • Wake-up by D2D interface (Stop mode only)
  • Wake-up due to internal / external Reset (Stop mode only)
  • Wake-up due to loss of supply voltage (Sleep mode only)

Figure 19. Wake-up Sources

4.9.1 Wake-up Sources

4.9.1.1 Lx - Wake-up (Cyclic Sense Disabled)

low power mode. The Lx - Wake-up may be combined with the Forced Wake-up. Note: Selecting a Lx Input for wake-up will disable a selected analog input once entering low power mode.

4.9.1.2 Lx - Cyclic Sense Wake-up

both (forced and Lx change) events are present at the same time, the Forced Wake-up will be indicated as Wake-up source. cyclic sense event to the next. during STOP mode. There is no trimmed clock available during SLEEP mode.

4.9.1.3 Forced Wake-up

4.9.1.4 LIN - Wake-up

short-to-ground bus condition.

4.9.1.5 D2D - Wake-up (Stop Mode only)

stop mode. As this condition is controlled by the MCU, no wake-up status bit does indicate this wake-up source.

4.9.1.6 Wake-up Due to Internal / External Reset (STOP Mode Only)

4.9.1.7 Wake-up Due to Loss of Supply Voltage (SLEEP Mode Only)

While in Sleep mode, a supply voltage VS1 < VPOR will result in a transition to Power On mode.

4.9.2 Register Definition

4.9.2.1 Wake-up Control Register (WCR)

Table 94. Wake-up Control Register (WCR)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 95. WCR - Register Field Descriptions 11 - Cyclic Sense with periodic HS1 and HS2 on. Wake-up Input 5 Enabled - L5 Wake-up Select Bit. Wake-up Input 4 Enabled - L4 Wake-up Select Bit.

4.9.2.2 Timing Control Register (TCR)

Wake-up Input 3 Enabled - L3 Wake-up Select Bit. Wake-up Input 2 Enabled - L2 Wake-up Select Bit. Wake-up Input 1 Enabled - L1 Wake-up Select Bit. Wake-up Input 0 Enabled - L0 Wake-up Select Bit. Table 96. Timing Control Register (TCR)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

4.9.2.3 Wake-up Source Register (WSR)

Table 97. TCR - Register Field Descriptions parallel with the cyclic sense period <= the forced wake-up period.

  1. Cyclic Sense Timing wi th Accuracy CSAC and CSACT.

Table 98. Wake-up Source Register (WSR)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 99. WSR - Register Field Descriptions

required between the WSR read and the MCR write.

4.10 Window Watchdog

During Low Power mode, the watchdog feature is not active, a D2D read during Stop mode will have the WDOFF bit set. after the RESET_A has been released has to be 0xAA. The next one must be 0x55. After the RESET_A has been released, there will be a standard (non-window) watchdog active with a fixed timeout of tIWDTO. “MM912_634 - Analog Die Trimming. Figure 20. MM912_634 Analog Die Watchdog Operation (WDSR) before tIWDTO is reached. indicate the current status of the window. A timeout or wrong value written to the WDSR will force a watchdog reset. For debug purpose, the watchdog can be completely disabled by applying VTST to the TCLK pin while TEST_A is grounded. watchdog is re-enabled, the initial watchdog sequence has to be performed. During Low Power mode, the Watchdog clock is halted and the Watchdog Service Register (WDSR) is reset to the default state.

4.10.1 Register Definition

4.10.1.1 Watchdog Register (WDR)

Table 100. Watchdog Register (WDR)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

4.10.1.2 Watchdog Service Register (WDSR)

Table 101. WDR - Register Field Descriptions 7 - WDOFF Watchdog Off - Indicating the Watc hdog module is being disabled externally. 6 - WDWO Watchdog Window Open - Indicating the Watc hdog Window is currently open for counter reset. Watchdog Timeout Configuration - configuring the Watchdog timeout duration tWDTO. Table 102. Watchdog Service Register (WDSR)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 103. WDSR - Register Field Descriptions will reset the watchdog counter. Writing the register while the watchdog is disabled will have no effect.

4.11 Hall Sensor S upply Output - HSUP

to the VS1 supply input. For protection, an Over-temperature Shutdown and a Current Limitation is implemented. The HSUP output is active only during Normal mode. A capacitor CHSUP is recommended for operation.

4.11.1 Register Definition

4.11.1.1 Hall Supply Register (HSR)

Table 104. Hall Supply Register (HSR)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 105. HSR - Register Field Descriptions clear the HOT flag if present. See Section 4.7, “Interrupts for details.

4.12 High Side Drivers - HS

  • PWM capability via the PWM Module
  • Open load detection
  • Current limitation
  • Over-temperature shutdown (with maskable interrupt)
  • High voltage shutdown - HVI (software maskable)
  • Cyclic-Sense, See Section 4.9, “Wake-up / Cyclic Sense

4.12.1 Open Load Detection

Each high side driver signals an open load condition if the current through the high side is below the open load current threshold. The open load condition is indicated with the bits HS1OL and HS2OL in the High Side Status Register (HSSR).

4.12.2 Current Limitation

are protected against over-current and short-circuit failures.

4.12.3 Over-temperature Protection (HS Interrupt)

A thermal shutdown of the high side drivers is indicated by setting the HSOT bit in the High Side Status Register (HSSR).

4.12.4 High Voltage Shutdown

condition is gone, will re-enable the high side drivers.

4.12.5 Sleep And Stop Mode

4.12.6 PWM Capability

4.12.7 Register Definition

4.12.7.1 High Side Control Register (HSCR)

Table 106. High Side Control Register (HSCR)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

4.12.7.2 High Side Status Register (HSSR)

Table 107. HSCR - Register Field Descriptions present. See Section 4.5, “Power Supply for the Voltage Status Register. Table 108. High Side Status Register (HSSR)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 109. HSSR - Register Field Descriptions interrupt flag if present. See Section 4.7, “Interrupts for details.

4.13 Low Side Drivers - LSx

4.13.1 Introduction / Features

  • PWM capability
  • Open load detection
  • Current limitation
  • Over-temperature shutdown (with maskable interrupt)
  • Active clamp
  • Independent VREG - High Voltage Shutdown

4.13.1.1 Block Diagram

The following Figure shows the basic structure of the LS drivers. Figure 21. Low Side Drivers - Block Diagram

4.13.1.2 Modes of Operation

The Low Side module is active only in Normal mode; the Low Side drivers are disabled in Sleep and Stop mode.

4.13.2 External Signal Description

This section lists and describes the signals that do connect off-chip. Table 110 shows all the pins and their functions that are controlled by the Low Side module. Table 110. Pin Functions and Priorities

4.13.3 Memory Map and Registers

4.13.3.1 Module Memory Map

4.13.3.2 Register Descriptions

4.13.3.2.1 Low Side Co ntrol Register (LSCR)

Table 111. Low Side Module - Memory Map Table 112. Low Side Control Register (LSCR)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 113. LSCR - Register Field Descriptions

4.13.3.2.2 Low Side Status Register (LSSR)

4.13.3.2.3 Low Side Control Enable Register (LSCEN)

4.13.4 Functional Description

Sides, the LSCEN register has to be correctly written once after RESET or VROV. To protect the device against over-voltage when an inductive load (relay) is turned off an active clamp circuit is implemented.

4.13.4.1 Voltage Regulator Over-voltage Protection

Side Drivers will automatically shut down in case of an over-voltage on one of the two regulators. due to the over-voltage condition. Table 114. Low Side Status Register (LSSR)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 115. LSSR - Register Field Descriptions flag if present. See Section 4.7, “Interrupts for details. Table 116. Low Side Enable Register (LSEN)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 117. LSEN - Register Field Descriptions Low Side Control Enable - To allow the LS Control via LSx, the correct value has to be written into the LSCEN Register.

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 84 Once an over-voltage condition on one of the voltage regulators occurs, the LSx control bits in the Low Side Control Register (LSCR) will be reset to 0. The Voltage Regulator Over-voltage Condition Bit (VROVC) in the Voltage Status Register (VSR) will stay set as long as the condition is present. If the Voltage Regulator Over-voltage Interrupt was enabled (VROVIE=1), the VROV- Interrupt will be issued. Reading the Voltage Regulator Over-voltage Condition Bit (VROVC) in the Voltage Status Register (VSR) will clear the interrupt. To issue another VROV - Interrupt, the condition has to vanish and be present again. To re-enable the Low Side Drivers after a Voltage Regulator Over-voltage condition occurred, first the LSCEN register has to be written with “0x05” - this information is processed through the main digital blocks, and would secure a minimum functionality before enabling the LS drivers again. In a second step, the LSx Control Bits in the Low Side Control Register (LSCR) must be enabled again after the over-voltage condition has vanished (VROVC=0). NOTE The over-voltage threshold has to be trimmed at system power up. Please refer to and may have disabled the LS function already. An initial LS enable would be needed.

4.13.4.2 Open Load Detection

Each Low Side driver signals an open load condition if the current through the Low Side is below the open load current threshold. The open load condition is indicated with the bit LS1OP and LS2OP in the Low Side Status Register (LSSR).

4.13.4.3 Current Limitation

Each Low Side driver has a current limitation. In combination with the over-temperature shutdown, the Low Side drivers are protected against over-current and short-circuit failures. The driver operates in current limitation, and is indicated with the bits LS1CL and LS2CL in the Low Side Status Register (LSSR). Note: If the drivers is operating in current limitation mode excessive power might be dissipated.

4.13.4.4 Over-temperature Protection (LS Interrupt)

Both Low Side drivers are protected against over-temperature. In case of an over-temperature condition, both Low Side drivers are shut down and the event is latched in the Interrupt Control Module. The shutdown is indicated as LS Interrupt in the Interrupt Source Register (ISR). If the bit LSM is set in the Interrupt Mask Register (IMR) than an Interrupt (IRQ) is generated. A write to the Low Side Control Register (LSCR) will re-enable the Low Side drivers when the over-temperature condition is gone.

4.13.5 PWM Capability

See Section 4.14, “PWM Control Module (PWM8B2C).

4.14 PWM Control Module (PWM8B2C)

4.14.1 Introduction

two channels with independent controls of left and center aligned outputs on each channel. continuous waveforms with software-selectable duty rates from 0% to 100%.

4.14.1.1 Features

  • Two independent PWM channels with programmable periods and duty cycles
  • Dedicated counter for each PWM channel
  • Programmable PWM enable/disable for each channel
  • Software selection of PWM duty pulse polarity for each channel
  • Period and duty cycle are double buffer ed. Change takes effect when the end of the effective period is reached (PWM counter reaches zero), or when the channel is disabled
  • Programmable center or left ali gned outputs on individual channels
  • Four clock sources (A, B, SA, and SB) provide for a wide range of frequencies
  • Programmable clock select logic

4.14.1.2 Modes of Operation

The PWM8B2C module does operate in Normal mode only.

4.14.1.3 Block Diagram

Figure 22 shows the block diagram for the 8-bit 2-channel PWM block. Figure 22. PWM Block Diagram

4.14.2 Signal Description

Section 4.18, “General Purpose I/O - PTB[0…2] for configuration details. frequencies higher than the maximum output frequency of the connected driver (HS, LS). Please refer to Section 3.6, “Dynamic Electrical Characteristics for details.

4.14.2.1 D2DCLK

4.14.2.2 PWM1 — Pulse Wi dth Modulator Channel 1

This signal serves as waveform output of PWM channel 1.

4.14.2.3 PWM0 — Pulse Wi dth Modulator Channel 0

This signal serves as waveform output of PWM channel 0.

4.14.3 Register Descriptions

read as 0 and the write will be unimplemented. Unimplemented functions are indicated by shading the bit. Table 118. PWM Register Summary

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

4.14.3.1 PWM Control Register (PWMCTL)

4.14.3.1.1 PWM Enable (PWMEx)

output until its clock source begins its next cycle, due to the synchronization of PWMEx and the clock source. disabled (PWME1–0 = 0), the prescaler counter shuts off for power savings.

4.14.3.1.2 PWM Po larity (PPOLx)

polarity bit is zero, the output starts low and then goes high when the duty count is reached.

4.14.3.1.3 PWM Clock Select (PCLKx)

Each PWM channel has a choice of two clocks to use as the clock source for that channel as described by the following. Table 119. PWM Control Register (PWMCTL)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 120. PWMCTL - Register Field Descriptions 0 Channels 1–0 operate in left aligned output mode. 1 Channels 1–0 operate in center aligned output mode. 0 Clock B is the clock source for PWM channel 1. 1 Clock SB is the clock source for PWM channel 1. 0 Clock A is the clock source for PWM channel 0. 1 Clock SA is the clock source for PWM channel 0. 0 PWM channel 1–0 outputs are low at the beginning of the period, then go high when the duty count is reached. 1 PWM channel 1–0 outputs are high at the beginning of the period, then go low when the duty count is reached. 0 Pulse width channel 1–0 is disabled. clock source begins its next cycle.

4.14.3.1.4 PWM Center Align Enable (CAEx)

description of the PWM output modes. Write these bits only when the corresponding channel is disabled.

4.14.3.2 PWM Prescale Clock Select Register (PWMPRCLK)

This register selects the prescale clock source for clocks A and B independently. Table 121. PWM Prescale Clock Select Register (PWMPRCLK)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 122. PWMPRCLK - Register Field Descriptions determine the rate of clock B, as shown in Table 123. determine the rate of clock A, as shown in Table 124. Table 123. Clock B Prescaler Selects

4.14.3.3 PWM Scale A Register (PWMSCLA)

A, dividing it by the value in the PWMSCLA register and dividing that by two.

4.14.3.4 PWM Scale B Register (PWMSCLB)

B, dividing it by the value in the PWMSCLB register and dividing that by two. Any value written to this register will cause the scale counter to load the new scale value (PWMSCLB). Table 124. Clock A Prescaler Selects Table 125. PWM Scale A Register (PWMSCLA)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

4.14.3.5 PWM Channel Counter Registers (PWMCNTx)

register and then back down to 0.

4.14.3.6 PWM Channel Period Registers (PWMPERx)

  • The effective period ends
  • The counter is written (counter resets to $00)
  • The channel is disabled In this way, the output of the PWM will always be either the old waveform or the new waveform, not some variation in between. If the channel is not enabled, then writes to the period register will go directly to the latches as well as the buffer. NOTE Reads of this register return the most recent value written. Reads do not necessarily return the value of the currently active period due to the double buffering scheme. To calculate the output period, take the selected clock source period for the channel of interest (A, B, SA, or SB) and multiply it by the value in the period register for that channel:

Table 126. PWM Scale B Register (PWMSCLB)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 127. PWM Channel Counter Registers (PWMCNTx)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.
  • Left aligned output (CAEx = 0)
  • PWMx Period = Channel Clock Period * PWMPERx Center Aligned Output (CAEx = 1)
  • PWMx Period = Channel Clock Period * (2 * PWMPERx)

4.14.3.7 PWM Channel Duty Registers (PWMDTYx)

  • The effective period ends
  • The counter is written (counter resets to $00)
  • The channel is disabled In this way, the output of the PWM will always be either the old duty waveform or the new duty waveform, not some variation in between. If the channel is not enabled, then writes to the duty register will go directly to the latches as well as the buffer. NOTE Reads of this register return the most recent value written. Reads do not necessarily return the value of the currently active duty due to the double buffering scheme. NOTE Depending on the polarity bit, the duty registers will contain the count of either the high time or the low time. If the polarity bit is one, the output starts high and then goes low when the duty count is reached, so the duty registers contain a count of the high time. If the polarity bit is zero, the output starts low and then goes high when the duty count is reached, so the duty registers contain a count of the low time. To calculate the output duty cycle (high time as a% of period) for a particular channel:
  • Polarity = 0 (PPOL x =0) – Duty Cycle = [(PWMPERx-PWMDTYx)/PWMPERx] * 100%
  • Polarity = 1 (PPOLx = 1) – Duty Cycle = [PWMDTYx / PWMPERx] * 100%

Table 128. PWM Channel Period Registers (PWMPERx)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 129. PWM Channel Duty Registers (PWMDTYx)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

PWM Control Module (PWM8B2C) MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 92

4.14.4 Functional Description

4.14.4.1 PWM Clock Select

There are four available clocks: clock A, clock B, clock SA (scaled A), and clock SB (scaled B). These four clocks are based on the D2D clock. Clock A and B can be software selected to be 1, 1/2, 1/4, 1/8,..., 1/64, 1/128 times the D2D clock. Clock SA uses clock A as an input and divides it further with a reloadable counter. Similarly, clock SB uses clock B as an input and divides it further with a reloadable counter. The rates available for clock SA are software selectable to be clock A divided by 2, 4, 6, 8,..., or 512 in increments of divide by 2. Similar rates are available for clock SB. Each PWM channel has the capability of selecting one of two clocks, either the pre-scaled clock (clock A or B) or the scaled clock (clock SA or SB). The block diagram in Figure 23 shows the four different clocks and how the scaled clocks are created.

4.14.4.1.1 Prescale

The input clock to the PWM prescaler is the D2D clock. The input clock can also be disabled when both PWM channels are disabled (PWME1-0 = 0). This is useful for reducing power by disabling the prescale counter. Clock A and clock B are scaled values of the input clock. The value is software selectable for both clock A and clock B and has options of 1, 1/2, 1/4, 1/8, 1/16, 1/32, 1/64, or 1/128 times the D2D clock. The value selected for clock A is determined by the PCKA2, PCKA1, PCKA0 bits in the PWMPRCLK register. The value selected for clock B is determined by the PCKB2, PCKB1, PCKB0 bits also in the PWMPRCLK register.

4.14.4.1.2 Clock Scale

The scaled A clock uses clock A as an input and divides it further with a user programmable value and then divides this by 2. The scaled B clock uses clock B as an input and divides it further with a user programmable value and then divides this by 2. The rates available for clock SA are software selectable to be clock A divided by 2, 4, 6, 8,..., or 512 in increments of divide by 2. Similar rates are available for clock SB.

Figure 23. PWM Clock Select Block Diagram clock A divided by two times the value in the PWMSCLA register.

PWM Control Module (PWM8B2C) MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 94 NOTE Clock SA = Clock A / (2 * PWMSCLA) When PWMSCLA = $00, PWMSCLA value is considered a full scale value of 256. Clock A is thus divided by 512. Similarly, clock B is used as an input to an 8-bit down counter followed by a divide by two producing clock SB. Thus, clock SB equals clock B divided by two times the value in the PWMSCLB register. NOTE Clock SB = Clock B / (2 * PWMSCLB) When PWMSCLB = $00, PWMSCLB value is considered a full scale value of 256. Clock B is thus divided by 512. As an example, consider the case in which the user writes $FF into the PWMSCLA register. Clock A for this case will be E divided by 4. A pulse will occur at a rate of once every 255x4 E cycles. Passing this through the divide by two circuit produces a clock signal at an E divided by 2040 rate. Similarly, a value of $01 in the PWMSCLA register when clock A is E divided by 4 will produce a clock at an E divided by 8 rate. Writing to PWMSCLA or PWMSCLB causes the associated 8-bit down counter to be re-loaded. Otherwise, when changing rates the counter would have to count down to $01 before counting at the proper rate. Forcing the associated counter to re-load the scale register value every time PWMSCLA or PWMSCLB is written prevents this. NOTE Writing to the scale registers while channels are operating can cause irregularities in the PWM outputs.

4.14.4.1.3 Clock Select

Each PWM channel has the capability of selecting one of two clocks. For channels 0 the clock choice is clock A or clock SA. For channels 1 the choice is clock B or clock SB. The clock selection is done with the PCLKx control bits in the PWMCTL register. NOTE Changing clock control bits while channels are operating can cause irregularities in the PWM outputs.

4.14.4.2 PWM Channel Timers

The main part of the PWM module are the actual timers. Each of the timer channels has a counter, a period register, and a duty register (each are 8-bit). The waveform output period is controlled by a match between the period register and the value in the counter. The duty is controlled by a match between the duty register and the counter value, and causes the state of the output to change during the period. The starting polarity of the output is also selectable on a per channel basis. Shown in Figure 24 is the block diagram for the PWM timer.

Figure 24. PWM Timer Channel Block Diagram

4.14.4.2.1 PWM Enable

PWM output until its clock source begins its next cycle due to the synchronization of PWMEx and the clock source. The first PWM cycle after enabling the channel can be irregular. (PWMEx = 0), the counter for the channel does not count.

4.14.4.2.2 PWM Polarity

reached. Conversely, if the polarity bit is zero, the output starts low and then goes high when the duty count is reached.

4.14.4.2.3 PWM Pe riod and Duty

  • The effective period ends
  • The counter is written (counter resets to $00)
  • The channel is disabled D2D Clock T R Q Q PPOLx PWMEx PWM Gate 8-bit Compare = PWMDTYx 8-bit Compare = PWMPERx CAExT R Q Q 8-Bit Counter PWMCNTx (Clock Edge Sync) Up/Down Reset M U X

In this way, the output of the PWM will always be either the old waveform or the new waveform, not some variation in between. If the channel is not enabled, then writes to the period and duty registers will go directly to the latches as well as the buffer. When forcing a new period or duty into effect immediately, an irregular PWM cycle can occur.

4.14.4.2.4 PWM Timer Counters

Each channel counter can be read at anytime without affecting the count or the operation of the PWM channel. channel is disabled, except that the new period is started immediately with the output set according to the polarity bit. “Center Aligned Outputs” for more details).

4.14.4.2.5 Left Al igned Outputs

in the PWMCTL register. If the CAEx bit is cleared (CAEx = 0), the corresponding PWM output will be left aligned. to the value in the period register – 1. Table 130. PWM Timer Counter Conditions When PWMCNTx register written to any value When PWM channel is enabled (PWMEx = 1).

to program the output mode before enabling the PWM channel. Figure 25. PWM Left Aligned Output Waveform for the channel (A, B, SA, or SB), and divide it by the value in the period register for that channel.

  • PWMx Frequency = Clock (A, B, SA, or SB) / PWMPERx
  • PWMx Duty Cycle (high time as a % of period): — Polarity = 0 (PPOLx = 0)
  • Duty Cycle = [(PWMPERx-PWMDTYx)/PWMPERx] * 100% — Polarity = 1 (PPOLx = 1) Duty Cycle = [PWMDTYx / PWMPERx] * 100% As an example of a left aligned output, consider the following case: Clock Source = E, where E = 10 kHz (100 µs period) PPOLx = 0 PWMPERx = 4 PWMDTYx = 1 PWMx Frequency = 10 kHz/4 = 2.5 kHz PWMx Period = 400 µs PWMx Duty Cycle = 3/4 *100% = 75% The output waveform generated is shown in Figure 26.

Figure 26. PWM Left Aligned Output Example Waveform

4.14.4.2.6 Center Aligned Outputs

output will be center aligned.

down to 0. Thus the effective period is PWMPERx*2. to program the output mode before enabling the PWM channel. Figure 27. PWM Center Aligned Output Waveform for the channel (A, B, SA, or SB) and divide it by twice the value in the period register for that channel.

  • PWMx Frequency = Clock (A, B, SA, or SB) / (2*PWMPERx)
  • PWMx Duty Cycle (high time as a% of period): — Polarity = 0 (PPOLx = 0) Duty Cycle = [(PWMPERx-PWMDTYx)/PWMPERx] * 100% — Polarity = 1 (PPOLx = 1) Duty Cycle = [PWMDTYx / PWMPERx] * 100% As an example of a center aligned output, consider the following case: Clock Source = E, where E = 10 kHz (100 µs period) PPOLx = 0 PWMPERx = 4 PWMDTYx = 1 PWMx Frequency = 10 kHz/8 = 1.25 kHz PWMx Period = 800 µs PWMx Duty Cycle = 3/4 *100% = 75% Figure 28 shows the output waveform generated.

Figure 28. PWM Center Aligned Output Example Waveform

4.14.4.2.7 PWM Boundary Cases

Table 131 summarizes the boundary conditions for the PWM, regardless of the output mode (left aligned or center aligned).

4.14.5 Resets

their bit-fields. All special functions or modes which are initialized during or just following reset are described within this section.

  • The 8-bit up/down counter is configur ed as an up counter out of reset.
  • All the channels are disabled and all the counters do not count.

4.14.6 Interrupts

The PWM module has no Interrupts. Table 131. PWM Boundary Cases

  1. Counter = $00 and does not count.

LIN Physical Layer Interface - LIN MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 100

4.15 LIN Physical La yer Interface - LIN

The LIN bus pin provides a physical layer for single-wire communication in automotive applications. The LIN physical layer is designed to meet the LIN physical layer version 2.1 specification, and has the following features:

  • LIN physical la yer 2.1 compliant
  • Slew rate selection 20 kBit, 10 kBit, and fast Mode (100 kBit)
  • Over-temperature Shutdown - HTI
  • Permanent Pull-up in Normal mode 30 k , 1.0 M in low power
  • Current limitation
  • External Rx / Tx access. See Section 4.18, “General Purpose I/O - PTB[0…2]
  • Slew Rate Trim Bit. See Section 4.26, “MM912_634 - Analog Die Trimming The LIN driver is a Low Side MOSFET with current limitation and thermal shutdown. An internal pull-up resistor with a serial diode structure is integrated, so no external pull-up components are required for the application in a slave node. The fall time from dominant to recessive and the rise time from recessive to dominant is controlled. The symmetry between both slopes is guaranteed.

4.15.1 LIN Pin

The LIN pin offers high susceptibility immunity level from external disturbance, guaranteeing communication during external disturbance. See Section 3.8, “ESD Protection and Latch-up Immunity.

4.15.2 Slew Ra te Selection

The slew rate can be selected for optimized operation at 10 kBit/s and 20 kBit/s as well as a fast baud rate (100 kBit) for test and programming. The slew rate can be adapted with the bits LINSR[1:0] in the LIN Register (LINR). The initial slew rate is 20 kBit/s.

4.15.3 Over-temperature Shutdown (LIN Interrupt)

The output Low Side FET (transmitter) is protected against over-temperature conditions. In case of an over-temperature condition, the transmitter will be shut down and the bit LINOTC in the LIN Register (LINR) is set as long as the condition is present. If the LINOTIE bit is set in the LIN Register (LINR), an Interrupt IRQ will be generated. Acknowledge the interrupt by reading the LIN Register (LINR). To issue a new interrupt, the condition has to vanish and occur again. The transmitter is automatically re-enabled once the over-temperature condition is gone and TxD is High.

4.15.4 Low Power Mode and Wake-up Feature

During Low Power mode operation the transmitter of the physical layer is disabled. The receiver is still active and able to detect Wake-up events on the LIN bus line. A dominant level longer than tPROPWL followed by a rising edge, will generate a wake-up event and be reported in the Wake-up Source Register (WSR).

4.15.5 J2602 Compliance

A Low Voltage Shutdown feature was implemented to allow controlled J2602 compliant LIN driver behavior under Low Voltage conditions (LVSD=0). When an under-voltage occurs on VS1 (LVI), the LIN stays in recessive mode if it was in recessive state. If it was in a dominant state, it waits until the next dominant to recessive transition, then it stays in the recessive state. When the under-voltage condition (LVI) is gone, the LIN will start operating when Tx is in a recessive state or on the next dominant to recessive transition. ANALOGMCU

4.15.6 Register Definition

4.15.6.1 LIN Register (LINR)

Table 132. LIN Register (LINR)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 133. LINR - Register Field Descriptions 6 - LINOTC LIN - Over-temperature condition pr esent. LIN driver is shut down. Reading this bit will clear the LINOT interrupt flag.

Serial Communication Interface (S08SCIV4) MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 102

4.16 Serial Communicati on Interface (S08SCIV4)

4.16.1 Introduction

4.16.1.1 Features

Features of the SCI module include:

  • Full-duplex, standard non-return-to-zero (NRZ) format
  • Double-buffered transmitter and receiver with separate enables
  • Programmable baud rates (13-bit modulo divider)
  • Interrupt-driven or polled operation: — Transmit data register em pty and transmission complete — Receive data register full — Receive overrun, parity error, framing error, and noise error — Idle receiver detect — Active edge on receive pin — Break detect supporting LIN
  • Hardware parity generation and checking
  • Programmable 8-bit or 9-bit character length
  • Receiver wake-up by idle-line or address-mark
  • Optional 13-bit break character generat ion / 11-bit break character detection
  • Selectable transmitter output polarity

4.16.1.2 Modes of Operation

See Section 4.16.3, “Functional Description,” for details concerning SCI operation in these modes:

  • 8 and 9-bit data modes
  • Loop mode
  • Single-wire mode

4.16.1.3 Block Diagram

Figure 29 shows the transmitter portion of the SCI. ANALOGMCU

Figure 30. SCI Receiver Block Diagram

4.16.2 Register Definition

The SCI has eight 8-bit registers to control baud rate, select SCI options, report SCI status, and for transmit/receive data. Refer to Section 4.6, “Die to Die Interface - Target of this data sheet for the absolute address assignments for all SCI registers. This section refers to registers and control bits only by their names.

4.16.2.1 SCI Baud Rate Regist ers (SCIBD (hi), SCIBD (lo))

in SCIBD (hi) does not change until SCIBD (lo) is written. transmitter is enabled (RE or TE bits in SCIC2 are written to 1). Table 134. SCI Baud Rate Register (SCIBD (hi))

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 135. SCIBD (hi) Field Descriptions 0 Hardware interrupts from LBKDIF disabled (use polling). 1 Hardware interrupt requested when LBKDIF flag is 1. 0 Hardware interrupts from RXEDGIF disabled (use polling). 1 Hardware interrupt requested when RXEDGIF flag is 1. to 8191, the SCI baud rate = BUSCLK/(16BR). See also BR bits in Table 137. Table 136. SCI Baud Rate Register (SCIBDL)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 137. SCIBDL Field Descriptions to 8191, the SCI baud rate = BUSCLK/(16BR). See also BR bits in Table 135.

4.16.2.2 SCI Control Register 1 (SCIC1)

This read/write register is used to control various optional features of the SCI system. Table 138. SCI Control Register 1 (SCIC1)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 139. SCIC1 Field Descriptions output is internally connected to the receiver input. 0 Normal operation — RxD an d TxD use separate pins. 0 Provided LOOPS = 1, RSRC = 0 selects internal loop back mode and the SCI does not use the RxD pins. 1 Single-wire SCI mode where the TxD pin is connec ted to the transmitter output and receiver input. 0 Normal — start + 8 data bits (LSB first) + stop. 1 Receiver and transmitter use 9-bit data characters star t + 8 data bits (LSB first) + 9th data bit + stop. Wake-up” for more information. 0 Idle character bit count starts after start bit. 1 Idle character bit count starts after stop bit. the data character (eighth or ninth data bit) is treated as the parity bit. 0 No hardware parity generation or checking.

4.16.2.3 SCI Control Register 2 (SCIC2)

This register can be read or written at any time. Table 140. SCI Control Register 2 (SCIC2)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 141. SCIC2 Field Descriptions 0 Hardware interrupts from TDRE disabled (use polling). 1 Hardware interrupt requested when TDRE flag is 1. 0 Hardware interrupts from TC disabled (use polling). 1 Hardware interrupt requested when TC flag is 1. 0 Hardware interrupts from RDRF disabled (use polling). 1 Hardware interrupt requested when RDRF flag is 1. 0 Hardware interrupts from IDLE disabled (use polling). 1 Hardware interrupt requested when IDLE flag is 1. SCI communication line (TxD pin). finishes transmitting before allowing the pin to revert to a general-purpose I/O pin. the RxD pin reverts to being a general-purpose I/O pin even if RE = 1.

4.16.2.4 SCI Status Register 1 (SCIS1)

this register) are used to clear these status flags. (WAKE = 0, idle-line wake-up), or a logic 1 in the most significant data bit in a character (WAKE = 1, address-mark wake-up). 0 Normal SCI receiver operation. 1 SCI receiver in standby waiting for wake-up condition. 0 Normal transmitter operation. 1 Queue break character(s) to be sent. Table 142. SCI Status Register 1 (SCIS1)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 143. SCIS1 Field Descriptions then write to the SCI data register (SCID). 0 Transmit data register (buffer) full. 1 Transmit data register (buffer) empty. 0 Transmitter active (sending data, a preamble, or a break). 1 Transmitter idle (transmission activity complete).

  • Write to the SCI data register (SCID) to transmit new data
  • Queue a preamble by changing TE from 0 to 1
  • Queue a break character by writing 1 to SBK in SCIC2 RDRF Receive Data Register Full Flag — RDRF becomes set when a ch aracter transfers from the receive shifter into the receive data register (SCID). To clear RDRF, read SCIS1 with RDRF = 1 and then read the SCI data register (SCID). 0 Receive data register empty. 1 Receive data register full.

Table 141. SCIC2 Field Descriptions (continued)

4.16.2.5 SCI Status Register 2 (SCIS2)

This register has one read-only status flag. needed for the receiver to detect an idle line. the receive line remains idle for an extended period. the SCI data register (SCID). 1 Receive overrun (new SCI data lost). then read the SCI data register (SCID). 1 Noise detected in the received character in SCID. Framing Error Flag — FE is set at the same time as RDRF when the receiver detects a logic 0 where the stop bit was expected. the SCI data register (SCID). 0 No framing error detected. This does not guarantee the framing is correct. character does not agree with the expected parity value. To clear PF, read SCIS1 and then read the SCI data register (SCID). Table 144. SCI Status Register 2 (SCIS2)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 143. SCIS1 Field Descriptions (continued)

from 10 bits to 11 bits, preventing false detection of a 0x00 data character as a LIN break symbol.

4.16.2.6 SCI Control Register 3 (SCIC3)

Table 145. SCIS2 Field Descriptions detected. LBKDIF is cleared by writing a “1” to it. 0 No LIN break character has been detected. 1 LIN break character has been detected. RxD pin occurs. RXEDGIF is cleared by writing a “1” to it. 0 No active edge on the receive pin has occurred. 1 An active edge on the receive pin has occurred. Receive Data Inversion — Setting this bit reve rses the polarity of the received data input.

0 Receive data not inverted

1 Receive data inverted

Receive Wake Up Idle Detect— RWUID controls whether the idle character that wakes up the receiver sets the IDLE bit. 0 During receive standby state (RWU = 1), the IDLE bit does not get set upon detection of an idle character. 1 During receive standby state (RWU = 1), the IDLE bit gets set upon detection of an idle character. framing error is not affected by the state of this bit.

0 Break character is tr ansmitted with length of 10 bit times (11 if M = 1)

1 Break character is tr ansmitted with length of 13 bit times (14 if M = 1)

error (FE) and receive data register full (RDRF) flags are prevented from setting. 0 Break character detection enabled. 1 Break character detection disabled.

  1. Setting RXINV inverts the RxD input for all cases: data bits, start and stop bits, break, and idle.

Table 146. SCI Control Register 3 (SCIC3)

  1. Offset related to 0x0200 for bloc king access and 0x300 for non blocking access within the global address space.

4.16.2.7 SCI Data Register (SCID)

Table 147. SCIC3 Field Descriptions not be written each time SCID is written. (LOOPS = RSRC = 1), this bit determines the direction of data at the TxD pin. 0 TxD pin is an input in single-wire mode. 1 TxD pin is an output in single-wire mode. Transmit Data Inversion — Setting this bit revers es the polarity of the transmitted data output.

0 Transmit data not inverted

1 Transmit data inverted

Overrun Interrupt Enable — This bi t enables the overrun flag (OR) to generate hardware interrupt requests. 0 OR interrupts disabled (use polling). 1 Hardware interrupt requested when OR = 1. Noise Error Interrupt Enable — This bit enables the noi se flag (NF) to generate hardware interrupt requests. 0 NF interrupts disabled (use polling). 1 Hardware interrupt requested when NF = 1. Framing Error Interrupt Enable — This bit enables the framing error flag (FE) to generate hardware interrupt requests. 0 FE interrupts disabled (use polling). 1 Hardware interrupt requested when FE = 1. Parity Error Interrupt Enable — This bit enables the parity error flag (PF) to generate hardware interrupt requests. 0 PF interrupts disabled (use polling). 1 Hardware interrupt requested when PF = 1.

  1. Setting TXINV inverts the TxD output for all cases: data bits, start and stop bits, break, and idle.

Table 148. SCI Data Register (SCID)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

4.16.3 Functional Description

SCI, writes the data to be transmitted, and processes received data. The following describes each of the blocks of the SCI.

4.16.3.1 Baud Ra te Generation

As shown in Figure 31, the clock source for the SCI baud rate generator is the D2D clock. Figure 31. SCI Baud Rate Generation the leading edge of the start bit and how bit sampling is performed. acceptable for reliable communications.

4.16.3.2 Transmitter Functional Description

idle characters. The transmitter block diagram is shown in Figure 29. store data into the transmit data buffer by writing to the SCI data register (SCID). complete flag and enters an idle mode, with TxD high, waiting for more characters to transmit. must first be completed. This includes data characters in progress, queued idle characters, and queued break characters.

4.16.3.2.1 Send Break and Queued Idle

Semiconductor SCI, the break characters will be received as 0s in all eight data bits and a framing error (FE = 1) occurs. control of the port pin between writing 0 and then 1 to TE. The length of the break character is affected by the BRK13 and M bits as shown below.

4.16.3.3 Receiver F unctional Description

wake-up function are explained. buffer must be read to avoid a receiver overrun.

4.16.3.3.1 Data Sampling Technique

consecutive logic 1 samples. The 16 baud rate clock is used to divide the bit time into 16 segments labeled RT1 through RT16. not merely noise. If at least two of these three samples are 0, the receiver assumes it is synchronized to a receive character. with the logic level for that bit, the noise flag (NF) will be set when the received character is transferred to the receive data buffer. falling edge is filled with three logic 1 samples so that a new start bit can be detected almost immediately. Table 149. Break Character Length

Serial Communication Interface (S08SCIV4) MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 114 In the case of a framing error, the receiver is inhibited from receiving any new characters until the framing error flag is cleared. The receive shift register continues to function, but a complete character cannot transfer to the receive data buffer if FE is still set.

4.16.3.3.2 Receiver Wake-up Operation

Receiver wake-up is a hardware mechanism that allows an SCI receiver to ignore the characters in a message that is intended for a different SCI receiver. In such a system, all receivers evaluate the first character(s) of each message, and as soon as they determine the message is intended for a different receiver, they write logic 1 to the receiver wake up (RWU) control bit in SCIC2. When RWU bit is set, the status flags associated with the receiver (with the exception of the idle bit, IDLE, when RWUID bit is set) are inhibited from setting, thus eliminating the software overhead for handling the unimportant message characters. At the end of a message, or at the beginning of the next message, all receivers automatically force RWU to 0 so all receivers wake up in time to look at the first character(s) of the next message. When WAKE = 0, the receiver is configured for idle-line wake-up. In this mode, RWU is cleared automatically when the receiver detects a full character time of the idle-line level. The M control bit selects 8-bit or 9-bit data mode that determines how many bit times of idle are needed to constitute a full character time (10 or 11 bit times because of the start and stop bits). When RWU is one and RWUID is zero, the idle condition that wakes up the receiver does not set the IDLE flag. The receiver wakes up and waits for the first data character of the next message which will set the RDRF flag and generate an interrupt if enabled. When RWUID is one, any idle condition sets the IDLE flag and generates an interrupt if enabled, regardless of whether RWU is zero or one. The idle-line type (ILT) control bit selects one of two ways to detect an idle line. When ILT = 0, the idle bit counter starts after the start bit so the stop bit and any logic 1s at the end of a character count toward the full character time of idle. When ILT = 1, the idle bit counter does not start until after a stop bit time, so the idle detection is not affected by the data in the last character of the previous message. When WAKE = 1, the receiver is configured for address-mark wake-up. In this mode, RWU is cleared automatically when the receiver detects a logic 1 in the most significant bit of a received character (eighth bit in M = 0 mode and ninth bit in M = 1 mode). Address-mark wake-up allows messages to contain idle characters but requires that the MSB be reserved for use in address frames. The logic 1 MSB of an address frame clears the RWU bit before the stop bit is received and sets the RDRF flag. In this case the character with the MSB set is received even though the receiver was sleeping during most of this character time.

4.16.3.4 Interrupts and Status Flags

The SCI system has three separate interrupt vectors to reduce the amount of software needed to isolate the cause of the interrupt. One interrupt vector is associated with the transmitter for TDRE and TC events. Another interrupt vector is associated with the receiver for RDRF, IDLE, RXEDGIF and LBKDIF events, and a third vector is used for OR, NF, FE, and PF error conditions. Each of these ten interrupt sources can be separately masked by local interrupt enable masks. The flags can still be polled by software when the local masks are cleared to disable generation of hardware interrupt requests. The SCI transmitter has two status flags that optionally can generate hardware interrupt requests. Transmit data register empty (TDRE) indicates when there is room in the transmit data buffer to write another transmit character to SCID. If the transmit interrupt enable (TIE) bit is set, a hardware interrupt will be requested whenever TDRE = 1. Transmit complete (TC) indicates that the transmitter is finished transmitting all data, preamble, and break characters and is idle with TxD at the inactive level. This flag is often used in systems with modems to determine when it is safe to turn off the modem. If the transmit complete interrupt enable (TCIE) bit is set, a hardware interrupt will be requested whenever TC = 1. Instead of hardware interrupts, software polling may be used to monitor the TDRE and TC status flags if the corresponding TIE or TCIE local interrupt masks are 0s. When a program detects that the receive data register is full (RDRF = 1), it gets the data from the receive data register by reading SCID. The RDRF flag is cleared by reading SCIS1 while RDRF = 1 and then reading SCID. When polling is used, this sequence is naturally satisfied in the normal course of the user program. If hardware interrupts are used, SCIS1 must be read in the interrupt service routine (ISR). Normally, this is done in the ISR anyway to check for receive errors, so the sequence is automatically satisfied. The IDLE status flag includes logic that prevents it from getting set repeatedly when the RxD line remains idle for an extended period of time. IDLE is cleared by reading SCIS1 while IDLE = 1 and then reading SCID. After IDLE has been cleared, it cannot become set again until the receiver has received at least one new character and has set RDRF.

Serial Communication Interface (S08SCIV4) MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 115 If the associated error was detected in the received character that caused RDRF to be set, the error flags — noise flag (NF), framing error (FE), and parity error flag (PF) — get set at th e same time as RDRF. These flags are not set in overrun cases. If RDRF was already set when a new character is ready to be transferred from the receive shifter to the receive data buffer, the overrun (OR) flag gets set instead the data along with any associated NF, FE, or PF condition is lost. At any time, an active edge on the RxD serial data input pin causes the RXEDGIF flag to set. The RXEDGIF flag is cleared by writing a “1” to it. This function does depend on the receiver being enabled (RE = 1).

4.16.3.5 Additional SCI Functions

The following sections describe additional SCI functions. 4.16.3.5.1 8- and 9- Bit Data Modes The SCI system (transmitter and receiver) can be configured to operate in 9-bit data mode by setting the M control bit in SCIC1. In 9-bit mode, there is a ninth data bit to the left of the MSB of the SCI data register. For the transmit data buffer, this bit is stored in T8 in SCIC3. For the receiver, the ninth bit is held in R8 in SCIC3. For coherent writes to the transmit data buffer, write to the T8 bit before writing to SCID. If the bit value to be transmitted as the ninth bit of a new character is the same as for the previous character, it is not necessary to write to T8 again. When data is transferred from the transmit data buffer to the transmit shifter, the value in T8 is copied at the same time data is transferred from SCID to the shifter. 9-bit data mode typically is used in conjunction with parity to allow eight bits of data plus the parity in the ninth bit. Or it is used with address-mark wake-up so the ninth data bit can serve as the wake-up bit. In custom protocols, the ninth bit can also serve as a software-controlled marker.

4.16.3.5.2 Stop Mode Operation

During all stop modes, clocks to the SCI module are halted. In stop1 and stop2 modes, all SCI register data is lost and must be re-initialized upon recovery from these two stop modes. No SCI module registers are affected in stop3 mode. The receive input active edge detect circuit is still active in stop3 mode, but not in stop2. An active edge on the receive input brings the CPU out of stop3 mode if the interrupt is not masked (RXEDGIE = 1). Note that because the clocks are halted, the SCI module will resume operation upon exit from stop (only in stop3 mode). Software should ensure stop mode is not entered while there is a character being transmitted out of or received into the SCI module.

4.16.3.5.3 Loop Mode

When LOOPS = 1, the RSRC bit in the same register chooses between loop mode (RSRC = 0) or single-wire mode (RSRC = 1). Loop mode is sometimes used to check software, independent of connections in the external system, to help isolate system problems. In this mode, the transmitter output is internally connected to the receiver input and the RxD pin is not used by the SCI, so it reverts to a general purpose port I/O pin.

4.16.3.5.4 Single-wire Operation

When LOOPS = 1, the RSRC bit in the same register chooses between loop mode (RSRC = 0) or single-wire mode (RSRC = 1). Single-wire mode is used to implement a half-duplex serial connection. The receiver is internally connected to the transmitter output and to the TxD pin. The RxD pin is not used and reverts to a general purpose port I/O pin. In single-wire mode, the TXDIR bit in SCIC3 controls the direction of serial data on the TxD pin. When TXDIR = 0, the TxD pin is an input to the SCI receiver and the transmitter is temporarily disconnected from the TxD pin so an external device can send serial data to the receiver. When TXDIR = 1, the TxD pin is an output driven by the transmitter. In single-wire mode, the internal loop back connection from the transmitter to the receiver causes the receiver to receive characters that are sent out by the transmitter.

4.17 High Voltage Inputs - Lx

  • Digital Input Capable
  • Analog Input Capable with selectable voltage divider.
  • Wake-up Capable during Low Power mode. See Section 4.9, “Wake-up / Cyclic Sense. When used as analog inputs to sense voltages outside the module a series resistor must be used on the used input. When a Lx input is not selected in the analog multiplexer, the voltage divider is disconnected from that input. When a Lx input is selected in the analog multiplexer, it will be disconnected in low power mode if configured as Wake-up input. Unused Lx pins are recommended to be connected to GND to improve EMC behavior.

4.17.1 Register Definition

4.17.1.1 Lx Status Register (LXR)

4.17.1.2 Lx Control Register (LXCR)

Table 150. Lx Status Register (LXR)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 151. LXR - Register Field Descriptions Table 152. Lx Control Register (LXCR)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 153. LXCR - Register Field Descriptions

4.18 General Purpose I/O - PTB[0…2]

The three multipurpose I/O pins can be configured to operate as documented in the table below. The alternate function of PTB2, PTB1 and PTB0 can be configured by selecting the function in the corresponding module (e.g. TIMER). The selection with the highest priority will take effect when more than one function is selected.

4.18.1 Digital I/O Functionality

All three pins act as standard digital Inputs / Outputs with selectable pull-up resistor.

4.18.2 Alternative SCI / LIN Functionality

internal LIN and / or SCI signals (RxD and TxD). Figure 32 shows the 4 available configurations. Figure 32. Alternative SCI / LIN Functionality

4.18.3 Alternative PWM Functionality

configured in the Port B Configuration Register 2 (PTBC2). Table 154. General purpose I/O - Operating modes

4.18.4 Register definition

4.18.4.1 Port B Configuration Register 1 (PTBC1)

The pull-up resistor is not active once the port is configured as an output.

4.18.4.2 Port B Configuration Register 2 (PTBC2)

Table 155. Port B Configuration Register 1 (PTBC1)

  1. Offset related to 0x0200 for bloc king access and 0x300 for non blocking access within the global address space.

Table 156. PTBC1 - Register Field Descriptions 0 - Pull-up disabled on PTBx pin. 1- Pull-up enabled on PTBx pin. 0 - PTBx configured as input. 1 - PTBx configured as output. Table 157. Port B Configuration Register 2 (PTBC2)

  1. Offset related to 0x0200 for bloc king access and 0x300 for non blocking access within the global address space.

4.18.4.3 Port B Data Register (PTB)

Table 158. PTBC2 - Register Field Descriptions PWM Channel Select PTB2. See Section 4.14, “PWM Control Module (PWM8B2C). PWM Enable for PTB2. See Section 4.14, “PWM Control Module (PWM8B2C). Serial Mode Select for PTB0 and PTB1. See Figure 32 for details. Table 159. Port B Data Register (PTB)

  1. Offset related to 0x0200 for bloc king access and 0x300 for non blocking access within the global address space.

Table 160. PTB - Register Field Descriptions and synchronized pin input state is read.

4.19 Basic Timer Modul e - TIM (TIM16B4C)

4.19.1 Introduction

4.19.1.1 Overview

The basic timer consists of a 16-bit, software-programmable counter driven by a seven-stage programmable prescaler. waveform. Pulse widths can vary from microseconds to many seconds. A full access for the counter registers or the input capture/output compare registers should take place in 16bit word access.

4.19.1.2 Features

  • Four input capture/output compare channels.
  • Clock prescaler
  • 16-bit counter

4.19.1.3 Modes of Operation

The TIM16B4C is only active during Normal mode.

4.19.1.4 Block Diagram

Figure 33. Timer Block Diagram For more information see the respective functional descriptions see Section 4.19.4, “Functional Description of this chapter.

4.19.2 Signal Description

4.19.2.1 Overview

“General Purpose I/O - PTB[0…2] (IOC3).

4.19.2.2 Detailed Signal Descriptions

4.19.2.2.1 IOC3 – Input Capture and Output Compare Channel 3

Section 4.18.2, “Alternative SCI / LIN Functionality. channel would have no effect.

4.19.2.2.2 IOC2 – Input Capture and Output Compare Channel 2

This pin serves as an input capture or output compare for channel 2 and can be routed to the PTB2 general purpose I/O.

4.19.2.2.3 IOC1 – Input Capture and Output Compare Channel 1

This pin serves as an input capture or output compare for channel 1 and can be routed to the PTB1 general purpose I/O.

4.19.2.2.4 IOC0 – Input Capture and Output Compare Channel 0

This pin serves as an input capture or output compare for channel 0 and can be routed to the PTB0 general purpose I/O. For the description of interrupts see Section 4.19.6, “Interrupts.

4.19.3 Memory Map and Registers

4.19.3.1 Overview

This section provides a detailed description of all memory and registers.

4.19.3.2 Module Memory Map

The memory map for the TIM16B4C module is given below in Table 161. Table 161. Module Memory Map

4.19.3.3 Register Descriptions

associated figure number. Details of register bit and field function follow the register diagrams, in bit order.

4.19.3.3.1 Timer Input Capture/Output Compare Select (TIOS)

4.19.3.3.2 Timer Compare Force Register (CFORC)

  1. Offset related to 0x0200 for bloc king access and 0x300 for non blocking access within the global address space.
  2. Only writable in special modes. (Refer to SOC Guide for different modes).
  3. Write to these registers have no meaning or effect during input capture.

Table 162. Timer Input Capture/Output Compare Select (TIOS)

  1. Offset related to 0x0200 for blocki ng access and 0x300 for non blocking access within the global address space.

Table 163. TIOS - Register Field Descriptions 0 - The corresponding channel acts as an input capture. 1 - The corresponding channel acts as an output compare. Table 164. Timer Compare Force Register (CFORC)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

register except the interrupt flag does not get set. then forced output compare action will take precedence and interrupt flag will not get set.

4.19.3.3.3 Output Compare 3 Mask Register (OC3M)

ranges from 0 to 2) bit is set to be an output compare. OC3M bit that is set, the output compare action reflects the corresponding OC3D bit.

4.19.3.3.4 Output Compare 3 Data Register (OC3D)

Table 165. CFORC - Register Field Descriptions Table 166. Output Compare 3 Mask Register (OC3M)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 167. OC3M - Register Field Descriptions Table 168. Output Compare 3 Data Register (OC3D)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

4.19.3.3.5 Timer Count Register (TCNT)

4.19.3.3.6 Timer System Co ntrol Register 1 (TSCR1)

Table 169. OC3D - Register Field Descriptions Table 170. Timer Count Register (TCNT)

  1. Offset related to 0x0200 for blocki ng access and 0x300 for non blocking access within the global address space.

Table 171. TCNT - Register Field Descriptions

16 Bit Timer Count Register

Table 172. Timer System Control Register 1 (TSCR1)

  1. Offset related to 0x0200 for blocki ng access and 0x300 for non blocking access within the global address space.

4.19.3.3.7 Timer Toggle On Overflow Register 1 (TTOV)

toggle on the output compare pin takes precedence over forced output compare events.

4.19.3.3.8 Timer Control Register 1 (TCTL1)

Table 173. TSCR1 - Register Field Descriptions 0 = Disables the timer. (Used for reducing power consumption). flag clearing due to unintended accesses. 0 = Allows the timer flag clearing. Table 174. Timer Toggle On Overflow Register 1 (TTOV)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 175. TTOV - Register Field Descriptions 1 = Toggle output compare pin on overflow feature enabled. 0 = Toggle output compare pin on overflow feature disabled. Table 176. Timer Control Register 1 (TCTL1)

  1. Offset related to 0x0200 for blocking access and 0x300 fo r non blocking access within the global address space.

4.19.3.3.9 Timer Control Register 2 (TCTL2)

These four pairs of control bits configure the input capture edge detector circuits. Table 177. TCTL1 - Register Field Descriptions Table 178. Compare Result Output Action Table 179. Timer Control Register 2 (TCTL2)

  1. Offset related to 0x0200 for blocking access and 0x300 fo r non blocking access within the global address space.

Table 180. TCTL2 - Register Field Descriptions Table 181. Edge Detector Circuit Configuration

4.19.3.3.10 Timer Interrupt Enable Register (TIE)

4.19.3.3.11 Timer System Co ntrol Register 2 (TSCR2)

This mode of operation is similar to an up-counting modulus counter. counter register (TCNT) is reset from $FFFF to $0000. where all prescale counter stages equal zero. Table 182. Timer Interrupt Enable Register (TIE)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 183. TIE - Register Field Descriptions Input Capture/Output Compare Interrupt Enable. Table 184. Timer System Control Register 2 (TSCR2)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 185. TIE - Register Field Descriptions 1 = Hardware interrupt requested when TOF flag set in TFLG2 register. 0 = Hardware Interrupt request inhibited. 0 = Inhibits Timer Counter reset and counter continues to run. These three bits select the frequency of the timer prescaler clock derived from the Bus Clock as shown in Table 186.

4.19.3.3.12 Main Timer Interrupt Flag 1 (TFLG1)

channel flag CnF to be cleared.

4.19.3.3.13 Main Timer Interrupt Flag 2 (TFLG2)

Table 186. Timer Clock Selection Table 187. Main Timer Interrupt Flag 1 (TFLG1)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 188. TFLG1 - Register Field Descriptions Input Capture/Output Compare Channel Flag. 0 = No event (Input Capture or Output Compare event) occurred. Table 189. Main Timer Interrupt Flag 2 (TFLG2)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

4.19.3.3.14 Timer Input Capture/Outp ut Compare Registers (TC3 - TC0)

Table 190. TFLG2 - Register Field Descriptions 0 = Flag indicates an Interrupt has not occurred. Table 191. Timer Input Capture/Output Compare Register 0 (TC0)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 192. Timer Input Capture/Output Compare Register 1(TC1)

  1. Offset related to 0x0200 for blocking access and 0x300 fo r non blocking access within the global address space.

no effect during input capture. corresponding input capture edge detector or to trigger an output action for output compare. it will give a different result.

4.19.4 Functional Description

4.19.4.1 General

Table 193. Timer Input Capture/Output Compare Register 2(TC2)

  1. Offset related to 0x0200 for bloc king access and 0x300 for non blocking access within the global address space.

Table 194. Timer Input Capture/Output Compare Register 3(TC3)

  1. Offset related to 0x0200 for blocking access and 0x300 fo r non blocking access within the global address space.

Table 195. TCn - Register Field Descriptions

16 Timer Input Capture/Output Compare Registers

Figure 34. Detailed Timer Block Diagram

4.19.4.2 Prescaler

The prescaler divides the bus clock by 1, 2, 4, 8, 16, 32, 64, or 128. The prescaler select bits, PR[2:0], select the prescaler divisor. PR[2:0] are in the timer system control register 2 (TSCR2).

4.19.4.3 Input Capture

timer transfers the value in the timer counter into the timer channel registers, TCn. The minimum pulse width for the input capture input is greater than two bus clocks. An input capture on channel n sets the CnF flag. The CnI bit enables the CnF flag to generate interrupt requests.

4.19.4.4 Output Compare

the CnF flag. The CnI bit enables the CnF flag to generate interrupt requests. disconnects the pin from the output logic.

being used as the pulse accumulator input. Writing to the timer port bit of an output compare pin does not affect the pin state. The value written is stored in an internal latch. When the pin becomes available for general-purpose output, the last value written to the bit appears at the pin.

4.19.5 Resets

4.19.5.1 General

details the registers and their bit-fields.

4.19.6 Interrupts

4.19.6.1 General

4.19.6.2 Description of Interrupt Operation

4.19.6.2.1 Channel [3:0] Interrupt

register should be set. These interrupts are serviced by the system controller.

4.19.6.2.2 Timer Overfl ow Interrupt (TOF)

when the overflow enable bit (TOI) bit of TFLG2 register is set. This interrupt is serviced by the system controller. Table 196. TIM16B4C Interrupts

4.20 Analog Digital Converter - ADC

4.20.1 Introduction

4.20.1.1 Overview

and high precision conversions. Figure 35. Analog Digital Converter Block Diagram

4.20.1.2 Features

  • 10-bit resolution
  • 13 µs (typ.), 10-bit Single Sample + Conversion Time
  • External ADC2p5 pin with over-current protection to filter the analog reference voltage
  • Total Error (TE) of ± 5 LSB without offset calibration active
  • Integrated selectable offset compensation
  • 14 + 1 analog channels (AD0…8; ISENSE, TSENSE and VSENSE, VS1SENSE, BANDGAP, plus calibration channel)
  • Sequence- and Continuous Conversion Mode with IRQ for Sequence Complete indication
  • Dedicated Result register for each channel

4.20.2 Modes of Operation

The Analog Digital Converter Module is active only in normal mode; it is disabled in Sleep and Stop mode.

4.20.3 External Signal Description

controlled by the Analog Digital Converter Module.

4.20.4 Memory Map and Register Definition

4.20.4.1 Module Memory Map

Table 197. ADC - Pin Functions and Priorities Table 198. Analog Digital Converter Module - Memory Map

4.20.4.2 Register Definition

4.20.4.2.1 ADC Config Register (ACR)

  1. Offset related to 0x0200 for bloc king access and 0x300 for non blocking access within the global address space.

Table 199. ADC Config Register (ACR)

  1. Offset related to 0x0200 for blocking access and 0x3 00 for non blocking access within the global address space.

Table 200. ACR - Register Field Descriptions

ADCRST is strongly recommended to be set during D2D clock frequency changes.

4.20.4.2.2 ADC Status Register (ASR)

4.20.4.2.3 ADC Conv ersion Control Register (ACCR)

Table 201. ADC Status Register (ASR)

  1. Offset related to 0x0200 for blocking access and 0x300 fo r non blocking access within the global address space.

Table 202. ACR - Register Field Descriptions 7 - SCF Sequence Complete Flag. Reading the ADC St atus Register (ASR) will clear the Flag. Table 203. ADC Conversion Control Register (ACCR)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 204. ACCR - Register Field Descriptions Channel 15, if selected. Write to the Low Byte will not start a conversion. offset compensation functional.

4.20.4.2.4 ADC Conversi on Complete Status Register (ACCSR)

4.20.4.2.5 ADC Data Resu lt Register x (ADRx)

4.20.5 Functional Description

4.20.5.1 Analog Channel Definitions

Table 205. ADC Conversion Complete Status Register (ACCSR)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 206. ACCSR - Register Field Descriptions recommended. 8-Bit read will return the current status, no latching will be performed. Table 207. ADC Data Result Register x (ADRx)

  1. Offset related to 0x0200 for bloc king access and 0x300 for non blocking access within the global address space.

Table 208. ADRx - Register Field Descriptions high byte will clear the cc flag. Table 209. Analog Channels

0 AD0 - PTB0 Analog Input AD0

1 AD1 - PTB1 Analog Input AD1

2 AD2 - PTB2 Analog Input AD2

3 AD3 - L0 Analog Input AD3

4 AD4 - L1 Analog Input AD4

5 AD5 - L2 Analog Input AD5

6 AD6 - L3 Analog Input AD6

4.20.5.2 Automatic Of fset Compensation

content. See Section 4.26, “MM912_634 - Analog Die Trimming. The reference is factory trimmed to 8 LSB. work with single and sequence conversion. Figure 36. Automatic Offset Compensation

4.20.5.3 Conversion Timing

needs to be configured to have the ADCCLK match the specified fADC clock limits.

7 AD7 - L4 Analog Input AD7

8 AD8 - L5 Analog Input AD8

9 Current Sense ISENSE

10 Voltage Sense VSENSE

11 Temperature Sense TSENSE

12 VS1 Sense VS1SENSE

14 Bandgap (133) BANDGAP

15 Calibration Reference CAL

  1. Internal “bg1p25sleep” reference.

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 140 A conversion is divided into the following 27+ clock cycles:

  • 9 cycle sampling time
  • 18 cycle remaining conversion time
  • A worst case (only channel 14) of 15 clock cycles to count up to the selected channel (15, 0, 1,....14)
  • 4 cycles between two channels Example 1. Single Conversion Channel 10 (VSENSE) 12c (count up to Ch10) + 9c (sample) + 18c (conversion) = 39 cycles from start to end of conversion. Example 2. Sequence of Channel 10 (VSENSE) + Channel 15 (Offset Compensation) 1c (count) + 9c (sample Ch15) + 18c (conversion Ch15) + 4c (in between) + 0c (count further to Ch10 is performed while converting ch15) + 9c (sample) + 18c (conversion) = 59 cycles from start to end of both conversions.

4.21 Current Sense Module - ISENSE

Figure 37. Current Sense Module with External Filter Option eight different GAIN setting are implemented.

4.21.1 Register Definition

4.21.1.1 Current Sense Register (CSR)

Table 210. Current Sense Register (CSR)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

Table 211. CSR - Register Field Descriptions

  1. This feature should be used when implementi ng an external filter to the current sense ISENSEx inputs. In principal an internal charge

compensation is activated in synch with the conversion to avoid the sample capacitors to be discharged by the external filter.

4.22 Temperature Sensor - TSENSE

To be able to measure the current MM912_634 analog die chip temperature, the TSENSE feature is implemented. A constant temperature related gain of TSG can be routed to the internal Analog Digital Converter (Channel 11). Figure 38. TSENSE - Graph Refer to the Section 4.20, “Analog Digital Converter - ADC for details on the channel selection and analog measurement. system power up and wake-up.

4.23 Supply Voltage Sense - VSENSE

conditions without delay. A series resistor is required to protect the MM912_634 analog die from fast transients. Figure 39. VSENSE Module interrupt (LBI) to alert the MCU. Section 4.20, “Analog Digital Converter - ADC.

4.24 Internal Supply Voltage Sense - VS1SENSE

Section 4.20, “Analog Digital Converter - ADC for details on the acquisition. Figure 40. VS1Sense Module

4.25 Internal Bandgap Refere nce Voltage Sense - BANDGAP

or the 2p5sleep Bandgap circuity.

  1. The maximum allowed sample frequency for Channel 14 is limit ed to fCH14. Increasing the sample frequency above can result in

unwanted turn off of the LS drivers due to a false VREG over-voltage.

4.26 MM912_634 - Analog Die Trimming

have to be copied into the MM912_634 analog die trimming registers. The trimming registers will maintain their content during Low Power mode, Reset will set the default value.

4.26.1 Memory Map and Register Definition

4.26.1.1 Module Memory Map

analog die trimming registers. The following table shows the register correlation. SLPBG_LOCK bit has to stay at 0. is locked, no other trim on the parameter is possible. Table 212. MM912_634 Analog Die Trimming Registers

2 OFFCTR1 OFFCTR0 CTR3_E CTR3_2 CTR3_1 CTR3_0

  1. Offset related to 0x0200 for bloc king access and 0x300 for non blocking access within the global address space.

Table 213. MM912_634 - MCU vs. Analog Die Trimming Register Correlation

  1. Offset related to 0x0200 for blocking access and 0x300 fo r non blocking access within the global address space.

4.26.1.2 Register Descriptions

4.26.1.2.1 Trimming Register 0 (CTR0)

4.26.1.2.2 Trimming Register 1 (CTR1)

Table 214. Trimming Register 0 (CTR0)

  1. Offset related to 0x0200 for bloc king access and 0x300 for non blocking access within the global address space.

Table 215. CTR0 - Register Field Descriptions Table 216. Trimming Register 1 (CTR1)

  1. Offset related to 0x0200 for bloc king access and 0x300 for non blocking access within the global address space.

4.26.1.2.3 Trimming Register 2 (CTR2)

Table 217. CTR1 - Register Field Descriptions Table 218. Trimming Register 2 (CTR2)

  1. Offset related to 0x0200 for blocking access and 0x300 for non blocking access within the global address space.

4.26.1.2.4 Trimming Register 3 (CTR3)

Table 219. CTR2 - Register Field Descriptions VDDx over-voltage detection. Table 220. Trimming Register 3 (CTR3)

  1. Offset related to 0x0200 for bloc king access and 0x300 for non blocking access within the global address space.

Table 221. CTR3 - Register Field Descriptions

MM912_634 - MCU Die Overview MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 150

4.27 MM912_634 - MCU Die Overview

4.27.1 Introduction

The MC9S12I64 micro controller implemented in the MM912_634 is designed as counter part to an analog die, and is not being offered as a standalone MCU. The MC9S12I64 device contains a S12 Central Processing Unit (CPU), offers 64kB of Flash memory and 6.0 kB of system SRAM, up to eight general purpose I/Os, an on-chip oscillator and clock multiplier, one Serial Peripheral Interface (SPI), an interrupt module and debug capabilities via the on-chip debug module (DBG) in combination with the Background Debug Mode (BDM) interface. Additionally there is a die-to-die initiator (D2DI) which represents the communication interface to the companion (analog) die.

4.27.2 Features

This section describes the key features of the MC9S12I64 micro controller unit.

4.27.2.1 Chip-Level Features

On-chip modules available within the family include the following features:

  • S12 CPU core (CPU12_V1)
  • Kbyte on-chip flash with ECC
  • 4.0 kbyte on-chip data flash with ECC
  • 6.0 kbyte on-chip SRAM
  • Phase locked loop (IPLL) frequency multiplier with internal filter
  • 4–16 MHz amplitude controlled Pierce oscillator
  • 1.0 MHz internal RC oscillator
  • One serial peripheral interface (SPI) module
  • On-chip voltage regulator (VREG) for regulation of input supply and all internal voltages
  • Die to Die Initiator (D2DI)

4.27.3 Module Features

The following sections provide more details of the modules implemented on the MC9S12I64.

4.27.3.1 S12 16-Bit Centra l Processor Unit (CPU)

S12 CPU is a high-speed 16-bit processing unit:

  • Full 16-bit data paths supports efficient arithmetic operation and high-speed math execution
  • Includes many single-byte instructions. This allows much more efficient use of ROM space.
  • Extensive set of indexed addr essing capabilities, including: — Using the stack pointer as an indexing register in all indexed operations — Using the program counter as an indexing regi ster in all but auto increment/decrement mode — Accumulator offsets using A, B, or D accumulators — Automatic index pre-decrement, pre-increment, post-decrement, and post-increment (by –8 to +8)

4.27.3.2 On-Chip Flash with ECC

On-chip flash memory on the MC9S12I64 features the following:

  • kbyte of program flash memory — 32 data bits plus 7 syndrome ECC (Error Correction Code) bits allow single bit error correction and double fault detection — Erase sector size 512 bytes — Automated program and erase algorithm — User margin level setting for reads — Protection scheme to prevent accidental program or erase ANALOGMCU

MM912_634 - MCU Die Overview MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 151

  • 4.0 kbyte data flash memory — 16 data bits plus 6 syndrome ECC (Error Correction Code) bits allow single bit error correction and double-bit error detection — Erase sector size 256 bytes — Automated program and erase algorithm — User margin level setting for reads

4.27.3.3 On-Chip SRAM

6.0 kBytes of general-purpose RAM

4.27.3.4 Main External Oscillator (XOSC)

Loop controlled Pierce oscillator using a 4.0 MHz to 16 MHz crystal or resonator — Current gain control on amplitude output — Signal with low harmonic distortion — Low power — Good noise immunity — Eliminates need for external current limiting resistor — Transconductance sized for optimum start-up margin for typical crystals

4.27.3.5 Internal RC Oscillator (IRC)

Trimmable internal reference clock.

4.27.3.6 Intern al Phase-locked Loop (IPLL)

Phase-locked loop clock frequency multiplier — No external components required — Reference divider and multiplier allow large variety of clock rates — Automatic bandwidth control mode for low-jitter operation — Automatic frequency lock detector — Configurable option to spread spectrum for reduced EMC radiation (frequency modulation) — Reference clock sources: – External 4.0 to 16 MHz resonator/crystal (XOSC) – Internal 1.0 MHz RC oscillator (IRC)

4.27.3.7 System Integrity Support

  • Power-on reset (POR)
  • System reset generation
  • Illegal address detection with reset
  • Low-voltage detection with interrupt or reset
  • Real time interrupt (RTI)
  • Computer operating properly (COP) watchdog — Configurable as window COP for enhanced failure detection — Initialized out of reset using option bits located in flash memory
  • Clock monitor supervising the co rrect function of the oscillator

4.27.3.8 Serial Peripheral Interface Module (SPI)

  • Configurable 8 or 16-bit data size
  • Full-duplex or single-wire bidirectional
  • Double-buffered transmit and receive
  • Master or slave mode
  • MSB-first or LSB-first shifting
  • Serial clock phase and polarity options

MM912_634 - MCU Die Overview MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 152

4.27.3.9 On-Chip Voltage Regulator (VREG)

  • Linear voltage regulator with bandgap reference
  • Low-voltage detect (LVD) with low-voltage interrupt (LVI)
  • Power-on reset (POR) circuit
  • Low-voltage reset (LVR)

4.27.3.10 Background Debug (BDM)

  • Non-intrusive memory access commands
  • Supports in-circuit programming of on-chip nonvolatile memory

4.27.3.11 Debugger (DBG)

  • Trace buffer with depth of 64 entries
  • Three comparators (A, B and C) — Comparator A compares the full address bus and full 16-bit data bus — Exact address or address range comparisons
  • Two types of comparator matches — Tagged: This matches just before a s pecific instruction begins execution — Force: This is valid on the first instruction boundary after a match occurs
  • Four trace modes
  • Four stage state sequencer

4.27.3.12 Die to Die Initiator (D2DI)

  • Up to 2.0 Mbyte/s data rate
  • Configurable 4-bit or 8-bit wide data path Figure 4.27.4 shows MC9S12I64 CPU and BDM local address translation to the global memory map. It indicates also the location of the internal resources in the memory map. The whole 256 k global memory space is visible through the P-Flash window located in the 64 k local memory map located at 0x8000 - 0xBFFF using the PPAGE register.

Figure 41. MC9S12I128 Global Memory Map

4.27.4 Part ID Assignments

unique part ID for each revision of the chip. Table 222 shows the assigned part ID number and Mask Set number.

4.27.5 System Clock Description

For the system clock description please refer to 4.38, “S12 Clock, Reset and Power Management Unit (S12CPMU)”.

4.27.6 Modes of Operation

module status whilst the background debug module is active to facilitate debugging.

4.27.6.1 Chip Conf iguration Summary

The different modes and the security state of the MCU affect the debug features (enabled or disabled). MODC signal is latched into this bit on the rising edge of RESET.

4.27.6.1.1 Normal Single-Chip Mode

the reset vector to be programmed correctly). The processor program is executed from internal memory.

4.27.6.1.2 Special Single-Chip Mode

additional serial commands through the BKGD pin.

4.27.6.2 Low Power Operation

4.27.7 Security

Table 222. Assigned Part ID Numbers

  1. The coding is as follows:

Table 223. Chip Modes

4.27.8 Resets and Interrupts

Consult the S12 CPU manual and the S12SINT section for information on exception processing.

4.27.8.1 Resets

4.27.8.2 Interru pt Vectors

(S12SINTV1)”) provides an interrupt vector base register (IVBR) to relocate the vectors. Table 224. Reset Sources and Vector Locations Table 225. Interrupt Vector Locations (Sheet 1 of 2)

4.27.8.3 Effects of Reset

When a reset occurs, MCU registers and control bits are initialized. Refer to the respective block sections for register reset states. On each reset, the Flash module executes a reset sequence to load Flash configuration registers.

4.27.8.3.1 Flash Configuration Reset Sequence Phase

more detail in the Flash module Section 4.40.6, “Initialization”.

4.27.8.3.2 Reset While Flash Command Active

programmed or the sector/block being erased is not guaranteed.

4.27.8.3.3 I/O Pins

Refer to the PIM section for reset configurations of all peripheral module ports.

4.27.8.3.4 Memory

The RAM arrays are not initialized out of reset.

4.27.9 COP Configuration

global address 0x3_FF0E during the reset sequence.

  1. 16 bits vector address based

Table 226. Initial COP Rate Configuration Table 227. Initial WCOP Configuration Table 225. Interrupt Vector Locations (Sheet 2 of 2)

4.28 Port Integrati on Module (S12IPIMV1)

4.28.1 Introduction

Die-To-Die Interface module (D2DI) to the I/O pins of the MCU. prioritization and multiplexing on shared pins. Figure 42. Block Diagram

4.28.1.1 Features

  • 8-pin port A associated with the SPI module
  • 2-pin port C used as D2DI clock output and D2DI interrupt input
  • 8-pin port D used as 8 or 4 bit data I/O for the D2DI module
  • 2-pin port E associated with the CPMU OSC module
  • GPIO function shared on port A, E pins
  • Pull-down devices on PC1 and PD7-0 if used as D2DI inputs
  • Reduced drive capability on PC0 and PD7-0 on per pin basis The Port Integration Module includes these distinctive registers:
  • Data registers for ports A, E when used as general-purpose I/O
  • Data direction registers for ports A, E when used as general-purpose I/O
  • Port input register on ports A and E
  • Reduced drive register on port C and D

4.28.2 Memory Map and Register Definition

This section provides a detailed description of all Port Integration Module registers.

4.28.2.1 Memory Map

4.28.2.2 Port A Data Register (PORTA)

Figure 43. Port A Data Register (PORTA)

4.28.2.3 Port E Data Register (PORTE)

Table 228. PORTA Register Field Descriptions Port A general purpose input/output data—Data RegisterIn output mode the register bit is driven to the pin. synchronized pin input state is read. When not used with the alternative function, this pin can be used as general purpose I/O. In general purpose output mode the register bit is driven to the pin.

  • The SPI function takes precedence over t he general purpose I/O function if enabled. PA Port A general purpose input/output data—Data Register, SPI SCK input/output When not used with the alternative function, this pin can be used as general purpose I/O. In general purpose output mode the register bit is driven to the pin. If the associated data direction bit of this pin is set to 1, a read returns the value of the port register, otherwise the buffered pin input state is read.
  • The SPI function takes precedence over t he general purpose I/O function if enabled. PA Port A general purpose input/output data—Data Register, SPI MOSI input/output When not used with the alternative function, this pin can be used as general purpose I/O. In general purpose output mode the register bit is driven to the pin. If the associated data direction bit of this pin is set to 1, a read returns the value of the port register, otherwise the buffered pin input state is read.
  • The SPI function takes precedence over t he general purpose I/O function if enabled. PA Port A general purpose input/output data—Data Register, SPI MISO input/output When not used with the alternative function, this pin can be used as general purpose I/O. In general purpose output mode the register bit is driven to the pin. If the associated data direction bit of this pin is set to 1, a read returns the value of the port register, otherwise the buffered pin input state is read.
  • The SPI function takes precedence over t he general purpose I/O function if enabled.

Table 229. Port E Data Register (PORTE)

4.28.2.4 Port A Data Direction Register (DDRA)

4.28.2.5 Port E Data Direction Register (DDRE)

Table 230. PORTE Register Field Descriptions When not used with the alternative function, this pin can be used as general purpose I/O. In general purpose output mode the register bit is driven to the pin.

  • The CPMU OSC function takes precedence ov er the general purpose I/O function if enabled. PE Port E general purpose input/output data—Data Register, CPMU OSC EXTAL signal When not used with the alternative function, this pin can be used as general purpose I/O. In general purpose output mode the register bit is driven to the pin. If the associated data direction bit of this pin is set to 1, a read returns the value of the port register, otherwise the buffered pin input state is read.
  • The CPMU OSC function takes precedence ov er the general purpose I/O function if enabled.

Figure 44. Port A Data Direction Register (DDRA) Table 231. DDRA Register Field Descriptions Port A Data Direction— This bit determines whether the associated pin is an input or output. 1 Associated pin is configured as output. 0 Associated pin is configured as input. Port A Data Direction— This bit determines whether the associated pin is an input or output. 1 Associated pin is configured as output. 0 Associated pin is configured as input. Figure 45. Port E Data Direction Register (DDRE)

4.28.2.6 PIM Reserved Registers

These registers are reserved for factory testing of the PIM module. Writing to these addresses can alter the module functionality.

4.28.2.7 Pull Contro l Register (PUCR)

Table 232. DDRE Register Field Descriptions connects the associated pins directly to the oscillator module. In this case the data direction bits will not change. 1 Associated pin is configured as output. 0 Associated pin is configured as input. Table 233. PIM Reserved Registers

  1. Read: Always reads 0x00

Table 234. Pull Control Register (PUCR) Table 235. PUCR Register Field Descriptions pin is used as input. This bit has no effect if the pin is used as output. Out of reset the pull-up device is enabled. are enabled. If the CPMU OSC function is active the pull-down devices are disabled. In this case the register bit will not change. 1 Pull-down devices enabled. 0 Pull-down devices disabled.

4.28.2.8 Reduced Drive Register (RDRIV)

4.28.2.9 Port A Input Register (PTIA)

Table 236. Reduced Drive Register (RDRIV) Table 237. RDRIV Register Field Descriptions or reduced. If a pin is used as input this bit has no effect.

1 Reduced drive selected (1/5 of the full drive strength)

0 Full drive strength enabled

pin as either full or reduced. Table 238. Port A Input Register (PTIA) Write: Unimplemented. Writing to this register has no effect.

  1. u = Unaffected by reset

Table 239. PTIA Register Field Descriptions circuit conditions on output pins.

4.28.2.10 Port E Input Register (PTIE)

4.28.2.11 PIM Reserved Registers

4.28.3 Functional Description

4.28.3.1 Registers

4.28.3.1.1 Data register (PORTx)

This register holds the value driven out to the pin if the pin is used as a general purpose I/O. buffered and synchronized state of the pin is returned if the associated data direction register bit is set to “0”. other configuration (Figure 46).

4.28.3.1.2 Data direct ion register (DDRx)

data direction register is ignored (Figure 46).

4.28.3.1.3 Input register (PTIx)

This is a read-only register and always returns the buffered and synchronized state of the pin (Figure 46). Table 240. Port E Input Register (PTIE) Write: Unimplemented. Writing to this register has no effect.

  1. u = Unaffected by reset

Table 241. PTIE Register Field Descriptions circuit conditions on output pins. Table 242. PIM Reserved Register Write: Unimplemented. Writing to this register has no effect.

Figure 46. Illustration of I/O Pin Functionality

4.28.3.1.4 Reduced Driv e Register (RDRIV)

If the pin is used as an output this register allows the configuration of the drive strength.

4.28.3.1.5 Pull Device Enable Register (PUCR)

This register turns on a pull-up or pull-down device. It becomes active only if the pin is used as an input.

4.28.3.2 Ports

4.28.3.2.1 Port A

4.28.3.2.2 Port C

generation of a wake-up interrupt.

4.28.3.2.3 Port D

enabled on all pins if used as D2DI inputs.A reduced drive strength can be selected on all pins if used as D2DI outputs.

4.28.3.2.4 Port E

This port is associated with the CPMU OSC. Port E pins PE1-0 can be used for general-purpose or with the CPMU OSC module.

4.28.4 Initializat ion Information

4.28.4.1 Port Data and Data Direction Register writes

may have extra transitions during the write access. Initialize the port data register before enabling the outputs.

4.29 Memory Map Co ntrol (S12PMMCV1)

4.29.1 Introduction

4.29.1.1 Glossary

4.29.1.2 Overview

responsible for constraining memory accesses on secured devices and for selecting the MCU’s functional mode.

4.29.1.3 Features

  • Paging capability to support a global 256 kByte memory address space
  • Bus arbitration between the masters CP U12, S12SBDM to different resources.
  • MCU operation mode control
  • MCU security control
  • Separate memory map schemes for each master CPU12, S12SBDM
  • Generation of system reset when CPU12 accesses an unimp lemented address (i.e., an address which does not belong to any of the on-chip modules) in single-chip modes

4.29.1.4 Modes of Operation

The S12PMMC selects the MCU’s functional mode. It also determines the devices behavior in secured and unsecured state.

4.29.1.4.1 Functional Modes

  • Normal Single Chip (NS) The mode used for running applications.
  • Special Single Chip Mode (SS) A debug mode which causes the device to enter BDM Active Mode after each reset. Peripherals may also provide special debug features in this mode.

Table 243. Glossary Of Terms Aligned Bus Access Bus acce ss to an even address. Misaligned Bus Access Bus access to an odd address. Unimplemented Address Ranges Address ranges wh ich are not mapped to any on-chip resource.

4.29.1.4.2 Security

permissions to the on-chip memories in secured and unsecured state.

4.29.1.5 Block Diagram

Figure 47 shows a block diagram of the S12PMMC. Figure 47. S12PMMC Block Diagram

4.29.2 External Signal Description

User Guide (DUG) for the mapping of these signals to device pins.

4.29.3 Memory Map and Registers

4.29.3.1 Module Memory Map

bits are given in the subsections that follow. Table 244. External System Pins Associated With S12PMMC (See DUG) RESET The RESET pin is used the select the MCU’s operating mode. determines the MCU’s operating mode.

4.29.3.2 Register Descriptions

This section consists of the S12PMMC control register descriptions in address order.

4.29.3.2.1 Mode Register (MODE)

Write: Only if a transition is allowed (see Figure 48). The MODC bit of the MODE register is used to select the MCU’s operating mode. Table 245. MMC Register Summary Table 246. Mode Register (MODE)

  1. External signal (see Table 244).

Figure 48. Mode Transition Diagram When MCU is Unsecured

4.29.3.2.2 Direct Page Register (DIRECT)

Write: anytime in special SS, write-one in NS. Figure 49. DIRECT Address Mapping Table 247. MODE Field Descriptions after the RESET signal goes inactive (see Figure 48). Write restrictions exist to disallow transitions between certain modes. Figure 48 illustrates all allowed mode changes. Write accesses to the MODE register are blocked when the device is secured. Table 248. Direct Register (DIRECT) Table 249. DIRECT Field Descriptions Direct Page Index Bits 15–8 — These bits are used by the CPU when performing accesses using the direct addressing mode. These register bits form bits [15:8] of the local address (see Figure 49).

MOVB #$80,DIRECT ;Set DIRECT register to 0x80. Write once only. ;Global data accesses to the range 0xXX_80XX can be direct. ;Logical data accesses to the range 0x80XX are direct. LDY <$00 ;Load the Y index register from 0x8000 (direct access). ;automatically select direct mode.

4.29.3.2.3 MMC Contro l Register (MMCCTL1)

The IFRON bit of the MMCCTL1 register is used to make IFR sector visible in the memory map. The RAMON and ROMON bits of the MMCCTL1 register are used to make Scratch-RAM and ROM visible in the memory map. Table 250. MMC Control Register (MMCCTL1) Table 251. MODE Field Descriptions This bit is used to make the FTMRC Scratch-RAM visible in the global memory map. 0 Not visible in the global memory map.

1 Visible in the global memory map and accessible via PPAGE 0x01

This bit is used to make the FTMRC ROM visible in the global memory map. 0 Not visible in the global memory map. This bit is used to make the IFR sector visible in the global memory map. 0 Not visible in the global memory map.

4.29.3.2.4 Program Page Index Register (PPAGE)

format. The CPU has special access to read and write this register directly during execution of CALL and RTC instructions. Figure 50. PAGE Address Mapping complete before the end of the instruction execution. and RAM space. See SoC Guide for details. The fixed 16 kB page from 0x4000–0x7FFF is the page number 0x0D. The reset value of 0x0E ensures that there is linear Flash space available between addresses 0x0000 and 0xFFFF out of reset. The fixed 16 kB page from 0xC000-0xFFFF is the page number 0x0F.

4.29.4 Functional Description

Table 252. Program Page Index Register (PPAGE) Table 253. PPAGE Field Descriptions be accessed in the Program Page Window.

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 171

4.29.4.1 MCU Operating Modes

  • Normal single chip mode This is the operation mode for running application code. There is no external bus in this mode.
  • Special single chip mode This mode is generally used for debugging operation, boot-strapping or security related operations. The active background debug mode is in control of the CPU code execution and the BDM firmware is waiting for serial commands sent through the BKGD pin.

4.29.4.2 Memory Map Scheme

4.29.4.2.1 CPU and BDM Memory Map Scheme

The BDM firmware lookup tables and BDM register memory locations share addresses with other modules; however they are not visible in the memory map during user’s code execution. The BDM memory resources are enabled only during the READ_BD and WRITE_BD access cycles to distinguish between accesses to the BDM memory area and accesses to the other modules. (Refer to BDM Block Guide for further details). When the MCU enters active BDM mode, the BDM firmware lookup tables and the BDM registers become visible in the local memory map in the range 0xFF00-0xFFFF (global address 0x3_FF00 - 0x3_FFFF) and the CPU begins execution of firmware commands or the BDM begins execution of hardware commands. The resources which share memory space with the BDM module will not be visible in the memory map during active BDM mode. Please note that after the MCU enters active BDM mode the BDM firmware lookup tables and the BDM registers will also be visible between addresses 0xBF00 and 0xBFFF if the PPAGE register contains value of 0x0F. Expansion of the CPU Local Address Map The program page index register in S12PMMC allows accessing up to 256 kB of P-Flash in the global memory map by using the four index bits (PPAGE[3:0]) to page 16x16 kB blocks into the program page window located from address 0x8000 to address 0xBFFF in the local CPU memory map. The page value for the program page window is stored in the PPAGE register. The value of the PPAGE register can be read or written by normal memory accesses as well as by the CALL and RTC instructions (see Section 4.29.6.1, “CALL and RTC Instructions). Control registers, vector space and parts of the on-chip memories are located in unpaged portions of the 64 kB local CPU address space. The starting address of an interrupt service routine must be located in unpaged memory unless the user is certain that the PPAGE register will be set to the appropriate value when the service routine is called. However an interrupt service routine can call other routines that are in paged memory. The upper 16 kB block of the local CPU memory space (0xC000–0xFFFF) is unpaged. It is recommended that all reset and interrupt vectors point to locations in this area or to the other unmapped pages sections of the local CPU memory map. Expansion of the BDM Local Address Map PPAGE and BDMPPR register is also used for the expansion of the BDM local address to the global address. These registers can be read and written by the BDM. The BDM expansion scheme is the same as the CPU expansion scheme. The four BDMPPR Program Page index bits allow access to the full 256 kB address map that can be accessed with 18 address bits. The BDM program page index register (BDMPPR) is used only when the feature is enabled in BDM and, in the case the CPU is executing a firmware command which uses CPU instructions, or by a BDM hardware commands. See the BDM Block Guide for further details. (see Figure 51).

Figure 51. BDMPPR Address Mapping

Figure 52. Local to Global Address Mapping

0 P0P1P2P3000

4.29.5 Implemented Memory in the System Memory Architecture

means less implemented pages. All non implemented pages are called unimplemented areas.

  • Registers has a fixed size of 1.0 kB, accessible via xbus0.
  • SRAM has a maximum size of 11 kB, accessible via xbus0.
  • D-Flash has a fixed size of 4.0 kB accessible via xbus0.
  • P-Flash has a maximum size of 224 kB, accessible via xbus0.
  • NVM resources (IFR, Scratch-RAM, ROM) including D- Flash have maximum size of 16 kB (PPAGE 0x01). These resources are visible on the memory map by enabling the appropriate bits on MMCCTL1 register (see Figure 250)

4.29.5.0.1 Implemented Memory Map

module. Size of the individual internal resources are however fixed in the design of the device cannot be changed by the user. resources. Please note that the memory spaces have fixed top addresses. Table 254. Global Implemented Memory Space

  1. RAMSIZE is the hexadecimal value of RAM SIZE in bytes
  2. FLASHSIZE is the hexadecimal value of FLASH SIZE in bytes

Figure 53. Implemented Global Address Mapping

4.29.5.1 Chip Bus Control

are connected to specific target buses (see Figure 54).

Figure 54. S12I Platform

4.29.5.1.1 Master Bus Priori tization regarding Access Conflicts on Target Buses

  • CPU12 always has priority over BDM.
  • BDM has priority over CPU12 when its access is stalled for more than 128 cycles. In the later case the CPU will be stalled after finishing the current operation and the BDM will gain access to the bus.

4.29.5.2 Interrupts

The MMC does not generate any interrupts.

4.29.6 Initialization/A pplication Information

4.29.6.1 CALL and RTC Instructions

memory map. Execution then begins at the address of the called subroutine.

  1. Writes the current PPAGE value into an internal tempor ary register and writes the new instruction-supplied PPAGE
  2. Calculates the address of the next instruction after the CALL instruction (the return address) and pushes this 16-bit value
  3. Pushes the temporarily stor ed PPAGE value onto the stack
  4. Calculates the effective address of the subroutine, refills the queue and begins execution at the new address

can be performed from any address to any other address in the local CPU memory space. values calculated at run time rather than immediate values that must be known at the time of assembly.

4.30 Interrupt Module (S12SINTV1)

4.30.1 Introduction

  • I bit and X bit maskable interrupt requests
  • A non-maskable unimplemented op-code trap
  • A non-maskable software interrupt (SWI) or background debug mode request
  • Three system reset vector requests
  • A spurious interrupt vector Each of the I bit maskable interrupt requests is assigned to a fixed priority level.

4.30.1.1 Glossary

Table 255 contains terms and abbreviations used in the document.

4.30.1.2 Features

  • Interrupt vector base register (IVBR)
  • One spurious interrupt vector (at address vector base (160) + 0x0080).
  • 2–58 I bit maskable interrupt vector requests (at addresses vector base + 0x0082–0x00F2).
  • I bit maskable interrupts can be nested.
  • One X bit maskable interrupt vector request (at address vector base + 0x00F4).
  • One non-maskable software interrupt request (SWI) or ba ckground debug mode vector request (at address vector base + 0x00F6).
  • One non-maskable unimplemented op-code trap (TR AP) vector (at address vector base + 0x00F8).
  • Three system reset vectors (a t addresses 0xFFFA–0xFFFE).
  • Determines the highest priority interrupt vector reques ts, drives the vector to the bus on CPU request
  • Wakes up the system from stop mode when an appropriate interrupt request occurs. Note: 160. The vector base is a 16-bit address which is accumulated from the contents of the interrupt vector base register (IVBR, used as upper byte) and 0x00 (used as lower byte).

4.30.1.3 Modes of Operation

  • R u n m o d e This is the basic mode of operation.
  • Stop Mode In stop mode, the clock to the INT module is disabled. The INT module is however capable of waking-up the CPU from
  • Freeze mode (BDM active) In freeze mode (BDM active), the interrupt vector base register is overridden internally. Please refer to

4.30.1.4 Block Diagram

Figure 55 shows a block diagram of the INT module. Table 255. Terminology

Figure 55. INT Block Diagram

4.30.2 External Signal Description

The INT module has no external signals.

4.30.3 Memory Map and Register Definition

This section provides a detailed description of all registers accessible in the INT module.

4.30.3.1 Register Descriptions

This section describes in address order all the INT registers and their individual bits.

4.30.3.1.1 Interrupt Vector Base Register (IVBR)

Table 256. Interrupt Vector Base Register (IVBR) Table 257. IVBR Field Descriptions are set to 0xFF (i.e., vectors are located at 0xFF80–0xFFFE) to ensure compatibility to HCS12. non-maskable interrupts in the BDM firmware.

4.30.4 Functional Description

4.30.4.1 S12S Exception Requests

4.30.4.2 Interrupt Prioritization

one interrupt request is pending, the interrupt request with the higher vector address wins the prioritization. The following conditions must be met for an I bit maskable interrupt request to be processed.

  1. The local interrupt enabled bit in the peripheral module must be set.
  2. The I bit in the condition code regist er (CCR) of the CPU must be cleared.
  3. There is no SWI, TRAP , or X bit maskable request pending.

interrupt requests, e.g., by nesting SWI or TRAP calls. highest priority vector and the system will process this interrupt request first, before the original interrupt request is processed.

4.30.4.3 Reset Exception Requests

  1. Pin reset, power-on reset or illegal addre ss reset, low voltage reset (if applicable)
  2. Clock monitor reset request
  3. COP watchdog reset request

4.30.4.4 Exception Priority

Table 258. Exception Vector Map and Priority

4.30.5 Initialization/A pplication Information

4.30.5.1 Init ialization

  1. Initialize the interrupt vector base register if the interrupt vector table is not located at the default location
  2. Enable I bit maskable interrupts by clearing the I bit in the CCR.
  3. Enable the X bit maskable interrupt by clearing the X bit in the CCR.

4.30.5.2 Interru pt Nesting

interrupt requests can be interrupted by an interrupt request with a higher priority. I bit maskable interrupt requests can interrupt the current ISR.

  1. Service interrupt, e.g., clear interrupt flags, copy data, etc.
  2. Clear I bit in the CCR by executing the instruction CLI (thus allowing other I bit maskable interrupt requests)
  3. Return from interrupt by executing the instruction RTI

4.30.5.3 Wake-up from Stop Mode

4.30.5.3.1 CPU Wake-up from Stop Mode

I bit in the CCR is set, all I bit maskable interrupts are masked from waking-up the MCU. The X bit maskable interrupt request can wake up the MCU from stop mode at anytime, even if the X bit in CCR is set. If the X bit maskable interrupt request is used to wake-up the MCU with the X bit in the CCR set, the associated ISR is not called. until the system begins execution of the instruction following the WAI or STOP instruction; otherwise, wake-up may not occur.

  1. 16 bits vector address based
  2. D2D error interrupt on MCUs featuring a D2D initiator module, otherwise XIRQ pin interrupt
  3. D2D interrupt on MCUs featuring a D2D initiator module, otherwise IRQ pin interrupt

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 181

4.31 Background Debug Module (S12SBDMV1)

4.31.1 Introduction

This section describes the functionality of the background debug module (BDM) sub-block of the HCS12S core platform. The background debug module (BDM) sub-block is a single-wire, background debug system implemented in on-chip hardware for minimal CPU intervention. All interfacing with the BDM is done via the BKGD pin. The BDM has enhanced capability for maintaining synchronization between the target and host while allowing more flexibility in clock rates. This includes a sync signal to determine the communication rate and a handshake signal to indicate when an operation is complete. The system is backwards compatible to the BDM of the S12 family with the following exceptions:

  • TAGGO command not su pported by S12SBDM
  • External instruction tagging feat ure is part of the DBG module
  • S12SBDM register map and register content modified
  • Family ID readable from BDM ROM at global address 0x3_FF 0F in active BDM (value for devices with HCS12S core is 0xC2)
  • Clock switch removed from BDM (CLKSW bit removed from BDMSTS register)

4.31.1.1 Features

The BDM includes these distinctive features:

  • Single-wire communication with host development system
  • Enhanced capability for allowing more flexibility in clock rates
  • SYNC command to determine communication rate
  • GO_UNTIL(171) command
  • Hardware handshake protocol to increase the performance of the serial communication
  • Active out of reset in special single chip mode
  • Nine hardware commands using free cycles, if available, for minimal CPU intervention
  • Hardware commands not requiring active BDM
  • 14 firmware commands execute from the standard BDM firmware lookup table
  • When secured, hardware commands are allowed to access the r egister space in special single chip mode, if the Flash erase tests fail.
  • Family ID readable from BDM ROM at global address 0x3_FF 0F in active BDM (value for devices with HCS12S core is 0xC2)
  • BDM hardware commands are operational until system stop mode is entered

4.31.1.2 Modes of Operation

BDM is available in all operating modes but must be enabled before firmware commands are executed. Some systems may have a control bit that allows suspending the function during background debug mode.

4.31.1.2.1 Regular Run Modes

All of these operations refer to the part in run mode and not being secured. The BDM does not provide controls to conserve power during run mode.

  • Normal modes General operation of the BDM is available and operates the same in all normal modes.
  • Special single chip mode In special single chip mode, background operation is enabled and active out of reset.This allows programming a system with blank memory.

4.31.1.2.2 Secure Mode Operation

If the device is in secure mode, the operation of the BDM is reduced to a small subset of its regular run mode operation. Secure

4.31.1.2.3 Low-power Modes

The BDM can be used until stop mode is entered. The CPU cannot enter stop mode during BDM active mode.

BDM is now ready to receive a new command.

4.31.1.3 Block Diagram

A block diagram of the BDM is shown in Figure 56. Figure 56. BDM Block Diagram

4.31.2 External Signal Description

A single-wire interface pin called the background debug interface (BKGD) pin is used to communicate with the BDM system. becomes the dedicated serial interface pin for the background debug mode.

4.31.3 Memory Map and Register Definition

4.31.3.1 Module Memory Map

Table 259 shows the BDM memory map when BDM is active. Table 259. BDM Memory Map

4.31.3.2 Register Descriptions

communications to the BDM hardware using READ_BD and WRITE_BD commands. Table 260. BDM Register Summary

4.31.3.2.1 BDM Status Register (BDMSTS)

not apply in special single chip mode). firmware lookup table upon exit from BDM active mode. by the BDM hardware or standard firmware lookup table as part of BDM command execution. Table 261. BDM Status Register (BDMSTS)

  1. ENBDM is read as 1 by a debugging environment in special single chip mode when the device is not secured or secured but fully erased
  2. UNSEC is read as 1 by a debugging environment in special sing le chip mode when the device is secured and fully erased, else it is 0

and can only be read if not secure (see also bit description). Table 262. BDMSTS Field Descriptions

0 BDM disabled

1 BDM enabled

not be set until after the Flash erase verify tests are complete. of the exit sequence to return to user code and remove the BDM memory from the map.

0 BDM not active

1 BDM active

firmware or hardware read command or after data has been received as part of a BDM firmware or hardware write command. to control program flow execution.

0 Data phase of command not complete

1 Data phase of command is complete

the BDMCCR register is read zero.

4.31.3.2.2 BDM Program Page Index Register (BDMPPR)

first recognized. It will stay set until BDM firmware is exited by one of the following BDM commands: GO or GO_UNTIL(171).

0 TRACE1 command is not being executed

1 TRACE1 command is being executed

map overlapping the standard BDM firmware lookup table. turned off. If the erase test fails, the UNSEC bit will not be asserted. 0 System is in a secured mode. 1 System is in a unsecured mode. Note: When UNSEC is set, security is off and the user can change the state of the secure bits in the on-chip Flash EEPROM. is configured for unsecure mode. Table 263. BDM CCR Holding Register (BDMCCR) Table 264. BDM Program Page Register (BDMPPR) Table 262. BDMSTS Field Descriptions (continued)

4.31.3.3 Family ID Assignment

unique family ID which is 0xC2 for devices with an HCS12S core.

4.31.4 Functional Description

hardware and firmware commands. register (X), Y index register (Y), stack pointer (SP), and program counter (PC). commands can only be executed when the system is not secure and is in active background debug mode (BDM).

4.31.4.1 Security

hardware to be used to erase the Flash.

4.31.4.2 Enabling and Activating BDM

BDM status (BDMSTS) register, via the single-wire interface, using a hardware command such as WRITE_BD_BYTE.

  • Hardware BACKGROUND command
  • CPU BGND instruction
  • Breakpoint force or tag mechanism (167) When BDM is activated, the CPU finishes executing the current instruction and then begins executing the firmware in the standard BDM firmware lookup table. When BDM is activated by a breakpoint, the type of breakpoint used determines if BDM becomes active before or after execution of the next instruction. Note: 166. BDM is enabled and active immediatel y out of special single-chip reset. 167. This method is provided by the S12S_DBG module.

Table 265. BDMPPR Field Descriptions for global accesses even if the BGAE bit is set.

0 BDM Program Paging disabled

1 BDM Program Paging enabled

the program page window scheme, please refer to the S12S_MMC Block Guide.

BACKGROUND commands issued are ignored by the BDM and the CPU is not delayed. In active BDM, the BDM registers and standard BDM firmware lookup table are mapped to addresses 0x3_FF00 to 0x3_FFFF. the BDM. However, these registers are not readable by user programs. command before executing the GO command.

4.31.4.3 BDM Hardware Commands

Hardware commands are used to read and write target system memory locations and to enter active background debug mode. Target system memory includes all memory that is accessible by the CPU such as on-chip RAM, Flash, I/O and control registers. requires multiple cycles the CPU is frozen until the operation is complete, even though the BDM found a free cycle. The BDM hardware commands are listed in Table 266. the BDM to access BDM locations unobtrusively, even if the addresses conflict with the application memory map. Table 266. Hardware Commands part enters active background mode. ACK_ENABLE D5 None Enable Handshake. Issues an ACK pulse after the command is executed. ACK_DISABLE D6 None Disable Handshake. This command does not issue an ACK pulse. Read from memory with standard BDM firmware lookup table in map. Odd address data on low byte; even address data on high byte. Read from memory with standard BDM firmware lookup table in map. Read from memory with standard BDM firmware lookup table out of map. Odd address data on low byte; even address data on high byte. Write to memory with standard BDM firmware lookup table in map. Odd address data on low byte; even address data on high byte. Write to memory with standard BDM firmware lookup table in map. Write to memory with standard BDM firmware lookup table out of map. Odd address data on low byte; even address data on high byte. Write to memory with standard BDM firmware lookup table out of map.

  1. If enabled, ACK will occur when data is ready for transmission for all BDM READ commands and will occur after the write is complete

4.31.4.4 Standard BDM Firmware Commands

BACKGROUND is the usual way to activate BDM. watches for serial commands and executes them as they are received. The firmware commands are shown in Table 267.

4.31.4.5 BDM Command Structure

Table 267. Firmware Commands READ_NEXT(170) 62 16-bit data out Increment X index register by 2 (X = X + 2), then read word X points to. READ_PC 63 16-bit data out Read program counter. READ_D 64 16-bit data out Read D accumulator. READ_X 65 16-bit data out Read X index register. READ_Y 66 16-bit data out Read Y index register. READ_SP 67 16-bit data out Read stack pointer. WRITE_PC 43 16-bit data in Write program counter. WRITE_D 44 16-bit data in Write D accumulator. WRITE_X 45 16-bit data in Write X index register. WRITE_Y 46 16-bit data in Write Y index register. WRITE_SP 47 16-bit data in Write stack pointer. GO 08 none Go to user program. If enabled, ACK will occur when leaving active background mode. ACK will occur upon returning to active background mode. This command will be deprecated and should not be used anymore. Opcode will be executed as a GO command.

  1. If enabled, ACK will occur when data is ready for transmission for all BDM READ commands and will occur after the write is complete
  2. When the firmware command READ_NEXT or WRITE_NEXT is us ed to access the BDM address space the BDM resources are

accessed rather than user code. Writing BDM firmware is not possible.

  1. System stop disables the ACK function and ignored commands wi ll not have an ACK-pulse (e.g., CPU in stop mode). The GO_UNTIL

(see Section 4.31.4.7, “Serial Interface Hardware Handshake Protocol” last note).

address from the remaining bits. cycle before stealing a cycle. in the BDM shift register, ready to be shifted out. attempting to send a new command. This is to avoid disturbing the BDM shift register before the write has been completed. that the ACK (acknowledge function) is used to indicate when an operation is complete. When using ACK, the delay times are automated. Figure 57. BDM Command Structure

8 Bits

16 Bits

4.31.4.6 BDM Serial Interface

This clock will be referred to as the target clock in the following explanation. source of this speedup pulse is the host for transmit cases and the target for receive cases. earlier. Synchronization between the host and target is established in this manner at the start of every bit time. Since the host drives the high speedup pulses in these two cases, the rising edges look like digitally driven signals. Figure 58. BDM Host-to-Target Serial Bit Timing after the perceived start of the bit time. The host should sample the bit level about 10 target clock cycles after it started the bit time.

10 Cycles

Figure 59. BDM Target-to-Host Serial Bit Timing (Logic 1) cycles after starting the bit time. Figure 60. BDM Target-to-Host Serial Bit Timing (Logic 0)

4.31.4.7 Serial Interface Ha rdware Handshake Protocol

slowest possible rate the clock could be running. This sub-section will describe the hardware handshake protocol. pulse is generated by the target MCU when a command, issued by the host, has been successfully executed (see Figure 61). on any accurate time measurement or short response time to any event in the serial communication. Figure 61. Target Acknowledge Pulse (ACK) mode, the BDM command is no longer pending. of a word and the host needs to determine which is the appropriate byte based on whether the address was odd or even. Figure 62. Handshake Protocol at the Command Level

16 Cycles

32 Cycles

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 193 Differently from the normal bit transfer (where the host initiates the transmission), the serial interface ACK handshake pulse is initiated by the target MCU by issuing a negative edge on the BKGD pin. The hardware handshake protocol in Figure 61 specifies the timing when the BKGD pin is being driven, so the host should follow this timing constraint in order to avoid the risk of an electrical conflict on the BKGD pin. NOTE The only place the BKGD pin can have an electrical conflict is when one side is driving low and the other side is issuing a speedup pulse (high). Other “highs” are pulled rather than driven. However, at low rates the time of the speedup pulse can become lengthy and so the potential conflict time becomes longer as well. The ACK handshake protocol does not support nested ACK pulses. If a BDM command is not acknowledge by an ACK pulse, the host needs to abort the pending command first in order to be able to issue a new BDM command. When the CPU enters stop while the host issues a hardware command (e.g., WRITE_BYTE), the target discards the incoming command due to the stop being detected. Therefore, the command is not acknowledged by the target, which means that the ACK pulse will not be issued in this case. After a certain time the host (not aware of stop) should decide to abort any possible pending ACK pulse in order to be sure a new command can be issued. Therefore, the protocol provides a mechanism in which a command, and its corresponding ACK, can be aborted. NOTE The ACK pulse does not provide a timeout. This means for the GO_UNTIL(171) command that it can not be distinguished if a stop has been executed (command discarded and ACK not issued) or if the “UNTIL” condition (BDM active) is just not reached yet. Hence in any case where the ACK pulse of a command is not issued the possible pending command should be aborted before issuing a new command. See the handshake abort procedure described in Section 4.31.4.8, “Hardware Handshake Abort Procedure”.

4.31.4.8 Hardware Handshake Abort Procedure

The abort procedure is based on the SYNC command. In order to abort a command, which had not issued the corresponding ACK pulse, the host controller should generate a low pulse in the BKGD pin by driving it low for at least 128 serial clock cycles and then driving it high for one serial clock cycle, providing a speedup pulse.By detecting this long low pulse in the BKGD pin, the target executes the SYNC protocol, see Section 4.31.4.9, “SYNC — Request Timed Reference Pulse”, and assumes that the pending command and therefore the related ACK pulse, are being aborted. Therefore, after the SYNC protocol has been completed the host is free to issue new BDM commands. For BDM firmware READ or WRITE commands it can not be guaranteed that the pending command is aborted when issuing a SYNC before the corresponding ACK pulse. There is a short latency time from the time the READ or WRITE access begins until it is finished and the corresponding ACK pulse is issued. The latency time depends on the firmware READ or WRITE command that is issued and on the selected bus clock rate. When the SYNC command starts during this latency time the READ or WRITE command will not be aborted, but the corresponding ACK pulse will be aborted. A pending GO, TRACE1 or GO_UNTIL(171) command can not be aborted. Only the corresponding ACK pulse can be aborted by the SYNC command. Although it is not recommended, the host could abort a pending BDM command by issuing a low pulse in the BKGD pin shorter than 128 serial clock cycles, which will not be interpreted as the SYNC command. The ACK is actually aborted when a negative edge is perceived by the target in the BKGD pin. The short abort pulse should have at least 4 clock cycles keeping the BKGD pin low, in order to allow the negative edge to be detected by the target.In this case, the target will not execute the SYNC protocol but the pending command will be aborted along with the ACK pulse. The potential problem with this abort procedure is when there is a conflict between the ACK pulse and the short abort pulse. In this case, the target may not perceive the abort pulse. The worst case is when the pending command is a read command (i.e., READ_BYTE). If the abort pulse is not perceived by the target the host will attempt to send a new command after the abort pulse was issued, while the target expects the host to retrieve the accessed memory byte. In this case, host and target will run out of synchronism. However, if the command to be aborted is not a read command the short abort pulse could be used. After a command is aborted the target assumes the next negative edge, after the abort pulse, is the first bit of a new BDM command. NOTE The details about the short abort pulse are being provided only as a reference for the reader to better understand the BDM internal behavior. It is not recommended that this procedure be used in a real application. Since the host knows the target serial clock frequency, the SYNC command (used to abort a command) does not need to consider the lower possible target frequency. In this case, the host could issue a SYNC very close to the 128 serial clock cycles length.

Section 4.31.4.9, “SYNC — Request Timed Reference Pulse”. the command is aborted a new command could be issued by the host computer. Figure 63. ACK Abort Procedure at the Command Level along with the SYNC command. In this case, there is an electrical conflict between the ACK speedup pulse and the SYNC pulse. Since this is not a probable situation, the protocol does not prevent this conflict from happening. Figure 64. ACK Pulse and SYNC Request Conflict provides backwards compatibility with the existing POD devices which are not able to execute the hardware handshake protocol. It also allows for new POD devices, that support the hardware handshake protocol, to freely communicate with the target device. If desired, without the need for waiting for the ACK pulse.

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 195

  • ACK_ENABLE — enables the hardware handshake protoc ol. The target will issue the ACK pulse when a CPU command is executed by the CPU. The ACK_ENABLE command itself also has the ACK pulse as a response.
  • ACK_DISABLE — disables the ACK pulse protocol. In this case, the host needs to use the worst case delay time at the appropriate places in the protocol. The default state of the BDM after reset is hardware handshake protocol disabled. All the read commands will ACK (if enabled) when the data bus cycle has completed and the data is then ready for reading out by the BKGD serial pin. All the write commands will ACK (if enabled) after the data has been received by the BDM through the BKGD serial pin and when the data bus cycle is complete. See Section 4.31.4.3, “BDM Hardware Commands” and Section 4.31.4.4, “Standard BDM Firmware Commands” for more information on the BDM commands. The ACK_ENABLE sends an ACK pulse when the command has been completed. This feature could be used by the host to evaluate if the target supports the hardware handshake protocol. If an ACK pulse is issued in response to this command, the host knows that the target supports the hardware handshake protocol. If the target does not support the hardware handshake protocol the ACK pulse is not issued. In this case, the ACK_ENABLE command is ignored by the target since it is not recognized as a valid command. The BACKGROUND command issues an ACK pulse when the CPU changes from normal to background mode. The ACK pulse related to this command could be aborted using the SYNC command. The GO command issues an ACK pulse when the CPU exits from background mode. The ACK pulse related to this command could be aborted using the SYNC command. The GO_UNTIL(171) command is equivalent to a GO command with exception that the ACK pulse, in this case, is issued when the CPU enters into background mode. This command is an alternative to the GO command and should be used when the host wants to trace if a breakpoint match occurs and causes the CPU to enter active background mode. Note that the ACK is issued whenever the CPU enters BDM, which could be caused by a breakpoint match or by a BGND instruction being executed. The ACK pulse related to this command could be aborted using the SYNC command. The TRACE1 command has the related ACK pulse issued when the CPU enters background active mode after one instruction of the application program is executed. The ACK pulse related to this command could be aborted using the SYNC command.

4.31.4.9 SYNC — Request Timed Reference Pulse

The SYNC command is unlike other BDM commands because the host does not necessarily know the correct communication speed to use for BDM communications until after it has analyzed the response to the SYNC command. To issue a SYNC command, the host should perform the following steps: 1. Drive the BKGD pin low for at least 128 cycles at th e lowest possible BDM serial communication frequency 2. Drive BKGD high for a brief speedup pulse to get a fast rise time (this speedup pulse is typically one cycle of the host clock.) 3. Remove all drive to the BKGD pin so it reverts to high impedance. 4. Listen to the BKGD pin for the sync response pulse. Upon detecting the SYNC request from the host, the target performs the following steps: 1. Discards any incomplete command received or bit retrieved. 2. Waits for BKGD to return to a logic one. 3. Delays 16 cycles to allow the host to stop driving the high speedup pulse. 4. Drives BKGD low for 128 cycles at the cu rrent BDM serial communication frequency. 5. Drives a one-cycle high speedup pulse to force a fast rise time on BKGD. 6. Removes all drive to the BKGD pin so it reverts to high impedance. The host measures the low time of this 128 cycle SYNC response pulse and determines the correct speed for subsequent BDM communications. Typically, the host can determine the correct communication speed within a few percent of the actual target speed and the communication protocol can easily tolerate speed errors of several percent. As soon as the SYNC request is detected by the target, any partially received command or bit retrieved is discarded. This is referred to as a soft-reset, equivalent to a time-out in the serial communication. After the SYNC response, the target will consider the next negative edge (issued by the host) as the start of a new BDM command or the start of new SYNC request. Another use of the SYNC command pulse is to abort a pending ACK pulse. The behavior is exactly the same as in a regular SYNC command. Note that one of the possible causes for a command to not be acknowledged by the target is a host-target synchronization problem. In this case, the command may not have been understood by the target and so an ACK response pulse will not be issued.

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 196

4.31.4.10 Instruction Tracing

When a TRACE1 command is issued to the BDM in active BDM, the CPU exits the standard BDM firmware and executes a single instruction in the user code. Once this has occurred, the CPU is forced to return to the standard BDM firmware and the BDM is active and ready to receive a new command. If the TRACE1 command is issued again, the next user instruction will be executed. This facilitates stepping or tracing through the user code one instruction at a time. If an interrupt is pending when a TRACE1 command is issued, the interrupt stacking operation occurs but no user instruction is executed. Once back in standard BDM firmware execution, the program counter points to the first instruction in the interrupt service routine. Be aware when tracing through the user code that the execution of the user code is done step by step but peripherals are free running. Hence possible timing relations between CPU code execution and occurrence of events of other peripherals no longer exist. Do not trace the CPU instruction BGND used for soft breakpoints. Tracing over the BGND instruction will result in a return address pointing to BDM firmware address space. When tracing through user code which contains stop instructions the following will happen when the stop instruction is traced: The CPU enters stop mode and the TRACE1 command can not be finished before leaving the low power mode. This is the case because BDM active mode can not be entered after CPU executed the stop instruction. However all BDM hardware commands except the BACKGROUND command are operational after tracing a stop instruction and still being in stop mode. If system stop mode is entered (all bus masters are in stop mode) no BDM command is operational. As soon as stop mode is exited the CPU enters BDM active mode and the saved PC value points to the entry of the corresponding interrupt service routine. In case the handshake feature is enabled the corresponding ACK pulse of the TRACE1 command will be discarded when tracing a stop instruction. Hence there is no ACK pulse when BDM active mode is entered as part of the TRACE1 command after CPU exited from stop mode. All valid commands sent during CPU being in stop mode or after CPU exited from stop mode will have an ACK pulse. The handshake feature becomes disabled only when system stop mode has been reached. Hence after a system stop mode the handshake feature must be enabled again by sending the ACK_ENABLE command.

4.31.4.11 Serial Communication Timeout

The host initiates a host-to-target serial transmission by generating a falling edge on the BKGD pin. If BKGD is kept low for more than 128 target clock cycles, the target understands that a SYNC command was issued. In this case, the target will keep waiting for a rising edge on BKGD in order to answer the SYNC request pulse. If the rising edge is not detected, the target will keep waiting forever without any timeout limit. Consider now the case where the host returns BKGD to logic one before 128 cycles. This is interpreted as a valid bit transmission, and not as a SYNC request. The target will keep waiting for another falling edge marking the start of a new bit. If, however, a new falling edge is not detected by the target within 512 clock cycles since the last falling edge, a timeout occurs and the current command is discarded without affecting memory or the operating mode of the MCU. This is referred to as a soft-reset. If a read command is issued but the data is not retrieved within 512 serial clock cycles, a soft-reset will occur causing the command to be disregarded. The data is not available for retrieval after the timeout has occurred. This is the expected behavior if the handshake protocol is not enabled. In order to allow the data to be retrieved even with a large clock frequency mismatch (between BDM and CPU) when the hardware handshake protocol is enabled, the time out between a read command and the data retrieval is disabled. Therefore, the host could wait for more then 512 serial clock cycles and still be able to retrieve the data from an issued read command. However, once the handshake pulse (ACK pulse) is issued, the timeout feature is re-activated, meaning that the target will time out after 512 clock cycles. Therefore, the host needs to retrieve the data within a 512 serial clock cycles time frame after the ACK pulse had been issued. After that period, the read command is discarded and the data is no longer available for retrieval. Any negative edge in the BKGD pin after the timeout period is considered to be a new command or a SYNC request. Note that whenever a partially issued command, or partially retrieved data, has occurred the timeout in the serial communication is active. This means that if a time frame higher than 512 serial clock cycles is observed between two consecutive negative edges and the command being issued or data being retrieved is not complete, a soft-reset will occur causing the partially received command or data retrieved to be disregarded. The next negative edge in the BKGD pin, after a soft-reset has occurred, is considered by the target as the start of a new BDM command, or the start of a SYNC request pulse.

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 197

4.32 S12S Debug Module (S12SDBGV2)

4.32.1 Introduction

The S12SDBG module provides an on-chip trace buffer with flexible triggering capability to allow non-intrusive debug of application software. The S12SDBG module is optimized for S12SCPU debugging. Typically the S12SDBG module is used in conjunction with the S12SBDM module, whereby the user configures the S12SDBG module for a debugging session over the BDM interface. Once configured the S12SDBG module is armed and the device leaves BDM returning control to the user program, which is then monitored by the S12SDBG module. Alternatively the S12SDBG module can be configured over a serial interface using SWI routines.

4.32.1.1 Glossary Of Terms

COF: Change Of Flow. Change in the program flow due to a conditional branch, indexed jump or interrupt. BDM: Background Debug Mode S12SBDM: Background Debug Module DUG: Device User Guide, describing the features of the device into which the DBG is integrated. WORD: 16 bit data entity Data Line: 20 bit data entity CPU: S12SCPU module DBG: S12SDBG module POR: Power On Reset Tag: Tags can be attached to CPU opcodes as they enter the instruction pipe. If the tagged opcode reaches the execution stage a tag hit occurs.

4.32.1.2 Overview

The comparators monitor the bus activity of the CPU module. A match can initiate a state sequencer transition. On a transition to the Final State, bus tracing is triggered and/or a breakpoint can be generated. Independent of comparator matches a transition to Final State with associated tracing and breakpoint can be triggered immediately by writing to the TRIG control bit. The trace buffer is visible through a 2-byte window in the register address map and can be read out using standard 16-bit word reads. Tracing is disabled when the MCU system is secured.

4.32.1.3 Features

  • Three comparators (A, B and C) — Comparators A compares the full address bus and full 16-bit data bus — Comparator A features a data bus mask register — Comparators B and C compare the full address bus only — Each comparator features selectio n of read or write access cycles — Comparator B allows selection of byte or word access cycles — Comparator matches can initiate state sequencer transitions
  • Three comparator modes — Simple address/data comparator match mode — Inside address range mode, Addmin  Address Addmax — Outside address range match mode, Address Addminor Address  Addmax
  • Two types of matches — Tagged — This matches just before a specific instruction begins execution — Force — This is valid on the first in struction boundary after a match occurs
  • Two types of breakpoints — CPU breakpoint entering BDM on breakpoint (BDM) — CPU breakpoint executing SWI on breakpoint (SWI)
  • Trigger mode independent of comparators — TRIG Immediate software trigger
  • Four trace modes definition. — Loop1: same as Normal but inhibits co nsecutive duplicate source address entries — Detail: address and data for all cycles except free cycles and opcode fetches are stored — Compressed Pure PC: all program counter addresses are stored
  • 4-stage state sequencer for trace buffer control — Tracing session trigger linked to Final State of state sequencer — Begin and End alignment of tracing to trigger

4.32.1.4 Modes of Operation

The DBG module can be used in all MCU functional modes. BDM Mode through a BACKGROUND command, the DBG module, if already armed, remains armed.

4.32.1.5 Block Diagram

Figure 65. Debug Module Block Diagram Table 268. Mode Dependent Restriction Summary

4.32.2 External Signal Description

There are no external signals associated with this module.

4.32.3 Memory Map and Registers

4.32.3.1 Module Memory Map

bits are given in the subsections that follow. Table 269. Quick Reference to DBG Registers

4.32.3.2 Register Descriptions

4.32.3.2.1 Debug Control Register 1 (DBGC1)

Bit 6 can be written anytime but always reads back as 0. Bits 4:3 anytime DBG is not armed. being written. These bits must be cleared using a second write if required.

  1. This bit is visible at DBGCNT[7] and DBGSR[7]
  2. This represents the contents if the Comparator A control register is blended into this address.
  3. This represents the contents if the Comparator B control register is blended into this address.
  4. This represents the contents if the Comparator C control register is blended into this address.

Table 270. Debug Control Register (DBGC1)

4.32.3.2.2 Debug Status Register (DBGSR)

Table 271. DBGC1 Field Descriptions this bit the state sequencer enters State1.

0 Debugger disarmed

1 Debugger armed

bit always reads back a 0. Writing a 0 to this bit has no effect. If the DBGTCR_TSOURCE bit is clear no tracing is carried out. The session is ended by setting TRIG and ARM simultaneously. 0 Do not trigger until the state sequencer enters the Final State.

1 Trigger immediately

then breakpoints default to SWI. 0 Breakpoint to Software Interrupt if BDM inactive. Otherwise no breakpoint. is not enabled, the breakpoint is generated immediately.

0 No Breakpoint generated

1 Breakpoint generated

is visible at the address 0x0027. See Table 272. Table 272. COMRV Encoding

00 Comparator A DBGSCR1

01 Comparator B DBGSCR2

10 Comparator C DBGSCR3

11 None DBGMFR

Table 273. Debug Status Register (DBGSR)

4.32.3.2.3 Debug Trace Control Register (DBGTCR)

Write: Bit 6 only when DBG is neither secure nor armed.Bits 3,2,0 anytime the module is disarmed. Table 274. DBGSR Field Descriptions Table 275. SSF[2:0] — State Sequence Flag Bit Encoding

000 State0 (disarmed)

001 State1

010 State2

011 State3

100 Final State

Table 276. Debug Trace Control Register (DBGTCR) Table 277. DBGTCR Field Descriptions secured, this bit cannot be set and tracing is inhibited. This bit must be set to read the trace buffer.

0 Debug session without tracing requested

1 Debug session with tracing requested

program counter value for each instruction executed is stored. See Table 278. Trigger Align Bit — This bit controls whether the trigger is a ligned to the beginning or end of a tracing session.

0 Trigger at end of stored data

1 Trigger before storing data

4.32.3.2.4 Debug Contro l Register2 (DBGC2)

Write: Anytime the module is disarmed. This register configures the comparators for range matching.

4.32.3.2.5 Debug Trace Buffe r Register (DBGTBH:DBGTBL)

Read: Only when unlocked AND unsecured AND not armed AND TSOURCE set. Write: Aligned word writes when disarmed unlock the trace buffer for reading but do not affect trace buffer contents. Table 278. TRCMOD Trace Mode Bit Encoding

00 Normal

01 Loop1

10 Detail

11 Compressed Pure PC

Table 279. Debug Control Register2 (DBGC2) Table 280. DBGC2 Field Descriptions A and B Comparator Match Control — These bits determine the A and B comparator match mapping as described in Table 281. Table 281. ABCM Encoding 00 Match0 mapped to comparator A match: Match1 mapped to comparator B match. 01 Match 0 mapped to comparator A/B inside range: Match1 disabled. 10 Match 0 mapped to comparator A/B outside range: Match1 disabled.

11 Reserved (177)

  1. Currently defaults to Comparator A, Comparator B disabled

Table 282. Debug Trace Buffer Register (DBGTB)

4.32.3.2.6 Debug Count Register (DBGCNT)

Table 283. DBGTB Field Descriptions Table 284. Debug Count Register (DBGCNT) Table 285. DBGCNT Field Descriptions Table 286. CNT Decoding Table

4.32.3.2.7 Debug Stat e Control Registers

allowed, depending upon comparator matches or tag hits, and defines the next state for the state sequencer following a match. Write: If COMRV[1:0] = 00 and DBG is not armed. ARM bit will be cleared and the tracing session ends. Table 287. State Control Register Access Encoding

00 DBGSCR1

01 DBGSCR2

10 DBGSCR3

11 DBGMFR

Table 288. Debug State Control Register 1 (DBGSCR1) Table 289. DBGSCR1 Field Descriptions These bits select the targeted next state whilst in State1, based upon the match event. Table 290. State1 Sequencer Next State Selection

0000 Any match to Final State

0001 Match1 to State3

0010 Match2 to State2

Write: If COMRV[1:0] = 01 and DBG is not armed. comparator enable bit in the associated DBGXCTL control register.

0011 Match1 to State2

0111 Either Match0 or Match1 to State2

1000 Reserved

1001 Match0 to State3

1010 Reserved

1011 Reserved

1100 Reserved

1110 Reserved

1111 Reserved

Table 291. Debug State Control Register 2 (DBGSCR2) Table 292. DBGSCR2 Field Descriptions These bits select the targeted next state whilst in State2, based upon the match event. Table 293. State2 —Sequencer Next State Selection

0010 Match2 to State3

Write: If COMRV[1:0] = 10 and DBG is not armed. comparator enable bit in the associated DBGXCTL control register.

0101 Match2 to Final State

0111 Either Match0 or Match1 to Final State

1001 Reserved

1101 Reserved

Table 294. Debug State Control Register 3 (DBGSCR3) Table 295. DBGSCR3 Field Descriptions These bits select the targeted next state whilst in State3, based upon the match event. Table 296. State3 — Sequencer Next State Selection

0000 Match0 to State1

followed by the match on the lower channel number (0,1,2). flags. Once a flag is set, further comparator matches on the same channel in the same session have no affect on that flag.

4.32.3.2.8 Comparator Re gister Descriptions

Each comparator has a bank of registers that are visible through an 8-byte window in the DBG module register address map. register). Comparator C consists of four register bytes (three address bus compare registers and a control register). Each set of comparator registers can be accessed using the COMRV bits in the DBGC1 register. Unimplemented registers (e.g. from those of comparators A and C.

0100 Match1 to State2

0101 Match1 to Final State

0111 Match0 to Final State

Table 297. Debug Match Flag Register (DBGMFR) Table 298. Comparator Register Layout

DBG module register address map. Table 299. Debug Comparator Control Register DBGACTL (Comparator A) Table 300. Debug Comparator Control Register DBGBCTL (Comparator B) Table 301. Debug Comparator Control Register DBGCCTL (Comparator C)

is set since the match occurs based on the tagged opcode reaching the execution stage of the instruction queue. Table 302. DBGXCTL Field Descriptions comparator. This bit is ignored if the TAG bit in the same register is set.

0 Word/Byte access size is not used in comparison

1 Word/Byte access size is used in comparison

comparator. This bit is ignored if the SZE bit is cleared or if the TAG bit in the same register is set.

0 Word access size is compared

1 Byte access size is compared

0 Allow state sequencer trans ition immediately on match

0 The debug session termination is dependent upon the state sequencer and trigger conditions. if active, is terminated and the module disarmed. comparator. The RW bit is not used if RWE = 0. This bit is ignored if the TAG bit in the same register is set.

0 Write cycle is match ed1 Read cycle is matched

0 Read/Write is not used in comparison

1 Read/Write is used in comparison

only available for comparator A.

0 Match on data bus equivalence to comparator register contents

1 Match on data bus difference to comparator register contents

0 The comparator is not enabled

1 The comparator is enabled

Table 303. Read or Write Comparison Logic Table

Read: Anytime. See Table for visible register encoding. Write: If DBG not armed. See Table for visible register encoding. Read: Anytime. See Table for visible register encoding. Write: If DBG not armed. See Table for visible register encoding. Table 304. Debug Comparator Address High Register (DBGXAH) Table 305. Comparator Address Register Visibility

00 DBGAAH, DBGAAM, DBGAAL

01 DBGBAH, DBGBAM, DBGBAL

10 DBGCAH, DBGCAM, DBGCAL

11 None

Table 306. DBGXAH Field Descriptions comparator compares the address bus bits [17:16] to a logic one or logic zero.

0 Compare corresponding address bit to a logic zero

1 Compare corresponding address bit to a logic one

Table 307. Debug Comparator Address Mid Register (DBGXAM) Table 308. DBGXAM Field Descriptions comparator compares the address bus bits [15:8] to a logic one or logic zero.

Read: Anytime. See Table for visible register encoding. Write: If DBG not armed. See Table for visible register encoding. Write: If COMRV[1:0] = 00 and DBG not armed. Write: If COMRV[1:0] = 00 and DBG not armed. Table 309. Debug Comparator Address Low Register (DBGXAL) Table 310. DBGXAL Field Descriptions comparator compares the address bus bits [7:0] to a logic one or logic zero. Table 311. Debug Comparator Data High Register (DBGADH) Table 312. DBGADH Field Descriptions performed if the TAG bit in DBGACTL is clear.

0 Compare corresponding data bit to a logic zero

1 Compare corresponding data bit to a logic one

Table 313. Debug Comparator Data Low Register (DBGADL)

Write: If COMRV[1:0] = 00 and DBG not armed. Write: If COMRV[1:0] = 00 and DBG not armed. Table 314. DBGADL Field Descriptions Table 315. Debug Comparator Data High Mask Register (DBGADHM) Table 316. DBGADHM Field Descriptions 0 Do not compare corresponding data bit Any va lue of corresponding data bit allows match.

1 Compare corresponding data bit

Table 317. Debug Comparator Data Low Mask Register (DBGADLM) Table 318. DBGADLM Field Descriptions

4.32.4 Functional Description

generate breakpoints but tracing is not possible.

4.32.4.1 S12SDB G Operation

sequencer, and the trace buffer. The comparators monitor the bus activity of the CPU. All comparators can be configured to monitor address bus activity. Comparator A can also be configured to monitor data bus activity and mask out individual data bus bits during a compare. tracing is triggered and/or a breakpoint can be generated. Figure 66. DBG Overview

4.32.4.2 Comparator Modes

DBGADL and allows masking of individual data bus bits. All comparators are disabled in BDM and during BDM accesses. configuration is controlled by the control register contents and the range control by the DBGC2 contents.

to be considered in the compare. Only comparators A and B feature SZE and SZ. the comparator address register must be loaded with the exact opcode address. of an opcode at an odd address when TAG = 0, the corresponding even address must be contained in the comparator register. Thus for an opcode at odd address (n), the comparator register must contain address (n–1). value when a subsequent match occurs.

4.32.4.2.1 Single Addre ss Comparator Match

depending on comparator channel. address register loaded with address (n) a word access of address (n–1) also accesses (n) but does not cause a match. byte access of a particular address, a word access covering the same address does not lead to match. Assuming the access direction is not qualified (RWE=0), for simplicity, the size access considerations are shown in Table 320. Table 319. Comparator C Access Considerations

  1. A word access of ADDR[n-1] also accesses ADDR[n] but does not generate a match. The comparator address register must contain

the exact address from the code.

Comparator A offers address, direction (R/W), access size (word/byte) and data bus comparison. or trigger on difference. This allows monitoring of a difference in the contents of an address location from an expected value. difference can be detected. In this case address bus equivalence does not cause a match. Table 320. Comparator B Access Size Considerations

  1. A word access of ADDR[n-1] also accesses ADDR[n] but does not generate a match. The comparator address register must contain

the exact address from the code. Table 321. Comparator A Matches When Accessing ADDR[n]

0 X $0000 Byte

0 X $00FF Word, data(ADDR[n])=X, data(ADDR[n+1])=DL Match data(ADDR[n+1])

0 X $00FF Byte, data(ADDR[n])=X, data(ADDR[n+1])=DL Possible unintended match

0 X $FFFF Word, data(ADDR[n])=DH, data(ADDR[n+1])=DL Match data(ADDR[n], ADDR[n+1])

0 X $FFFF Byte, data(ADDR[n])=DH, data(ADDR[n+1])=DL Possible unintended match

4.32.4.2.2 Range Comparisons

must be cleared. The comparator A BRK bit is used to for the AB range, the comparator B BRK bit is ignored in range mode. When configured for range comparisons and tagging, the ranges are accurate only to word boundaries. boundary is valid only if the aligned address is inside the range. only if the aligned address is outside the range. be avoided by setting the upper range limit to $3FFFF or lower range limit to $00000 respectively.

4.32.4.3 Match Modes (Forced or Tagged)

match mode. The modes are described in the following sections.

4.32.4.3.1 Forced Match

match of an opcode address typically precedes a tagged match at the same address.

4.32.4.3.2 Tagged Match

4.32.4.3.3 Immediate Trigger

alignment, setting the TRIG bit disarms the module, ending the session and issues a forced breakpoint request to the CPU. Table 322. NDB and MASK Bit Dependency 0 0 Do not compare data bus bit. 0 1 Compare data bus bit. Match on equivalence. 1 0 Do not compare data bus bit. 1 1 Compare data bus bit. Match on difference.

4.32.4.3.4 Chann el Priorities

4.32.4.4 State Sequence Control

Figure 67. State Sequencer Diagram the DBG module has been armed by setting the ARM bit in the DBGC1 register, then state1 of the state sequencer is entered. transition updates the SSF[2:0] flags in DBGSR accordingly to indicate the current state. Alternatively writing to the TRIG bit in DBGSC1, provides an immediate trigger independent of comparator matches. a debug session is ended by a match on a channel the state sequencer transitions through Final State for a clock cycle to state0. state0 and the debug module is disarmed.

4.32.4.4.1 Final State

Table 323. Channel Priorities

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 219 the disarmed state0. If tracing is enabled a breakpoint request can occur at the end of the tracing session. If neither tracing nor breakpoints are enabled then when the final state is reached it returns automatically to state0 and the debug module is disarmed.

4.32.4.5 Trace Buffer Operation

The trace buffer is a 64 lines deep by 20-bits wide RAM array. The DBG module stores trace information in the RAM array in a circular buffer format. The system accesses the RAM array through a register window (DBGTBH:DBGTBL) using 16-bit wide word accesses. After each complete 20-bit trace buffer line is read, an internal pointer into the RAM increments so that the next read receives fresh information. Data is stored in the format shown in Table 324 and Table . After each store the counter register DBGCNT is incremented. Tracing of CPU activity is disabled when the BDM is active. Reading the trace buffer whilst the DBG is armed returns invalid data and the trace buffer pointer is not incremented.

4.32.4.5.1 Trace Trigger Alignment

Using the TALIGN bit (see Section 4.32.3.2.3, “Debug Trace Control Register (DBGTCR)) it is possible to align the trigger with the end or the beginning of a tracing session. If end alignment is selected, tracing begins when the ARM bit in DBGC1 is set and State1 is entered; the transition to Final State signals the end of the tracing session. Tracing with Begin-Trigger starts at the opcode of the trigger. Using end alignment or when the tracing is initiated by writing to the TRIG bit whilst configured for begin alignment, tracing starts in the second cycle after the DBGC1 write cycle. Storing with begin alignment, data is not stored in the Trace Buffer until the Final State is entered. Once the trigger condition is met the DBG module remains armed until 64 lines are stored in the Trace Buffer. If the trigger is at the address of the change-of-flow instruction the change of flow associated with the trigger is stored in the Trace Buffer. Using begin alignment together with tagging, if the tagged instruction is about to be executed then the trace is started. Upon completion of the tracing session the breakpoint is generated, thus the breakpoint does not occur at the tagged instruction boundary. Storing with end alignment, data is stored in the Trace Buffer until the Final State is entered, at which point the DBG module becomes disarmed and no more data is stored. If the trigger is at the address of a change of flow instruction, the trigger event is not stored in the Trace Buffer. If all trace buffer lines have been used before a trigger event occurs then the trace continues at the first line, overwriting the oldest entries.

4.32.4.5.2 Trace Modes

Four trace modes are available. The mode is selected using the TRCMOD bits in the DBGTCR register. Tracing is enabled using the TSOURCE bit in the DBGTCR register. The modes are described in the following subsections. In Normal Mode, change of flow (COF) program counter (PC) addresses are stored. COF addresses are defined as follows:

  • Source address of taken conditional branches (long, short, bit-conditional, and loop primitives)
  • Destination address of indexed JMP, JSR, and CALL instruction
  • Destination address of RTI, RTS, and RTC instructions
  • Vector address of interrupts, except for BDM vectors LBRA, BRA, BSR, BGND as well as non-indexed JMP, JSR, and CALL instructions are not classified as change of flow and are not stored in the trace buffer. Stored information includes the full 18-bit address bus and information bits, which contains a source/destination bit to indicate whether the stored address was a source address or destination address. NOTE When a COF instruction with destination address is executed, the destination address is stored to the trace buffer on instruction completion, indicating the COF has taken place. If an interrupt occurs simultaneously then the next instruction carried out is actually from the interrupt service routine. The instruction at the destination address of the original program flow gets executed after the interrupt service routine.

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 220 In the following example an IRQ interrupt occurs during execution of the indexed JMP at address MARK1. The BRN at the destination (SUB_1) is not executed until after the IRQ service routine but the destination address is entered into the trace buffer to indicate that the indexed JMP COF has taken place. LDX #SUB_1 MARK1 JMP 0,X ; IRQ interrupt occurs during execution of this MARK2 NOP ; SUB_1 BRN * ; JMP Destination address TRACE BUFFER ENTRY 1 ; RTI Destination address TRACE BUFFER ENTRY 3 NOP ; ADDR1 DBNE A,PART5 ; Source address TRACE BUFFER ENTRY 4 IRQ_ISR LDAB #$F0 ; IRQ Vector $FFF2 = TRACE BUFFER ENTRY 2 STAB VAR_C1 RTI ; The execution flow taking into account the IRQ is as follows LDX #SUB_1 MARK1 JMP 0,X ; IRQ_ISR LDAB #$F0 ; STAB VAR_C1 RTI ; SUB_1 BRN * NOP ; ADDR1 DBNE A,PART5 ; Loop1 Mode, similarly to Normal Mode also stores only COF address information to the trace buffer, it however allows the filtering out of redundant information. The intent of Loop1 Mode is to prevent the Trace Buffer from being filled entirely with duplicate information from a looping construct such as delays using the DBNE instruction or polling loops using BRSET/BRCLR instructions. Immediately after address information is placed in the Trace Buffer, the DBG module writes this value into a background register. This prevents consecutive duplicate address entries in the Trace Buffer resulting from repeated branches. Loop1 Mode only inhibits consecutive duplicate source address entries that would typically be stored in most tight looping constructs. It does not inhibit repeated entries of destination addresses or vector addresses, since repeated entries of these would most likely indicate a bug in the user’s code that the DBG module is designed to help find. In Detail Mode, address and data for all memory and register accesses is stored in the trace buffer. This mode is intended to supply additional information on indexed, indirect addressing modes where storing only the destination address would not provide all information required for a user to determine where the code is in error. This mode also features information bit storage to the trace buffer, for each address byte storage. The information bits indicate the size of access (word or byte) and the type of access (read or write). When tracing in Detail Mode, all cycles are traced except those when the CPU is either in a free or opcode fetch cycle. In Compressed Pure PC Mode, the PC addresses of all executed opcodes, including illegal opcodes are stored. A compressed storage format is used to increase the effective depth of the trace buffer. This is achieved by storing the lower order bits each time and using 2 information bits to indicate if a 64 byte boundary has been crossed, in which case the full PC is stored. Each Trace Buffer row consists of 2 information bits and 18 PC address bits

4.32.4.5.3 Trace Buffer Or ganization (Normal, Loop1, Detail modes)

ADRH, ADRM, ADRL denote address high, middle and low byte respectively. The numerical suffix refers to the tracing count. information (CRW and CSZ respectively). higher address is stored to byte0. The format of the bits is dependent upon the active trace mode as described below. In Detail Mode the CSZ and CRW bits indicate the type of access being made by the CPU. Table 324. Trace Buffer Organization (Normal,Loop1,Detail modes)

0 DATAH1 DATAL1

0 DATAH2 DATAL2

Table 325. Field2 Bits in Detail Mode Table 326. Field Descriptions

0 Word Access

1 Byte Access

0 Write Access

1 Read Access

Address Bus bit 17 — Corresponds to system address bus bit 17. Address Bus bit 16 — Corresponds to system address bus bit 16.

4.32.4.5.4 Trace Buffer Organizati on (Compressed Pure PC mode)

Line 4. The pointer points to the oldest entry, Line 2. Figure 68. Information Bits PCH Table 327. PCH Field Descriptions or destination address. This bit has no meaning in Compressed Pure PC mode.

0 Source Address

1 Destination Address

Vector Indicator — In Normal and Loop1 mode this bit indicates if the corresponding stored address is a vector address. meaning in Compressed Pure PC mode.

0 Non-Vector Destination Address

1 Vector Destination Address

Program Counter bit 17 — In Normal and Loop1 mode this bit corresponds to program counter bit 17. Program Counter bit 16 — In Normal and Loop1 mode this bit corresponds to program counter bit 16. Table 328. Trace Buffer Organization Example (Compressed PurePC mode)

The first line of the trace buffer always gets a base PC address, this applies also on rollover.

4.32.4.5.5 Reading Da ta from Trace Buffer

can only be unlocked for reading by a single aligned word write to DBGTB when the module is disarmed. first-out. By reading CNT in DBGCNT the number of valid lines can be determined. DBGCNT does not decrement as data is read. oldest data entry, thus if no rollover has occurred, the pointer points to line0, otherwise it points to the line with the oldest entry.

  1. Thus if rollover is indicated by the TBF bit, the line status must be decoded using the INF bits in field3 of that line. If both INF

bits are clear then the line contains only entries from before the last rollover. If INF0=1 then field 0 contains post rollover data but fields 1 and 2 contain pre rollover data. If INF1=1 then fields 0 and 1 contain post rollover data but field 2 contains pre rollover data. buffer read sequence to be easily restarted from the oldest data entry. field 2 in the least significant bits [3:0] and “0” for bits [15:4]. Reading the Trace Buffer while the DBG module is armed returns invalid data and no shifting of the RAM pointer occurs.

4.32.4.5.6 Trace Buff er Reset State

no information would be stored in the trace buffer. The Trace Buffer contents and DBGCNT bits are undefined following a POR.

4.32.4.6 Tagging

the queue a tag hit occurs and can initiate a state sequencer transition. Table 329. Compressed Pure PC Mode Field 3 Information Bit Encoding

address stored in the comparator match address registers must be an opcode address. to Final State then a breakpoint is generated immediately, before the tagged instruction is carried out. are ignored if tagging is selected. When configured for range comparisons and tagging, the ranges are accurate only to word boundaries. Tagging is disabled when the BDM becomes active.

4.32.4.7 Breakpoints

4.32.4.7.1 Breakpoi nts From Comparator Channels

breakpoint is generated when the tagged opcode reaches the execution stage of the instruction queue. no tracing session is selected, breakpoints are requested immediately. If the BRK bit is set, then the associated breakpoint is generated immediately independent of tracing trigger alignment.

4.32.4.7.2 Breakpoints Gene rated Via The TRIG Bit

setting ARM and TRIG simultaneously.

4.32.4.7.3 Breakpoi nt Priorities

channel match, it has no effect, since tracing has already started. the breakpoint to SWI is suppressed. Table 330. Breakpoint Setup For CPU Breakpoints

service routine care must be taken to avoid a repeated breakpoint at the same address. is the first instruction executed when normal program execution resumes.

4.32.5 Application Information

4.32.5.1 State Machine scenarios

4.32.5.2 Scenario 1

A trigger is generated if a given sequence of 3 code events is executed. Figure 69. Scenario 1

4.32.5.3 Scenario 2

A trigger is generated if a given sequence of 2 code events is executed. Table 331. Breakpoint Mapping Summary

0 X X X No Breakpoint

Figure 70. Scenario 2a (COMPA,COMPB configured for range mode). M1 is disabled in range modes. Figure 71. Scenario 2b Figure 72. Scenario 2c

4.32.5.4 Scenario 3

Figure 73. Scenario 3

4.32.5.5 Scenario 4

CompC to match on the same address as shown. Figure 74. Scenario 4a

allowing a M0 to return to state 2, whilst a M2 leads to final state as shown. Figure 75. Scenario 4b (with 2 comparators) DBG would break on a simultaneous M0/M2.

4.32.5.6 Scenario 5

Trigger if following event A, event C precedes event B. i.e. the expected execution flow is A->B->C. Figure 76. Scenario 5

4.32.5.7 Scenario 6

comparisons use channel0 only. Figure 77. Scenario 6

4.32.5.8 Scenario 7

Trigger when a series of 3 events is executed out of order. Specifying the event order as M1,M2,M0 to run in loops (120120120). possibilities are very limited in the channel encoding. By adding OR forks as shown in red this scenario is possible.

Figure 78. Scenario 7

4.32.5.9 Scenario 8

Trigger when a routine/event at M2 follows either M1 or M0. Figure 79. Scenario 8a Figure 80. Scenario 8b Scenario 8a and 8b are possible with the S12SDBGV1 and S12SDBGV2 SCR encoding.

4.32.5.10 Scenario 9

Figure 81. Scenario 9

4.32.5.11 Scenario 10

possible to generate a breakpoint on the third consecutive occurrence of event M0 without a reset M1.

4.33 Security (S12X9SECV2)

4.33.1 Introduction

This specification describes the function of the security mechanism in the S12I chip family (9SEC). or copying the FLASH and/or EEPROM difficult for unauthorized users.

4.33.1.1 Features

which allows access to a programming routine that updates parameters stored in another section of the Flash memory.

  • Protect the content of non-volatile memories (Flash, EEPROM)
  • Execution of NVM commands is restricted
  • Disable access to internal memory via background debug module (BDM)

4.33.1.2 Modes of Operation

Table 332 gives an overview over availability of security relevant features in unsecure and secure modes. Figure 84 shows all modules affected by security in an MCU. Table 332. Feature Availability in Unsecure and Secure Modes on S12I

  1. Restricted NVM command set only. Please refer to th e NVM wrapper block guides for detailed information.
  2. BDM hardware commands restricted to peripheral registers only.

Figure 84. Chip Security Block Diagram

4.34 Impact on MCU modules

4.34.1 MMC

resulting state of “device security” are shown in Table 333. independent of how the part got to expanded mode (straight out of reset or by writing the mode register). Table 333. : Security Bits - System Control

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 232 One cycle after bdm_unsecure is asserted the secure firmware is disabled from the map. In secure mode aBDM access to a non register address will be translated to a peripheral register address, and BDM registers are not accessible. No BDM global access is possible if the chip is secured. In secured expanded mode or emulation mode, FLASH and EEPROM are disabled by the MMC.

4.34.2 BDM

When security is active and the blank check is performed and failed, only BDM hardware commands are available. If the blank check is succeeds, all BDM commands are available. The BDM status register contains a bit called UNSEC. This bit is only writable by the secure firmware in special single chip mode. Based on the state of this bit, the BDM generates a signal called “unsecure”. The bit and signal are always reset to 0 (= de-asserted = secure). If the user resets into special single chip mode with the part secured, an alternate BDM firmware (“SECURE firmware”), is placed in the map along with the standard BDM firmware. The secure firmware has higher priority than the standard firmware, but it is smaller (less bytes). The secure firmware covers the vector space, but does not reach the beginning of the BDM firmware space. When blank check is successfully performed, UNSEC is asserted. The BDM program jumps to the start of the standard BDM firmware program and the secure firmware is turned off. If the blank check fails, then the ENBDM bit in the BDMSTS register is set without asserting UNSEC, and the BDM firmware code enters a loop. This enables the BDM hardware commands. In secure mode the MMC restricts BDM accesses to the register space. With UNSEC asserted, security is off and the user can change the state of the secure bits in the FLASH. Note that if the user does not change the state of these bits to “unsecured”, the part will be secured again when it is next taken out of reset.

4.34.3 DBG

S12X_DBG will disable the trace buffer, but breakpoints are still valid.

4.34.4 XGATE

XGATE internal registers XGCCR, XGPC, and XGR1 - XGR7 can not be written and will read zero from IPBI. Single stepping in XGATE is not possible. XGATE code residing in the internal RAM cannot be protected: 1. start MCU in NSC, let it run for a while 2. reset into SSC, MASERS the NVM 3. reset into SSC, bl ank check of BDM secure firmware succeeds 4. MCU is temporarily unsecured 5. BDM can be used to read internal RAM (contents not affected by reset)

4.35 Secure firmware Code Overview

The BDM contains a secure firmware code. This firmware code is invoked when the user comes out of reset in special single chip mode with security enabled. The function of the firmware code is straight forward:

  • Verify the FLASH is erased
  • Verify the EEPROM is erased
  • If both are erased, release security If either the FLASH or the EEPROM is not erased, then security is not released. The ENBDM bit is set and the code enters a loop. This allows BDM hardware commands, which may be used to erase the EEPROM and FLASH. Note that erasing the memories and erasing / reprogramming the security bits is NOT part of the firmware code. The user must perform these operations. The blank check of FLASH and EEPROM is done in the BDM firmware. As such it could be changed on future parts. The current scheme uses the NVM command state-machines (FTX, EETX) to perform the blank check.

4.35.0.1 Securing the Microcontroller

the PPAGE register. The contents of this byte are copied into the Flash security register (FSEC) during a reset sequence. Backdoor Key Access” for more information.

4.35.0.2 Operation of the Secured Microcontroller

be enhanced by requiring a challenge/response authentication before any code can be downloaded.

4.35.0.2.1 Normal Single Chip Mode (NS)

  • Background debug module (BDM) operation is completely disabled.
  • Execution of Flash and EEPROM comm ands is restricted. Please refer to the NVM block guide for details.
  • Tracing code execution using the DBG module is disabled.

Table 334. Flash Options/Security Byte Table 335. Backdoor Key Access Enable Bits Table 336. Security Bits

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 234

4.35.0.2.2 Speci al Single Chip Mode (SS)

  • BDM firmware commands are disabled.
  • BDM hardware commands are restricted to the register space.
  • Execution of Flash and EEPROM comm ands is restricted. Please refer to the NVM block guide for details.
  • Tracing code execution using the DBG module is disabled. Special single chip mode means BDM is active after reset. The availability of BDM firmware commands depends on the security state of the device. The BDM secure firmware first performs a blank check of both the Flash memory and the EEPROM. If the blank check succeeds, security will be temporarily turned off and the state of the security bits in the appropriate Flash memory location can be changed If the blank check fails, security will remain active, only the BDM hardware commands will be enabled, and the accessible memory space is restricted to the peripheral register area. This will allow the BDM to be used to erase the EEPROM and Flash memory without giving access to their contents. After erasing both Flash memory and EEPROM, another reset into special single chip mode will cause the blank check to succeed and the options/security byte can be programmed to “unsecured” state via BDM. While the BDM is executing the blank check, the BDM interface is completely blocked, which means that all BDM commands are temporarily blocked.

4.35.0.2.3 Executing from Intern al Memory in Expanded Mode

The user may choose to operate from internal memory while in expanded mode. To do this the user must start in single chip mode and write to the mode bits selecting expanded operation. In this mode internal visibility and IPIPE are blocked. If the users program tries to execute from outside the program memory space (internal space occupied by the FLASH), the FLASH and EEPROM will be disabled. BDM operations will be blocked. 4.35.0.3 If the user begins operat ion in single chip mode with security on, the user is constrained to operate out of internal memory - even if the user changes to expanded mode. To accomplish this the MMC needs to register that the part started in single chip mode and was secured. The CPU will provide the state of the two high-order bits of the Program Counter. All this information, plus the firmware size information is used to determine that the part is executing in the proper space. If the program strays, the selects for FLASH and EEPROM are disabled by the MMC until the part goes through reset.

4.35.0.3.1 Unsecuring the Microcontroller

Unsecuring the microcontroller can be done by three different methods: 1. Backdoor key access 2. Reprogramming the security bits 3. Complete memory erase (special modes)

4.35.0.3.2 Unsecuring the MCU Using the Backdoor Key Access

In normal modes (single chip and expanded), security can be temporarily disabled using the backdoor key access method. This method requires that:

  • The backdoor key at 0xFF00–0xFF07 (= global addresse s 0x7F_FF00–0x7F_FF07) has been programmed to a valid value.
  • The KEYEN[1:0] bits within the Flash options/security byte select ‘enabled’.
  • In single chip mode, the application program programmed in to the microcontroller must be designed to have the capability to write to the backdoor key locations. The backdoor key values themselves would not normally be stored within the application data, which means the application program would have to be designed to receive the backdoor key values from an external source (e.g. through a serial port). The backdoor key access method allows debugging of a secured microcontroller without having to erase the Flash. This is particularly useful for failure analysis. NOTE No word of the backdoor key is allowed to have the value 0x0000 or 0xFFFF.

4.35.0.4 Reprogramming the Security Bits

In normal single chip mode (NS), security can also be disabled by erasing and reprogramming the security bits within Flash options/security byte to the unsecured value. Because the erase operation will erase the entire sector from 0xFE00–0xFFFF (0x7F_FE00–0x7F_FFFF), the backdoor key and the interrupt vectors will also be erased; this method is not recommended for

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 235 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 will enter the unsecured state after the next reset following the programming of the security bits to the unsecured value. This method requires that:

  • The application software previously programmed into the mi crocontroller has been designed to have the capability to erase and program the Flash options/security byte, or security is first disabled using the backdoor key method, allowing BDM to be used to issue commands to erase and program the Flash options/security byte.
  • The Flash sector containing the Flash options/security byte is not protected.

4.35.0.5 Complete Memory Erase (Special Modes)

The microcontroller can be unsecured in special modes by erasing the entire EEPROM and Flash memory contents. When a secure microcontroller is reset into special single chip mode (SS), the BDM firmware verifies whether the EEPROM and Flash memory are erased. If any EEPROM or Flash memory address is not erased, only BDM hardware commands are enabled. BDM hardware commands can then be used to write to the EEPROM and Flash registers to mass erase the EEPROM and all Flash memory blocks. When next reset into special single chip mode, the BDM firmware will again verify whether all EEPROM and Flash memory are erased, and this being the case, will enable all BDM commands, allowing the Flash options/security byte to be programmed to the unsecured value. The security bits SEC[1:0] in the Flash security register will indicate the unsecure state following the next reset.

4.36 Initialization of a Virgin Device

“Virgin” cells in the Flash array will read all programmed and the MCU will be secured as the SEC[1:0] bits would be loaded with ‘00’ from the Flash security byte. At wafer probe NVM BIST mode is used to test and initialize the Flash IFR block. Wafer probe will leave the Flash block erased so the MCU will be secured. For blind-assembled products, the following sequence must be used to initialize the Flash array:

  • Reset the MCU into special mode.
  • Set FCLKDIV to provide a proper FCLK period.
  • Set FPROT register to the unprotected state.
  • Set the WRALL bit in the FT STMOD register, if available.
  • Load the Flash Pulse Timer with the mass erase ti me by executing a LDPTMR command write sequence.
  • Execute MASERSI commands to mass erase the Flash main block and Flash IFR block.
  • Execute the LDPTMR and PGMI command write sequence to program all timing parameters into the Flash IFR block.
  • Reset the MCU into special single chip mode. After th e reset the BDM secure firmware executes a blank check command. If the blank check succeeds the MCU will be temporarily unsecured.
  • Execute the PGM command write sequence to prog ram the security byte to the unsecured state. Blocking access to memories which can be secured during SCAN testing is necessary. While it would take a fair amount of sophistication on the part of a “thief”, our DFT people still consider this a major risk to security. It is therefore highly recommended that accesses to the FLASH and EEPROM arrays be blocked at chip level during scan test. Blocking or not blocking security at the core level will not help this.

4.37 Impact of Security on Test

When silicon comes out of processing, it is extremely unlikely that the security bits will be configured for unsecure. There will need to be “hooks” for running BIST (if present) or Burn-in by bypassing the security. If wafer level burn-in is to be used, security must have a bypass which can be connected to by the burn-in layer. In burn-in, security is bypassed, but when the burn-in layer is removed, the state of secreq determines whether the part is secured or not. This may require some sort of weak pull-up device. At some point during testing the internal FLASH and EEPROM will need to be unsecured. This test program should follow the same sequence as a user to unsecure the part: erase the memories, bring the part up in special mode, erase and program the security bits to the unsecured state.

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 236

4.38 S12 Clock, Reset and Power Management Unit (S12CPMU)

4.38.1 Introduction

This specification describes the function of the Clock, Reset and Power Management Unit.

  • The Pierce oscillator (OSCLCP) provides a robust, low-no ise and low-power external clock source. It is designed for optimal start-up margin with typical crystal oscillators.
  • The Voltage regulator (IVREG) operates from the range 3.13 to 5.5 V. It provides all the required chip internal voltages and voltage monitors.
  • The Phase Locked Loop (PLL) provides a highly accurate frequency multiplier with internal filter.
  • The Internal Reference Clock (IRC1M) provides a 1.0 MHz clock.

4.38.1.1 Features

The Pierce Oscillator (OSCLCP) contains circuitry to dynamically control current gain in the output amplitude. This ensures a signal with low harmonic distortion, low power and good noise immunity.

  • Supports crystals or resonators from 4.0 to 16 MHz.
  • High noise immunity due to input hysteresis and spike filtering.
  • Low RF emissions with peak-to- peak swing limited dynamically
  • Transconductance (gm) sized for optimum start-up margin for typical crystals
  • Dynamic gain control eliminates the nee d for external current limiting resistor
  • Integrated resistor eliminates the need for external bias resistor.
  • Low power consumption: Operates from internal 1.8 V (nominal) supply, Amplitude control limits power The Voltage Regulator (IVREG) has the following features:
  • Input voltage range from 3.13 to 5.5 V
  • Low-voltage detect (LVD) with low-voltage interrupt (LVI)
  • Power-on reset (POR)
  • Low-voltage reset (LVR)
  • during scan pattern execution option to go to RPM to support IDDq test.
  • external voltage reference used for HV-stress test and MIM screen, the external voltage on VDDA, divided by series resistors, will be used as input to the regulating loop of the IVREG The Phase Locked Loop (PLL) has the following features:
  • highly accurate and phase locked frequency multiplier
  • Configurable internal filter for best stability and lock time.
  • Frequency modulation for defined jitter and reduced emission
  • Automatic frequency lock detector
  • Interrupt request on entry or exit from locked condition
  • Reference clock either external (crystal) or internal square wave (1.0 MHz IRC1M) based.
  • PLL stability is sufficient for LIN communica tion, even if using IRC1M as reference clock The Internal Reference Clock (IRC1M) has the following features:
  • Trimmable in frequency
  • Factory trimmed value for 1.0 MHz in Flash Memory , can be overwritten by application if required Other features of the S12CPMU include
  • Clock monitor to detect loss of crystal
  • Autonomous periodical interrupt (API)
  • Bus Clock Generator — Clock switch to select either PLLCLK or external crystal/resonator based Bus Clock — PLLCLK divider to adjust system speed
  • System Reset generation from the following possible sources: — Power-on reset (POR) — Low-voltage reset (LVR) — Illegal address access — COP timeout — Loss of oscillation (clock monitor fail) — External pin RESET

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 237

4.38.1.2 Modes of Operation

This subsection lists and briefly describes all operating modes supported by the S12CPMU.

4.38.1.2.1 Run Mode

The voltage regulator is in Full Performance Mode (FPM). The Phase-locked Loop (PLL) is on. The Internal Reference Clock (IRC1M) is on. The API is available.

  • PLL Engaged Internal (PEI) — This is the default mode after System Reset and Power-on Reset. — The Bus Clock is based on the PLLCLK. — After reset the PLL is configured for 64 MHz VCOCLK operation Post divider is 0x03, so PLLCLK is VCOCLK divided by 4, that is 16 MHz and Bus Clock is 8.0 MHz. The PLL can be reconfigured for other bus frequencies. — The reference clock for the PLL (REFCLK) is based on internal reference clock IRC1M
  • PLL Engaged External (PEE) — The Bus Clock is based on the PLLCLK. — This mode can be entered from default mo de PEI by performing the following steps: – Configure the PLL for desired bus frequency. – Program the reference divider (REF DIV[3:0] bits) to divide down oscillator frequency if necessary. – Enable the external oscillator (OSCE bit)
  • PLL Bypassed External (PBE) — The Bus Clock is based on the Oscillator Clock (OSCCLK). — This mode can be entered from default mo de PEI by performing the following steps: – Enable the external oscillator (OSCE bit) – Wait for oscillator to start up (UPOSC=1) – Select the Oscillator Clock (OSCCLK) as Bus Clock (PLLSEL=0) — The PLLCLK is still on to filter possible spikes of the external oscillator clock

4.38.1.2.2 Stop Mode

This mode is entered by executing the CPU STOP instruction. The voltage regulator is in Reduced Power mode (RPM) The API is available The Phase Locked Loop (PLL) is off The Internal Reference Clock (IRC1M) is off Core Clock, Bus Clock and BDM Clock are stopped Depending on the setting of the PSTP and the OSCE bit, Stop mode can be differentiated between Full Stop mode (PSTP = 0 or OSCE=0) and Pseudo Stop mode (PSTP = 1 and OSCE=1).

  • Full Stop mode (pstp = 0 or osce=0) The external oscillator (OSCLCP) is disabled After wake-up from Full Stop mode the Core Clock and Bus Clock are running on PLLCLK (PLLSEL=1). After wake-up from Full Stop mode the COP and RTI are running on IRCCLK (COPOSCSEL=0, RTIOSCSEL=0)
  • Pseudo Stop Mode (PSTP = 1 and OSCE=1) The external oscillator (OSCLCP) continues to run. If the respective enable bits are set the COP and RTI will continue to run. The clock configuration bits PLLSEL, COPOSCSEL, RTIOSCSEL are unchanged NOTE When starting up the external oscillator (either by programming OSCE bit to 1 or on exit from Full Stop Mode with OSCE bit already 1) the software must wait for a minimum time equivalent to the startup-time of the external oscillator t UPOSC before entering Pseudo Stop mode.

4.38.1.3 S12CPMU Block Diagram

Figure 85. Block diagram of S12CPMU

Figure 86 shows a block diagram of the OSCLCP . Figure 86. OSCLCP Block Diagram

4.38.2 Signal Description

This section lists and describes the signals that connect off chip.

4.38.2.1 RESET

open-drain output it indicates that an MCU-internal reset has been triggered.

4.38.2.2 EXTAL and XTAL

k and the XTAL pin is pulled down by an internal resistor of approximately 700 k.

4.38.2.3 VDDR — Regulator Power Input Pin

Pin VDDR is the power input of IVREG. All currents sourced into the regulator loads flow through this pin. An off-chip decoupling capacitor (100 nF...220 nF, X7R ceramic) between VDDR and VSS can smooth ripple on VDDR.

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 240

4.38.2.4 VSS — Ground Pin

4.38.2.5 VSS must be grounded.VDDA, VSSA — Regulator Reference Supply Pins Pins VDDA and VSSA are used to supply the analog parts of the regulator. Internal precision reference circuits are supplied from these signals. An off-chip decoupling capacitor (100 nF...220 nF, X7R ceramic) between VDDA and VSSA can improve the quality of this supply.

4.38.2.6 VDDX, VSSX— Pad Supply Pins

This supply domain is monitored by the Low Voltage Reset circuit. An off-chip decoupling capacitor (100 nF...220 nF, X7R ceramic) between VDDX and VSSX can improve the quality of this supply. NOTE Depending on the device package following device supply pins are maybe combined into one supply pin: VDDR, VDDX and VDDA. Depending on the device package following device supply pins are maybe combined into one supply pin: VSS, VSSX and VSSA. Please refer to the device Reference Manual for information if device supply pins are combined into one supply pin for certain packages and which supply pins are combined together. An off-chip decoupling capacitor (100 nF...220 nF, X7R ceramic) between the combined supply pin pair can improve the quality of this supply.

4.38.2.7 VDD — Internal Regulator Output Supply (Core Logic)

Node VDD is a device internal supply output of the voltage regulator that provides the power supply for the core logic. This supply domain is monitored by the Low Voltage Reset circuit.

4.38.2.8 VDDF — Internal Regulator Output Supply (NVM Logic)

Node VDDF is a device internal supply output of the voltage regulator that provides the power supply for the NVM logic. This supply domain is monitored by the Low Voltage Reset circuit

4.38.2.9 API_EXTCLK — API external clock output pin

This pin provides the signal selected via APIES and is enabled with APIEA bit. See device specification to which pin it connects. 4.38.2.10 vddf_test, vdd_test, vddpll_test — supply testmode pins These pins allow to measure internal VDDF, VDD, VDDPLL. 4.38.2.11 cpmu_test_clk This signal is connected to a device pin and allows measuring internal clocks if cpmu_test_clk_en bit is set. 4.38.2.12 cpmu_test_xfc This signal is connected to a device pin and allows measuring the internal PLL filter node if cpmu_test_xfc_en bit is set.

4.38.2.13 REGFT[2:0] and REGT[2:0]

With the ipt_trim_ld_en signal of the PTI, the trim values for VDD and VDDF of the VREG are loaded into CPMUTEST3 register which directly trims the VREG.

4.38.3 Memory Map and Registers

This section provides a detailed description of all registers accessible in the S12CPMU.

4.38.3.1 Module Memory Map

The S12CPMU registers are shown in Figure 337.

Table 337. CPMU Register Summary

4.38.3.2 Register Descriptions

This section describes all the S12CPMU registers and their individual bits. Address order is as listed in Figure 337.

4.38.3.2.1 S12CPMU Synthesi zer Register (CPMUSYNR)

The CPMUSYNR register controls the multiplication factor of the PLL and selects the VCO frequency range. Write: Anytime if PROT=0 (CPMUPROT register) and PLLSEL=1 (CPMUCLKS register). Else write has no effect. Writing to this register clears the LOCK and UPOSC status bits. exceed the specified maximum. VCOFRQ[1:0] bits incorrectly can result in a non functional PLL (no locking and/or insufficient stability). Table 338. S12CPMU Synthesizer Register (CPMUSYNR)

4.38.3.2.2 S12CPMU Reference Di vider Register (CPMUREFDIV)

Write: Anytime if PROT=0 (CPMUPROT register) and PLLSEL=1 (CPMUCLKS register). Else write has no effect. Write to this register clears the LOCK and UPOSC status bits. the REFFRQ[1:0] bits have to be selected according to the actual REFCLK frequency as shown in Table 341. can still be written but will have no effect on the PLL filter configuration. For OSCE=1, setting the REFFRQ[1:0] bits incorrectly can result in a non functional PLL (no locking and/or insufficient stability). Table 339. VCO Clock Frequency Selection

32 MHz <= fVCO<= 48 MHz 00

48 MHz < fVCO<= 6 4MHz 01

Table 340. S12CPMU Reference Divider Register (CPMUREFDIV)

4.38.3.2.3 S12CPMU Po st Divider Register (CPMUPOSTDIV)

The POSTDIV register controls the frequency ratio between the VCOCLK and the PLLCLK. Write: Anytime if PLLSEL=1. Else write has no effect.

4.38.3.2.4 S12CPMU Flags Register (CPMUFLG)

This register provides S12CPMU status bits and flags. Table 341. Reference Clock Frequency Selection if OSC_LCP is enabled Table 342. S12CPMU Post Divider Register (CPMUPOSTDIV) Table 343. S12CPMU Flags Register (CPMUFLG)

  1. PORF is set to 1 when a power on reset occurs. Unaffected by System Reset.
  2. LVRF is set to 1 when a low voltage reset occurs. Unaffected by System Reset. Set by power on reset.
  3. ILAF is set to 1 when an illegal address reset occurs. Unaffected by System Reset. Cleared by power on reset.

information as well (UPOSC=0). Table 344. CPMUFLG Field Descriptions a 0 has no effect. If enabled (RTIE=1), RTIF causes an interrupt request. 0 RTI timeout has not yet occurred. 0 Power on reset has not occurred. 1 Power on reset has occurred. Low Voltage Reset Flag — LVRF is set to 1 when a low voltage reset occu rs. This flag can only be cleared by writing a 1. 0 Low voltage reset has not occurred. 1 Low voltage reset has occurred. PLL Lock Interrupt Flag — LOCKIF is set to 1 when LOCK status bit ch anges. This flag can only be cleared by writing a 1. Writing a 0 has no effect.If enabled (LOCKIE=1), LOCKIF causes an interrupt request. (LOCK=0) fPLL is fVCO / 4 to protect the system from high core clock frequencies during the PLL stabilization time tlock. 0 VCOCLK is not within the desired tolerance of the target frequency. f PLL = fVCO/4. 1 VCOCLK is within the desired tolerance of the target frequency. f PLL = fVCO/(POSTDIV+1). flag can only be cleared by writing a 1. Writing a 0 has no effect. 0 Illegal address reset has not occurred. 1 Illegal address reset has occurred. Oscillator Interrupt Flag — OSCIF is set to 1 when UPOSC status bit changes. This flag can only be cleared by writing a 1. Writing a 0 has no effect.If enabled (OSCIE=1), OSCIF causes an interrupt request. going to the MSCAN module is off. Entering Full Stop Mode UPOSC is cleared. 0 The oscillator is off or oscillation is not qualified by the PLL. 1 The oscillator is qualified by the PLL.

4.38.3.2.5 S12CPMU Interrupt En able Register (CPMUINT)

This register enables S12CPMU interrupt requests.

4.38.3.2.6 S12CPMU Cl ock Select Register (CPMUCLKS)

This register controls S12CPMU clock selection.

  1. Only possible if PROT=0 (CPMUPROT register) in all MCU Modes (Normal and Special mode).
  2. All bits in Special mode (if PROT=0).
  3. PLLSEL, PSTP, PRE, PCE, RTIOSC SEL: In Normal mode (if PROT=0).
  4. COPOSCSEL: In Normal mode (if PROT=0) until CPMUCOP write once is taken. If COPOSCSEL was cleared by

register to make sure that write of PLLSEL, RTIOSCSEL and COPOSCSEL was successful. Table 345. S12CPMU Interrupt Enable Register (CPMUINT) Table 346. CRGINT Field Descriptions 0 Interrupt requests from RTI are disabled. 1 Interrupt will be requested whenever RTIF is set. 0 PLL LOCK interrupt requests are disabled. 1 Interrupt will be requested whenever LOCKIF is set. 0 Oscillator Corrupt interrupt requests are disabled. 1 Interrupt will be requested whenever OSCIF is set. Table 347. S12CPMU Clock Select Register (CPMUCLKS)

4.38.3.2.7 S12CPMU PLL Control Register (CPMUPLL)

This register controls the PLL functionality. Write: Anytime if PROT=0 (CPMUPROT register) and PLLSEL=1 (CPMUCLKS register). Else write has no effect. Table 348. CPMUCLKS Descriptions This bit selects the PLLCLK as source of the System Clocks (Core Clock and Bus Clock). PLLSEL can only be set to 0, if UPOSC=1. UPOSC= 0 sets the PLLSEL bit. Entering Full Stop Mode sets the PLLSEL bit.

0 System clocks are derived from OSCCLK if oscillator is up (UPOSC=1, f

1 System clocks are derived from PLLCLK, f BUS = fPLL / 2. This bit controls the functionality of the oscillator during Stop Mode. 0 Oscillator is disabled in Stop Mode (Full Stop Mode). 1 Oscillator continues to run in Stop Mode (Pseudo Stop Mode), option to run RTI and COP. case of frequent STOP conditions at the expense of a slightly increased power consumption. before entering Pseudo Stop Mode. RTI Enable During Pseudo Stop Bit — PRE enables the RTI during Pseudo Stop Mode. 0 RTI stops running during Pseudo Stop Mode. 1 RTI continues running during Pseudo Stop Mode if RTIOSCSEL=1. Note: If PRE=0 or RTIOSCSEL=0 then the RTI will go stat ic while Stop Mode is active. The RTI counter will not be reset. COP Enable During Pseudo Stop Bit — PCE enables the COP during Pseudo Stop Mode.

0 COP stops running during Pseudo Stop Mode

1 COP continues running during Pseudo Stop Mode if COPOSCSEL=1

Note: If PCE=0 or COPOSCSEL=0 then the COP will go static while Stop Mode is active. The COP counter will not be reset. bit re-starts the RTI timeout period. RTIOSCSEL can only be set to 1, if UPOSC=1. UPOSC= 0 clears the RTIOSCSEL bit. 0 RTI clock source is IRCCLK. 1 RTI clock source is OSCCLK. COPOSCSEL bit re-starts the COP timeout period. COPOSCSEL can only be set to 1, if UPOSC=1. UPOSC= 0 clears the COPOSCSEL bit. 0 COP clock source is IRCCLK.

1 COP clock source is OSCCLK

Table 349. S12CPMU PLL Control Register (CPMUPLL)

Write to this register clears the LOCK and UPOSC status bits. maximum when frequency modulation is enabled.

4.38.3.2.8 S12CPMU RTI Cont rol Register (CPMURTI)

This register selects the timeout period for the Real Time Interrupt. PSTP=1 (Pseudo Stop Mode) and RTIOSCSEL=1 the RTI continues to run, else the RTI counter halts in Stop Mode. a different value or loosing UPOSC status) restarts the RTI timeout period. Table 350. CPMUPLL Field Descriptions noise emission. The modulation frequency is fref divided by 16. See Table 351 for coding. Table 351. FM Amplitude selection

00 F M o f f

Table 352. S12CPMU RTI Control Register (CPMURTI)

Table 353. CPMURTI Field Descriptions Decimal or Binary Divider Select Bit — RTDEC selects decimal or binary based prescaler values. granularity.Table 354 and Table 355 show all possible divide values selectable by the CPMURTI register. Table 354. RTI Frequency Divide Rates for RTDEC = 0

  1. Denotes the default value out of reset.This value should be us ed to disable the RTI to ensure future backwards compatibility.

Table 355. RTI Frequency Divide Rates for RTDEC=1

4.38.3.2.9 S12CPMU COP Cont rol Register (CPMUCOP)

This register controls the COP (Computer Operating Properly) watchdog. PSTP=1(Pseudo Stop Mode), COPOSCSEL=1 and PCE=1 the COP continues to run, else the COP counter halts in Stop Mode.

  1. RSBCK: anytime in Special Mode; write to “1” but not to “0” in Normal Mode

— Write once in Normal Mode, when WR TMASK is 0, otherwise it has no effect. – Writing CR[2:0] to “000” has no effect, but counts for the “write once” condition. – Writing WCOP to “0” has no effect, but counts for the “write once” condition. Table 356. S12CPMU COP Control Register (CPMUCOP)

  1. After de-assert of System Reset the values are automatically loaded from the Flash memory. See Device specification for details.

When a non-zero value is loaded from Flash to CR[2:0] the COP timeout period is started. A change of the COPOSCSEL bit (writing a different value or loosing UPOSC status) re-starts the COP timeout period.

  1. Writing a non-zero value to CR[2: 0] (anytime in Special Mode, once in Normal Mode) with WRTMASK = 0.
  2. Writing WCOP bit (anytime in Special Mode, once in Normal Mode) with WRTMASK = 0.
  3. Changing RSBCK bit from “0” to “1”.

In Special Mode, any write access to CPMUCOP register restarts the COP timeout period.

4.38.3.2.10 Reserved Register CPMUTEST0

Table 357. CPMUCOP Field Descriptions Window COP Mode Bit — When set, a write to the CPMUARMCOP register must occur in the last 25% of the selected period.

0 Normal COP operation

1 Window COP operation

0 Allows the COP and RTI to keep running in Active BDM mode. 1 Stops the COP and RTI counters whenever the part is in Active BDM mode. the CPMUCOP register. It is intended for BDM writing the RSBCK without changing the content of WCOP and CR[2:0].

0 Write of WCOP and CR[2:0] has an effect with this write of CPMUCOP

avoided by periodically (before timeout) initializing the COP counter via the CPMUARMCOP register. Table 358. COP Watchdog Rates

Table 359. Reserved Register (CPMUTEST0) Table 360. CPMUTEST0 Field Descriptions FMCS Register Select Bit— This bit switches either CPMUTEST1 or CPMUFMCS test register to address 0x003E. 1 CPMUFMCS register is visible on address 0x003E, fm_cs[7:0] of hardmacro driven to value of FMCS register. functional test mode (where it is by default disabled).

0 Glitch Filter disable request

1 Glitch Filter enable request

pfd_force_up=pfd_force_down=0. pfd_force_up=pfd_force_down=0.

0 Internal filter node (FC) not driven from defined values (1/2 or 1/3 VDDPLL)

1 If REFFRQ[1]=1 then internal filter node (FC) is driven to V DDPLL/3. If REFFRQ[1]=0 then internal filter node (FC) is driven to VDDPLL/2. converter in the PLL. Setting vcofrq2-0 all to 1 is intended for 160MHz VCOCLK generation. is easier to measure on tester.

0 FM amplitude multiplied by 1

1 FM amplitude multiplied by 4

Test square wave enable Bit — Enables XTAL pin digital input data used for Oscillator test.

0 XTAL pin as digital input disabled

1 XTAL pin as digital input enabled

4.38.3.2.11 Reserved Register CPMUTEST1

4.38.3.2.12 Reserved Register CPMUFMCS

Table 361. Reserved Register (CPMUTEST1) Table 362. CPMUTEST1 Field Descriptions pfd_force_up or pfd_force_down bit or cpmu_test_xfc pin or fc_force_en. 0 Normal functionality of Phase Detector using REFCLK and FBCLK. 1 Phase detector de-connected from REFCLK and FBCLK (PLL loop open). CPMU test clock enable Bit— This bits routes the clock selected by cpmu_t est_clk_sel[1:0] to external pin cpmu_test_clk. 0 CPMU test clock not observable. 1 CPMU test clock observable at external pin. or characterization purposes. 00 = IRCCLK, 01=OSCCLK, 10=VCOCLK, 11=VCOCLK_DIV4. Oscillator clock monitor disable Bit — to disable the clock monitor in special single chip mode. 0 Clock monitor always enabled with OSCE=1. 1 Clock monitor disabled regardless of OSCE Bit. Oscillator external square wave enable Bit — Drives directly osc_lcp_extsqw _enable input of OSCLCP hardmacro. (FC). So for this case write xfc_en=fc_force_en=pfd_force_down=0. 1 If pfd_force_en=1 then the charge pump conti nuously drives internal filter node down. node (FC). So for this case write xfc_en=fc_force_en=pfd_force_up=0. 1 If pfd_force_en=1 then the charge pump cont inuously drives internal filter node up.

4.38.3.2.13 S12CPMU CO P Timer Arm/Reset Register (CPMUARMCOP)

This register is used to restart the COP timeout period. When the COP is disabled (CR[2:0] = “000”) writing to this register has no effect. the selected period will cause a COP reset.

4.38.3.2.14 Low Voltage Control Register (CPMULVCTL)

The CPMULVCTL register allows the configuration of the low-voltage detect features. Figure 87. Reserved Register (CPMUFMCS) Table 363. CPMUFMCS Field Descriptions Table 364. S12CPMU CPMUARMCOP Register Table 365. Low Voltage Control Register (CPMULVCTL)

4.38.3.2.15 Autonomous Periodical Inte rrupt Control Register (CPMUAPICTL)

The CPMUAPICTL register allows the configuration of the autonomous periodical interrupt features.

  1. The Reset state of LVDS and LVIF depends on the external supplied VDDA level

Table 366. CPMULVCTL Field Descriptions Low-voltage Detect Status Bit — This read-only status bit re flects the voltage level on VDDA. Writes have no effect. 0 Input voltage VDDA is above level VLVID or RPM. 1 Input voltage VDDA is below level VLVIA and FPM. 0 Interrupt request is disabled. 1 Interrupt will be requested whenever LVIF is set. Low-voltage Interrupt Flag — LVIF is set to 1 when LVDS status bit changes. This flag can only be cleared by writing a 1. Writing a 0 has no effect. If enabled (LVIE = 1), LVIF causes an interrupt request. Figure 88. Autonomous Periodical Interrupt Control Register (CPMUAPICTL)

Figure 89. Waveform selected on API_EXTCLK pin (APIEA=1, APIFE=1)

4.38.3.2.16 Autonomous Periodical Inte rrupt Trimming Register (CPMUAPITR)

The CPMUAPITR register configures the trimming of the API time-out period. Table 367. CPMUAPICTL Field Descriptions Autonomous Periodical Interrupt Clock Select Bit — Selects the clock source for the API. Writable only if APIFE = 0. APICLK cannot be changed if APIFE is set by the same write operation. 0 Autonomous periodical interrupt clock used as source. in Figure 89. See device level specification for connectivity of API_EXTCLK pin. every selected period with the size of half of the minimum period (APIR=0x0000 in Table 371). accessed externally. See device level specification for connectivity. 0 Waveform selected by APIES can not be accessed externally. 1 Waveform selected by APIES can be acce ssed externally, if APIFE is set. Autonomous Periodical Interrupt Feature Enable Bit — Enables the API feature and starts the API timer when set. 0 Autonomous periodical interrupt is disabled. 1 Autonomous periodical interrupt is enabled and timer starts running. 0 API interrupt request is disabled. 1 API interrupt will be requested whenever APIF is set. only be cleared by writing a 1. Writing a 0 has no effect. If enabled (APIE = 1), APIF causes an interrupt request. 0 API time-out has not yet occurred. 1 API time-out has occurred.

4.38.3.2.17 Autonomous Periodical Interrupt Rate High and Low Register (CPMUAPIRH / CPMUAPIRL)

The CPMUAPIRH and CPMUAPIRL registers allow the configuration of the autonomous periodical interrupt rate. Figure 90. Autonomous Periodical Interrupt Trimming Register (CPMUAPITR) After de-assert of System Reset a value is automatically loaded from the Flash memory. Table 368. CPMUAPITR Field Descriptions represents a signed number influencing the ACLK period time. Table 369. Trimming Effect of APITR Figure 91. Autonomous Periodical Interrupt Rate High Register (CPMUAPIRH) Figure 92. Autonomous Periodical Interrupt Rate Low Register (CPMUAPIRL)

Write: Anytime if APIFE=0. Else writes have no effect.

4.38.3.2.18 Reserved Register CPMUTEST3

Table 370. CPMUAPIRH / CPMUAPIRL Field Descriptions the effect of the autonomous periodical interrupt rate bits. Table 371. Selectable Autonomous Periodical Interrupt Periods 1 When fACLK is trimmed to 10KHz.

1 FFFD 131068 * Bus Clock period

1 FFFE 131070 * Bus Clock period

1 FFFF 131072 * Bus Clock period

4.38.3.2.19 S12CPMU IRC1M Trim Regist ers (CPMUIRCTRIMH / CPMUIRCTRIML)

Writes to these registers while PLLSEL=1 clears the LOCK and UPOSC status bits. Table 372. Reserved Register (CPMUTEST3) Table 373. S12CPMU IRC1M Trim High Register (CPMUIRCTRIMH)

  1. After de-assert of System Reset a factory programmed trim val ue is automatically loaded from the Flash memory to provide trimmed

Internal Reference Frequency fIRC1M_TRIM. Table 374. S12CPMU IRC1M Trim Low Register (CPMUIRCTRIML)

  1. After de-assert of System Reset a factory programmed trim val ue is automatically loaded from the Flash memory to provide trimmed

Internal Reference Frequency fIRC1M_TRIM.

Figure 93. IRC1M Frequency Trimming Diagram Table 375. CPMUIRCTRIMH/L Field Descriptions Trim bits for the Temperature Coefficient (TC) of the IRC1M frequency. Figure 94 shows the influence of the bits TCTRIM4:0] on the relationship between frequency and temperature. Reference Frequency fIRC1M_TRIM. See device electrical characteristics for value of fIRC1M_TRIM. A rough trimming controlled by bits IRCTRIM[9:6] can be done with frequency leaps of about 6% in average. Figure 93 shows the relationship between the trim bits and the resulting IRC1M frequency.

1.5 MHz

1.0 MHz

Figure 94. Influence of TCTRIM[4:0] on the Temperature Coefficient The frequency is not necessarily linear with the temperature (in most cases it will not be). of the TC, relative to the nominal TC. which result in the nominal TC of the IRC1M. Table 376. TC Trimming of the Frequency of the IRC1M

ambient temperature which can vary from device to device.

4.38.3.2.20 S12CPMU Oscillator Register (CPMUOSC)

This register configures the external oscillator (OSCLCP). Write: Anytime if PROT=0 (CPMUPROT register) and PLLSEL=1 (CPMUCLKS register). Else write has no effect. Write to this register clears the LOCK and UPOSC status bits. number, the filter can not be used and the OSCFILT[4:0] bits must be set to 0.

4.38.3.2.21 S12CPMU Protect ion Register (CPMUPROT)

Table 377. S12CPMU Oscillator Register (CPMUOSC) Table 378. CPMUOSC Field Descriptions register indicates when the oscillation is stable and OSCCLK can be selected as Bus Clock or source of the COP or RTI. A loss of oscillation will lead to a clock monitor reset. 0 External oscillator is disabled. REFCLK for PLL is IRCCLK. oscillator tUPOSC before entering Pseudo Stop Mode. 0 Oscillator filter bandwidth is narrow (window for expected OSCCLK edge is one VCOCLK cycle). 1 Oscillator filter bandwidth is wide (window for expected OSCCLK edge is three VCOCLK cycles). If OSCE=1 this read-only bit is set. It can only be cleared with the next reset. Enabling the external oscillator reserves the EXTAL and XTAL pins exclusively for oscillator application. 0 EXTAL and XTAL pins are not reserved for oscillator. 1 EXTAL and XTAL pins exclusiv ely reserved for oscillator. external oscillator clock and detects if the external oscillator clock is qualified or not (quality status shown by bit UPOSC). OSCFILT[4:0] bits to enable the Adaptive Oscillator Filter. 0x0000 Adaptive Oscillator Filter disabled.

4.38.3.2.22 Reserved Register CPMUTEST2

a $E3 before into this register. Table 379. S12CPMU Protection Register (CPMUPROT) (see list of protected registers above). Writing 0x26 to the CPMUPROT register clears the PROT bit, other write accesses set the PROT bit. 0 Protection of clock configuration registers is disabled. Table 380. Reserved Register CPMUTEST2

4.38.4 Functional Description

4.38.4.1 Phase-locked Loop with Internal Filter (PLL)

The PLL is used to generate a high speed PLLCLK based on a low frequency REFCLK. The REFCLK is by default the IRCCLK which is trimmed to fIRC1M_TRIM=1.0 MHz. can be divided in a range of 1,2, 3, 4, 5, 6,... to 32 to generate the PLLCLK. Table 381. CPMUTEST2 Field Descriptions when core reset disabled for parametric tests. Writes have no effect. 0 Input voltage V DD is above level VLVRA or device is in Reduced Performance Mode (RPM). 1 Input voltage V DD is below level VLVRA and device is in Full Performance Mode (FPM). when core reset disabled for parametric tests. Writes have no effect. 0 Input voltage V DDF is above level VLVRFA or device is in RPM. 1 Input voltage V DDF is below level VLVRFA and device is in FPM. when core reset disabled for parametric tests. Writes have no effect. 0 Input voltage V DDX is above level VLVRXA or device is in RPM. 1 Input voltage V DDX is below level VLVRXA and device is in FPM. (ACLK) can be mapped also to an output pin. See Section 1 (Device Overview) and Section Port Integration Module for details. 0 The Autonomous Periodical Interrupt clock (ACLK) is not mapped to an output pin. 1 The Autonomous Periodical Interrupt clock (ACLK) is mapped to an output pin if APIFE is set and APIEA=0.

exceed the specified bus frequency limit for the MCU.

  • Use lowest possible f VCO / fREF ratio (SYNDIV value).
  • Use highest possible REFCLK frequency f REF. The phase detector inside the PLL compares the feedback clock (FBCLK = VCOCLK/(SYNDIV+1) with the reference clock (REFCLK = (IRC1M or OSCCLK)/(REFDIV+1)). Correction pulses are generated based on the phase difference between the two signals. The loop filter alters the DC voltage on the internal filter capacitor, based on the width and direction of the correction pulse, which leads to a higher or lower VCO frequency. The user must select the range of the REFCLK frequency (REFFRQ[1:0] bits) and the range of the VCOCLK frequency (VCOFRQ[1:0] bits) to ensure that the correct PLL loop bandwidth is set. The lock detector compares the frequencies of the FBCLK and the REFCLK. Therefore the speed of the lock detector is directly proportional to the reference clock frequency. The circuit determines the lock condition based on this comparison. If PLL LOCK interrupt requests are enabled, the software can wait for an interrupt request and for instance check the LOCK bit. If interrupt requests are disabled, software can poll the LOCK bit continuously (during PLL start-up) or at periodic intervals. In either case, only when the LOCK bit is set, the VCOCLK will have stabilized to the programmed frequency.
  • The LOCK bit is a read-only indica tor of the locked state of the PLL.
  • The LOCK bit is set when the VCO frequency is within the tolerance, Lock, and is cleared when the VCO frequency is out of the tolerance, unl.
  • Interrupt requests can occur if enabled (LOCKIE = 1) when the lock condition changes, toggling the LOCK bit.

4.38.4.2 Startup from Reset

An example of startup of clock system from Reset is given in Figure 95. Figure 95. Startup of Clock System After Reset Table 382. Examples of PLL Divider Settings

4.38.4.3 Stop Mode using PLLCLK as Bus Clock

Lock interrupt (LOCKIE=0) before going into Stop mode. Figure 96. Stop Mode Using PLLCLK as Bus Clock

4.38.4.4 Full Stop Mode using Oscillator Clock as Bus Clock

An example of what happens going into Full Stop mode and exiting Full Stop mode after an interrupt is shown in Figure 97. Disable PLL Lock interrupt (LOCKIE=0) and oscillator status change interrupt (OSCIE=0) before going into Full Stop mode. Figure 97. Full Stop Mode Using Oscillator Clock as Bus Clock

4.38.4.5 Extern al Oscillator

4.38.4.5.1 Enabl ing the External Oscillator

An example of how to use the oscillator as Bus Clock is shown in Figure 98.

Figure 98. Enabling the External Oscillator

4.38.4.5.2 The Adapti ve Oscillator Filter

A spike in the oscillator clock can disturb the function of the modules driven by this clock.

  1. Filter noise (spikes) from the incoming external o scillator clock. The filter feature is illustrated in Figure 99.

Figure 99. Noise Filtered by the Adaptive Oscillator Filter

  1. Detect severe noise disturbance on external oscillator clock which can not be filtered and indicate the critical situation

Figure 100. Critical Noise Detected by the Adaptive Oscillator Filter enable external oscillator by writing OSCE bit to one.

The use of the filter function is only possible if the VCOCLK-to-OSCCLK ratio divided by two ((fVCO / fOSC)/2) is an integer number. This integer value must be written to the OSCFILT[4:0] bits. of this window is three VCOCLK cycles, if the OSCBW = 0 it is one VCOCLK cycle. The noise detection is active for certain combinations of OSCFILT[4:0] and OSCBW bit settings as shown in Table 383.

4.38.4.6 System Clock Configurations

4.38.4.6.1 PLL Engaged Internal Mode (PEI)

This mode is the default mode after System Reset or Power-on Reset. 8.0 MHz. The PLL can be re-configured to other bus frequencies. The clock sources for COP and RTI are based on the internal reference clock generator (IRC1M).

4.38.4.6.2 PLL Engaged External Mode (PEE)

The clock sources for COP and RTI can be based on the internal reference clock generator or on the external oscillator clock.

  1. Configure the PLL for desired bus frequency.
  2. Optionally the adaptive spike filter and detection logic can be enabled by calculating the integer value for the

OSCFIL[4:0] bits and setting the bandwidth (OSCBW) accordingly.

  1. Enable the external Oscillator (OSCE bit).
  2. Wait for the PLL being locked (LOCK = 1) and the oscillator to start-up and additionally being qualified if the Adaptive

Oscillator Filter is enabled (UPOSC =1).

  1. Clear all flags in the CPMUFLG register to be able to detect any future status bit change.
  2. Optionally status interrupts ca n be enabled (CPMUINT register).

Table 383. Noise Detection Settings

The PLLCLK is derived from the VCO clock (with its actual frequency) divided by four until the PLL locks again. Application software needs to be prepared to deal with the impact of loosing the oscillator status at any time.

4.38.4.6.3 PLL Bypassed External Mode (PBE)

The clock sources for COP and RTI can be based on the internal reference clock generator or on the external oscillator clock.

  1. Make sure the PLL configuration is valid.
  2. Optionally the adaptive spike filter and detection logic can be enabled by calculating the integer value for the

OSCFIL[4:0] bits and setting the bandwidth (OSCBW) accordingly.

  1. Enable the external Oscillator (OSCE bit)
  2. Wait for the PLL being locked (LOCK = 1) and the oscillator to start-up and additionally being qualified if the Adaptive

Oscillator Filter is enabled (UPOSC=1).

  1. Clear all flags in the CPMUFLG register to be able to detect any status bit change.
  2. Optionally status interrupts ca n be enabled (CPMUINT register).
  3. Select the Oscillator Clock (OSCCLK) as Bus Clock (PLLSEL=0)
  • PLLSEL is set automatically and the Bus Clock is switched back to the PLLCLK.
  • The PLLCLK is derived from the VCO clock (with its ac tual frequency) divided by four until the PLL locks again. Application software needs to be prepared to deal with the impact of loosing the oscillator status at any time. In the PBE mode, not every noise disturbance can be indicated by bits LOCK and UPOSC (both bits are based on the Bus Clock domain). There are clock disturbances possible, after which UPOSC and LOCK both stay asserted while occasional pauses on the filtered OSCCLK and resulting Bus Clock occur. The adaptive spike filter is still functional and protects the Bus Clock from frequency overshoot due to spikes on the external oscillator clock. The filtered OSCCLK and resulting Bus Clock will pause until the PLL has stabilized again.

4.38.5 Resets

4.38.5.1 General

4.38.5.2 Description of Reset Operation

samples the RESET pin to determine the originating source. Table 385 shows which vector will be fetched. Table 384. Reset Summary

While System Reset is asserted the PLLCLK runs with the frequency fVCORST. reset remains asserted longer. Figure 101. RESET Timing

4.38.5.2.1 Clock Monitor Reset

mode the external oscillator and the clock monitor are disabled.

4.38.5.2.2 Computer Operating Pr operly Watchdog (COP) Reset

software is no longer being executed in the intended sequence; thus COP reset is generated. PSTP=1 (Pseudo Stop Mode), COPOSCSEL=1 and PCE=1 the COP continues to run, else the COP counter halts in Stop Mode. Three control bits in the CPMUCOP register allow selection of seven COP time-out periods. COP reset is generated. Also, if any value other than $55 or $AA is written, a COP reset is generated. Table 385. Reset Vector Selection

4.38.5.3 Power-On Reset (POR)

because this internal supply is not visible on device pins).

4.38.5.4 Low-voltage Reset (LVR)

the supply voltage VDDX are VLVRXA and VLVRXD and are specified in the device Reference Manual.

4.38.6 Interrupts

4.38.6.1 Description of Interrupt Operation

4.38.6.1.1 Real Time Interrupt (RTI)

PSTP=1 (Pseudo Stop mode), RTIOSCSEL=1 and PRE=1 the RTI continues to run, else the RTI counter halts in Stop mode. RTI timeout period starts immediately. A write to the CPMURTI register restarts the RTI timeout period.

4.38.6.1.2 PLL Lock Interrupt

interrupt flag (LOCKIF) is set to 1 when the lock condition has changed, and is cleared to 0 by writing a 1 to the LOCKIF bit.

4.38.6.1.3 Oscillator Status Interrupt

  1. Filters spikes of the external oscillator clock.
  2. Qualify the external oscillator clock.

filtered. The UPOSC bit is then set after the LOCK bit is set. set. Going into Full Stop Mode or disabling the oscillator can also cause a status change of UPOSC. Table 386. S12CPMU Interrupt Vectors

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 273 Also, since the Adaptive Oscillator Filter is based on the PLLCLK, any change in PLL configuration or any other event which causes the PLL lock status to be cleared leads to a loss of the oscillator status information as well (UPOSC=0). Oscillator status change interrupts are locally enabled with the OSCIE bit. NOTE Loosing the oscillator status (UPOSC=0) affects the clock configuration of the system(190). This needs to be dealt with in application software. Note: 190. For details please refer to “ 4.38.4.6, “System Clock Configurations”

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 274

4.39 Serial Peripheral Interface (S12SPIV5)

4.39.1 Introduction

The SPI module allows a duplex, synchronous, serial communication between the MCU and peripheral devices. Software can poll the SPI status flags or the SPI operation can be interrupt driven.

4.39.1.1 Glossary of Terms

4.39.1.2 Features

The SPI includes these distinctive features:

  • Master mode and slave mode
  • Selectable 8 or 16-bit transfer width
  • Bi-directional mode
  • Slave select output
  • Mode fault error flag with CPU interrupt capability
  • Double-buffered data register
  • Serial clock with programmable polarity and phase

4.39.1.3 Modes of Operation

The SPI functions in two modes: run and stop.

  • R u n m o d e This is the basic mode of operation.
  • Stop mode The SPI is inactive in stop mode for reduced power consumption. If the SPI is configured as a master, any transmission in progress stops, but is resumed after CPU goes into run mode. If the SPI is configured as a slave, reception and transmission of data continues, so that the slave stays synchronized to the master. For a detailed description of operating modes, please refer to Section 4.39.4.7, “Low Power Mode Options”.

4.39.1.4 Block Diagram

Figure 102 gives an overview on the SPI architecture. The main parts of the SPI are status, control and data registers, shifter logic, baud rate generator, master/slave control logic, and port control logic. SPI Serial Peripheral Interface SS Slave Select SCK Serial Clock MOSI Master Output, Slave Input MISO Master Input, Slave Output MOMI Master Output, Master Input SISO Slave Input, Slave Output

Figure 102. SPI Block Diagram

4.39.2 External Signal Description

module has a total of four external pins.

4.39.2.1 MOSI — Master Out/Slave In Pin

4.39.2.2 MISO — Master In/Slave Out Pin

4.39.2.3 SS — Slave Select Pin

when it is configured as a master and it is used as an input to receive the slave select signal when the SPI is configured as slave.

4.39.2.4 SCK — Serial Clock Pin

In master mode, this is the synchronous output clock. In slave mode, this is the synchronous input clock.

4.39.3 Memory Map and Register Definition

This section provides a detailed description of address space and registers used by the SPI.

4.39.3.1 Module Memory Map

the reserved bits return zeros and writes to the reserved bits have no effect.

4.39.3.2 Register Descriptions

associated figure number. Details of register bit and field function follow the register diagrams, in bit order. Table 387. SPI Register Summary

4.39.3.2.1 SPI Control Register 1 (SPICR1)

Table 388. SPI Control Register 1 (SPICR1) Table 389. SPICR1 Field Descriptions SPI Interrupt Enable Bit — This bit enables SPI interrupt requests, if SPIF or MODF status flag is set. is cleared, SPI is disabled and forced into idle state, status bits in SPISR register are reset. 0 SPI disabled (lower power consumption). 1 SPI enabled, port pins are dedicated to SPI functions. SPI Transmit Interrupt Enable — This bit enables SPI interrupt requests, if SPTEF flag is set. from master to slave or vice versa forces the SPI system into idle state. force the SPI system into idle state. 0 Active-high clocks selected. In idle state SCK is low. 1 Active-low clocks selected. In idle state SCK is high. transmission in progress and force the SPI system into idle state. 0 Sampling of data occurs at odd edges (1,3,5,...) of the SCK clock. 1 Sampling of data occurs at even edges (2,4,6,...) of the SCK clock. progress and force the SPI system into idle state. 0 Data is transferred most significant bit first. 1 Data is transferred least significant bit first.

4.39.3.2.2 SPI Control Register 2 (SPICR2)

Table 390. SS Input / Output Selection

00 S S not used by SPI SS input

01 S S not used by SPI SS input

10 S S input with MODF feature SS input

11 S S is slave select output SS input

Table 391. SPI Control Register 2 (SPICR2) Table 392. SPICR2 Field Descriptions the SPI system into idle state. mode, a change of this bit will abort a transmission in progress and force the SPI system into idle state. 0S S port pin is not used by the SPI. 1S S port pin with MODF feature. transmission in progress and force the SPI into idle state. of this bit will abort a transmission in progress and force the SPI system into idle state.

  1. n is used later in this document as a placeholder for the selected transfer width.

4.39.3.2.3 SPI Baud Ra te Register (SPIBR)

Electricals chapter of this data sheet. Table 393. Bidirectional Pin Configurations

1 Master I/O

0 Slave In

1 Slave I/O

Table 394. SPI Baud Rate Register (SPIBR) Table 395. SPIBR Field Descriptions of these bits will abort a transmission in progress and force the SPI system into idle state. these bits will abort a transmission in progress and force the SPI system into idle state. Table 396. Example SPI Baud Rate Selection (25 MHz us Clock)

Table 396. Example SPI Baud Rate Selection (25 MHz us Clock) (continued)

4.39.3.2.4 SPI Status Register (SPISR)

Table 397. SPI Status Register (SPISR)

Table 398. SPISR Field Descriptions clearing SPIF Flag, please refer to Table . 0 Transfer not yet complete. clearing this bit and placing data into the transmit data register, please refer to Table . 0 SPI data register not empty. to the SPI control register 1. 0 Mode fault has not occurred. Table 399. SPIF Interrupt Flag Clearing Sequence

0 Read SPISR with SPIF = 1 then Read SPIDRL

1 Read SPISR with SPIF = 1 then

  1. Data in SPIDRH is lost in this case.
  2. SPIDRH can be read repeatedly without any effect on SPIF. SPI F Flag is cleared only by the read of SPIDRL after reading SPISR with

Table 400. SPTEF Interrupt Flag Clearing Sequence

0 Read SPISR with SPTEF = 1 then Write to SPIDRL (194)

1 Read SPISR with SPTEF = 1 then

  1. Any write to SPIDRH or SPIDRL with SPTEF = 0 is effectively ignored.
  2. Data in SPIDRH is undefined in this case.
  3. SPIDRH can be written repeatedly without any effect on SPTEF. SPTEF Flag is cleared only by writing to SPIDRL after reading SPISR

4.39.3.2.5 SPI Data Regist er (SPIDR = SPIDRH:SPIDRL)

Received data in the SPIDR is valid when SPIF is set. receive shift register until the start of another transmission. The data in the SPIDR does not change. in the receive shift register is transferred into the SPIDR and SPIF remains set (see Figure 105). the receive shift register has become invalid and is not transferred into the SPIDR (see Figure 106). Figure 105. Reception with SPIF Serviced in Time Table 401. SPI Data Register High (SPIDRH) Table 402. SPI Data Register Low (SPIDRL)

Figure 106. Reception with SPIF Serviced Too Late

4.39.4 Functional Description

poll the SPI status flags or SPI operation can be interrupt driven.

  • Slave select (SS )
  • Serial clock (SCK)
  • Master out/slave in (MOSI)
  • Master in/slave out (MISO) The main element of the SPI system is the SPI data register. The n-bit (197) data register in the master and the n-bit(197) data register in the slave are linked by the MOSI and MISO pins to form a distributed 2n-bit(197) register. When a data transfer operation is performed, this 2n-bit(197) register is serially shifted n(197) bit positions by the S-clock from the master, so data is exchanged between the master and the slave. Data written to the master SPI data register becomes the output data for the slave, and data read from the master SPI data register after a transfer operation is the input data from the slave. A read of SPISR with SPTEF = 1 followed by a write to SPIDR puts data into the transmit data register. When a transfer is complete and SPIF is cleared, received data is moved into the receive data register. This data register acts as the SPI receive data register for reads and as the SPI transmit data register for writes. A common SPI data register address is shared for reading data from the read data buffer and for writing data to the transmit data register. The clock phase control bit (CPHA) and a clock polarity control bit (CPOL) in the SPI control register 1 (SPICR1) select one of four possible clock formats to be used by the SPI system. The CPOL bit simply selects a non-inverted or inverted clock. The CPHA bit is used to accommodate two fundamentally different protocols by sampling data on odd numbered SCK edges or on even numbered SCK edges (see Section 4.39.4.3, “Transmission Formats”). The SPI can be configured to operate as a master or as a slave. When the MSTR bit in SPI control register1 is set, master mode is selected, when the MSTR bit is clear, slave mode is selected. Note: NOTE A change of CPOL or MSTR bit while there is a received byte pending in the receive shift register will destroy the received byte and must be avoided. Receive Shift Register SPIF SPI Data Register Data A Data B Data A Data A Received Data B Received Data C Data C SPIF Serviced Data C Received Data B Lost = Unspecified = Reception in progress

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 285

4.39.4.1 Master Mode

The SPI operates in master mode when the MSTR bit is set. Only a master SPI module can initiate transmissions. A transmission begins by writing to the master SPI data register. If the shift register is empty, data immediately transfers to the shift register. Data begins shifting out on the MOSI pin under the control of the serial clock.

  • Serial clock The SPR2, SPR1, and SPR0 baud rate selection bits, in conjunction with the SPPR2, SPPR1, and SPPR0 baud rate preselection bits in the SPI baud rate register, control the baud rate generator and determine the speed of the transmission. The SCK pin is the SPI clock output. Through the SCK pin, the baud rate generator of the master controls the shift register of the slave peripheral.
  • MOSI, MISO pin In master mode, the function of the serial data output pin (MOSI) and the serial data input pin (MISO) is determined by the SPC0 and BIDIROE control bits.
  • S S pin If MODFEN and SSOE are set, the SS pin is configured as slave select output. The SS output becomes low during each transmission and is high when the SPI is in idle state. If MODFEN is set and SSOE is cleared, the SS pin is configured as input for detecting mode fault error. If the SS input becomes low this indicates a mode fault error where another master tries to drive the MOSI and SCK lines. In this case, the SPI immediately switches to slave mode, by clearing the MSTR bit and also disables the slave output buffer MISO (or SISO in bidirectional mode). So the result is that all outputs are disabled and SCK, MOSI, and MISO are inputs. If a transmission is in progress when the mode fault occurs, the transmission is aborted and the SPI is forced into idle state. This mode fault error also sets the mode fault (MODF) flag in the SPI status register (SPISR). If the SPI interrupt enable bit (SPIE) is set when the MODF flag becomes set, then an SPI interrupt sequence is also requested. When a write to the SPI data register in the master occurs, there is a half SCK-cycle delay. After the delay, SCK is started within the master. The rest of the transfer operation differs slightly, depending on the clock format specified by the SPI clock phase bit, CPHA, in SPI control register 1 (see Section 4.39.4.3, “Transmission Formats”). NOTE A change of the bits CPOL, CPHA, SSOE, LSBFE, XFRW, MODFEN, SPC0, or BIDIROE with SPC0 set, SPPR2-SPPR0 and SPR2-SPR0 in master mode will abort a transmission in progress and force the SPI into idle state. The remote slave cannot detect this, therefore the master must ensure that the remote slave is returned to idle state.

4.39.4.2 Slave Mode

The SPI operates in slave mode when the MSTR bit in SPI control register 1 is clear.

  • Serial clock In slave mode, SCK is the SPI clock input from the master.
  • MISO, MOSI pin In slave mode, the function of the serial data output pin (MISO) and serial data input pin (MOSI) is determined by the SPC0 bit and BIDIROE bit in SPI control register 2.
  • S S pin The SS pin is the slave select input. Before a data transmission occurs, the SS pin of the slave SPI must be low. SS must remain low until the transmission is complete. If SS goes high, the SPI is forced into idle state. The SS input also controls the serial data output pin, if SS is high (not selected), the serial data output pin is high impedance, and, if SS is low, the first bit in the SPI data register is driven out of the serial data output pin. Also, if the slave is not selected (SS is high), then the SCK input is ignored and no internal shifting of the SPI shift register occurs. Although the SPI is capable of duplex operation, some SPI peripherals are capable of only receiving SPI data in a slave mode. For these simpler devices, there is no serial data out pin. NOTE When peripherals with duplex capability are used, take care not to simultaneously enable two receivers whose serial outputs drive the same system slave’s serial data output line. As long as no more than one slave device drives the system slave’s serial data output line, it is possible for several slaves to receive the same transmission from a master, although the master would not receive return information from all of the receiving slaves.

MSB of the SPI shift register, depending on the LSBFE bit. register, depending on the LSBFE bit. flag in the SPI status register is set. SPC0 set in slave mode will corrupt a transmission in progress and must be avoided.

4.39.4.3 Transmission Formats

master SPI device, the slave select line can be used to indicate multiple-master bus contention. Figure 107. Master/Slave Transfer Block Diagram

4.39.4.3.1 Clock Phase and Polarity Controls

Using two bits in the SPI control register 1, software selects one of four combinations of serial clock phase and polarity. The CPOL clock polarity control bit specifies an active high or low clock and has no significant effect on the transmission format. The CPHA clock phase control bit selects one of two fundamentally different transmission formats.

4.39.4.3.2 CPHA = 0 Transfer Format

selected. In this format, the first SCK edge is issued a half cycle after SS has become low. from the serial data input pin is shifted into the LSB or MSB of the shift register, depending on LSBFE bit. edges and shifted on even numbered edges.

Figure 109. SPI Clock Format 0 (CPHA = 0), with 16-Bit Transfer Width Selected (XFRW = 1) cycle) between successive transmissions, then the content of the SPI data register is transmitted. for at least minimum idle time.

4.39.4.3.3 CPHA = 1 Transfer Format

slave to transfer its first data bit to the serial data input pin of the master. A half SCK cycle later, the second edge appears on the SCK pin. This is the latching edge for both the master and slave. of the master to the serial input pin on the slave. place on odd numbered edges. tL, tT, and tI are guaranteed for the master mode and required for the slave mode.

Figure 111. SPI Clock Format 1 (CPHA = 1), with 16-Bit Transfer Width Selected (XFRW = 1) in systems having a single fixed master and a single slave that drive the MISO data line. immediately without a trailing and minimum idle time.

4.39.4.4 SPI Baud Rate Generation

SPR1, and SPR0) determine the divisor to the SPI module clock which results in the SPI baud rate. in the baud rate selection bits (SPR2–SPR0). The module clock divisor equation is shown in Equation 112. the module clock divisor becomes 8, etc.

the divider is disabled to decrease IDD current. Electricals chapter of this data sheet.

4.39.4.5 Special Features

4.39.4.5.1 SS Output

The mode fault feature is disabled while SS output is enabled. mode fault feature is not available for detecting system errors between masters.

4.39.4.5.2 Bidirectional Mode (MOMI or SISO)

the serial data I/O (MOMI) pin for the master mode, and the MISO pin becomes serial data I/O (SISO) pin for the slave mode. The MISO pin in master mode and MOSI pin in slave mode are not used by the SPI. register is driven out on the pin. The same pin is also the serial input to the shift register.

  • The SCK is output for the master mode and input for the slave mode.
  • T h e S S is the input or output for the master mode, and it is always the input for the slave mode.
  • The bidirectional mode does not affect SCK and SS functions. NOTE In bidirectional master mode, with mode fault enabled, both data pins MISO and MOSI can be occupied by the SPI, though MOSI is normally used for transmissions in bidirectional mode and MISO is not used by the SPI. If a mode fault occurs, the SPI is automatically switched to slave mode. In this case MISO becomes occupied by the SPI and MOSI is not used. This must be considered, if the MISO pin is used for another purpose.

Table 403. Normal Mode and Bidirectional Mode

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 292

4.39.4.6 Error Conditions

The SPI has one error condition: Mode fault error

4.39.4.6.1 Mode Fault Error

If the SS input becomes low while the SPI is configured as a master, it indicates a system error where more than one master may be trying to drive the MOSI and SCK lines simultaneously. This condition is not permitted in normal operation, the MODF bit in the SPI status register is set automatically, provided the MODFEN bit is set. In the special case where the SPI is in master mode and MODFEN bit is cleared, the SS pin is not used by the SPI. In this special case, the mode fault error function is inhibited and MODF remains cleared. In case the SPI system is configured as a slave, the SS pin is a dedicated input pin. Mode fault error doesn’t occur in slave mode. If a mode fault error occurs, the SPI is switched to slave mode, with the exception that the slave output buffer is disabled. So SCK, MISO, and MOSI pins are forced to be high impedance inputs to avoid any possibility of conflict with another output driver. A transmission in progress is aborted and the SPI is forced into idle state. If the mode fault error occurs in the bidirectional mode for a SPI system configured in master mode, output enable of the MOMI (MOSI in bidirectional mode) is cleared if it was set. No mode fault error occurs in the bidirectional mode for SPI system configured in slave mode. The mode fault flag is cleared automatically by a read of the SPI status register (with MODF set) followed by a write to SPI control register 1. If the mode fault flag is cleared, the SPI becomes a normal master or slave again. NOTE If a mode fault error occurs and a received data byte is pending in the receive shift register, this data byte will be lost.

4.39.4.7 Low Power Mode Options

4.39.4.7.1 SPI in Run Mode

In run mode with the SPI system enable (SPE) bit in the SPI control register clear, the SPI system is in a low-power, disabled state. SPI registers remain accessible, but clocks to the core of this module are disabled.

4.39.4.7.2 SPI in Stop Mode

Stop mode is dependent on the system. The SPI enters stop mode when the module clock is disabled (held high or low). If the SPI is in master mode and exchanging data when the CPU enters stop mode, the transmission is frozen until the CPU exits stop mode. After stop, data to and from the external SPI is exchanged correctly. In slave mode, the SPI will stay synchronized with the master. The stop mode is not dependent on the SPISWAI bit.

4.39.4.7.3 Reset

The reset values of registers and signals are described in Section 4.39.3, “Memory Map and Register Definition”, which details the registers and their bit fields.

  • If a data transmission occurs in slave mode after reset without a write to SPIDR, it will transmit garbage, or the data last received from the master before the reset.
  • Reading from the SPIDR after reset will always read zeros.

4.39.4.7.4 Interrupts

The SPI only originates interrupt requests when SPI is enabled (SPE bit in SPICR1 set). The following is a description of how the SPI makes a request and how the MCU should acknowledge that request. The interrupt vector offset and interrupt priority are chip dependent. The interrupt flags MODF, SPIF, and SPTEF are logically ORed to generate an interrupt request. MODF occurs when the master detects an error on the SS pin. The master SPI must be configured for the MODF feature (see Table 390). After MODF is set, the current transfer is aborted and the following bit is changed:

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 293 MSTR = 0, The master bit in SPICR1 resets. The MODF interrupt is reflected in the status register MODF flag. Clearing the flag will also clear the interrupt. This interrupt will Status Register (SPISR)”. SPIF occurs when new data has been received and copied to the SPI data register. After SPIF is set, it does not clear until it is SPTEF occurs when the SPI data register is ready to accept new data. After SPTEF is set, it does not clear until it is serviced.

4.39.5 Initialization/A pplication Information

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 294 4.40 64 KByte Flash Module (S12FTMRC64K1V1)

4.40.1 Introduction

The module implements the following:

  • kbytes of P-Flash (Program Flash) memory
  • kbytes of D-Flash (Data Flash) memory The Flash memory is ideal for single-supply applications allowing for field reprogramming without requiring external high voltage sources for program or erase operations. The Flash module includes a memory controller that executes commands to modify Flash memory contents. The user interface to the memory controller consists of the indexed Flash Common Command Object (FCCOB) register which is written to with the command, global address, data, and any required command parameters. The memory controller must complete the execution of a command before the FCCOB register can be written to with a new command. CAUTION A Flash word or phrase must be in the erased state before being programmed. Cumulative programming of bits within a Flash word or phrase is not allowed. The Flash memory may be read as bytes, aligned words, or misaligned words. Read access time is one bus cycle for bytes and aligned words, and two bus cycles for misaligned words. For Flash memory, an erased bit reads 1 and a programmed bit reads 0. It is possible to read from P-Flash memory while some commands are executing on D-Flash memory. It is not possible to read from D-Flash memory while a command is executing on P-Flash memory. Simultaneous P-Flash and D-Flash operations are discussed in Section 4.40.4.4. Both P-Flash and D-Flash memories are implemented with Error Correction Codes (ECC) that can resolve single bit faults and detect double bit faults. For P-Flash memory, the ECC implementation requires that programming be done on an aligned 8 byte basis (a Flash phrase). Since P-Flash memory is always read by half-phrase, only one single bit fault in an aligned 4 byte half-phrase containing the byte or word accessed will be corrected.

4.40.1.1 Glossary

Command Write Sequence — An MCU instruction sequence to execute built-i n algorithms (including program and erase) on the Flash memory. D-Flash Memory — The D-Flash memory constitutes the nonvolatile memory store for data. D-Flash Sector — The D-Flash sector is the smallest portion of the D-Flash memory that can be erased. The D-Flash sector consists of four 64 byte rows for a total of 256 bytes. NVM Command Mode — An NVM mode using the CPU to setup the FCCOB register to pass parameters required for Flash command execution. Phrase — An aligned group of four 16-bit words within the P-Flash memory. Each phrase includes two sets of aligned double words with each set including 7 ECC bits for single bit fault correction and double bit fault detection within each double word. P-Flash Memory — The P-Flash memory constitu tes the main nonvolatile memory store for applications. P-Flash Sector — The P-Flash sector is the smallest portion of the P- Flash memory that can be erased. Each P-Flash sector contains 512 bytes. Program IFR — Nonvolatile information register located in the P-Flash block that contains the Device ID, Version ID, and the Program Once field.

4.40.1.2 Features

4.40.1.2.1 P-Flash Features

  • Single bit fault correction and double bit fault detect ion within a 32-bit double word during read operations
  • Automated program and erase algorithm with verify and generation of ECC parity bits
  • Fast sector erase and phrase program operation
  • Ability to read the P-Flash memory while programming a word in the D-Flash memory
  • Flexible protection scheme to prevent accide ntal program or erase of P-Flash memory

4.40.1.2.2 D-Flash Features

  • Single bit fault correction and double bit fault detection within a word during read operations
  • Automated program and erase algorithm with verify and generation of ECC parity bits
  • Fast sector erase and word program operation
  • Protection scheme to prevent accidental program or erase of D-Flash memory
  • Ability to program up to four words in a burst sequence

4.40.1.2.3 Other Flash Module Features

  • No external high-voltage power supply required for Flash memory program and erase operations
  • Interrupt generation on Flash command completion and Flash error detection
  • Security mechanism to prevent unaut horized access to the Flash memory

4.40.1.3 Block Diagram

The block diagram of the Flash module is shown in .

4.40.2 External Signal Description

The Flash module contains no signals that connect off-chip.

4.40.3 Memory Map and Registers

4.40.3.1 Module Memory Map

The S12 architecture places the P-Flash memory between global addresses .The P-Flash memory map is shown in . Table 404. Flash Configuration Field 0x3_FF0C 1 P-Flash Protection byte. 0x3_FF0D 1 D-Flash Protection byte.

  1. 0x3FF08-0x3_FF0F form a Flash phrase and must be programmed in a single command write sequence. Each byte in the 0x3_FF08
  • 0x3_FF0B reserved field should be programmed to 0xFF.

Figure 113. D-Flash and Memory Controller Resource Memory Map Table 405. Program IFR Fields

  1. For patch code storage, see Section 4.40.4.2
  2. Used to track firmware patch versions, see Section 4.40.4.2

Table 406. D-Flash and Memory Controller Resource Fields

4 Kbytes

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 297

4.40.3.2 Register Descriptions

The Flash module contains a set of 20 control and status registers located between Flash module base + 0x0000 and 0x0013. A summary of the Flash module registers is given in Figure 407 with detailed descriptions in the following subsections. CAUTION Writes to any Flash register must be avoided while a Flash command is active (CCIF=0) to prevent corruption of Flash register contents and adversely affect Memory Controller behavior.

4.40.3.2.1 Flash Clock Di vider Register (FCLKDIV)

The FCLKDIV register is used to control timed events in program and erase algorithms. Table 407. FTMRC64K1 Register Summary

All bits in the FCLKDIV register are readable, bit 7 is not writable, bit 6 is write-once-hi and controls the writability of the FDIV field. Table 408. Flash Clock Divider Register (FCLKDIV) Table 409. FCLKDIV Field Descriptions

0 FCLKDIV register has not been written since the last reset

1 FCLKDIV register has been written since the last reset

0 FDIV field is open for writing

writability to the FDIV field. refer to Section 4.40.4.3, “Flash Command Operations,” for more information.

4.40.3.2.2 Flash Securi ty Register (FSEC)

The FSEC register holds all bits associated with the security of the MCU and Flash module. All bits in the FSEC register are readable but not writable. bits in the FSEC register will be set to leave the Flash module in a secured state with backdoor key access disabled. Table 410. FDIV values for various BUSCLK Frequencies

  1. BUSCLK is Greater Than this value.
  2. BUSCLK is Less Than or Equal to this value.

Table 411. Flash Security Register (FSEC) Table 412. FSEC Field Descriptions Reserved Nonvolatile Bits — The RNV bits should remain in the erased state for future enhancements. unsecured using backdoor key access, the SEC bits are forced to 10.

The security function in the Flash module is described in Section 4.40.5.

4.40.3.2.3 Flash CCOB In dex Register (FCCOBIX)

The FCCOBIX register is used to index the FCCOB register for Flash memory operations. CCOBIX bits are readable and writable while remaining bits read 0 and are not writable.

4.40.3.2.4 Flash Reserv ed0 Register (FRSV0)

This Flash register is reserved for factory testing. All bits in the FRSV0 register read 0 and are not writable. Table 413. Flash KEYEN States

00 DISABLED

01 DISABLED (207)

10 ENABLED

11 DISABLED

  1. Preferred KEYEN state to di sable backdoor key access.

Table 414. Flash Security States

00 SECURED

01 SECURED (208)

10 UNSECURED

11 SECURED

  1. Preferred SEC state to set MCU to secured state

Table 415. FCCOB Index Register (FCCOBIX) Table 416. FCCOBIX Field Descriptions Table 417. Flash Reserved0 Register (FRSV0)

4.40.3.2.5 Flash Configur ation Register (FCNFG)

CCIE, IGNSF, FDFD, and FSFD bits are readable and writable while remaining bits read 0 and are not writable.

4.40.3.2.6 Flash Error Config uration Register (FERCNFG)

The FERCNFG register enables the Flash error interrupts for the FERSTAT flags. All assigned bits in the FERCNFG register are readable and writable. Table 418. Flash Configuration Register (FCNFG) Table 419. FCNFG Field Descriptions Command Complete Interrupt Enable — The CCIE bit controls interrupt gener ation when a Flash command has completed.

0 Command complete interrupt disabled

0 All single bit faults detected during array reads are reported

will not be updated during the Flash array read operation with FDFD set unless an actual double bit fault is detected. updated during the Flash array read operation with FSFD set unless an actual single bit fault is detected. Table 420. Flash Error Configuration Register (FERCNFG)

4.40.3.2.7 Flash Status Register (FSTAT)

The FSTAT register reports the operational status of the Flash module. remaining bits read 0 and are not writable. Table 421. FERCNFG Field Descriptions during a Flash block read operation.

0 DFDIF interrupt disabled

during a Flash block read operation. Table 422. Flash Status Register (FSTAT)

  1. Reset value can deviate from the value shown if a double bit fault is detected during the reset sequence (see Section 4.40.6).

Table 423. FSTAT Field Descriptions cleared by writing a 1 to CCIF to launch a command and CCIF will stay low until command completion or command violation.

0 Flash command in progress

1 Flash command has completed

a 0 to the ACCERR bit has no effect on ACCERR.

0 No access error detected

1 Access error detected

command or start a command write sequence.

0 No protection violation detected

1 Protection violation detected

Memory Controller Busy Flag — The MGBUSY flag reflects the active state of the Memory Controller .

0 Memory Controller is idle

1 Memory Controller is busy executing a Flash command (CCIF = 0)

4.40.3.2.8 Flash Error Stat us Register (FERSTAT)

The FERSTAT register reflects the error status of internal Flash operations. All flags in the FERSTAT register are readable and only writable to clear the flag.

4.40.3.2.9 P-Flash Protection Register (FPROT)

The FPROT register defines which P-Flash sectors are protected against program and erase operations. bits in the FPROT register will be set to leave the P-Flash memory fully protected. same P-Flash block are protected. Reserved Bit — This bit is reserved and always reads 0 . Description,” and Section 4.40.6, “Initialization” for details. Table 424. Flash Error Status Register (FERSTAT) Table 425. FERSTAT Field Descriptions

0 No double bit fault detected

1 Double bit fault detected or an invalid Flash array read operation attempted

1 to SFDIF. Writing a 0 to SFDIF has no effect on SFDIF.

0 No single bit fault detected

1 Single bit fault detected and corrected or an invalid Flash array read operation attempted

  1. The single bit fault and double bit fault fl ags are mutually exclusive for parity errors (an ECC fault occurrence can be either single fault

Table 423. FSTAT Field Descriptions (continued)

mode while providing as much protection as possible if reprogramming is not required.

4.40.3.2.10 D-Flas h Protection Register (DFPROT)

The DFPROT register defines which D-Flash sectors are protected against program and erase operations. The (unreserved) bits of the DFPROT register are writable with the restriction that protection can be added but not removed. enabled). If the DPOPEN bit is set, the state of the DPS bits is irrelevant. Figure 428. To change the D-Flash protection that will be loaded during the reset sequence, the P-Flash sector containing the will be cleared and DPS bits will be set to leave the D-Flash memory fully protected. be set in the FSTAT register. Block erase of the D-Flash memory is not possible if any of the D-Flash sectors are protected. Table 426. FPROT Field Descriptions Reserved Nonvolatile Bit — The RNV bit should remain in the erased state for future enhancements. area in a specific region of the P-Flash memory ending with global address 0x3_FFFF.

0 Protection/Unprotection enabled

1 Protection/Unprotection disabled

memory as shown inTable 427. The FPHS bits can only be written to while the FPHDIS bit is set. Table 427. P-Flash Protection Higher Address Range Table 428. D-Flash Protection Register (DFPROT)

4.40.3.2.11 Flash Comm on Command Object Register (FCCOB)

are allowed to the FCCOB register. Table 429. DFPROT Field Descriptions

1 Disables D-Flash memory prot ection from program and erase

Table 430. D-Flash Protection Address Range Table 431. Flash Common Command Object High Register (FCCOBHI) Table 432. Flash Common Command Object Low Register (FCCOBLO)

(as evidenced by the Memory Controller returning CCIF to 1). Some commands return information to the FCCOB register array. unimplemented parameter fields (CCOBIX = 110 and CCOBIX = 111) are ignored with reads from these fields returning 0x0000. command, see the Flash command descriptions in Section 4.40.4.5.

4.40.3.2.12 Flash Reserv ed1 Register (FRSV1)

This Flash register is reserved for factory testing. All bits in the FRSV1 register read 0 and are not writable.

4.40.3.2.13 Flash Reserv ed2 Register (FRSV2)

This Flash register is reserved for factory testing. All bits in the FRSV2 register read 0 and are not writable.

4.40.3.2.14 Flash Reserv ed3 Register (FRSV3)

This Flash register is reserved for factory testing. Table 433. FCCOB - NVM Command Mode (Typical Usage) Table 434. Flash Reserved1 Register (FRSV1) Table 435. Flash Reserved2 Register (FRSV2)

All bits in the FRSV3 register read 0 and are not writable.

4.40.3.2.15 Flash Reserv ed4 Register (FRSV4)

This Flash register is reserved for factory testing. All bits in the FRSV4 register read 0 and are not writable.

4.40.3.2.16 Flash Opti on Register (FOPT)

The FOPT register is the Flash option register. All bits in the FOPT register are readable but are not writable.

4.40.3.2.17 Flash Reserv ed5 Register (FRSV5)

This Flash register is reserved for factory testing. Table 436. Flash Reserved3 Register (FRSV3) Table 437. Flash Reserved4 Register (FRSV4) Table 438. Flash Option Register (FOPT) Table 439. FOPT Field Descriptions Table 440. Flash Reserved5 Register (FRSV5)

All bits in the FRSV5 register read 0 and are not writable.

4.40.3.2.18 Flash Reserv ed6 Register (FRSV6)

This Flash register is reserved for factory testing. All bits in the FRSV6 register read 0 and are not writable.

4.40.3.2.19 Flash Reserv ed7 Register (FRSV7)

This Flash register is reserved for factory testing. All bits in the FRSV7 register read 0 and are not writable.

4.40.4 Functional Description

4.40.4.1 Modes of Operation

availability (see Table 445).

4.40.4.2 IFR Version ID Word

The version ID word is stored in the IFR at address 0x0_40B6. The contents of the word are defined in Table 444. VERNUM: Version number. The first version is number 0b_0001 with both 0b_0000 and 0b_1111 meaning ‘none’. Table 441. Flash Reserved6 Register (FRSV6) Table 442. Flash Reserved7 Register (FRSV7) Table 443. Modes and Mode Control Inputs Table 444. IFR Version ID Fields

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 310

4.40.4.3 Flash Command Operations

Flash command operations are used to modify Flash memory contents. The next sections describe:

  • How to write the FCLKDIV register that is used to generate a time base (FCLK) derived from BUSCLK for Flash program and erase command operations
  • The command write sequence used to set Fl ash command parameters and launch execution
  • Valid Flash commands available for execution

4.40.4.3.1 Writing the FCLKDIV Register

Prior to issuing any Flash program or erase command after a reset, the user is required to write the FCLKDIV register to divide BUSCLK down to a target FCLK of 1 MHz. Table 410 shows recommended values for the FDIV field based on BUSCLK frequency. NOTE Programming or erasing the Flash memory cannot be performed if the bus clock runs at less than 0.8 MHz. Setting FDIV too high can destroy the Flash memory due to overstress. Setting FDIV too low can result in incomplete programming or erasure of the Flash memory cells. When the FCLKDIV register is written, the FDIVLD bit is set automatically. If the FDIVLD bit is 0, the FCLKDIV register has not been written since the last reset. If the FCLKDIV register has not been written, any Flash program or erase command loaded during a command write sequence will not execute and the ACCERR bit in the FSTAT register will set.

4.40.4.3.2 Command Write Sequence

The Memory Controller will launch all valid Flash commands entered using a command write sequence. Before launching a command, the ACCERR and FPVIOL bits in the FSTAT register must be clear (see Section 4.40.3.2.7) and the CCIF flag should be tested to determine the status of the current command write sequence. If CCIF is 0, the previous command write sequence is still active, a new command write sequence cannot be started, and all writes to the FCCOB register are ignored. CAUTION Writes to any Flash register must be avoided while a Flash command is active (CCIF=0) to prevent corruption of Flash register contents and Memory Controller behavior. The FCCOB parameter fields must be loaded with all required parameters for the Flash command being executed. Access to the The contents of the FCCOB parameter fields are transferred to the Memory Controller when the user clears the CCIF command completion flag in the FSTAT register (writing 1 clears the CCIF to 0). The CCIF flag will remain clear until the Flash command has completed. Upon completion, the Memory Controller will return CCIF to 1 and the FCCOB register will be used to communicate any results. The flow for a generic command write sequence is shown in Figure 114.

Figure 114. Generic Flash Command Write Sequence Flowchart to load required command parameter.

4.40.4.3.3 Valid Flash Module Commands

4.40.4.3.4 P-Flash Commands

resources within the Flash module. Table 445. Flash Commands by Mode

  1. Unsecured Normal Single Chip mode
  2. Unsecured Special Single Chip mode
  3. Secured Normal Single Chip mode
  4. Secured Special Single Chip mode

Table 446. P-Flash Commands 0x01 Erase Verify All Blocks Verify that al l P-Flash (and D-Flash) blocks are erased. 0x02 Erase Verify Block Verify t hat a P-Flash block is erased. Verify that a given number of words starting at the address provided are erased. previously programmed using the Program Once command. 0x06 Program P-Flash Program a phrase in a P-Flash block. allowed to be programmed only once. Erase all P-Flash (and D-Flash) blocks. FPROT register and the DPOPEN bit in the DFPROT register are set prior to launching the command. Erase a P-Flash (or D-Flash) block. FPROT register are set prior to launching the command. 0x0A Erase P-Flash Sector Erase al l bytes in a P-Flash sector.

4.40.4.3.5 D-Flash Commands

Table 447 summarizes the valid D-Flash commands along with the effects of the commands on the D-Flash block.

4.40.4.4 Allowed Simultaneous P-Flash and D-Flash Operations

Data Flash, providing read (P-Flash) while write (D-Flash) functionality. verifying that all P-Flash (and D-Flash) blocks are erased. Supports a method of releasing MCU security by verifying a set of security keys. 0x0D Set User Margin Level Specifies a user margin read level for all P-Flash blocks. 0x0E Set Field Margin Level Specifies a field margin read level for all P-Flash blocks (special modes only). Table 447. D-Flash Commands 0x01 Erase Verify All Blocks Verify that al l D-Flash (and P-Flash) blocks are erased. 0x02 Erase Verify Block Verify t hat the D-Flash block is erased. Erase all D-Flash (and P-Flash) blocks. FPROT register and the DPOPEN bit in the DFPROT register are set prior to launching the command. Erase a D-Flash (or P-Flash) block. prior to launching the command. verifying that all D-Flash (and P-Flash) blocks are erased. 0x0D Set User Margin Level Specifies a user margin read level for the D-Flash block. 0x0E Set Field Margin Level Specifies a field margin read level for the D-Flash block (special modes only). Verify that a given number of words starting at the address provided are erased. 0x11 Program D-Flash Program up to four words in the D-Flash block. 0x12 Erase D-Flash Sector Er ase all bytes in a sector of the D-Flash block. Table 448. Allowed P-Flash and D-Flash Simultaneous Operations

4.40.4.5 Flash Command Description

  • Starting any command write sequence that programs or eras es Flash memory before initializing the FCLKDIV register
  • Writing an invalid command as part of the command write sequence
  • For additional possible errors, refer to the error handling table provided for each command If a Flash block is read during execution of an algorithm (CCIF = 0) on that same block, the read operation will return invalid data. If the SFDIF or DFDIF flags were not previously set when the invalid read operation occurred, both the SFDIF and DFDIF flags will be set. If the ACCERR or FPVIOL bits are set in the FSTAT register, the user must clear these bits before starting any command write CAUTION A Flash word or phrase must be in the erased state before being programmed. Cumulative programming of bits within a Flash word or phrase is not allowed.

4.40.4.5.1 Erase Verify All Blocks Command

The Erase Verify All Blocks command will verify that all P-Flash and D-Flash blocks have been erased. memory space is erased. The CCIF flag will set after the Erase Verify All Blocks operation has completed.

4.40.4.5.2 Erase Verify Block Command

upper global address bits determine which block must be verified.

  1. A ‘Margin Read’ is any read after ex ecuting the margin setting commands ‘Set User Margin Level’ or ‘Set Field

Margin Level’ with anything but the ‘normal’ level specified.

  1. The ‘Mass Erase’ operations are commands ‘Erase All Blocks’ and ‘Erase Flash Block’.

Table 449. Erase Verify All Blocks Command FCCOB Requirements Table 450. Erase Verify All Blocks Command Error Handling

D-Flash block is erased. The CCIF flag will set after the Erase Verify Block operation has completed.

4.40.4.5.3 Erase Verify P-Flash Section Command

P-Flash Section command defines the starting point of the code to be verified and the number of phrases. of Flash memory is erased. The CCIF flag will set after the Erase Verify P-Flash Section operation has completed.

4.40.4.5.4 Read Once Command

Table 451. Erase Verify Block Command FCCOB Requirements Table 452. Erase Verify Block Command Error Handling Table 453. Erase Verify P-Flash Section Command FCCOB Requirements

001 Global address [15:0] of the first phrase to be verified

010 Number of phrases to be verified

Table 454. Erase Verify P-Flash Section Command Error Handling

P-Flash block will return invalid data.

4.40.4.5.5 Program P-Flash Command

The Program P-Flash operation will program a previously erased phrase in the P-Flash memory using an embedded algorithm. programming of bits within a Flash phrase is not allowed. P-Flash operation has completed. Table 455. Read Once Command FCCOB Requirements

001 Read Once phrase index (0x0000 - 0x0007)

010 Read Once word 0 value

011 Read Once word 1 value

100 Read Once word 2 value

101 Read Once word 3 value

Table 456. Read Once Command Error Handling Table 457. Program P-Flash Command FCCOB Requirements

001 Global address [15:0] of phrase location to be programmed (218)

010 Word 0 program value

011 Word 1 program value

100 Word 2 program value

101 Word 3 program value

  1. Global address [2:0] must be 000

4.40.4.5.6 Program Once Command

reserved field to avoid code runaway. setting only after the Program Once operation has completed.

4.40.4.5.7 Erase All Blocks Command

The Erase All Blocks operation will erase the entire P-Flash and D-Flash memory space. Table 458. Program P-Flash Command Error Handling Table 459. Program Once Command FCCOB Requirements

001 Program Once phrase index (0x0000 - 0x0007)

010 Program Once word 0 value

011 Program Once word 1 value

100 Program Once word 2 value

101 Program Once word 3 value

Table 460. Program Once Command Error Handling

  1. If a Program Once phrase is initially programmed to 0xFFF F_FFFF_FFFF_FFFF, the Program Once command will be allowed

to execute again on that same phrase.

flag will set after the Erase All Blocks operation has completed.

4.40.4.5.8 Erase Flash Block Command

The Erase Flash Block operation will erase all addresses in a P-Flash or D-Flash block. verify that it is erased. The CCIF flag will set after the Erase Flash Block operation has completed.

4.40.4.5.9 Erase P-Flash Sector Command

The Erase P-Flash Sector operation will erase all addresses in a P-Flash sector. Table 461. Erase All Blocks Command FCCOB Requirements Table 462. Erase All Blocks Command Error Handling Table 463. Erase Flash Block Command FCCOB Requirements

001 Global address [15:0] in Flash block to be erased

Table 464. Erase Flash Block Command Error Handling Table 465. Erase P-Flash Sector Command FCCOB Requirements 001 Global address [15:0] anywhere within the sector to be erased.

and then verify that it is erased. The CCIF flag will be set after the Erase P-Flash Sector operation has completed.

4.40.4.5.10 Unsecure Flash Command

Flash module register. The CCIF flag is set after the Unsecure Flash operation has completed.

4.40.4.5.11 Verify Backdo or Access Key Command

from the Flash block containing the backdoor comparison key to avoid code runaway. Table 466. Erase P-Flash Sector Command Error Handling Table 467. Unsecure Flash Command FCCOB Requirements Table 468. Unsecure Flash Command Error Handling Table 469. Verify Backdoor Access Key Command FCCOB Requirements

001 Key 0

010 Key 1

011 Key 2

100 Key 3

key in the Flash configuration field with Key 0 compared to 0x3_FF00, etc. If the backdoor keys match, security will be released.

4.40.4.5.12 Set User Margin Level Command

targeted block and then set the CCIF flag. Valid margin level settings for the Set User Margin Level command are defined in Table 472. Table 470. Verify Backdoor Access Key Command Error Handling Table 471. Set User Margin Level Command FCCOB Requirements

001 Margin level setting

Table 472. Valid Set User Margin Level Settings

  1. Read margin to the erased state
  2. Read margin to the programmed state

4.40.4.5.13 Set Field Margin Level Command

for future read operations of the P-Flash or D-Flash block. targeted block and then set the CCIF flag. Valid margin level settings for the Set Field Margin Level command are defined in Table 475. Table 473. Set User Margin Level Command Error Handling Table 474. Set Field Margin Level Command FCCOB Requirements Table 475. Valid Set Field Margin Level Settings

  1. Read margin to the erased state
  2. Read margin to the programmed state

Field margin levels must only be used during verify of the initial factory programming .

4.40.4.5.14 Erase Verify D-Flash Section Command

Section command defines the starting point of the data to be verified and the number of words. of D-Flash memory is erased. The CCIF flag will set after the Erase Verify D-Flash Section operation has completed.

4.40.4.5.15 Program D-Flash Command

operation will confirm that the targeted location(s) were successfully programmed upon completion. programming of bits within a Flash word is not allowed. Table 476. Set Field Margin Level Command Error Handling Table 477. Erase Verify D-Flash Section Command FCCOB Requirements

001 Global address [15:0] of the first word to be verified

010 Number of words to be verified

Table 478. Erase Verify D-Flash Section Command Error Handling

determines how many words will be programmed in the D-Flash block. The CCIF flag is set when the operation has completed.

4.40.4.5.16 Erase D-Fl ash Sector Command

The Erase D-Flash Sector operation will erase all addresses in a sector of the D-Flash block. and verify that it is erased. The CCIF flag will set after the Erase D-Flash Sector operation has completed. Table 479. Program D-Flash Command FCCOB Requirements

001 Global address [15:0] of word to be programmed

011 Word 1 program value, if desired

100 Word 2 program value, if desired

101 Word 3 program value, if desired

Table 480. Program D-Flash Command Error Handling Table 481. Erase D-Flash Sector Command FCCOB Requirements 001 Global address [15:0] anywhere within the sector to be erased. Table 482. Erase D-Flash Sector Command Error Handling

4.40.4.6 Interrupts

operation has detected an ECC fault. Vector addresses and their relative interrupt priority are determined at the MCU level.

4.40.4.6.1 Description of Flash Interrupt Operation

The logic used for generating the Flash module interrupts is shown in Figure 115. Figure 115. Flash Module Interrupts Implementation

4.40.4.7 Stop Mode

the CPU is allowed to enter stop mode.

4.40.5 Security

programmed, its new value will take affect after the next MCU reset.

  • Unsecuring the MCU using Backdoor Key Access
  • Unsecuring the MCU in Special Single Chip Mode using BDM
  • Mode and Security Effects on Flash Command Availability

Table 483. Flash Interrupt Sources

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 325

4.40.5.1 Unsecuring the MCU using Backdoor Key Access

The MCU may be unsecured by using the backdoor key access feature which requires knowledge of the contents of the backdoor keys (four 16-bit words programmed at addresses 0x3_FF00-0x3_FF07). If the KEYEN[1:0] bits are in the enabled state (see prospective keys for comparison to the keys stored in the Flash memory via the Memory Controller. If the keys presented in the Verify Backdoor Access Key command match the backdoor keys stored in the Flash memory, the SEC bits in the FSEC register (see Table 414) will be changed to unsecure the MCU. Key values of 0x0000 and 0xFFFF are not permitted as backdoor keys. While the Verify Backdoor Access Key command is active, P-Flash memory and D-Flash memory will not be available for read access and will return invalid data. The user code stored in the P-Flash memory must have a method of receiving the backdoor keys from an external stimulus. This external stimulus would typically be through one of the on-chip serial ports. If the KEYEN[1:0] bits are in the enabled state (see Section 4.40.3.2.2), the MCU can be unsecured by the backdoor key access sequence described below: 2. If the Verify Backdoor Access Key comm and is successful, the MCU is unsecured and the SEC[1:0] bits in the FSEC register are forced to the unsecure state of 10 The Verify Backdoor Access Key command is monitored by the Memory Controller and an illegal key will prohibit future use of the Verify Backdoor Access Key command. A reset of the MCU is the only method to re-enable the Verify Backdoor Access Key command. The security as defined in the Flash security byte (0x3_FF0F) is not changed by using the Verify Backdoor Access Key command sequence. The backdoor keys stored in addresses 0x3_FF00-0x3_FF07 are unaffected by the Verify Backdoor Access Key command sequence. The Verify Backdoor Access Key command sequence has no effect on the program and erase protections defined in the Flash protection register, FPROT. After the backdoor keys have been correctly matched, the MCU will be unsecured. After the MCU is unsecured, the sector containing the Flash security byte can be erased and the Flash security byte can be reprogrammed to the unsecure state, if desired. In the unsecure state, the user has full control of the contents of the backdoor keys by programming addresses 0x3_FF00-0x3_FF07 in the Flash configuration field.

4.40.5.2 Unsecuring the MCU in Sp ecial Single Chip Mode using BDM

A secured MCU can be unsecured in special single chip mode by using the following method to erase the P-Flash and D-Flash memory: 1. Reset the MCU into special single chip mode 2. Delay while the BDM executes the Erase Verify All Blocks command write sequence to check if the P-Flash and D-Flash memories are erased 3. Send BDM commands to disable protec tion in the P-Flash and D-Flash memory 4. Execute the Erase All Blocks command write sequence to erase the P-Flash and D-Flash memory 5. After the CCIF flag sets to indicate th at the Erase All Blocks operation has completed, reset the MCU into special single chip mode 6. Delay while the BDM executes the Erase Verify All Blo cks command write sequence to verify that the P-Flash and D-Flash memory are erased If the P-Flash and D-Flash memory are verified as erased, the MCU will be unsecured. All BDM commands will now be enabled and the Flash security byte may be programmed to the unsecure state by continuing with the following steps: 7. Send BDM commands to execute the Program P-Flash command write sequence to program the Flash security byte to the unsecured state 8. Reset the MCU

4.40.5.3 Mode and Security Effects on Flash Command Availability

The availability of Flash module commands depends on the MCU operating mode and security state as shown in Table 445.

4.40.6 Init ialization

On each system reset the Flash module executes a reset sequence which establishes initial values for the Flash Block Configuration Parameters, the FPROT and DFPROT protection registers, and the FOPT and FSEC registers. The Flash module reverts to using built-in default values that leave the module in a fully protected and secured state if errors are encountered during

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 326 execution of the reset sequence. If a double bit fault is detected during the reset sequence, both MGSTAT bits in the FSTAT register will be set. CCIF remains clear throughout the reset sequence. The Flash module holds off all CPU access for the initial portion of the reset sequence. While Flash memory reads and access to most Flash registers are possible when the hold is removed, writes to the FCCOBIX, FCCOBHI, and FCCOBLO registers are ignored. Completion of the reset sequence is marked by setting CCIF high which enables writes to the FCCOBIX, FCCOBHI, and FCCOBLO registers to launch any available Flash command. If a reset occurs while any Flash command is in progress, that command will be immediately aborted. The state of the word being programmed or the sector/block being erased is not guaranteed.

4.41 Die-to-Die Initiator (D2DIV1)

4.41.0.1 Preface

This document contains the user specification of the D2D Initiator.

4.41.0.1.1 Acronyms and Abbreviations

Table 484 contains sample acronyms and abbreviations used in this document.

4.41.0.1.2 Glossary

Table 485 shows a glossary of the major terms used in this document.

4.41.1 Introduction

between a microcontroller die (Interface Initiator) and an analog die (Interface Target) located in the same package.

  • realizes the initiator part of the D2D interface, including supervision and error interrupt generation
  • generates the clock for this interface
  • disables/enables the interrupt from the D2D interface

4.41.1.1 Overview

Table 484. Acronyms and Abbreviated Terms Table 485. Glossary Active low The signal is asserted when it changes to logic-level zero. Active high The signal is asserted when it changes to logic-level one. Asserted Discrete signal is in active logic state. Customer The end user of an SoC design or device. Negated A discrete signal is in inactive logic state. Pin External physical connection. Signal Electronic construct whose state or change in state conveys information. Transfer A read or write on the CPU bus following the IP-Bus protocol. Transaction Command, address and if required data sent on the D2D interface. A transaction is finished by the EOT acknowledge cycle. Version Particular form or variation of an earlier or original document.

Figure 116. Die-to-Die Initiator (D2DI) Block Diagram

4.41.1.2 Features

  • Software transparent, memory mapped access to peripherals on target die — 256 Byte address window — Supports blocking read or write as we ll as non-blocking write transactions
  • Scalable interface clock divide by 1, 2, 3, or 4 of bus clock
  • Clock halt on system STOP
  • Configurable for 4 or 8-bit wide transfers
  • Configurable timeout period
  • Non-maskable interrupt on transaction errors
  • Transaction Status and Error Flags
  • Interrupt enable for receiving interrupt (from D2D target)

4.41.1.3 Modes of Operation

4.41.1.3.1 D2DI in STOP mode

of the current high phase, as defined by D2DCLKDIV). STOP mode is entered by different CPU instructions. Every (enabled) interrupt can be used to leave the STOP mode.

4.41.1.3.2 D2DI in special modes

“write-once” feature is disabled. See the MCU description for details.

4.41.2 External Signal Description

4.41.2.1 D2DCLK

asserted), otherwise it is a continuos clock. This pin may be shared with general purpose functionality if the D2DI is disabled.

4.41.2.2 D2DDAT[7:4]

connection width is set as 4-bit wide, the pins may be shared with general purpose pin functionality.

4.41.2.3 D2DDAT[3:0]

elements are enabled. If the D2DI is disabled the pins and may be shared with general purpose pin functionality.

4.41.2.4 D2DINT

disabled the pin may be shared with general purpose pin functionality. See the port interface module (PIM) guide for details of the GPIO function.

4.41.3 Memory Map and Register Definition

4.41.3.1 Memory Map

The D2DI memory map is split into three sections.

  1. An eight-byte set of control registers
  2. A 256 byte window for blocking transactions
  3. A 256 byte window for non-blocking transactions

See the chapter “Device Memory Map” for the register layout (distribution of these sections). Table 486. Signal Properties

  1. Active if in input state, only if D2DEN=1

Figure 117. D2DI Top Level Memory Map are given in the subsections that follow.

4.41.3.2 Register Definition

4.41.3.3 D2DI Control Register 0 (D2DCTL0)

This register is used to enable and configure the interface width, the wait behavior and the frequency of the interface clock. Table 487. D2DI Register Summary Table 488. D2DI Control Register 0 (D2DCTL0)

8 Byte Control

256 Byte Window

cycle is shorter than 50% or equal but never longer, since this is beneficial for the transaction speed. Figure 118. Interface Clock Waveforms for various D2DCLKDIV Encoding

4.41.3.4 D2DI Control Register 1 (D2DCTL1)

This register is used to enable the D2DI interrupt and set number of D2DCLK cycles before a timeout error is asserted. Table 489. D2DCTL0 Register Field Descriptions D2DI Enable — Enables the D2DI module. This bit is write-once in normal mode and can always be written in special modes. 0 D2DI initiator is disabled. No lines are not us ed, the pins have their GPIO (secondary) function. the IDLE command; the D2DCLK is driven by the divided bus clock. can always be written in special modes. 0 Lines D2DDAT[3:0] are used for four line data transfer. D2DDAT[7:4] are unused. 1 All eight interface lines D2DDAT[7:0] are used for data transfer. 4:2 Reserved, should be written to 0 to ensure compat ibility with future versions of this interface. 00 Encoding 0. Bus clock divide by 1. 01 Encoding 1. Bus clock divide by 2. 10 Encoding 2. Bus clock divide by 3. 11 Encoding 3. Bus clock divide by 4. Table 490. D2DI Control Register 1 (D2DCTL1) Table 491. D2DCTL1 Register Field Descriptions

0 External Interrupt is disabled

1 External Interrupt is enabled

4.41.3.5 D2DI Status Register 0 (D2DSTAT0)

This register reflects the status of the D2DI transactions.

4.41.3.6 D2DI Status Register 1 (D2DSTAT1)

This register holds the status of the external interrupt pin and an indicator about the D2DI transaction status. 6:4 Reserved, should be written to 0 to ensure compat ibility with future versions of this interface. case of a timeout the TIMEF flag in the D2DSTAT0 register will be set. These bits are write-once in normal modes and can always be written in special modes. 0000: The acknowledge is expected directly after the last transfer, i.e. the target must not insert a wait cycle. Table 492. D2DI Status Register 0 (D2DSTAT0) Table 493. D2DI Status Register 0 Field Descriptions following five flags).This interrupt is not locally maskable. Write a 1 to clear the flag. Writing a 0 has no effect. 0 D2DI has not detected an error during a transaction. 1 D2DI has detected an error during a transaction. indicating a potential broken wire. This flag is cleared when the ERRIF bit is cleared by writing a 1 to the ERRIF bit. pending error flag (ERRIF). This flag is cleared when the ERRIF bit is cleared by writing a 1 to the ERRIF bit. bit is cleared by writing a 1 to the ERRIF bit. the transaction. This flag is cleared when the ERRIF bit is cleared by writing a 1 to the ERRIF bit. Parity Error Flag — This read-only flag indicates the initiator has detected a parity error. Parity bits[1:0] contain further information. This flag is cleared when the ERRIF bit is cleared by writing a 1 to the ERRIF bit.

4.41.3.7 D2DI Address Bu ffer Register (D2DADR)

when a new transaction starts. In error cases the user can track back, which transaction failed. Table 494. D2DI Status Register 1 (D2DSTAT1) Table 495. D2DSTAT1 Register Field Descriptions target specific interrupt acknowledge sequence.

0 External Interrupt is negated

1 External Interrupt is asserted

D2D Initiator Busy — This read-only status bit indica tes that a D2D transaction is ongoing. 1 D2D initiator transaction ongoing. 5:0 Reserved, should be masked to ensure compatibil ity with future versions of this interface. Table 496. D2DI Address Buffer Register (D2DADR) Table 497. D2DI Address Buffer Register Bit Descriptions

0 Write Transaction

1 Read Transaction

13 Reserved, should be masked to ensure compatibil ity with future versions of this interface. 11:8 Reserved, should be masked to ensure compatibil ity with future versions of this interface.

4.41.3.8 D2DI Data Buffer Register (D2DDATA)

finalized when the transaction is acknowledged by the target. In error cases the user can track back what has happened. Both D2DDATA and D2DADR can be read with byte accesses.

4.41.4 Functional Description

4.41.4.1 Init ialization

4.41.4.2 Transactions

read or write instructions determines if 8-bit or 16-bit wide data are transferred. There is always only one transaction active. Figure 119 shows the various types of transactions explained in more detail below. operates properly) supervision. The stretched CPU cycles cause the “CPU halted” phases (see Figure 119). Table 498. D2DI Data Buffer Register (D2DDATA) Table 499. D2DI Data Buffer Register Bit Descriptions

Figure 119. Blocking and Non-Blocking Transfers.

4.41.4.2.1 Blocking Writes

at the target is completed before proceeding with the CPU instruction stream.

4.41.4.3 Non-Blocking Writes

are not affected by the change in the target caused by the previous transaction.

4.41.4.4 Blocking Read

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 336

4.41.4.5 Non-Blocking Read

Read access to the non-blocking window is reserved for future use. When reading from the address window associated with non-blocking writes, the read returns an all 0s data byte or word. This behavior can change in future revisions.

4.41.4.6 Transfer Width

8-bit wide writes or reads are translated into 8-bit wide interface transactions. 16-bit wide, aligned writes or reads are translated into a16-bit wide interface transactions. 16-bit wide, misaligned writes or reads are split up into two consecutive 8-bit transactions with the transaction on the odd address first followed by the transaction on the next higher even address. Due to the much more complex error handling (by the MCU), misaligned 16-bit transfers should be avoided.

4.41.4.7 Error Conditions and Handling faults

Since the S12 CPU (as well as the S08) do not provide a method to abort a transfer once started, the D2DI asserts an D2DERRINT. The ERRIF Flag is set in the D2DSTAT0 register. Depending on the error condition further error flags will be set as described below. The content of the address and data buffers are frozen and all transactions will be replaced by an IDLE command, until the error flag is cleared. If an error is detected during the read transaction of a read-modify-write instruction or a non-blocking write transaction was followed by another write or read transaction, the second transaction is cancelled. The CNCLF is set in the D2DSTAT0 register to indicate that a transaction has been cancelled. The D2DERRINT handler can read the address and data buffer register to assess the error situation. Any further transaction will be replaced by IDLE until the ERRIF is cleared.

4.41.4.7.1 Missing Acknowledge

If the target detects a wrong command it will not send back an acknowledge. The same situation occurs if the acknowledge is corrupted. The D2DI detects this missing acknowledge after the timeout period configured in the TIMOUT parameter of the D2DCTL1 register. In case of a timeout the ERRIF and the TIMEF flags in the D2DSTAT0 register will be set.

4.41.4.7.2 Parity error

In the final acknowledge cycle of a transaction the target sends two parity bits. If this parity does not match the parity calculated by the initiator, the ERRIF and the PARF flags in the D2DSTAT0 register will be set. The PAR[1:0] bits contain the parity value received by the D2DI.

4.41.4.7.3 Error Signal

During the acknowledge cycle the target can signal a target specific error condition. If the D2DI finds the error signal asserted during a transaction, the ERRIF and the TERRF flags in the D2DSTAT0 register will be set.

4.41.4.8 Low Power Mode Options

4.41.4.8.1 D2DI in Run Mode

In run mode with the D2D Interface enable (D2DEN) bit in the D2D control register 0 clear, the D2DI system is in a low-power, disabled state. D2D registers remain accessible, but clocks to the core of this module are disabled. On D2D lines the GPIO function is activated.

4.41.4.8.2 D2DI in Stop Mode

If the CPU enters the STOP mode, any pending transmission is completed. When the D2DCLK output is driven low, clock generation is stopped. All internal clocks to the D2DCLK are stopped as well, and the module enters a power saving state.

4.41.4.8.3 Reset

In case of reset any transaction is immediately stopped and the D2DI module is disabled.

4.41.4.8.4 Interrupts

The D2DI only originates interrupt requests, when D2DI is enabled (D2DIE bit in D2DCTL0 set). There are two different interrupt requests from the D2D module. The interrupt vector offset and interrupt priority are chip dependent.

pin can be observed by reading the D2DIF bit in the D2DSTAT1 register. The D2DINIT signal is asserted also in the stop mode; it can be used to leave these modes. Figure 120. D2D External Interrupt Scheme architecture to the XIRQ. See the chapter “Vectors” of the MCU description for details. Figure 121. D2D Internal Interrupts

4.41.5 Initializat ion Information

before starting any transaction. See the D2D Target specification for details.

4.41.6 Application Information

4.41.6.1 Entering low power mode

  1. CPU determines there is no more work pending.
  2. CPU writes a byte to a register on the analog die using blocking write configuring which mode to enter.
  3. Analog die acknowledges that write sending back an acknowledge symbol on the interface.
  4. CPU executes STOP command.
  5. Analog die can enter low power mode - (S12 needs some more cycles to stack data!)

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 338 CLI ; re-enable right befo re the STOP instruction STOP ; stack and turn off all clocks inc. interface clock For wake-up from STOP the basic flow is as follows: 1. Analog die detects a wake-up condition, e.g. on a switch input or start bit of a LIN message. 2. Analog die exits Voltage Regulator low power mode. 3. Analog die asserts the interrupt signal D2DINT. 4. CPU starts clock generation. 5. CPU enters interrupt handler routine. 6. CPU services interrupt and acknowle dges the source on the analog die. NOTE Entering STOP mode mode with D2DSWAI asserted the clock will complete the high duty cycle portion and settle at low level.

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 339

5 Packaging

5.1 Package Dimensions

For the most current package revision, visit www.freescale.com and perform a keyword search using the “98A” listed below. AE SUFFIX 48-PIN LQFP48 REVISION 0

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 340 AE SUFFIX 48-PIN LQFP48 REVISION 0

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 341 AE SUFFIX 48-PIN LQFP48 REVISION 0

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 342 AP SUFFIX 48-PIN 98ASH00962A REVISION G

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 343 AP SUFFIX 48-PIN 98ASH00962A REVISION G

Revision History

MM912_634 Advance Information, Rev. 4.0 Freescale Semiconductor 344

6 Revision History

1.0 11/2010 • Initial release. Preliminary. 2.0 4/2011 • Advance Information release. 3.0 5/2011 • Added a note to the Ordering Information Table defining the addition of R2 to the part number

  • Updated the Table 3 part numbering scheme 4.0 5/2011 • Corrected errors in Table 49. ESD and Latch-up Protection Characteristics

Document Number: MM912_634 Rev. 4.0 How to Reach Us: Home Page: www.freescale.com Web Support: http://www.freescale.com/support USA/Europe or Locations Not Listed: Freescale Semiconductor, Inc. Technical Information Center, EL516

2100 East Elliot Road

Tempe, Arizona 85284 +1-800-521-6274 or +1-480-768-2130 www.freescale.com/support Europe, Middle East, and Africa: Freescale Halbleiter Deutschland GmbH Technical Information Center Schatzbogen 7

81829 Muenchen, Germany

+44 1296 380 456 (English) +46 8 52200080 (English) +49 89 92103 559 (German) +33 1 69 35 48 48 (French) www.freescale.com/support Japan: Freescale Semiconductor Japan Ltd. Headquarters ARCO Tower 15F 1-8-1, Shimo-Meguro, Meguro-ku, Tokyo 153-0064 Japan 0120 191014 or +81 3 5437 9125 support.japan@freescale.com Asia/Pacific: Freescale Semiconductor Hong Kong Ltd. Technical Information Center

2 Dai King Street

Tai Po, N.T., Hong Kong +800 2666 8080 support.asia@freescale.com For Literature Requests Only: Freescale Semiconductor Literature Distribution Center P .O. Box 5405 Denver, Colorado 80217 1-800-441-2447 or 303-675-2140 Fax: 303-675-2150 LDCForFreescaleSemiconductor@hibbertgroup.com Information in this document is provided solely to enable system and software implementers to use Freescale Semiconductor products. There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in this document. Freescale Semiconductor reserves the right to make changes without further notice to any products herein. Freescale Semiconductor makes no warranty, representation or guarantee regarding the 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 any and all liability, including without limitation consequential or incidental damages. “Typical” parameters that may be provided in Freescale Semiconductor data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. All operating parameters, including “Typicals”, 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 injury or death may occur. Should Buyer purchase or use Freescale Semiconductor products for any such unintended or unauthorized application, Buyer shall indemnify and hold Freescale Semiconductor and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that Freescale Semiconductor was negligent regarding the design or manufacture of the part. RoHS-compliant and/or Pb-free versions of Freescale products have the functionality and electrical characteristics as their non-RoHS-compliant and/or non-Pb-free counterparts. For further information, see http://www.freescale.com or contact your Freescale sales representative. For information on Freescale’s Environmental Products program, go to http://www.freescale.com/epp. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners © Freescale Semiconductor, Inc. 2010-2011. All rights reserved.