2.2.3Memories and memory interfaces..................................................................................................................42
2.2.5Security and integrity modules...................................................................................................................... 43
2.3Module to module interconnects...................................................................................................................................45
3.1.1Buses, interconnects, and interfaces.............................................................................................................. 49
4.2.4Erase all flash contents...................................................................................................................................56
5.5.1Clock divider values after reset......................................................................................................................70
7.4Entering and exiting power modes............................................................................................................................... 95
7.5Module operation in low-power modes........................................................................................................................ 96
8.1.2Security interactions with other modules.......................................................................................................101
9.2Debug port pin descriptions..........................................................................................................................................103
9.3SWD status and control registers..................................................................................................................................104
9.3.1MDM-AP Control Register............................................................................................................................105
9.3.2MDM-AP Status Register.............................................................................................................................. 106
9.6Debug in low-power modes..........................................................................................................................................109
9.7Debug and security....................................................................................................................................................... 110
10.3KL27 Signal Multiplexing and Pin Assignments......................................................................................................... 112
10.4KL27 Family Pinouts....................................................................................................................................................115
10.5Module Signal Description Tables................................................................................................................................118
11.1Chip-specific PORT information..................................................................................................................................125
11.2Port control and interrupt summary..............................................................................................................................126
11.4.2Modes of operation........................................................................................................................................ 128
11.5External signal description............................................................................................................................................129
11.6Detailed signal description............................................................................................................................................129
11.7Memory map and register definition.............................................................................................................................129
12.3Memory map and register definition.............................................................................................................................144
12.3.18 COP Control Register (SIM_COPC)............................................................................................................. 168
12.3.19 Service COP (SIM_SRVCOP).......................................................................................................................169
13.6Kinetis Bootloader Status Error Codes.........................................................................................................................220
14.3Modes of operation.......................................................................................................................................................223
14.4Memory map and register descriptions.........................................................................................................................225
14.5.6Debug in low power modes........................................................................................................................... 240
15.5Memory map and register descriptions.........................................................................................................................243
18.2.2Modes of operation........................................................................................................................................ 265
18.3LLWU signal descriptions............................................................................................................................................267
19.1.1Number of peripheral bridges........................................................................................................................ 283
20.1.2DMA transfers via PIT trigger.......................................................................................................................295
20.2.3Modes of operation........................................................................................................................................ 296
20.3External signal description............................................................................................................................................297
20.6.2Enabling and configuring sources..................................................................................................................303
21.2DMA Transfer Overview..............................................................................................................................................309
21.4.1Transfer requests (Cycle-Steal and Continuous modes)................................................................................319
21.4.2Channel initialization and startup.................................................................................................................. 320
21.4.3Dual-Address Data Transfer Mode................................................................................................................321
21.4.4Advanced Data Transfer Controls: Auto-Alignment.....................................................................................322
23.1.2DMA Support on ADC.................................................................................................................................. 335
23.3ADC signal descriptions...............................................................................................................................................340
23.3.1Analog Power (VDDA)................................................................................................................................. 340
23.3.5Differential Analog Channel Inputs (DADx).................................................................................................341
23.4Memory map and register definitions...........................................................................................................................341
23.4.1
23.4.2
23.4.3
23.4.4
23.4.5
23.4.6
23.4.7
23.4.8
23.4.9
23.4.10
23.4.11
23.4.12
23.4.13
23.4.14
ADC Status and Control Registers 1 (ADCx_SC1n).....................................................................................343
23.5.1Clock select and divide control......................................................................................................................364
23.7.1External pins and routing............................................................................................................................... 383
23.7.2Sources of error..............................................................................................................................................385
24.4.3Startup and operation..................................................................................................................................... 407
25.5.1DAC data buffer operation.............................................................................................................................419
26.1.3Modes of Operation....................................................................................................................................... 424
26.1.4VREF Signal Descriptions.............................................................................................................................425
26.2Memory Map and Register Definition..........................................................................................................................425
26.2.1VREF Trim Register (VREF_TRM)..............................................................................................................426
26.2.2VREF Status and Control Register (VREF_SC)............................................................................................427
26.4Internal voltage regulator..............................................................................................................................................430
27.2Memory map and register definition.............................................................................................................................434
27.2.1MCG Control Register 1 (MCG_C1).............................................................................................................435
27.2.2MCG Control Register 2 (MCG_C2).............................................................................................................436
27.2.3MCG Status Register (MCG_S).................................................................................................................... 437
27.2.4MCG Status and Control Register (MCG_SC)..............................................................................................437
27.2.5MCG Miscellaneous Control Register (MCG_MC)......................................................................................438
27.3.4Enable LIRC in Stop mode ........................................................................................................................... 440
27.3.5MCG-Lite in Low-power mode .................................................................................................................... 440
27.3.6HIRC USB recovery ..................................................................................................................................... 441
28.3Features and Modes...................................................................................................................................................... 443
28.5OSC Signal Descriptions.............................................................................................................................................. 445
28.11 Low power modes operation.........................................................................................................................................454
29.2.3Modes of operation........................................................................................................................................ 459
29.3TPM Signal Descriptions..............................................................................................................................................460
29.4Memory Map and Register Definition..........................................................................................................................461
30.6Initialization and application information.....................................................................................................................496
30.7Example configuration for chained timers....................................................................................................................497
30.8Example configuration for the lifetime timer............................................................................................................... 498
Timer Load Value Register (PIT_LDVALn).................................................................................................492
Current Timer Value Register (PIT_CVALn)............................................................................................... 492
Timer Control Register (PIT_TCTRLn)........................................................................................................493
Timer Flag Register (PIT_TFLGn)................................................................................................................494
31.2.2Modes of operation........................................................................................................................................ 503
31.3LPTMR signal descriptions.......................................................................................................................................... 503
31.3.1Detailed signal descriptions........................................................................................................................... 503
31.4Memory map and register definition.............................................................................................................................504
31.5.1LPTMR power and reset................................................................................................................................508
32.2.2Modes of operation........................................................................................................................................ 514
32.2.3RTC signal descriptions.................................................................................................................................514
32.3.1RTC Time Seconds Register (RTC_TSR).....................................................................................................515
32.3.2RTC Time Prescaler Register (RTC_TPR)....................................................................................................515
32.3.3RTC Time Alarm Register (RTC_TAR)....................................................................................................... 516
32.3.4RTC Time Compensation Register (RTC_TCR)...........................................................................................516
32.3.5RTC Control Register (RTC_CR)..................................................................................................................518
32.3.6RTC Status Register (RTC_SR).................................................................................................................... 520
32.4.1Power, clocking, and reset............................................................................................................................. 523
33.1.3USB Power Distribution................................................................................................................................ 528
33.1.4USB power management............................................................................................................................... 530
34.1.3Modes of Operation....................................................................................................................................... 565
34.2USB Voltage Regulator Module Signal Descriptions.................................................................................................. 565
35.2.2Modes of operation........................................................................................................................................ 568
35.3External signal description............................................................................................................................................572
35.3.1SPSCK — SPI Serial Clock...........................................................................................................................573
35.3.2MOSI — Master Data Out, Slave Data In..................................................................................................... 573
35.3.3MISO — Master Data In, Slave Data Out..................................................................................................... 573
SPI Status Register (SPIx_S)......................................................................................................................... 574
35.5.5SPI Transmission by DMA............................................................................................................................592
SPI control register 3 (SPIx_C3)....................................................................................................................586
36.2.2Modes of operation........................................................................................................................................ 612
36.3I2C signal descriptions..................................................................................................................................................613
I2C Frequency Divider register (I2Cx_F)......................................................................................................615
I2C Control Register 1 (I2Cx_C1).................................................................................................................616
I2C Status register (I2Cx_S).......................................................................................................................... 618
I2C Data I/O register (I2Cx_D)..................................................................................................................... 620
I2C Control Register 2 (I2Cx_C2).................................................................................................................620
36.5.4System management bus specification.......................................................................................................... 635
37.2.2Modes of operation........................................................................................................................................ 648
37.4.5Interrupts and status flags.............................................................................................................................. 675
38.2.2Modes of operation........................................................................................................................................ 679
38.3UART signal descriptions.............................................................................................................................................680
38.3.1Detailed signal descriptions........................................................................................................................... 680
38.4Memory map and registers............................................................................................................................................680
38.4.1
38.4.2
38.4.3
Freescale Semiconductor, Inc.29
UART Baud Rate Registers: High (UARTx_BDH)...................................................................................... 682
38.5.4Data format (non ISO-7816)..........................................................................................................................726
38.9.3Overrun (OR) flag implications..................................................................................................................... 740
39.2.4Modes of operation........................................................................................................................................ 747
39.2.5FlexIO Signal Descriptions............................................................................................................................748
39.3Memory Map and Registers..........................................................................................................................................748
39.3.1Version ID Register (FLEXIO_VERID)....................................................................................................... 750
40.2.3Modes of operation........................................................................................................................................ 789
40.4Memory map and register definition.............................................................................................................................791
40.4.1
40.4.2
40.4.3
40.4.4
40.4.5
40.4.6
40.4.7
40.4.8
40.4.9
40.4.10
40.4.11
40.4.12
40.4.13
SAI Transmit Control Register (I2Sx_TCSR)............................................................................................... 792
SAI Transmit Configuration 2 Register (I2Sx_TCR2).................................................................................. 795
SAI Transmit Configuration 3 Register (I2Sx_TCR3).................................................................................. 796
SAI Transmit Configuration 4 Register (I2Sx_TCR4).................................................................................. 797
SAI Transmit Configuration 5 Register (I2Sx_TCR5).................................................................................. 799
SAI Transmit Data Register (I2Sx_TDRn)....................................................................................................800
SAI Transmit Mask Register (I2Sx_TMR)....................................................................................................800
SAI Receive Control Register (I2Sx_RCSR).................................................................................................801
SAI Receive Configuration 2 Register (I2Sx_RCR2)....................................................................................804
SAI Receive Configuration 3 Register (I2Sx_RCR3)....................................................................................806
SAI Receive Configuration 4 Register (I2Sx_RCR4)....................................................................................807
SAI Receive Configuration 5 Register (I2Sx_RCR5)....................................................................................809
SAI Receive Data Register (I2Sx_RDRn)..................................................................................................... 809
40.4.14
40.4.15
Freescale Semiconductor, Inc.33
SAI Receive Mask Register (I2Sx_RMR)..................................................................................................... 810
SAI MCLK Control Register (I2Sx_MCR)................................................................................................... 811
40.5.7Interrupts and DMA requests.........................................................................................................................819
41.1.2GPIO accessibility in the memory map......................................................................................................... 821
41.2.2Modes of operation........................................................................................................................................ 822
41.2.3GPIO signal descriptions............................................................................................................................... 822
41.3Memory map and register definition.............................................................................................................................824
42.1.3Modes of operation........................................................................................................................................ 833
42.2Memory map and register definition.............................................................................................................................833
43.1.3Modes of operation........................................................................................................................................ 855
43.2External signal description............................................................................................................................................855
43.3Memory map and register definition.............................................................................................................................856
43.3.3System ROM Memory Map...........................................................................................................................878
44.2Modes of operation.......................................................................................................................................................884
44.3External signal description............................................................................................................................................884
44.4Memory map and register descriptions.........................................................................................................................884
45.2External Signal Description..........................................................................................................................................890
45.3Memory Map and Registers..........................................................................................................................................890
45.3.1Flash Configuration Field Description...........................................................................................................891
45.4.3Flash Operation in Low-Power Modes.......................................................................................................... 903
45.4.4Functional Modes of Operation..................................................................................................................... 903
45.4.5Flash Reads and Ignored Writes.................................................................................................................... 903
45.4.6Read While Write (RWW).............................................................................................................................904
45.4.7Flash Program and Erase................................................................................................................................904
This document describes the features, architecture, and programming model of the
Freescale KL27 microcontroller.
1.1.2Audience
A reference manual is primarily for system architects and software application developers
who are using or considering using a Freescale product in a system.
1.2Conventions
1.2.1Numbering systems
The following suffixes identify different numbering systems:
This suffixIdentifies a
bBinary number. For example, the binary equivalent of the
number 5 is written 101b. In some cases, binary numbers are
shown with the prefix 0b.
dDecimal number. Decimal numbers are followed by this suffix
only when the possibility of confusion exists. In general,
decimal numbers are shown without a suffix.
hHexadecimal number. For example, the hexadecimal
equivalent of the number 60 is written 3Ch. In some cases,
hexadecimal numbers are shown with the prefix 0x.
The following typographic notation is used throughout this document:
ExampleDescription
placeholder, xItems in italics are placeholders for information that you provide. Italicized text is also used for
the titles of publications and for emphasis. Plain lowercase letters are also used as
placeholders for single letters and numbers.
code
SR[SCM]A mnemonic in brackets represents a named field in a register. This example refers to the
REVNO[6:4], XAD[7:0]Numbers in brackets and separated by a colon represent either:
Fixed-width type indicates text that must be typed exactly as shown. It is used for instruction
mnemonics, directives, symbols, subcommands, parameters, and operators. Fixed-width type
is also used for example code. Instruction mnemonics and directives in text and tables are
shown in all caps; for example, BSR.
Scaling Mode (SCM) field in the Status Register (SR).
• A subset of a register's named field
For example, REVNO[6:4] refers to bits 6–4 that are part of the COREREV field that
occupies bits 6–0 of the REVNO register.
• A continuous range of individual signals of a bus
For example, XAD[7:0] refers to signals 7–0 of the XAD bus.
1.2.3Special terms
The following terms have special meanings:
TermMeaning
assertedRefers to the state of a signal as follows:
• An active-high signal is asserted when high (1).
• An active-low signal is asserted when low (0).
deassertedRefers to the state of a signal as follows:
• An active-high signal is deasserted when low (0).
An active-low signal is deasserted when high (1).
•
In some cases, deasserted signals are described as negated.
reservedRefers to a memory space, register, or field that is either
reserved for future use or for which, when written to, the
module or chip behavior is unpredictable.
Information found here provides an overview of the Kinetis L series of ARM® Cortex®M0+ MCUs and KL27 product family. It also presents high-level descriptions of the
modules available on the devices covered by this document.
2.1.1Sub-family introduction
The device is highly-integrated, market leading ultra low-power 32-bit microcontroller
based on the enhanced Cortex-M0+ (CM0+) core platform. The features of the family
derivatives are as follows.
• Core platform clock up to 48 MHz, bus clock up to 24 MHz
• Memory option is up to 256 KB flash and 32 KB RAM
• Wide operating voltage ranges from 1.71–3.6 V with fully functional flash program/
erase/read operations
• Multiple package options from 32-pin to 64-pin
• Ambient operating temperature ranges from –40 °C to 105 °C.
The family acts as an ultra low-power, cost-effective microcontroller to provide
developers an appropriate entry-level 32-bit solution. The family is the next-generation
MCU solution for low-cost, low-power, high-performance devices applications. It’s
valuable for cost-sensitive, portable applications requiring long battery life-time.
The modules on this device are grouped into functional categories. Information found
here describes the modules assigned to each category in more detail.
Table 2-1. Module functional categories
Module categoryDescription
ARM Cortex-M0+ core• 32-bit MCU core from ARM’s Cortex-M class, 1.77 CoreMark®/MHz from
single-cycle access memories, 48 MHz CPU frequency
System• System integration module
• Power management and mode controllers
• Multiple power modes available based on run, wait, stop, and powerdown modes
• Miscellaneous control module
• Low-leakage wakeup unit
• Peripheral bridge
• Direct memory access (DMA) controller with multiplexer to increase available
DMA requests
• COP watchdog
Memories• Internal memories include:
• Up to 256 KB flash memory
• Up to 32 KB SRAM
• Up to 16 KB ROM
Clocks• Multiple clock generation options available from internally- and externally-
generated clocks
• MCG-Lite with 48MIRC and 8M/2M IRC for systems and CPU clock
sources.
• Low power 1 kHz RC oscillator for RTC and COP watchdog
• System oscillator to provide clock source for the MCU
Security• COP watchdog timer (COP)
Analog• 16-bit analog-to-digital converters with DMA supported and four muxed
differential pairs
• Comparator (CMP) with internal 6-bit digital-to-analog converter (DAC)
• 12-bit DAC with DMA support and two 16-bit data buffer
• High accuracy 1.2 V voltage reference to provide a stable reference for ADC
Timers• One 6-channel TPM
• Two 2-channel TPMs
• 2-channel periodic interrupt timer
• Real time clock
• Low-power timer
• System tick timer
Communications• Two 16-bit serial peripheral interface
• USB controller with built-in FS transceiver
• USB voltage regulator
• Two inter-integrated circuit (I2C) modules
• Two low power UART modules and one UART module
• One FlexIO
Human-Machine Interfaces (HMI)• General purpose input/output controller
The following core modules are available on this device.
Table 2-2. Core modules
ModuleDescription
ARM Cortex-M0+The ARM Cortex-M0+ is the newest member of the Cortex M Series of processors
targeting microcontroller applications focused on very cost sensitive, deterministic,
interrupt driven environments. The Cortex M0+ processor is based on the ARMv6
Architecture and Thumb®-2 ISA and is 100% instruction set compatible with its
predecessor, the Cortex-M0 core, and upward compatible to Cortex-M3 and M4
cores.
NVICThe ARMv6-M exception model and nested-vectored interrupt controller (NVIC)
implement a relocatable vector table supporting many external interrupts, a single
non-maskable interrupt (NMI), and priority levels.
The NVIC replaces shadow registers with equivalent system and simplified
programmability. The NVIC contains the address of the function to execute for a
particular handler. The address is fetched via the instruction port allowing parallel
register stacking and look-up. The first sixteen entries are allocated to ARM
internal sources with the others mapping to MCU-defined interrupts.
AWICThe primary function of the Asynchronous Wake-up Interrupt Controller (AWIC) is
to detect asynchronous wake-up events in stop modes and signal to clock control
logic to resume system clocking. After clock restart, the NVIC observes the
pending interrupt and performs the normal interrupt or event processing.
Single-cycle I/O PortFor high-speed, single-cycle access to peripherals, the Cortex-M0+ processor
implements a dedicated single-cycle I/O port.
Debug interfacesMost of this device's debug is based on the ARM CoreSight™ architecture. One
debug interface is supported:
• Serial Wire Debug (SWD)
2.2.2System modules
The following system modules are available on this device.
Table 2-3. System modules
ModuleDescription
System integration module (SIM)The SIM includes integration logic and several module configuration settings.
System mode controller (SMC)The SMC provides control and protection on entry and exit to each power mode,
control for the power management controller (PMC), and reset entry and exit for
the complete MCU.
Power management controller (PMC)The PMC provides the user with multiple power options. Multiple modes are
supported that allow the user to optimize power consumption for the level of
functionality needed. Includes power-on-reset (POR) and integrated low voltage
detect (LVD) with reset (brownout) capability and selectable LVD trip points.
Miscellaneous control module (MCM)The MCM includes integration logic and details.
Crossbar switch lite (AXBS-Lite)The AXBS connects bus masters and bus slaves, allowing all bus masters to
access different bus slaves simultaneously and providing arbitration among the bus
masters when they access the same slave.
Low-leakage wakeup unit (LLWU)The LLWU module allows the device to wake from low leakage power modes (LLS
and VLLS) through various internal peripheral and external pin sources.
Peripheral bridge (AIPS-Lite)The peripheral bridge converts the crossbar switch interface to an interface to
access a majority of peripherals on the device.
DMA multiplexer (DMAMUX)The DMA multiplexer selects from many DMA requests down to 4 for the DMA
controller.
Direct memory access (DMA) controllerThe DMA controller provides programmable channels with transfer control
descriptors for data movement via dual-address transfers for 8-, 16- and 32-bit
data values.
Computer operating properly watchdog
(WDOG)
The WDOG monitors internal system operation and forces a reset in case of
failure. It can run from an independent 1 kHz low power oscillator, 8/2 MHz internal
oscillator or external crystal oscillator with a programmable refresh window to
detect deviations in program flow or system frequency.
2.2.3Memories and memory interfaces
The following memories and memory interfaces are available on this device.
Table 2-4. Memories and memory interfaces
ModuleDescription
Flash memoryProgram flash memory — up to 256 KB of the non-volatile flash memory that can
execute program code.
Flash memory controllerManages the interface between the device and the on-chip flash memory.
SRAMUp to 32 KB internal system RAM.
ROM16 KB ROM.
2.2.4Clocks
The following clock modules are available on this device.
Table 2-5. Clock modules
ModuleDescription
Multipurpose Clock Generator Lite
(MCG-Lite)
System oscillator (OSC)The system oscillator, in conjunction with an external crystal or resonator,
MCG Lite module containing a 48 MHz and an 8 or 2 MHz internal reference clock
The following security and integrity modules are available on this device:
Table 2-6. Security and integrity modules
ModuleDescription
Watchdog timer (WDOG)Watchdog timer keeps a watch on the system functioning and resets it in case of
its failure.
2.2.6Analog modules
The following analog modules are available on this device:
Table 2-7. Analog modules
ModuleDescription
Analog-to-digital converters (ADC)16-bit successive-approximation ADC module.
Analog comparatorsOne comparator that compares two analog input voltages across the full range of
the supply voltage and can trigger an ADC acquisition, TPM update, or CPU
interrupt.
6-bit digital-to-analog converters (DAC)64-tap resistor ladder network which provides a selectable voltage reference for
comparator.
Voltage reference (VREF)Supplies an accurate voltage output that is trimmable in 0.5 mV steps. The VREF
can be used in medical applications, such as glucose meters, to provide a
reference voltage to biosensors or as a reference to analog peripherals, such as
the ADC, DAC, or CMP.
12-bit digital-to-analog converters (DAC) Low-power general-purpose DAC, whose output can be placed on an external pin
or set as one of the inputs to the analog comparator or ADC.
2.2.7Timer modules
The following timer modules are available on this device:
• Support the generation of an interrupt and/or DMA request per channel
• Support the generation of an interrupt and/or DMA request when the counter
overflows
• Support selectable trigger input to optionally reset or cause the counter to
start incrementing.
• Support the generation of hardware triggers when the counter overflows and
per channel
Periodic interrupt timers (PIT)• One general purpose interrupt timer
• Interrupt timers for triggering ADC conversions
• 32-bit counter resolution
• Clocked by bus clock frequency
• DMA support
Low power timer (LPTMR)• 16-bit time counter or pulse counter with compare
• Configurable clock source for prescaler/glitch filter
• Configurable input source for pulse counter
Real Time Clock (RTC)• 32-bit seconds counter with roll-over protection and 32-bit alarm
• Software selectable clock sources for input to prescaler with programmable
16-bit prescaler
• XOSC 32.678 kHz nominal
• LPO (~1 kHz)
• External RTC_CLKIN
2.2.8Communication interfaces
The following communication interfaces are available on this device:
Table 2-9. Communication modules
ModuleDescription
USB controller with built-in FS
transceiver
USB voltage regulatorUp to 5 V regulator input typically provided by USB VBUS power with 3.3 V
Serial peripheral interface (SPI)Synchronous serial bus for communication to an external device
Inter-integrated circuit (I2C)Allows communication between a number of devices. Also supports the System
Universal asynchronous receiver/
transmitters (UART) and (LPUART)
I2SThe I2S is a full-duplex, serial port that allows the chip to communicate with a
FlexIOThe FlexIO module is capable of supporting a wide range of protocols including,
Dual-role USB controller that supports a full-speed (FS) device. The module
complies with the USB 2.0 specification.
regulated output that powers on-chip USB subsystem, capable of sourcing 120 mA
to external board components.
Management Bus (SMBus) Specification, version 2.
Two low power UART modules that retains functional in stop modes. One UART
module does not work in stop mode.
variety of serial devices, such as standard codecs, digital signal processors
(DSPs), microprocessors, peripherals, and audio codecs that implement the interIC sound bus (I2S) and the Intel® AC97 standards
but not limited to--UART, I2C, SPI, I2S, Camera IF, LCD RGB, PWM / Waveform
generation. The module can remain functional in VLPS mode provided the clock it
is using remains enabled.
Several analog blocks have selectable reference voltages as shown in the below table .
These options allow analog peripherals to share or have separate analog references. Care
should be taken when selecting analog references to avoid cross talk noise.
VREFH pin can be used as filter capacitor pin for high
precision 1.2V VREF_OUT. When 1.2V VREF is enabled,
VREFH is 1.2V VREF_OUT. Also, when 1.2V VREF module
is enabled, adding supply to VREFH pad, which is a dedicated
1.2 VREF_OUT pad, from external is prohibited. If ADC or
DAC needs another reference voltage not equal to 1.2V at same
time, second reference VDDA or VDD is required to be
selected.
The enhanced ARM Cortex M0+ is the member of the Cortex-M Series of processors
targeting microcontroller cores focused on very cost sensitive, low power applications. It
has a single 32-bit AMBA AHB-Lite interface and includes an NVIC component. It also
has hardware debug functionality including support for simple program trace capability.
The processor supports the ARMv6-M instruction set (Thumb) architecture including all
but three 16-bit Thumb opcodes (52 total) plus seven 32-bit instructions. It is upward
compatible with other Cortex-M profile processors.
3.1.1Buses, interconnects, and interfaces
The ARM Cortex-M0+ core has two bus interfaces:
• Single 32-bit AMBA-3 AHB-Lite system interface that provides connections to
peripherals and all system memory, which includes flash memory and RAM
Single 32-bit I/O port bus interfacing to the GPIO with 1-cycle loads and stores
•
3.1.2System tick timer
The CLKSOURCE field in SysTick Control and Status register selects either the core
clock (when CLKSOURCE = 1) or a divide-by-16 of the core clock (when
CLKSOURCE = 0). Because the timing reference is a variable frequency, the TENMS
field in the SysTick Calibration Value Register is always 0.
3.1.3Debug facilities
This device supports standard ARM 2-pin SWD debug port.
The core on this device is implemented with both privileged and unprivileged levels. The
ARM documentation uses different terms than this document to distinguish between
privilege levels.
If you see this term...it also means this term...
PrivilegedSupervisor
Unprivileged or userUser
3.2
Nested vectored interrupt controller (NVIC)
3.2.1Interrupt priority levels
This device supports four priority levels for interrupts. Therefore, in the NVIC, each
source in the IPR registers contains two bits. For example, IPR0 is shown below:
The non-maskable interrupt request to the NVIC is controlled by the external NMI signal.
The pin the NMI signal is multiplexed on, must be configured for the NMI function to
generate the non-maskable interrupt request.
3.2.3Interrupt channel assignments
The interrupt vector assignments are defined in the following table.
• Vector number — the value stored on the stack when an interrupt is serviced.
• IRQ number — non-core interrupt source count, which is the vector number minus
16.
The IRQ number is used within ARM's NVIC documentation.
0x0000_00401600DMADMA channel 0 transfer complete and error
0x0000_00441710DMADMA channel 1 transfer complete and error
0x0000_00481820DMADMA channel 2 transfer complete and error
0x0000_004C1930DMADMA channel 3 transfer complete and error
0x0000_00502041——
0x0000_00542151FTFACommand complete and read collision
0x0000_00582261PMCLow-voltage detect, low-voltage warning
0x0000_005C2371LLWULow Leakage Wakeup
0x0000_00602482I2C0Status and Timeout and wakeup flags
0x0000_00642592I2C1Status and Timeout and wakeup flags
0x0000_006826102SPI0Single interrupt vector for all sources
0x0000_006C27112SPI1Single interrupt vector for all sources
0x0000_007028123LPUART0Status and error
0x0000_007429133LPUART1Status and error
0x0000_007830143UART2 or FlexIOStatus and error—
0x0000_007C31153ADC0Conversion complete
0x0000_008032164CMP0Rising or falling edge of comparator output
0x0000_008433174TPM0Overflow or channel interrupt
0x0000_008834184TPM1Overflow or channel interrupt
0x0000_008C35194TPM2Overflow or channel interrupt
0x0000_009036205RTCAlarm interrupt
0x0000_009437215RTCSeconds interrupt
0x0000_009838225PITSingle interrupt vector for all channels
0x0000_009C39235I2S0Single interrupt vector for all sources
0x0000_00A040246USB—
0x0000_00A441256DAC0—
0x0000_00A842266——
0x0000_00AC43276——
0x0000_00B044287LPTMR0LP Timer compare match
0x0000_00B445297——
0x0000_00B846307Port control modulePin detect (Port A)
0x0000_00BC47317Port control modulePin detect (Single interrupt vector for Port C,
1
NVIC
IPR
register
number
Source moduleSource description
2
Port D)
1. Indicates the NVIC's interrupt source number.
2. Indicates the NVIC's IPR register number used for this IRQ. The equation to calculate this value is: IRQ div 4
3.2.3.1Determining the bitfield and register location for configuring a
particular interrupt
Suppose you need to configure the SPI0 interrupt. The following table is an excerpt of the
SPI0 row from Interrupt priority levels.
Table 3-3. Interrupt vector assignments
AddressVectorIRQ
0x0000_006826102SPI0Single interrupt vector for all sources
1. Indicates the NVIC's interrupt source number.
2. Indicates the NVIC's IPR register number used for this IRQ. The equation to calculate this value is: IRQ div 4.
• The NVIC registers you would use to configure the interrupt are:
• To determine the particular IRQ's field location within these particular registers:
• NVICIPR2 field starting location = 8 * (IRQ mod 4) + 6 = 22
Since the NVICIPR fields are 2-bit wide (4 priority levels), the NVICIPR2 field
range is 22–23.
Therefore, the following field locations are used to configure the SPI0 interrupts:
• NVICIPR2[23:22]
3.3AWIC introduction
The primary function of the AWIC block is to detect asynchronous wake-up events in
stop modes and signal to clock control logic to resume system clocking. After clock
restart, the NVIC observes the pending interrupt and performs the normal interrupt or
event processing.
3.3.1Wake-up sources
The device uses the following internal and external inputs to the AWIC module.
Table 3-4. AWIC stop wake-up sources
Wake-up sourceDescription
Available system resetsRESET pin when LPO is its clock source
Low-voltage detectPower management controller—functional in Stop mode
Low-voltage warningPower management controller—functional in Stop mode
Pin interruptsPort control module—any enabled pin interrupt is capable of waking the system
ADCThe ADC is functional when using internal clock source or external crystal clock
CMP0Interrupt in normal or trigger mode
I2CAddress match wakeup
LPUART0 , LPUART1Any enabled interrupt can be a source as long as the module remains clocked
UART2Active edge on RXD
RTCAlarm or seconds interrupt
NMINMI pin
TPMxAny enabled interrupt can be a source as long as the module remains clocked
LPTMRAny enabled interrupt can be a source as long as the module remains clocked
SPIxSlave mode interrupt
FlexIOAny enabled interrupt can be a source as long as the module remains clocked
The flash memory and the flash registers are located at different base addresses as shown
in the figure found here.
The base address for each is specified in System memory map.
Figure 4-1. Flash memory map
The on-chip flash memory is implemented in a portion of the allocated Flash range to
form a contiguous block in the memory map beginning at address 0x0000_0000. See
Flash memory for details of supported ranges.
Access to the flash memory ranges outside the amount of flash on the device causes the
bus cycle to be terminated with an error followed by the appropriate response in the
requesting bus master.
4.2.2Flash security
For information on how flash security is implemented on this device, see Security.
4.2.3Flash modes
The flash memory chapter defines two modes of operation: NVM normal and NVM
special modes. On this device, the flash memory only operates in NVM normal mode. All
references to NVM special mode must be ignored.
4.2.4Erase all flash contents
In addition to software, the entire flash memory may be erased external to the flash
memory via the SW-DP debug port by setting MDM-AP CONTROL[0]. MDM-AP
STATUS[0] is set to indicate the mass erase command has been accepted. MDM-AP
STATUS[0] is cleared when the mass erase completes.
The flash memory's FTFA_FOPT register allows the user to customize the operation of
the MCU at boot time. See FOPT boot options for details of its definition.
4.3
SRAM
4.3.1SRAM sizes
This device contains SRAM which could be accessed by bus masters through the crossbar switch. The amount of SRAM for the devices covered in this document is shown in
the following table.
The on-chip SRAM is split into two ranges, 1/4 is allocated SRAM_L and 3/4 is allocated
to SRAM_U.
The on-chip RAM is implemented such that the SRAM_L and SRAM_U ranges form a
contiguous block in the memory map. As such:
• SRAM_L is anchored to 0x1FFF_FFFF and occupies the space before this ending
address.
SRAM_U is anchored to 0x2000_0000 and occupies the space after this beginning
1. The program flash always begins at 0x0000_0000 but the end of implemented flash varies depending on the amount of
flash implemented for a particular device. See Flash memory for details.
2. This range varies depending on SRAM sizes. See SRAM sizes for details.
3. Includes BME operations to GPIO at slot 15 (based at 0x4000_F000).
The Bit Manipulation Engine (BME) provides hardware support for atomic read-modifywrite memory operations to the peripheral address space.
By combining the basic load and store instruction support in the Cortex-M instruction set
architecture with the concept of decorated storage provided by the BME, the resulting
implementation provides a robust and efficient read-modify-write capability to this class
of ultra low-end microcontrollers. See the Bit Manipulation Engine Block Guide (BME)
for a detailed description of BME functionality.
4.7Peripheral bridge (AIPS-Lite) memory map
The peripheral memory map is accessible via one slave port on the crossbar in the
0x4000_0000–0x400F_FFFF region. The device implements one peripheral bridge that
defines a 1024 KB address space.
The three regions associated with this space are:
• A 128 KB region, partitioned as 32 spaces, each 4 KB in size and reserved for onplatform peripheral devices. The AIPS controller generates unique module enables
for all 32 spaces.
• A 384 KB region, partitioned as 96 spaces, each 4 KB in size and reserved for offplatform modules. The AIPS controller generates unique module enables for all 96
spaces.
• The last slot is a 4 KB region beginning at 0x400F_F000 for accessing the GPIO
module. The GPIO slot (slot 128) is an alias of slot 15. This block is also directly
interfaced to the core and provides direct access without incurring wait states
associated with accesses via the AIPS controller.
Modules that are disabled via their clock gate control bits in the SIM registers disable the
associated AIPS slots. Access to any address within an unimplemented or disabled
peripheral bridge slot results in a transfer error termination.
For programming model accesses via the peripheral bridges, there is generally only a
small range within the 4 KB slots that is implemented. Accessing an address that is not
implemented in the peripheral results in a transfer error termination.
4.7.1Read-after-write sequence and required serialization of
memory operations
In some situations, a write to a peripheral must be completed fully before a subsequent
action can occur. Examples of such situations include:
• Exiting an interrupt service routine (ISR)
• Changing a mode
• Configuring a function
In these situations, the application software must perform a read-after-write sequence to
guarantee the required serialization of the memory operations:
1. Write the peripheral register.
2. Read the written peripheral register to verify the write.
0x4003_C00060—
0x4003_D00061Real Time Clock (RTC)
0x4003_E00062—
0x4003_F00063DAC0
0x4004_000064Low-power timer (LPTMR)
0x4004_100065System register file
0x4004_200066—
0x4004_300067—
0x4004_400068—
0x4004_500069—
0x4004_600070—
0x4004_700071SIM low-power logic
0x4004_800072System integration module (SIM)
0x4004_900073Port A multiplexing control
0x4004_A00074Port B multiplexing control
0x4004_B00075Port C multiplexing control
0x4004_C00076Port D multiplexing control
0x4004_D00077Port E multiplexing control
0x4004_E00078—
0x4004_F00079—
This chapter presents the clock architecture for the device, the overview of the clocks and
includes a terminology section.
The Cortex M0+ resides within a synchronous core platform, where the processor and
bus masters, flash memory, and peripheral clocks can be configured independently. The
clock distribution figure shows how clocks from the lite version of Multi Clock
Generation (MCG-Lite) and OSC module are distributed to the microcontroller’s other
function units. Some modules in the microcontroller have selectable clock input.
5.2Programming model
The selection and multiplexing of system clock sources is controlled and programmed via
the Clock Generation Module. The setting of clock dividers and module clock gating for
the system are programmed via the SIM module. Refer to the MCG_Lite and SIM
sections for detailed register and bit descriptions.
5.3High-level device clocking diagram
The following system oscillator, MCG_Lite, and SIM module registers control the
multiplexers, dividers, and clock gates shown in the following figure:
Note1: See subsequent sections for details on where these clocks are used.
PMC logic
PMC
LPO
OSCCLK
CG
CG
CG
CG — Clock gate
8MHz/
2MHz
IRC
8MHz
2MHz
IRC8M
Clock options for
some peripherals
(see note)
RTC_CLKOUT
RTC
RTC_CKLIN
1Hz
IRCS
USB_EN
Counter logic
USB
IRC_TRIMs
Note2: 48Mhz clock (IRC48M) control register is defined in either USB or MCG_Lite. In case USB is not
available, IRC48M will be controlled by IRC_TRIMs in MCG_Lite module
Note3: FCRDIV support divider ratio 1,2,4,8,16, 32, 64, 128. LIRC_DIV2 provides the futher divide
down for MCGIRCLK.
Note4: OSC32KCLK is only available when external crystal is in 30KHz - 40KHz range.
MCGOUTCLK
FCRDIV
MCGPCLK
CG
LIRC_DIV2
Clock definitions
Figure 5-1. Clocking diagram
5.4Clock definitions
The following table describes the clocks in the previous block diagram.
I2S master clockUp to 25 MHzUp to 16 MHzSystem clock,
1. If in LIRC mode, where clocking is derived from the fast internal reference clock, the Bus clock and flash clock frequency
needs to be limited to 1Mhz if executing from flash.
VLPR mode
clock frequency
Clock sourceClock is disabled
when…
SIM_SOPT2[LPUART1
MCGPCLK,
OSCERCLK
MCGPCLK,
OSCERCLK
USB_CLKIN
OSCERCLK,
MCGIRCLK ,
MCGPCLK,
SRC]=00 selected clock
source disabled
SIM_SOPT2[FLEXIOS
RC]=00 selected clock
source disabled
USB FS is disabled
I2S is disabled
5.5Internal clocking requirements
The clock dividers are programmed via the SIM_CLKDIV1 register. The following
requirements must be met when configuring the clocks for this device:
• The core, platform, and system clock are programmable from a divide-by-1 through
divide-by-16 setting. The core, platform, and system clock frequencies must be 48
MHz or slower.
The frequency of bus clock and flash clock is divided by the system clock and is
•
programmable from a divide-by-1 through divide-by-8 setting. The bus clock and
flash clock must be programmed to 24 MHz or slower.
• MCGPCLK is used for peripheral which is fixed to 48 MHz.
• MCGIRCLK is also one of peripheral clock sources which is from IRC8M and can
be divided down by a divider.
The following is a common clock configuration for this device:
ClockMax. Frequency
Core clock48 MHz
Platform clock48 MHz
System clock48 MHz
Bus clock24 MHz
Flash clock24 MHz
Each clock divider is programmed via the CLKDIV1 registers of the SIM module. Two
bits in the flash memory's FTFA_FOPT register control the reset value of the core clock,
system clock, bus clock, and flash clock dividers as shown in the table given below:
000x7 (divide by 8)0x1 (divide by 2)VLPR
010x3 (divide by 4)0x1 (divide by 2)VLPR
100x1 (divide by 2)0x1 (divide by 2)RUN
110x0 (divide by 1)0x1 (divide by 2)RUN
This gives the user flexibility in selecting between a lower frequency, low-power boot
option and higher frequency, higher power during and after reset.
The flash erased state defaults to fast clocking mode, since these bits reside in flash,
which is logic 1 in the flash erased state. To enable a lower power boot option, program
the appropriate bits in FTFA_FOPT. During the reset sequence, if either of the control
bits is cleared, the system is in a slower clock configuration. Upon any system reset, the
clock dividers return to this configurable reset state.
The default reset clock for core/system clock is 8 MHz from IRC8M.
5.5.2VLPR mode clocking
The clock dividers cannot be changed while in VLPR mode. These dividers must be
programmed prior to entering VLPR mode to guarantee operation. Maximum frequency
limitations for VLPR mode is as follows :
• the core/system clocks are less than or equal to 4 MHz, and
the bus and flash clocks are less than or equal to 1 MHz
The clock to each module can be individually gated on and off using bits of the SCGCx
registers of the SIM module. These bits are cleared after any reset, which disables the
clock to the corresponding module to conserve power. Prior to initializing a module, set
the corresponding bit in the SCGCx register to enable the clock. Before turning off the
clock, make sure to disable the module.
Any bus access to a peripheral that has its clock disabled generates an error termination.
5.7Module clocks
The following table summarizes the clocks associated with each module.
The Power Management Controller (PMC) generates a 1-kHz clock that is enabled in all
modes of operation, including all low-power modes except VLLS0. This 1-kHz source is
commonly referred to as LPO clock or 1-kHz LPO clock.
5.7.2COP clocking
The COP may be clocked from four clock sources as shown in the following figure.
The RTC module can be clocked as shown in the following figure.
NOTE
The chosen clock must remain enabled if the RTC is to
continue operating in all required low-power modes.
Chapter 5 Clock Distribution
Figure 5-3. RTC clock generation
5.7.4RTC_CLKOUT and CLKOUT32K clocking
When the RTC is enabled and the port control module selects the RTC_CLKOUT
function, the RTC_CLKOUT signal, controlled from SIM_SOPT2[RTCCLKOUTSEL],
outputs a 1 Hz or 32 kHz output derived from RTC oscillator as shown below and can be
configured to drive to external pins via pin control configuration for the associated pin. It
is also possible to drive CLKOUT32K on the same pins as controlled by
SIM_SOPT1[OSC32KOUT] on the selected RTC_CLKOUT pins in all modes of
operation (including LLS/VLLS and System Reset), overriding the existing pin mux
configuration for that pin.
Figure 5-4. RTC_CLKOUT and CLKOUT32K generation
5.7.5LPTMR clocking
The prescaler and glitch filters in each of the LPTMRx modules can be clocked as shown
in the following figure.
The chosen clock must remain enabled if the LPTMRx is to
continue operating in all required low-power modes.
The audio master clock (MCLK) is used to generate the bit clock when the receiver or
transmitter is configured for an internally generated bit clock. The audio master clock can
also be output to or input from a pin. The transmitter and receiver have the same audio
master clock inputs.
Each SAI peripheral can control the input clock selection, pin direction and divide ratio
of one audio master clock.
The I2S/SAI transmitter and receiver support asynchronous bit clocks (BCLKs) that can
be generated internally from the audio master clock or supplied externally. The module
also supports the option for synchronous operation between the receiver and transmitter.
The transmitter and receiver can independently select between the bus clock and the
audio master clock to generate the bit clock.
The MCLK and BCLK source options appear in the following figure.
Each of the system reset sources has an associated bit in the System Reset Status (SRS)
registers. See the Reset Control Module for register details.
The MCU can exit and reset in functional mode where the CPU is executing code
(default) or the CPU is in a debug halted state. There are several boot options that can be
configured. See Boot information for more details.
6.2Reset
The information found here discusses basic reset mechanisms and sources.
Some modules that cause resets can be configured to cause interrupts instead. Consult the
individual peripheral chapters for more information.
When power is initially applied to the MCU or when the supply voltage drops below the
power-on reset re-arm voltage level (V
), the POR circuit causes a POR reset
POR
condition.
As the supply voltage rises, the LVD circuit holds the MCU in reset until the supply has
risen above the LVD low threshold (V
). The POR and LVD fields in the Reset
LVDL
Status Register are set following a POR.
6.2.2System reset sources
Resetting the MCU provides a way to start processing from a known set of initial
conditions. System reset begins with the on-chip regulator in full regulation and system
clocking generation from an internal reference. When the processor exits reset, it
performs the following:
• Reads the start SP (SP_main) from vector-table offset 0
Reads the start program counter (PC) from vector-table offset 4
•
• Link register (LR) is set to 0xFFFF_FFFF.
The on-chip peripheral modules are disabled and the non-analog I/O pins are initially
configured as disabled. The pins with analog functions assigned to them default to their
analog function after reset.
During and following a reset, the SWD pins have their associated input pins configured
as:
• SWD_CLK in pulldown (PD)
• SWD_DIO in pullup (PU)
6.2.2.1External pin reset (
RESET)
This pin is open drain and has an internal pullup device. Asserting RESET wakes the
device from any mode.
The RESET pin can be disabled by programming RESET_PIN_CFG option bit to 0.
When this option is selected, there could be a short period of contention during a POR
ramp where the device drives the pin-out low prior to establishing the setting of this
option and releasing the reset function on the pin.
The RESET pin filter supports filtering from both the 1 kHz LPO clock and the bus
clock. RCM_RPFC[RSTFLTSS], RCM_RPFC[RSTFLTSRW], and
RCM_RPFW[RSTFLTSEL] control this functionality; see the RCM chapter. The filters
are asynchronously reset by Chip POR. The reset value for each filter assumes the
RESET pin is negated.
For all stop modes where LPO clock is still active (Stop, VLPS, LLS, VLLS3, and
VLLS1), the only filtering option is the LPO-based digital filter. The filtering logic either
switches to bypass operation or has continued filtering operation depending on the
filtering mode selected. When entering VLLS0, the RESET pin filter is disabled and
bypassed.
The LPO filter has a fixed filter value of 3. Due to a synchronizer on the input data, there
is also some associated latency (2 cycles). As a result, 5 cycles are required to complete a
transition from low to high or high to low.
6.2.2.2Low-voltage detect (LVD)
The chip includes a system for managing low-voltage conditions to protect memory
contents and control MCU system states during supply voltage variations. The system
consists of a power-on reset (POR) circuit and an LVD circuit with a user-selectable trip
voltage. The LVD system is always enabled in Normal Run, Wait, or Stop mode. The
LVD system is disabled when entering VLPx, LLS, or VLLSx modes.
The LVD can be configured to generate a reset upon detection of a low-voltage condition
by setting PMC_LVDSC1[LVDRE] to 1. The low-voltage detection threshold is
determined by PMC_LVDSC1[LVDV]. After an LVD reset has occurred, the LVD
system holds the MCU in reset until the supply voltage has risen above the low voltage
detection threshold. RCM_SRS0[LVD] is set following either an LVD reset or POR.
The computer operating properly (COP) watchdog timer (WDOG) monitors the operation
of the system by expecting periodic communication from the software. This
communication is generally known as servicing (or refreshing) the COP watchdog. If this
periodic refreshing does not occur, the watchdog issues a system reset. The COP reset
causes RCM_SRS0[WDOG] to set.
The LLWU module provides the means for a number of external pins to wake the MCU
from low leakage power modes. The LLWU module is functional only in low leakage
power modes. In VLLSx modes, all enabled inputs to the LLWU can generate a system
reset.
After a system reset, the LLWU retains the flags indicating the input source of the last
wakeup until the user clears them.
NOTE
Some flags are cleared in the LLWU and some flags are
required to be cleared in the peripheral module. Refer to the
individual peripheral chapters for more information.
6.2.2.5Stop mode acknowledge error (SACKERR)
This reset is generated if the core attempts to enter Stop mode or Compute Operation, but
not all modules acknowledge Stop mode within 1025 cycles of the 1 kHz LPO clock.
A module might not acknowledge the entry to Stop mode if an error condition occurs.
The error can be caused by a failure of an external clock input to a module.
6.2.2.6Software reset (SW)
The SYSRESETREQ field in the NVIC Application Interrupt and Reset Control register
can be set to force a software reset on the device. (See ARM's NVIC documentation for
the full description of the register fields, especially the VECTKEY field requirements.)
Setting SYSRESETREQ generates a software reset request. This reset forces a system
reset of all major components except for the debug module. A software reset causes
RCM_SRS1[SW] to set.
6.2.2.7Lockup reset (LOCKUP)
The LOCKUP gives immediate indication of seriously errant kernel software. This is the
result of the core being locked because of an unrecoverable exception following the
activation of the processor’s built in system state protection hardware.
The LOCKUP condition causes a system reset and also causes RCM_SRS1[LOCKUP] to
set.
Set the System Reset Request field in the MDM-AP control register to initiate a system
reset. This is the primary method for resets via the SWD interface. The system reset is
held until this field is cleared.
Set the Core Hold Reset field in the MDM-AP control register to hold the core in reset as
the rest of the chip comes out of system reset.
6.2.3MCU resets
A variety of resets are generated by the MCU to reset different modules.
6.2.3.1POR Only
The POR Only reset asserts on the POR reset source only. It resets the PMC.
The POR Only reset also causes all other reset types to occur.
6.2.3.2Chip POR not VLLS
The Chip POR not VLLS reset asserts on POR and LVD reset sources. It resets parts of
the SMC and SIM. It also resets the LPTMR.
The Chip POR not VLLS reset also causes these resets to occur: Chip POR, Chip Reset
not VLLS, and Chip Reset (including Early Chip Reset).
6.2.3.3Chip POR
The Chip POR asserts on POR, LVD, and VLLS Wakeup reset sources. It resets the
Reset Pin Filter registers and parts of the SIM and MCG-Lite.
The Chip POR also causes the Chip Reset (including Early Chip Reset) to occur.
The Chip Reset not VLLS reset asserts on all reset sources except a VLLS Wakeup that
does not occur via the RESET pin. It resets parts of the SMC, LLWU, and other modules
that remain powered during VLLS mode.
The Chip Reset not VLLS reset also causes the Chip Reset (including Early Chip Reset)
to occur.
6.2.3.5Early Chip Reset
The Early Chip Reset asserts on all reset sources. It resets only the flash memory module.
It negates before flash memory initialization begins ("earlier" than when the Chip Reset
negates).
6.2.3.6Chip Reset
Chip Reset asserts on all reset sources and only negates after flash initialization has
completed and the RESET pin has also negated. It resets the remaining modules (the
modules not reset by other reset types).
6.2.4RESET pin
For all reset sources except a VLLS Wakeup that does not occur via the RESET pin, the
RESET pin is driven low by the MCU for at least 128 bus clock cycles and until flash
initialization has completed.
After flash initialization has completed, the RESET pin is released, and the internal Chip
Reset negates after the RESET pin is pulled high. Keeping the RESET pin asserted
externally delays the negation of the internal Chip Reset.
The RESET pin can be disabled by programming FTFA_FOPT[RESET_PIN_CFG]
option bit to 0 (See Table 6-2). When this option is selected, there could be a short period
of contention during a POR ramp where the device drives the pinout low prior to
establishing the setting of this option and releasing the reset function on the pin.
6.3Boot
The information found here describes the boot sequence, including sources and options.
Some configuration information such as clock trim values stored in factory programmed
flash locations is autoloaded.
6.3.1Boot sources
The CM0+ core adds support for a programmable Vector Table Offset Register (VTOR)
to relocate the exception vector table. This device supports booting from:
• internal flash
• ROM
This device supports booting from internal flash with the reset vectors located at
addresses 0x0 (initial SP_main), 0x4 (initial PC).
The device is also able to boot from ROM. The ROM start address is from 0x1C00_0000.
When boot from ROM, it remaps all vector fetch to ROM base address. ROM code start
pointer locates in ROM vector table which address is 0x1C00_0000 where stack pointer
is offset 0x0 and reset vector is offset 0x4. Vector table and stack pointer are valid out of
reset. RCM mode register is cleared by software when Boot ROM completes, this
disables remapping of vector fetches. Boot source can change between reset, but is
always known before core reset negation. NMI input is disabled to platform when
booting from ROM. See FOPT section and Reset Control Module for more detail options.
The boot options can be overridden by using RCM_FM[2:1] and RCM_MR[2:1] which
can be written by software. The boot source remains set until the next System Reset or
software can write logic one to clear one or both of the mode bits.
6.3.2FOPT boot options
The Flash Option (FOPT) register in the Flash Memory module (FTFA_FOPT) allows
the user to customize the operation of the MCU at boot time. The register contains readonly bits that are loaded from the NVM's option byte in the flash configuration field. The
default setting for all values in the FTFA_FOPT register is logic 1 since it is copied from
the option byte residing in flash, which has all bits as logic 1 in the flash erased state. To
configure for alternate settings, program the appropriate bits in the NVM option byte.
The new settings will take effect on subsequent POR, VLLSx recoveries, and any system
reset. For more details on programming the option byte, see the flash memory chapter.
The MCU uses FTFA_FOPT to configure the device at reset as shown in the following
table. An FTFA_FOPT value of 0x00 is invalid and will be ignored. The FOPT register is
written to 0xFF if the contents of the Flash nonvolatile option are 0x00.
7-6BOOTSRC_SELBoot Source Selection: these bits select the boot sources if boot pin option bit
5FAST_INITSelects initialization speed on POR, VLLSx, and any system reset.
3RESET_PIN_CFGEnables/disables control for the RESET pin.
2NMI_DISEnables/disables control for the NMI function.
1BOOTPIN_OPTExternal pin selects boot options
4,0LPBOOTControls the reset value of OUTDIV1 value in SIM_CLKDIV1 register, and the state of the
FieldValueDefinition
BOOTPIN_OPT = 1
00Boot from Flash
01Reserved
10Boot from ROM
11Boot from ROM
0Slower initialization: The flash initialization will be slower with the benefit of
reduced average current during this time. The duration of the recovery will be
controlled by the clock divider selection determined by the LPBOOT setting.
1Fast Initialization: The flash has faster recoveries at the expense of higher current
during these times.
0RESET pin is disabled following a POR and cannot be enabled as reset function.
When this option is selected, there could be a short period of contention during a
POR ramp where the device drives the pinout low prior to establishing the setting
of this option and releasing the reset function on the pin.
This bit is preserved through system resets and low-power modes. When RESET
pin function is disabled, it cannot be used as a source for low-power mode wakeup.
NOTE:
1RESET_b pin is dedicated. The port is configured as open drain and pullup
enabled.
0NMI interrupts are always blocked. The associated pin continues to default to NMI
pin controls with internal pullup enabled. When NMI pin function is disabled, it
cannot be used as a source for low-power mode wake-up.
1NMI_b pin/interrupts reset default to enabled.
0Force Boot from ROM if BOOTCFG0 asserted, where BOOTCFG0 is the boot
config function which is muxed with NMI pin. RESET pin must be enabled when
this option is selected.
1Boot source configured by FOPT[7:6] ( BOOTSRC_SEL) bits
RUNM register in SMC_PMCTRL. Larger divide value selections produce lower average
power consumption during POR, VLLSx recoveries and reset sequencing and after reset
exit. The recovery times are also extended if the FAST_INIT option is not selected.
When the reset pin has been disabled and security has been enabled by
means of the FSEC register, a mass erase can be performed only by
setting both the Mass Erase and System Reset Request fields in the
MDM-AP register.
1. Refer to Clock divider values after reset and RCM_FM, RCM_MR in the Reset Control Module (RCM) for details.
FieldValueDefinition
00Core and system clock divider (OUTDIV1) is 0x7 (divide by 8). Device is configured
for VLPR mode on exit from reset.
01Core and system clock divider (OUTDIV1) is 0x3 (divide by 4). Device is configured
for VLPR mode on exit from reset.
10Core and system clock divider (OUTDIV1) is 0x1 (divide by 2). Device is configured
for RUN mode on exit from reset.
11Core and system clock divider (OUTDIV1) is 0x0 (divide by 1). Device is configured
for RUN mode on exit from reset.
6.3.3Boot sequence
At power up, the on-chip regulator holds the system in a POR state until the input supply
exceeds the POR threshold. The system continues to be held in this static state until the
internally regulated supplies have reached a safe operating voltage as determined by the
LVD. The Reset Controller logic then controls a sequence to exit reset.
1. A system reset is held on internal logic, the RESET pin is driven out low, and the
MCG-Lite is enabled in its default clocking mode.
2. Required clocks are enabled (system clock, flash clock, and any bus clocks that do
not have clock gate control reset to disabled).
The system reset on internal logic continues to be held, but the Flash Controller is
3.
released from reset and begins initialization operation while the Reset Control logic
continues to drive the
RESET pin out low.
4. Early in reset sequencing, the NVM option byte is read and stored to the FOPT
register of the Flash Memory module (FTFA_FOPT). If the bits associated with
FTFA_FOPT[LPBOOT] are programmed for an alternate clock divider reset value,
the system/core clock is switched to a slower clock speed. If
FTFA_FOPT[FAST_INIT] is programmed clear, the flash initialization switches to
slower clock resulting longer recovery times.
When flash Initialization completes, the
5.
RESET pin is released. If RESET continues
to be asserted (an indication of a slow rise time on the RESET pin or external drive
in low), the system continues to be held in reset. Once the RESET pin is detected
high, the core clock is enabled and the system is released from reset.
6. When the system exits reset, the processor sets up the stack, program counter (PC),
and link register (LR). The processor reads the start SP (SP_main) from vector-table
offset 0. The core reads the start PC from vector-table offset 4. LR is set to
0xFFFF_FFFF. The next sequence of events depends on the NMI/BOOTCFG0 input
and FTFA_FOPT[NMI_DIS] and FTFA_FOPT[BOOTSRC_SEL] and
FTFA_FOPT[BOOTPIN_OPT] as well as RCM_FM[FORCEROM] and
RCM_MR[BOOTROM](See Table 6-2 and RCM block guide) :
• If the NMI/BOOTCFG0 input is high or the NMI function is disabled in
FTFA_FOPT, the CPU begins execution at the PC location.
• If the NMI/BOOTCFG0 input is low, the NMI function is enabled in
FTFA_FOPT, and FTFA_FOPT[BOOTPIN_OPT] = 1, this results in an NMI
interrupt. The processor executes an Exception Entry and reads the NMI
interrupt handler address from vector-table offset 8. The CPU begins execution
at the NMI interrupt handler.
• When FTFA_FOPT[BOOTPIN_OPT] = 0, it forces boot from ROM if NMI/
BOOTCFG0 pin set to 0.
NOTE
If the NMI function is not required, either for an interrupt or
wake up source, it is recommended that the NMI function be
disabled by clearing NMI_DIS in the FOPT register.
Subsequent system resets follow this same reset flow.
Information about the various chip power modes and functionality of the individual
modules in these modes can be found here.
See AN4503: Power Management for Kinetis and ColdFire+ MCUs for further details on
power management techniques.
7.2Clocking modes
Information found here describes the various clocking modes supported on this device.
7.2.1Partial Stop
Partial Stop is a clocking option that can be taken instead of entering Stop mode and is
configured in the SMC Stop Control Register (SMC_STOPCTRL). The Stop mode is
only partially entered, which leaves some additional functionality alive at the expense of
higher power consumption. Partial Stop can be entered from either Run mode or VLP
Run mode.
When configured for PSTOP2, only the core and system clocks are gated and the bus
clock remains active. The bus masters and bus slaves clocked by the system clock enter
Stop mode, but the bus slaves clocked by bus clock remain in Run (or VLP Run) mode.
The clock generators in the MCG and the on-chip regulator in the PMC also remain in
Run (or VLP Run) mode. Exit from PSTOP2 can be initiated by a reset, an asynchronous
interrupt from a bus master or bus slave clocked by the system clock, or a synchronous
interrupt from a bus slave clocked by the bus clock. If configured, a DMA request (using
the asynchronous DMA wakeup) can also be used to exit Partial Stop for the duration of a
DMA transfer before the device is transitioned back into PSTOP2.
When configured for PSTOP1, both the system clock and bus clock are gated. All bus
masters and bus slaves enter Stop mode, but the clock generators in the MCG and the onchip regulator in the PMC remain in Run (or VLP Run) mode. Exit from PSTOP1 can be
initiated by a reset or an asynchronous interrupt from a bus master or bus slave. If
configured, an asynchronous DMA request can also be used to exit Partial Stop for the
duration of a DMA transfer before the device is transitioned back into PSTOP1.
PSTOP1 is functionally similar to Stop mode, but offers faster wake-up at the expense of
higher power consumption. Another benefit is that it keeps all of the MCG clocks
enabled, which can be useful for some of the asynchronous peripherals that can remain
functional in Stop modes.
7.2.2DMA Wakeup
The DMA can be configured to wake the device on a DMA request whenever it is placed
in Stop mode. The wake-up is configured per DMA channel and is supported in Compute
Operation, PSTOP, STOP, and VLPS low power modes.
When a DMA wake-up is detected in PSTOP, STOP or VLPS then the device will initiate
a normal exit from the low power mode. This can include restoring the on-chip regulator
and internal power switches, enabling the clock generators in the MCG, enabling the
system and bus clocks (but not the core clock) and negating the stop mode signal to the
bus masters and bus slaves. The only difference is that the CPU will remain in the low
power mode with the CPU clock disabled.
During Compute Operation, a DMA wake-up will initiate a normal exit from Compute
Operation. This includes enabling the clocks and negating the stop mode signal to the bus
masters and bus slaves. The core clock always remains enabled during Compute
Operation.
Since the DMA wakeup will enable the clocks and negate the stop mode signals to all bus
masters and slaves, software needs to ensure that bus masters and slaves that are not
involved with the DMA wake-up and transfer remain in a known state. That can be
accomplished by disabling the modules before entry into the low power mode or by
setting the Doze enable bit in selected modules.
Once the DMA request that initiated the wake-up negates and the DMA completes the
current transfer, the device will transition back to the original low-power mode. This
includes requesting all non-CPU bus masters to enter Stop mode and then requesting bus
slaves to enter Stop mode. In STOP and VLPS modes the MCG and PMC would then
also enter their appropriate modes.
If the requested DMA transfer cannot cause the DMA request
to negate then the device will remain in a higher power state
until the low power mode is fully exited.
An enabled DMA wake-up can cause an aborted entry into the low power mode, if the
DMA request asserts during the stop mode entry sequence (or reentry if the request
asserts during a DMA wakeup) and can cause the SMC to assert its Stop Abort flag. Once
the DMA wake-up completes, entry into the low power mode will restart.
An interrupt that occurs during a DMA wake-up will cause an immediate exit from the
low power mode (this is optional for Compute Operation) without impacting the DMA
transfer.
A DMA wake-up can be generated by either a synchronous DMA request or an
asynchronous DMA request. Not all peripherals can generate an asynchronous DMA
request in stop modes, although in general if a peripheral can generate synchronous DMA
requests and also supports asynchronous interrupts in stop modes, then it can generate an
asynchronous DMA request.
7.2.3Compute Operation
Compute Operation is an execution or compute-only mode of operation that keeps the
CPU enabled with full access to the SRAM and Flash read port, but places all other bus
masters and bus slaves into their stop mode. Compute Operation can be enabled in either
Run mode or VLP Run mode.
NOTE
Do not enter any Stop mode without first exiting Compute
Operation.
Because Compute Operation reuses the Stop mode logic (including the staged entry with
bus masters disabled before bus slaves), any bus master or bus slave that can remain
functional in Stop mode also remains functional in Compute Operation, including
generation of asynchronous interrupts and DMA requests. When enabling Compute
Operation in Run mode, module functionality for bus masters and slaves is the equivalent
of STOP mode. When enabling Compute Operation in VLP Run mode, module
functionality for bus masters and slaves is the equivalent of VLPS mode. The MCG,
PMC, SRAM, and Flash read port are not affected by Compute Operation, although the
Flash register interface is disabled.
During Compute Operation, the AIPS peripheral space is disabled and attempted accesses
generate bus errors. The private peripheral space remains accessible during Compute
Operation, including the MCM, NVIC, IOPORT, and SysTick. Although access to the
GPIO registers via the IOPORT is supported, the GPIO Port Data Input registers do not
return valid data since clocks are disabled to the Port Control and Interrupt modules. By
writing to the GPIO Port Data Output registers, it is possible to control those GPIO ports
that are configured as output pins.
Compute Operation is controlled by the CPO register in the MCM (MCM_CPO), which
is only accessible to the CPU. Setting or clearing MCM_CPO[CPOREQ] initiates entry
or exit into Compute Operation. Compute Operation can also be configured to exit
automatically on detection of an interrupt, which is required in order to service most
interrupts. Only the core system interrupts (exceptions, including NMI and SysTick) and
any edge-sensitive interrupts can be serviced without exiting Compute Operation.
• When entering Compute Operation, the CPOACK status field in the CPO register of
MCM module (MCM_CPO[CPOACK]) indicates when entry has completed.
• When exiting Compute Operation in Run mode, MCM_CPO[CPOACK] negates
immediately.
• When exiting Compute Operation in VLP Run mode, the exit is delayed to allow the
PMC to handle the change in power consumption. This delay means that
MCM_CPO[CPOACK] is polled to determine when the AIPS peripheral space can
be accessed without generating a bus error.
The DMA wake-up is also supported during Compute Operation and causes
MCM_CPO[CPOACK] to clear and the AIPS peripheral space to be accessible for the
duration of the DMA wakeup. At the completion of the DMA wake-up, the device
transitions back into Compute Operation.
7.2.4Peripheral Doze
Several peripherals support a Peripheral Doze mode, where a register bit can be used to
disable the peripheral for the duration of a low-power mode. The flash memory can also
be placed in a low-power state during Peripheral Doze via a register bit in the SIM.
Peripheral Doze is defined to include all of the modes of operation listed below.
• The CPU is in Wait mode.
The CPU is in Stop mode, including the entry sequence and for the duration of a
•
DMA wakeup.
• The CPU is in Compute Operation, including the entry sequence and for the duration
of a DMA wakeup.
Peripheral Doze can therefore be used to disable selected bus masters or slaves for the
duration of WAIT or VLPW mode. It can also be used to disable selected bus slaves
immediately on entry into any stop mode (or Compute Operation), instead of waiting for
the bus masters to acknowledge the entry as part of the stop entry sequence. Finally, it
can be used to disable selected bus masters or slaves that should remain inactive during a
DMA wakeup.
If the flash memory is not being accessed during WAIT and PSTOP modes, then the
Flash Doze mode can be used to reduce power consumption, at the expense of a slightly
longer wake-up when executing code and vectors from flash. It can also be used to reduce
power consumption during Compute Operation when executing code and vectors from
SRAM.
7.2.5Clock gating
To conserve power, the clocks to most modules can be turned off using the SCGCx
registers in the SIM module. The bits of these registers are cleared after any reset, which
disables the clock to the corresponding module. Prior to initializing a module, set the
corresponding bit in the SCGCx register to enable the clock. Before turning off the clock,
make sure to disable the module. For more details, see the Clock Distribution and SIM
chapters.
7.3Power modes
The Power Management Controller (PMC) provides multiple power options to allow the
user to optimize power consumption for the level of functionality needed.
Depending on the stop requirements of the user application, a variety of stop modes are
available that provide state retention, partial power-down or full power-down of certain
logic and/or memory. I/O states are held in all modes of operation. The following table
compares the various power modes available.
For each run mode, there is a corresponding Wait and Stop mode. Wait modes are similar
to ARM Sleep modes. Stop modes (VLPS, STOP) are similar to ARM Sleep Deep mode.
The Very Low Power Run (VLPR) operating mode can drastically reduce runtime power
when the maximum bus frequency is not required to handle the application needs.
The three primary modes of operation are Run, Wait, and Stop. The WFI instruction
invokes both Wait and Stop modes for the chip. The primary modes are augmented in a
number of ways to provide lower power based on application needs.
Table 7-1. Chip power modes
Chip modeDescriptionCore modeNormal
recovery
method
Normal RunAllows maximum performance of chip.
• Default mode out of reset
• On-chip voltage regulator is on.
Normal Wait -
via WFI
Normal Stop -
via WFI
VLPR (Very
Low-Power Run)
VLPW (Very
Low-Power
Wait) -via WFI
VLPS (Very
Low-Power
Stop)-via WFI
LLS (Low-
Leakage Stop)
Allows peripherals to function while the core is in Sleep mode,
reducing power.
• NVIC remains sensitive to interrupts
• Peripherals continue to be clocked.
Places chip in static state. Lowest power mode that retains all registers
while maintaining LVD protection.
• NVIC is disabled.
• AWIC is used to wake up from interrupt.
• Peripheral clocks are stopped.
On-chip voltage regulator is in a low-power mode that supplies only
enough power to run the chip at a reduced frequency. Only MCG-Lite
modes LIRC and EXT can be used in VLPR.
• Reduced frequency Flash access mode (1 MHz)
• LVD off
• In LIRC clock mode, only the internal reference oscillator
(LIRC8M) is available to provide a low power nominal 4 MHz
source for the core with the nominal bus and flash clock required
to be <1 MHz
• Alternatively, EXT clock mode can be used with an external
clock or the crystal oscillator providing the clock source.
Same as VLPR but with the core in Sleep mode to further reduce
power.
• NVIC remains sensitive to interrupts (CPU clk = ON).
• On-chip voltage regulator is in a low-power mode that supplies
only enough power to run the chip at a reduced frequency.
Places chip in static state with LVD operation off. Lowest power mode
with ADC and pin interrupts functional.
• Peripheral clocks are stopped, but OSC, LPTMR, RTC, CMP can
be used.
• UART, LPUART and TPM can optionally be enabled if their clock
source is enabled.
• NVIC is disabled (CPU clk = OFF); AWIC is used to wake up
from interrupt.
• On-chip voltage regulator is in a low-power mode that supplies
only enough power to run the chip at a reduced frequency.
• All SRAM is operating (content retained and I/O states held).
State retention power mode
• Most peripherals are in state retention mode (with clocks
stopped), but OSC, LLWU,LPTMR, RTC, CMP can be used.
• All SRAM is operating (content retained and I/O states held).
• Most peripherals are disabled (with clocks stopped), but OSC,
LLWU, LPTMR, RTC, CMP can be used.
• NVIC is disabled; LLWU is used to wake up.
• SRAM_U and SRAM_L remain powered on (content retained
and I/O states held).
• Most peripherals are disabled (with clocks stopped), but OSC,
LLWU, LPTMR, RTC, CMP can be used.
• NVIC is disabled; LLWU is used to wake up.
• All of SRAM_U and SRAM_L are powered off.
• The 32-byte system register file remains powered for customercritical data
• Most peripherals are disabled (with clocks stopped), but LLWU,
LPTMR, RTC can be used.
• NVIC is disabled; LLWU is used to wake up.
• All of SRAM_U and SRAM_L are powered off.
• The 32-byte system register file remains powered for customercritical data
• LPO disabled, optional POR brown-out detection
The LLWU interrupt must not be masked by
the interrupt controller to avoid a scenario
where the system does not fully exit stop
mode on an LLS recovery
Sleep DeepWake-up Reset
Sleep DeepWake-up Reset
Sleep DeepWake-up Reset
2
2
2
1. Resumes Normal Run mode operation by executing the LLWU interrupt service routine.
2. Follows the reset flow with the LLWU interrupt flag set for the NVIC.
7.4Entering and exiting power modes
The WFI instruction invokes wait and stop modes for the chip. The processor exits the
low-power mode via an interrupt.
For LLS and VLLS modes, the wake-up sources are limited to LLWU generated wakeups,NMI_b pin, or RESET_b pin assertions. When the NMI_b pin or RESET_b pin have
been disabled through associated FTFA_FOPT settings, then these pins are ignored as
wakeup sources. The wake-up flow from VLLSx is always through reset.
NOTE
The WFE instruction can have the side effect of entering a lowpower mode, but that is not its intended usage. See ARM
documentation for more on the WFE instruction.
On VLLS recoveries, the I/O pins continue to be held in a static state after code execution
begins, allowing software to reconfigure the system before unlocking the I/O. RAM is
retained in VLLS3 only.
The table found here illustrates the functionality of each module while the chip is in each
of the low power modes.
The standard behavior is shown with some exceptions for Compute Operation (CPO) and
Partial Stop2 (PSTOP2).
Debug modules are discussed separately; see Debug in low-power modes. Number
ratings (such as 4 MHz and 1 Mbit/s) represent the maximum frequencies or maximum
data rates per mode. Following is list of terms also used in the table.
• FF = Full functionality. In VLPR and VLPW, the system frequency is limited, but if
a module does not have a limitation in its functionality, it is still listed as FF.
• Async operation = Fully functional with alternate clock source, provided the selected
clock source remains enabled
• static = Module register states and associated memories are retained.
• powered = Memory is powered to retain contents.
• low power = Memory is powered to retain contents in a lower power state
• OFF = Modules are powered off; module is in reset state upon wake-up. For clocks,
OFF means disabled.
• wakeup = Modules can serve as a wake-up source for the chip.
Table 7-2. Module operation in low power modes
ModulesVLPRVLPWStopVLPSLLSVLLSx
Core modules
NVICFFFFstaticstaticstaticOFF
System modules
Mode ControllerFFFFFFFFFFFF
1
LLWU
Regulatorlow powerlow powerONlow powerlow powerlow power in
Table 7-2. Module operation in low power modes (continued)
ModulesVLPRVLPWStopVLPSLLSVLLSx
ADC internal
clock only in
CPO
6
CMP
6-bit DACFF
12-bit DACFF
Internal Voltage
Reference
(VREF)
GPIOFF
FF
HS or LS
compare in CPO
static in CPO
static in CPO
FF
static in CPO
IOPORT write
only in CPO
FFHS or LS
compare
FF in PSTOP2
FFstatic
FF in PSTOP2
FFstatic
FF in PSTOP2
FFstatic
FF in PSTOP2
Human-machine interfaces
FFstatic output,
wakeup input
FF in PSTOP2
HS or LS
compare
staticstaticstatic, OFF in
staticstaticstatic, OFF in
staticstaticstatic, OFF in
static output,
wakeup input
LS compareLS compare in
VLLS1/3, OFF in
static, pins
latched
VLLS0
VLLS0
VLLS0
VLLS0
OFF, pins
latched
1. Using the LLWU module, the external pins available for this chip do not require the associated peripheral function to be
enabled. It only requires the function controlling the pin (GPIO or peripheral) to be configured as an input to allow a
transition to occur to the LLWU.
2. Since LPO clock source is disabled, filters will be bypassed during VLLS0.
3. STOPCTRL[PORPO] in the SMC module controls this option.
4. LPO clock source is not available in VLLS0. Also, to use system OSC in VLLS0 it must be configured for bypass (external
clock) operation. Pulse counting is available in all modes.
5. In VLLS0 the only clocking option is from RTC_CLKIN.
6. CMP in stop or VLPS supports high speed or low speed external pin to pin or external pin to DAC compares. CMP in LLS
or VLLSx only supports low speed external pin to pin or external pin to DAC compares.