Page 6
PORT digital filter clocking.........................162 5.7.6 LPTMR clocking............................162 5.7.7 RTC_CLKOUT and CLKOUT32K clocking....................163 5.7.8 USB FS OTG Controller clocking....................... 164 5.7.9 UART clocking............................165 5.7.10 LPUART0 clocking............................. 165 5.7.11 I2S/SAI clocking............................166 K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 7
7.2.5 Clock Gating..............................185 Power Modes Description.............................185 Entering and exiting power modes..........................187 Power mode transitions..............................188 Power modes shutdown sequencing..........................189 Flash Program Restrictions............................190 Module Operation in Low Power Modes........................190 K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 8
Debug Resets................................208 AHB-AP..................................209 ITM....................................209 Core Trace Connectivity............................... 210 9.10 TPIU....................................210 9.11 DWT..................................... 210 9.12 Debug in Low Power Modes............................211 9.12.1 Debug Module State in Low Power Modes....................211 K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 9
Port Control and Interrupts (PORT) 11.1 Introduction...................................239 11.2 Overview..................................239 11.2.1 Features................................ 239 11.2.2 Modes of operation............................240 11.3 External signal description............................241 11.4 Detailed signal description............................241 11.5 Memory map and register definition..........................241 K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 10
System Clock Gating Control Register 4 (SIM_SCGC4)................277 12.2.10 System Clock Gating Control Register 5 (SIM_SCGC5)................279 12.2.11 System Clock Gating Control Register 6 (SIM_SCGC6)................281 12.2.12 System Clock Gating Control Register 7 (SIM_SCGC7)................284 K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 19
Memory Map/Register Definition..........................543 25.3.1 MCG Control 1 Register (MCG_C1)......................544 25.3.2 MCG Control 2 Register (MCG_C2)......................545 25.3.3 MCG Control 3 Register (MCG_C3)......................546 25.3.4 MCG Control 4 Register (MCG_C4)......................547 25.3.5 MCG Control 5 Register (MCG_C5)......................548 K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 20
MCG mode switching..........................567 Chapter 26 Oscillator (OSC) 26.1 Introduction...................................577 26.2 Features and Modes..............................577 26.3 Block Diagram................................578 26.4 OSC Signal Descriptions.............................. 578 26.5 External Crystal / Resonator Connections........................579 K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Hexadecimal number. For example, the hexadecimal equivalent of the number 60 is written 3Ch. In some cases, hexadecimal numbers are shown with the prefix 0x. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Write 1 to clear: Refers to a register bitfield that must be written as 1 to be "cleared." K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• External memory or peripheral bus interface: FlexBus • Serial programming interface: EzPort Clocks • Multiple clock generation options available from internally- and externally- generated clocks Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
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. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
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 with a programmable refresh window to detect deviations in program flow or system frequency. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The RTC oscillator has an independent power supply and supports a 32 kHz crystal oscillator to feed the RTC clock. Optionally, the RTC oscillator can replace the system oscillator as the main oscillator source. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Positive transition of trigger event signal initiates the counter • Supports two triggered delay output signals, each with an independently- controlled delay from the trigger event Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• 32-bit seconds counter with 32-bit Alarm • 16-bit Prescaler with compensation that can correct errors between 0.12 ppm and 3906 ppm 2.2.8 Communication interfaces The following communication interfaces are available on this device: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
3.2.1 ARM Cortex-M4 Core Configuration This section summarizes how the module has been configured in the chip. Full documentation for this module is provided by ARM and can be found at arm.com. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 58
Data code (DCODE) bus System bus The system bus is connected to a separate master port on the crossbar. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
3.2.2 Nested Vectored Interrupt Controller (NVIC) Configuration This section summarizes how the module has been configured in the chip. Full documentation for this module is provided by ARM and can be found at arm.com. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 60
The pin the NMI signal is multiplexed on, must be configured for the NMI function to generate the non-maskable interrupt request. 3.2.2.3 Interrupt channel assignments The interrupt source assignments are defined in the following table. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 61
DMA channel 7 transfer complete 0x0000_0060 DMA channel 8 transfer complete 0x0000_0064 DMA channel 9 transfer complete 0x0000_0068 DMA channel 10 transfer complete 0x0000_006C DMA channel 11 transfer complete Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 62
0x0000_00CC UART2 Single interrupt vector for UART status sources 0x0000_00D0 UART2 Single interrupt vector for UART error sources 0x0000_00D4 — — 0x0000_00D8 — — Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 64
NVICIPR14 bitfield range is 20-23 Therefore, the following bitfield locations are used to configure the LPTMR interrupts: • NVICISER1[26] • NVICICER1[26] • NVICISPR1[26] • NVICICPR1[26] • NVICIABR1[26] • NVICIPR14[23:20] K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Pin interrupts Port Control Module - Any enabled pin interrupt is capable of waking the system ADCx The ADC is functional when using internal clock source Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Full description ARM Cortex-M4 Technical Reference Manual System memory map System memory map Clocking Clock Distribution Power Management Power Management Transfers ARM Cortex M4 core ARM Cortex-M4 core Private Peripheral Bus (PPB) K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
(SIM) Figure 3-6. SIM configuration Table 3-10. Reference links to related information Topic Related module Reference Full description System memory map System memory map Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Reference Full description System Mode Controller (SMC) System memory map System memory map Power management Power management Power management controller (PMC) Low-Leakage Wakeup LLWU Unit (LLWU) Reset Control Module Reset (RCM) K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Full description LLWU System memory map System memory map Clocking Clock distribution Power management Power management chapter Power Management Power Management Controller (PMC) Controller (PMC) Mode Controller Wake-up requests LLWU wake-up sources K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 70
2. Requires the peripheral and the peripheral interrupt to be enabled. The LLWU's WUME bit enables the internal module flag as a wakeup input. After wakeup, the flags are cleared based on the peripheral clearing mechanism. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Private Peripheral Bus (PPB) 3.3.6 Crossbar-Light Switch Configuration This section summarizes how the module has been configured in the chip. For a comprehensive description of the module itself, see the module’s dedicated chapter. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
3.3.7 Peripheral Bridge Configuration This section summarizes how the module has been configured in the chip. For a comprehensive description of the module itself, see the module’s dedicated chapter. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
3.3.8 DMA request multiplexer configuration This section summarizes how the module has been configured in the chip. For a comprehensive description of the module itself, see the module’s dedicated chapter. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 75
Source module Source description Async DMA number capable — Channel disabled Reserved Not used UART0 Receive UART0 Transmit UART1 Receive UART1 Transmit UART2 Receive UART2 Transmit Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
PIT/DMA Periodic Trigger Assignments 3.3.9 DMA Controller Configuration This section summarizes how the module has been configured in the chip. For a comprehensive description of the module itself, see the module’s dedicated chapter. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
3.3.10 External Watchdog Monitor (EWM) Configuration This section summarizes how the module has been configured in the chip. For a comprehensive description of the module itself, see the module’s dedicated chapter. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
3.4 Clock modules 3.4.1 MCG Configuration This section summarizes how the module has been configured in the chip. For a comprehensive description of the module itself, see the module’s dedicated chapter. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 82
RTC 32kHz oscillator output. RTC clock is derived from external crystal circuit associated with RTC. OSCCLK1 - Oscillator IRC48MCLK. Derived from internal 48 MHz oscillator. Reserved — Clock Distribution for more details on these clocks. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
MCG chapters for more details. 3.4.3 RTC OSC configuration This section summarizes how the module has been configured in the chip. For a comprehensive description of the module itself, see the module’s dedicated chapter. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Table 3-31. Reference links to related information Topic Related module Reference Full description Flash memory System memory map System memory map Clocking Clock Distribution Transfers Flash memory Flash memory controller controller Register access Peripheral bridge Peripheral bridge K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 85
The on-chip Flash 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 Sizes for details of supported ranges. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 86
See the EzPort chapter for more details. 3.5.1.8 FTF_FOPT Register The flash memory's FTF_FOPT register allows the user to customize the operation of the MCU at boot time. See FOPT boot options for details of its definition. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
See Crossbar-Light Switch Configuration for details on the master port assignments. 3.5.3 SRAM Configuration This section summarizes how the module has been configured in the chip. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 88
The amount of SRAM for the devices covered in this document is shown in the following table. Device SRAM_L size SRAM_U size Total SRAM (KB) Address Range (KB) (KB) MK22FN512VDC12 0x1FFF_0000-0x2000_FFFF MK22FN512VLL12 0x1FFF_0000-0x2000_FFFF MK22FN512VLH12 0x1FFF_0000-0x2000_FFFF Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Figure 3-23. System Register file configuration Table 3-34. Reference links to related information Topic Related module Reference Full description Register file Register file System memory map System memory map Clocking Clock distribution Power management Power management K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This device includes a 32-byte register file that is powered in all power modes and is powered by VBAT. The VBAT Register file is made up of eight 4-byte registers RFVBAT_REGn, where n ranges from 0 to 7. It is only reset during VBAT power-on reset. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The FOPT register is loaded from the flash option byte. If the flash option byte is modified the new value takes effect for any subsequent resets, until the value is changed again. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The multiplexing of the FlexBus address and data signals is controlled by the port control module. However, the multiplexing of some of the FlexBus control signals are controlled by the port control and FlexBus modules. The port control module registers control K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 93
FlexBus or another module signals are available on the external pin, while the FlexBus's CSPMCR register configures which FlexBus signals are available from the modules. The control signals are grouped as illustrated: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
FlexBus chapter. 3.6 Security 3.6.1 CRC Configuration This section summarizes how the module has been configured in the chip. For a comprehensive description of the module itself, see the module’s dedicated chapter. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
(RNG) Figure 3-29. RNG configuration Table 3-39. Reference links to related information Topic Related module Reference Full description System memory map System memory map Clocking Clock distribution Power management Power management K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The number of ADC channels present on the device is determined by the pinout of the specific device package. For details regarding the number of ADC channel available on a particular package, refer to the signal multiplexing chapter of this MCU. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 100
The following figure shows the assignment of ADCx_SEn channels a and b through a MUX selection to ADC. To select between alternate set of channels, refer to ADCx_CFG2[MUXSEL] bit settings for more details. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 101
There are other pins on this device that have a similar interleave configuration, including the plus side of differential pair pins available (for example ADC0_DP0 and ADC1_DP3). Refer to the Signal Multiplexing and Pin Assignments table for this device. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 103
1. For ADC operation in Compute only, PSTOP1, Stop and VLPS, ADACK and the alternate clock sources are allowed clock sources. Note however that ALTCLK2 is force disabled and therefore not available in VLPS. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
System memory map Clocking Clock distribution Power management Power management Signal multiplexing Port control Signal multiplexing 3.7.2.1 CMP input connections The following table shows the fixed internal connections to the CMP. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 105
LPTMR configuration. In Time Counter mode with prescaler enabled, the delay is 1/2 Prescaler output period. In Time Counter mode with prescaler bypassed, the delay is 1/2 Prescaler clock period. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The DAC includes a FIFO for DMA support. 3.7.3.2 12-bit DAC Output The output of the DAC can be placed on an external pin or set as one of the inputs to the analog comparator or ADC. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Clocking Clock distribution Power management Power management Signal multiplexing Port control Signal multiplexing 3.7.4.1 VREF Overview This device includes a voltage reference (VREF) to supply an accurate 1.2 V voltage output. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Table 3-50. Reference links to related information Topic Related module Reference Full description System memory map System memory map Clocking Clock distribution Power management Power management Signal multiplexing Port control Signal multiplexing K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 110
The application code can set the PDBx_CHnC1[BB] bits to configure the PDB pre- triggers as a single chain or several chains. 3.8.1.4 PDB Interval Trigger Connections to DAC In this MCU, PDB interval trigger connections to DAC are implemented as follows. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
31:2 - Reserved 3.8.2 FlexTimer Configuration This section summarizes how the module has been configured in the chip. For a comprehensive description of the module itself, see the module’s dedicated chapter. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 112
FTM1 Quadrature decoder or general purpose FTM2 Quadrature decoder or general purpose FTM3 3-phase motor + 2 general purpose or stepper motor 1. Only channels 0 and 1 are available. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 113
• FTM2 FAULT1 = CMP1 output • FTM3 FAULT0 = FTM3_FLT0 pin or CMP0 output 3.8.2.6 FTM Hardware Triggers The FTM synchronization hardware triggers are connected in the chip as follows: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 114
When the USB start of frame pulse option is selected as an FTM channel input capture, disable the USB SOF token interrupt in the USB Interrupt Enable register (INTEN[SOFTOKEN]) to avoid USB enumeration conflicts. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 115
FTM1_CH1. The diagram below shows the implementation for FTM0. FTM3 has similar implementation controlled by SIM_SOPT8[FTM3CHySRC] on each of its 8 channels with modulation possible via FTM2_CH1. See SIM Block Guide for further information. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 116
This chip provides the optional FTM global time base feature (see Global time base (GTB)). FTM0 provides the only source for the FTM global time base. The other FTM modules can share the time base as shown in the following figure: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
“debug halt mode". 3.8.3 PIT Configuration This section summarizes how the module has been configured in the chip. For a comprehensive description of the module itself, see the module’s dedicated chapter. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
SIM_SOPT7[ADCxTRGSEL] fields. For more details, refer to SIM chapter. 3.8.4 Low-power timer configuration This section summarizes how the module has been configured in the chip. For a comprehensive description of the module itself, see the module’s dedicated chapter. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 119
LPO — 1 kHz clock (not available in VLLS0 mode) ERCLK32K — secondary external reference clock OSCERCLK_UNDIV — Undivided external reference clock (not available in VLLS0 mode) Clock Distribution for more details on these clocks. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Figure 3-44. RTC configuration Table 3-59. Reference links to related information Topic Related module Reference Full description System memory map System memory map Clocking Clock Distribution Power management Power management K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Status detection and wakeup functions for USB data pins, VBUS pin, and OTG ID pin. • IRC48 with clock recovery block to eliminate the 48MHz crystal. This is available for USB device mode only. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 122
• In LLS/VLLS, if the GPIO pins chosen to detect VBUS and OTG ID are selected from those pins which are inputs to the LLWU, transitions on them can generate a wakeup. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 123
VDD. The USB regulator must be enabled by default to power the MCU. When connected to a USB host, the input source of this regulator is switched to the USB bus supply from the Li-ion battery. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 124
VDD. The USB regulator must be enabled by default to power the MCU, then to power USB transceiver or external sensor. To PMC and Pads VOUT33 Cstab Chip TYPE A VREGIN VBUS Regulator USB0_DP XCVR USB0_DM Controller Figure 3-49. USB regulator bus supply K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 125
3.9.1.5 USB Voltage Regulator Configuration This section summarizes how the module has been configured in the chip. For a comprehensive description of the module itself, see the module’s dedicated chapter. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Peripheral bridge Register access Module signals Signal multiplexing Figure 3-52. SPI configuration Table 3-62. Reference links to related information Topic Related module Reference Full description Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 127
CTAR0 is used, and a subset of its bitfields sets the slave transfer attributes. 3.9.2.4 TX FIFO size Table 3-63. SPI transmit FIFO size SPI Module Transmit FIFO size SPI0 SPI1 K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 128
Here are the steps to use a GPIO to create a wakeup upon reception of SPI data in slave mode: 1. Point the GPIO interrupt vector to the desired interrupt handler. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 129
8-bit/16-bit write to the transmit word into a 32-bit write that pushes both the command word and transmit word into the TX FIFO (PUSH TX FIFO Register In Master Mode) K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Signal Multiplexing 3.9.3.1 I2C Instantiation Information This device has two I C modules. The I2C module includes SMBus support and DMA support. It also has optional address match wakeup in Stop/VLPS mode. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
1. Standard features of all UARTs: • RS-485 support • Hardware flow control (RTS/CTS) • 9-bit UART to support address mark with parity • MSB/LSB configuration on data K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 132
The error interrupt combines the following interrupt sources: Source UART 0 UART 1 UART 2 Receiver overrun Noise flag Framing error Parity error Transmitter buffer overflow Receiver buffer overflow Receiver buffer underflow Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Table 3-69. Reference links to related information Topic Related module Reference Full description LPUART0 LPUART System memory map System memory map Clocking Clock distribution Power management Power management Signal multiplexing Port control Signal multiplexing K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Port control Signal Multiplexing 3.9.6.1 Instantiation information This device contains one I S module. As configured on the device, module features include: • TX data lines: 1 • RX data lines: 1 K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 135
The following table shows the input clock selection options on this device. Table 3-71. I2S0 MCLK input clock selection MCR[MICS] Clock Selection System clock OSC0ERCLK Not supported MCGPLLCLK, MCGFLLCLK, or IRC48MCLK K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 136
Audio Master Clock that remains operating in Stop mode. The SAI transmitter and/or receiver can generate an asynchronous interrupt to wake the CPU from Stop mode. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
3.10 Human-machine interfaces 3.10.1 GPIO configuration This section summarizes how the module has been configured in the chip. For a comprehensive description of the module itself, see the module’s dedicated chapter. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 138
PTD7, PTC3, and PTC4. All other GPIO support normal drive option only. PTA4 includes a passive input filter that is enabled or disabled by PORTA_PCR4[PFE] control. This reset default is to have this function disabled. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
RAM and peripheral address spaces. This functionality maps each 32-bit word of the aliased address space to a unique bit in the underlying RAM or peripheral address space to support single-bit insert and extract operations from the processor. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 140
1. EzPort master port is statically muxed with DMA master port. Access rights to AIPS-Lite peripheral bridge and general purpose input/output (GPIO) module address space is limited to the core, DMA and EzPort. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• a value of 0x0000_0000 to indicate the target bit is clear • a value of 0x0000_0001 to indicate the target bit is set Bit-band region Alias bit-band region Figure 4-1. Alias bit-band mapping K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
4.3 Flash Memory Map The flash memory and the flash registers are located at different base addresses as shown in the following figure. The base address for each is specified in System memory map. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The on-chip RAM is split in two regions: SRAM_L and SRAM_U. The RAM is implemented such that the SRAM_L and SRAM_U ranges form a contiguous block in the memory map. See SRAM Configuration for details. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
ACTLR[DISDEFWBUF]. However, disabling buffered writes is likely to degrade system performance much more than simply performing the required memory serialization for the situations that truly require it. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 146
— 0x4004_7000 SIM low-power logic 0x4004_8000 System integration module (SIM) 0x4004_9000 Port A multiplexing control 0x4004_A000 Port B multiplexing control 0x4004_B000 Port C multiplexing control Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
System Control Space (SCS) (for NVIC and FPU) 0xE000_F000–0xE003_FFFF Reserved 0xE004_0000–0xE004_0FFF Trace Port Interface Unit (TPIU) 0xE004_1000–0xE004_1FFF Reserved 0xE004_2000–0xE004_2FFF Reserved 0xE004_3000–0xE004_3FFF Reserved 0xE004_4000–0xE007_FFFF Reserved 0xE008_0000–0xE008_0FFF Miscellaneous Control Module (MCM) 0xE008_1000–0xE008_1FFF Reserved Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 149
Chapter 4 Memory Map Table 4-3. PPB memory map (continued) System 32-bit Address Range Resource 0xE008_2000–0xE00F_EFFF Reserved 0xE00F_F000–0xE00F_FFFF ROM Table - allows auto-detection of debug components K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
SIM module. Reference those sections for detailed register and bit descriptions. 5.3 High-Level device clocking diagram The following system oscillator, MCG, and module registers control the multiplexers, dividers, and clock gates shown in the below figure: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
CG — Clock gate Note: See subsequent sections for details on where these clocks are used. Figure 5-1. Clocking diagram 5.4 Clock definitions The following table describes the clocks in the previous block diagram. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
MCGOUTCLK Up to 120 MHz Up to 120 MHz Up to 4 MHz In all stop modes except for partial Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 154
30-40 kHz, or 30-40 kHz (low- range crystal) or Stop mode and 3-32 MHz (crystal) 3-32 MHz (crystal) OSC_CR[EREFST Up to 16 MHz EN] cleared (high-range crystal) Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 155
Up to 120 MHz Up to 4 MHz System clock or Trace is disabled MCGOUTCLK LPUART0 clock Up to 100 MHz Up to 100MHz Up to 16MHz MCGFLLCLK or LPUART0 is disabled IRC48MCLK or K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The following are a few of the more common clock configurations for this device: Option 1: Clock Frequency Core clock 50 MHz System clock 50 MHz Bus clock 50 MHz FlexBus clock 25 MHz Flash clock 25 MHz Option 2: Run K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
5.5.2 VLPR mode clocking The clock dividers cannot be changed while in VLPR mode. They must be programmed prior to entering VLPR mode to guarantee: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
System clock — — cJTAG, JTAGC — — JTAG_CLK System modules System clock — — DMA Mux Bus clock — — Port control Bus clock — Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 159
Communication interfaces USB FS OTG System clock USB FS clock — DSPI Bus clock — DSPI_SCK Bus clock — I2C_SCL UART0, UART1 System clock — — Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
MCG_C7[OSCSEL]=10) and either MCG is configured in an external clocking mode (PBE, BLPE, PEE, FBE or FEE) or MCG_C5[PLLCLKEN0] = 1. • SIM Control register selects IRC48 MHz clock — enabled when SIM_SOPT2[PLLFLLSEL]=11 K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The WDOG may be clocked from two clock sources as shown in the following figure. WDOG clock Bus clock WDOG_STCTRLH[CLKSRC] Figure 5-2. WDOG clock generation 5.7.4 Debug trace clock The debug trace clock source can be clocked as shown in the following figure. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The prescaler and glitch filters in each of the LPTMRx modules can be clocked as shown in the following figure. NOTE The chosen clock must remain enabled if the LPTMRx is to continue operating in all required low-power modes. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The CLKOUT32K function is available in all modes of operation. In VLLS0 mode only the RTC oscillator is available. PTE0 is available in all packages for this device. PTE26 is not available in 64-pin packages for this device. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
For the USB FS OTG controller to operate, the minimum system clock frequency is 20 MHz. The USB OTG controller also requires a 48 MHz clock. The clock source options are shown below. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The LPUART0 module has a selectable clock as shown in the following figure. NOTE The chosen clock must remain enabled if the LPUART0 is to continue operating in all required low-power modes. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
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. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 167
OSCERCLK Clock MCLK System Clock Divider BCLK Divider Bus Clock BCLK_IN [MSEL] [DIV] [BCD] SIM_SOPT2[PLLFLLSEL] I2Sx_MCR[MOE] I2Sx_MDR[FRACT,DIVIDE] I2Sx_MCR[MICS] MCLK_IN MCLK_OUT Direction Control Pad Interface Logic Figure 5-9. I S/SAI clock generation K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The MCU exits reset in functional mode that is controlled by EZP_CS pin to select between the single chip (default) or serial flash programming (EzPort) modes. See Boot options for more details. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
During and following a reset, the JTAG pins have their associated input pins configured • TDI in pull-up (PU) • TCK in pull-down (PD) • TMS in PU and associated output pin configured as: • TDO with no pull-down or pull-up K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 171
The LVD can be configured to generate a reset upon detection of a low voltage condition by setting the PMC's LVDSC1[LVDRE] bit to 1. The low voltage detection threshold is determined by the PMC's LVDSC1[LVDV] field. After an LVD reset has occurred, the K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 172
, as controlled by the C2[RANGE] field loc_low loc_high in the MCG module, the MCU resets. The RCM's SRS0[LOC] bit is set to indicate this reset source. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 173
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. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The POR Only reset asserts on the POR reset source only. It resets the PMC and System Register File. The POR Only reset also causes all other reset types (except VBAT POR) to occur. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Chip Reset asserts on all reset sources and only negates after flash initialization has completed and the RESET_b pin has also negated. It resets the remaining modules (the modules not reset by other reset types). K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Use the CDBGRSTREQ bit within the SWJ-DP CTRL/STAT register to reset the debug modules. However, as explained below, using the CDBGRSTREQ bit does not reset all debug-related registers. CDBGRSTREQ resets the debug-related registers within the following modules: • SWJ-DP • AHB-AP K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
EzPort chip select (EZP_CS) Description Serial flash programming mode (EzPort) Single chip (default) 1. CDBGRSTREQ does not affect AHB resources so that debug resources on the private peripheral bus are available during System Reset. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
POR, VLLSx recoveries and reset sequencing and after reset exit. The recovery times are also extended if the FAST_INIT option is not selected. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Once the RESET pin is detected high, the Core clock is enabled and the system is released from reset. EzPort mode is selected instead of the normal CPU execution if EZP_CS is low when the internal K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 180
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. Subsequent system resets follow this same reset flow. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
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. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Stop mode and then requesting bus slaves to enter Stop mode. In STOP and VLPS modes, MCG and PMC would then also enter their appropriate modes. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
VLPS mode. The MCG, PMC, SRAM and Flash read port are not affected by Compute Operation, although the Flash register interface is disabled. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• 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. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Stop mode entry is not supported directly from HSRUN and requires transition to Run prior to an attempt to enter a stop mode. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 186
Most peripherals are disabled (with clocks stopped), but LLWU, Sleep Deep Wakeup Reset Low Leakage LPTimer, RTC, CMP, DAC can be used. NVIC is disabled; LLWU is Stop3) used to wake up. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Recovery from VLLSx is through the wake-up Reset event. The chip wake-ups from VLLSx by means of reset, an enabled pin or enabled module. See the table "LLWU inputs" in the LLWU configuration section for a list of the sources. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
VLPR and VLPW are limited in frequency. The LLS and VLLSx mode(s) are the lowest power stop modes based on amount of logic or memory that is required to be retained by the application. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• System level wait and VLPW modes equate to: SLEEPING & SLEEPDEEP • All other low power modes equate to: SLEEPING & SLEEPDEEP When entering the non-wait modes, the chip performs the following sequence: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• 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 K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 191
4 MHz max 4 MHz max OFF in CPO Bus clock 4 MHz max 4 MHz max OFF in CPO 50 MHz max in PSTOP2 from Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 192
FF in PSTOP2 in CPO Async operation FF with external static with external clock Async operation clock in CPO Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 193
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. The SMC_STOPCTRL[PORPO] bit in the SMC module controls this option. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 194
VLLSx only supports low speed external pin to pin or external pin to DAC compares. Windowed, sampled & filtered modes of operation are not available while in stop, VLPS, LLSx, or VLLSx modes. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Further information regarding the flash security options and enabling/disabling flash security is available in the Flash Memory Module. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Erase in Progress bit in the MDM-AP Control register to trigger a mass erase (Erase All Blocks) command. A mass erase via the debugger is allowed even when some memory locations are protected. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 197
Chapter 8 Security When mass erase is disabled, mass erase via the debugger is blocked. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 198
Security Interactions with other Modules K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Serial Wire Debug (SWD) • ARM Real-Time Trace Interface(1-pin asynchronous mode only) The basic Cortex-M4 debug architecture is very flexible. The following diagram shows the topology of the core debug architecture and its components. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 200
The FPB unit contains two literal comparators for matching against literal loads from Code space, and remapping to a corresponding area in System space. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• ARM Debug Interface v5.1 • ARM CoreSight Architecture Specification 9.2 The Debug Port The configuration of the cJTAG module, JTAG controller, and debug port is illustrated in the following figure: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
3. Send more than 50 TCK cycles with TMS (SWDIO) =1 NOTE See the ARM documentation for the CoreSight DAP Lite for restrictions. 9.2.2 JTAG-to-cJTAG change sequence 1. Reset the debug port K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
TAPs (TDO) are muxed based on the IR code which is selected. This design is fully JTAG compliant and appears to the JTAG chain as a single TAP. At power on reset, ARM's IDCODE (IR=4'b1110) is selected. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
JTAG, cJTAG, or SWD. The MDM-AP is accessible as Debug Access Port 1 with the available registers shown in the table below. Table 9-4. MDM-AP Register Summary Address Register Description Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Bus Matrix SELECT[7:4] = 0xF selects the bank with IDR A[3:2] = 2’b11 selects the IDR Register See Control and Status Register (IDR register reads 0x001C_0000) Descriptions Figure 9-3. MDM AP Addressing K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 206
This bit is used by the debugger to clear the sticky LLS and VLLSx mode entry status bits. This bit is asserted and cleared by the debugger. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
ARM Core enters Deep Sleep. 0 Low Power Stop Mode is not enabled 1 Low Power Stop Mode is enabled Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Debug reset (CDBGRSTREQ bit within the SWJ-DP CTRL/STAT register) in the TCLK domain that allows the debugger to reset the debug logic. • TRST asserted via the cJTAG escape command. • System POR reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The four sources in decreasing order of priority are: 1. Software trace -- Software can write directly to ITM stimulus registers. This emits packets. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
HW, the MDM-AP Control register can be configured hold the system in reset on recovery so that the debugger can regain control and reconfigure debug logic prior to the system exiting reset and resuming operation. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
When mass erase is disabled (FSEC[MEEN]= 10), the debugger does not have the capability of performing a mass erase operation via writes to MDM-AP Control Register. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Figure 10-1. Signal multiplexing integration Table 10-1. Reference links to related information Topic Related module Reference Full description Port control Port control System memory map System memory map Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Disabled Disabled at reset Drive strength PTB0/PTB1 only PTC3/PTC4 only PTD4/PTD5/PTD6/ enable control PTD7 only Drive strength Disabled Disabled Disabled Disabled Disabled enable at reset Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The Port Control Module is responsible for selecting which ALT functionality is available on each pin. NOTE The MK22FN512VFX12 (88QFN) does not support the FlexBus function. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The following figure shows the pinout diagram for the devices supported by this document. Many signals may be multiplexed onto a single pin. To determine what signals can be used on which pin, see the previous section. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 226
Figure 10-5. K22F 88 QFN pinout diagram (transparent top view) NOTE For more information about QFN package use, see Electrical Connection Recommendations for the Exposed Pad on QFN and DFN Packages K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
10.4 Module Signal Description Tables The following sections correlate the chip-level signal name with the signal name used in the module's chapter. They also briefly describe the signal function and direction. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
EWM_in EWM input for safety status of external safety circuits. The polarity of EWM_in is programmable using the EWM_CTRL[ASSIN] bit. The default polarity is active-low. EWM_OUT EWM_out EWM reset out signal K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
For example, in 16-bit mode, the lower address is driven on FB_AD15–FB_AD0, and in 8-bit mode, the lower address is driven on FB_AD23–FB_AD0. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 231
2h (FB_TSIZ1–FB_TSIZ0 = 10b), and the final 8 bits are transferred at offset 4h (FB_TSIZ1–FB_TSIZ0 = 01b). For aligned transfers larger than the port size, FB_TSIZ1– FB_TSIZ0 behave as follows: Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 232
16 bytes (FB_TSIZ1–FB_TSIZ0 = 11b), and the address is misaligned within the 16-byte boundary, the external memory or peripheral must be able to wrap around the address. 1. FB_AD[23:21] not available on 100-LQFP devices. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
CMP0_IN[5:0] IN[5:0] Analog voltage inputs CMP0_OUT CMPO Comparator output Table 10-14. CMP 1 Signal Descriptions Chip signal name Module signal Description name CMP1_IN[5:0] IN[5:0] Analog voltage inputs CMP1_OUT CMPO Comparator output K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Fault input (j), where j can be 3-0 FTM1_QD_PHA Quadrature decoder phase A input. Input pin associated with quadrature decoder phase A. FTM1_QD_PHB Quadrature decoder phase B input. Input pin associated with quadrature decoder phase B. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 235
Table 10-24. RTC Signal Descriptions Chip signal name Module signal Description name VBAT — Backup battery supply for RTC and VBAT register file RTC_CLKOUT RTC_CLKOUT 1 Hz square-wave output or OSCERCLK K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Chip signal name Module signal Description name SPI1_PCS0 PCS0/SS Peripheral Chip Select 0 (O) SPI1_PCS[3:1] PCS[1:3] Peripheral Chip Selects 1–3 SPI1_SIN Serial Data In SPI1_SOUT SOUT Serial Data Out SPI1_SCK Serial Clock (O) K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 237
Request to send UART1_TX Transmit data UART1_RX Receive data Table 10-34. UART 2 Signal Descriptions Chip signal name Module signal Description name UART2_CTS Clear to send Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
PORTC31–PORTC0 General-purpose input/output PTD[31:0] PORTD31–PORTD0 General-purpose input/output PTE[31:0] PORTE31–PORTE0 General-purpose input/output 1. The available GPIO pins depends on the specific package. See the signal multiplexing section for which exact GPIO signals are available. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Support for interrupt or DMA request configured per pin • Asynchronous wake-up in low-power modes • Pin interrupt is functional in all digital pin muxing modes • Digital input filter on selected pins K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
In Stop mode, the PORT can be configured to exit the Low-Power mode via an asynchronous wake-up signal if an enabled interrupt is detected. In Stop mode, the digital input filters are bypassed unless they are configured to run from the LPO clock source. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
11.5 Memory map and register definition Any read or write access to the PORT memory space that is outside the valid memory map results in a bus error. All register accesses complete with zero wait states. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 242
(always 0000_0000h 11.5.2/251 reads 0) 4004_9084 Global Pin Control High Register (PORTA_GPCHR) (always 0000_0000h 11.5.3/251 reads 0) 4004_90A0 Interrupt Status Flag Register (PORTA_ISFR) 0000_0000h 11.5.4/252 Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 243
Pin Control Register n (PORTB_PCR30) See section 11.5.1/248 4004_A07C Pin Control Register n (PORTB_PCR31) See section 11.5.1/248 4004_A080 Global Pin Control Low Register (PORTB_GPCLR) (always 0000_0000h 11.5.2/251 reads 0) Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 244
Pin Control Register n (PORTC_PCR28) See section 11.5.1/248 4004_B074 Pin Control Register n (PORTC_PCR29) See section 11.5.1/248 4004_B078 Pin Control Register n (PORTC_PCR30) See section 11.5.1/248 Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 245
4004_C064 Pin Control Register n (PORTD_PCR25) See section 11.5.1/248 4004_C068 Pin Control Register n (PORTD_PCR26) See section 11.5.1/248 4004_C06C Pin Control Register n (PORTD_PCR27) See section 11.5.1/248 Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 246
4004_D058 Pin Control Register n (PORTE_PCR22) See section 11.5.1/248 4004_D05C Pin Control Register n (PORTE_PCR23) See section 11.5.1/248 4004_D060 Pin Control Register n (PORTE_PCR24) See section 11.5.1/248 Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 247
4004_D0A0 Interrupt Status Flag Register (PORTE_ISFR) 0000_0000h 11.5.4/252 4004_D0C0 Digital Filter Enable Register (PORTE_DFER) 0000_0000h 11.5.5/252 4004_D0C4 Digital Filter Clock Register (PORTE_DFCR) 0000_0000h 11.5.6/253 4004_D0C8 Digital Filter Width Register (PORTE_DFWR) 0000_0000h 11.5.7/253 K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This read-only field is reserved and always has the value 0. Interrupt Status Flag The pin interrupt configuration is valid in all digital pin muxing modes. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 249
Alternative 1 (GPIO). 0010 Alternative 2 (chip-specific). 0011 Alternative 3 (chip-specific). 0100 Alternative 4 (chip-specific). 0101 Alternative 5 (chip-specific). 0110 Alternative 6 (chip-specific). 0111 Alternative 7 (chip-specific). Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 250
Internal pulldown resistor is enabled on the corresponding pin, if the corresponding PE field is set. Internal pullup resistor is enabled on the corresponding pin, if the corresponding PE field is set. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Corresponding Pin Control Register is updated with the value in GPWD. GPWD Global Pin Write Data Write value that is written to all Pin Control Registers bits [15:0] that are selected by GPWE. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Chapter of Signal Multiplexing and Signal Descriptions for the pins that support digital filter. The digital filter configuration is valid in all digital pin muxing modes. Address: Base address + C0h offset Reset PORTx_DFER field descriptions Field Description Digital Filter Enable K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
11.5.7 Digital Filter Width Register (PORTx_DFWR) This register is read only for ports that do not support a digital filter. The digital filter configuration is valid in all digital pin muxing modes. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Pin Control register. For example, if an I C function is enabled on a pin, that does not override the pullup or open drain configuration for that pin. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The global pin control registers are write-only registers, that always read as 0. 11.6.3 External interrupts The external interrupt capability of the PORT module is available in all digital pin muxing modes provided the PORT module is enabled. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
If the digital filters for a port are configured to use the bus clock, then the digital filters are bypassed for the duration of Stop mode. While the digital filters K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 257
The maximum latency through a digital filter equals three filter clock cycles plus the filter width configuration register. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
USB voltage regulator not in standby during Stop, VLPS, LLS and VLLS modes. USB voltage regulator in standby during Stop, VLPS, LLS and VLLS modes. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 262
1011 256 KB 1101 512 KB 1111 1024 KB 11–6 This field is reserved. Reserved This read-only field is reserved and always has the value 0. Reserved This field is reserved. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Writing one to the URWE bit allows the SOPT1 USBREGEN bit to be written. This register bit clears after a write to USBREGEN. SOPT1 USBREGEN cannot be written. SOPT1 USBREGEN can be written. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This read-only field is reserved and always has the value 0. 27–26 LPUART clock source select LPUARTSRC Selects the clock source for the LPUART transmit and receive clock. Clock disabled Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 265
Off-chip instruction accesses are disallowed. Data accesses are allowed. Off-chip instruction accesses and data accesses are allowed. 7–5 CLKOUT select CLKOUTSEL Selects the clock to output on the CLKOUT pin. FlexBus CLKOUT Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
FlexTimer 3 Hardware Trigger 1 Source Select FTM3TRG1SRC Selects the source of FTM3 hardware trigger 1. Reserved FTM2 channel match drives FTM3 hardware trigger 1 Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 267
NOTE: The selected pin must also be configured for the FTM external clock function through the appropriate pin control register in the port control module. FTM_CLK0 pin FTM_CLK1 pin Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 268
FTM2_FLT0 pin CMP0 out 7–5 This field is reserved. Reserved This read-only field is reserved and always has the value 0. FTM1 Fault 0 Select FTM1FLT0 Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Description 31–20 This field is reserved. Reserved This read-only field is reserved and always has the value 0. 19–18 LPUART0 receive data source select LPUART0RXSRC Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 270
UART 0 transmit data source select Selects the source for the UART 0 transmit data. UART0_TX pin UART0_TX pin modulated with FTM1 channel 0 output UART0_TX pin modulated with FTM2 channel 0 output Reserved K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
FTM3_CH2 pin is output of FTM3 channel 2 output FTM3_CH2 pin is output of FTM3 channel 2 output modulated by FTM2 channel 1 output. FTM3 channel 1 output source FTM3OCH1SRC Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 274
Write 1 to assert the TRIG0 input to FTM3, software must clear this bit to allow other trigger sources to assert. FTM2 Hardware Trigger 0 Software Synchronization FTM2SYNCBIT Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
K7x Family 1000 K8x Family 27–24 Kinetis Sub-Family ID SUBFAMID Specifies the Kinetis sub-family of the device. 0000 Kx0 Subfamily 0001 Kx1 Subfamily (tamper detect) Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 276
Specifies the pincount of the device. 0000 Reserved 0001 Reserved 0010 32-pin 0011 Reserved 0100 48-pin 0101 64-pin 0110 80-pin 0111 81-pin or 121-pin 1000 100-pin 1001 121-pin 1010 144-pin Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This bit controls the clock gate to the comparator module. Clock disabled Clock enabled USB Clock Gate Control USBOTG This bit controls the clock gate to the USB module. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 278
This read-only field is reserved and always has the value 0. EWM Clock Gate Control This bit controls the clock gate to the EWM module. Clock disabled Clock enabled Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This bit controls the clock gate to the Port D module. Clock disabled Clock enabled Port C Clock Gate Control PORTC This bit controls the clock gate to the Port C module. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 280
This read-only field is reserved and always has the value 1. Low Power Timer Access Control LPTMR This bit controls software access to the Low Power Timer module. Access disabled Access enabled K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This bit controls the clock gate to the ADC0 module. Clock disabled Clock enabled FTM2 Clock Gate Control FTM2 This bit controls the clock gate to the FTM2 module. Clock disabled Clock enabled Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 282
This read-only field is reserved and always has the value 0. SPI1 Clock Gate Control SPI1 This bit controls the clock gate to the SPI1 module. Clock disabled Clock enabled Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 283
This bit controls the clock gate to the flash memory. Flash reads are still supported while the flash memory is clock gated, but entry into low power modes and HSRUN mode is blocked. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This bit controls the clock gate to the DMA module. Clock disabled Clock enabled FlexBus Clock Gate Control FLEXBUS This bit controls the clock gate to the FlexBus module. Clock disabled Clock enabled K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This field sets the divide value for the bus clock from MCGOUTCLK. At the end of reset, it is loaded with either 0000 or 0111 depending on FTF_FOPT[LPBOOT]. The bus clock frequency must be an integer divide of the core/system clock frequency. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 286
0001 or 1111 depending on FTF_FOPT[LPBOOT]. The flash clock frequency must be an integer divide of the system clock frequency. 0000 Divide-by-1. 0001 Divide-by-2. 0010 Divide-by-3. 0011 Divide-by-4. 0100 Divide-by-5. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This field sets the fraction multiply value for the fractional clock divider when the MCGFLLCLK, or MCGPLLCLK, or IRC48M clock is the USB clock source (SOPT2[USBSRC] = 1). Divider output clock = Divider input clock × [ (USBFRAC+1) / (USBDIV+1) ] K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
256 KB of program flash memory 1011 512 KB of program flash memory 1101 1024 KB of program flash memory 1111 512 KB of program flash memory Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This bit should not be changed during VLP modes. Relocate the interrupt vectors out of Flash memory before disabling the Flash. Flash is enabled Flash is disabled 12.2.16 Flash Configuration Register 2 (SIM_FCFG2) Address: 4004_7000h base + 1050h offset = 4004_8050h MAXADDR0 MAXADDR1 Reset Reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
After a device reset, the flashloader_loader program starts its execution first. The flashloader_loader program copies the contents of flashloader image from the flash to the on-chip RAM; the device then switches execution to the flashloader program to execute from RAM. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 294
Not supported ReadMemory Read data from memory Not supported GetProperty Get the current value of a property Supported Reset Reset the chip Supported SetProperty Attempt to modify a writable property Supported K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
3. The flashloader waits for communication to begin on a peripheral. • There is no timeout for the active peripheral detection process. • If communication is detected, then all inactive peripherals are shut down, and the command phase is entered. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The core runs on the default reset clock (20.9 MHz). After exiting the flashloader, the core sets the clock configuration back to the reset state (and enables the internal 48 MHz reference clock for the USB module). K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The protocol for a command with no data phase contains: • Command packet (from host) • Generic response command packet (to host) Target Host Command Process command Response Figure 13-2. Command with No Data Phase K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 298
• Generic response command packet (to host) Target Host Command Process command Initial Response Data packet Process data Final data packet Process data Final Response Figure 13-3. Command with incoming data phase K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 299
The protocol for a command with an outgoing data phase contains: • Command packet (from host) • ReadMemory Response command packet (to host) (kCommandFlag_HasDataPhase set) • Outgoing data packets (to host) • Generic response command packet (to host) K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 300
• If the ReadMemory Response command packet prior to the start of the data phase does not contain the kCommandFlag_HasDataPhase flag, then the data phase is aborted. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
A Ping packet must be sent before any other communications. In response to a Ping packet, the target sends a Ping Response packet. Table 13-3. Ping Packet Format Byte # Value Name 0x5A start byte 0xA6 ping K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 302
Table 13-4. Ping Response Packet Format Byte # Value Parameter 0x5A start byte 0xA7 Ping response code Protocol bugfix Protocol minor Protocol major Protocol name = 'P' (0x50) Options low Options high CRC16 low CRC16 high K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 303
Data phase is being aborted. 0xA4 kFramingPacketType_Command The framing packet contains a command packet payload. 0xA5 kFramingPacketType_Data The framing packet contains a data packet payload. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 304
Table 13-10. Commands that are supported Command Name 0x01 FlashEraseAll 0x02 FlashEraseRegion 0x03 ReadMemory 0x04 WriteMemory Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 305
ParameterCount: The number of parameters included in the command packet. Parameters: The parameters are word-length (32 bits). With the default maximum packet size of 32 bytes, a command packet can contain up to 7 parameters. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 306
Flashloader Status Error Codes, lists the status codes returned to the host by the Kinetis Flashloader. 4 - 7 Command tag The Command tag parameter identifies the response to the command sent by the host. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 307
0. The parameter count is set to 2 plus the number of words requested to be read in the FlashReadOnceCommand. Table 13-15. FlashReadOnceResponse Parameters Byte # Value Parameter 0 – 3 Status Code Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The Call command will execute a function that is written in memory at the address sent in the command. The address needs to be a valid memory location residing in accessible flash (internal or external) or in RAM. The command supports the passing of one 32-bit K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 309
Properties are the defined units of data that can be accessed with the GetProperty or SetProperty commands. Properties may be read-only or read-write. All read-write properties are 32-bit integers, so they can easily be carried in a command parameter. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 311
The property tag and the new value to set are the 2 parameters required for the SetProperty command. Table 13-21. Parameters for SetProperty Command Byte # Command 0 - 3 Property tag 4 - 7 Property value K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 312
The SetProperty command has no data phase. Response: The target (Kinetis Flashloader) will return a GenericResponse packet with one of following status codes: Table 13-23. SetProperty Response Status Codes Status Code kStatus_Success kStatus_ReadOnly kStatus_UnknownProperty kStatus_InvalidArgument K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 315
WriteMemory command. The difference between FillMemory and WriteMemory is that a data pattern is included in FillMemory command parameter, and there is no data phase for the FillMemory command, while WriteMemory does have a data phase. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 317
Table 13-30. Parameters for FlashProgramOnce Command Byte # Command 0 - 3 Index of program once field 4 - 7 Byte count (must be evenly divisible by 4) 8 - 11 Data 12 - 16 Data K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 318
13.3.6.8 FlashReadOnce command The FlashReadOnce command returns the contents of the program once field by given index and byte count. The FlashReadOnce command uses 2 parameters: index and byteCount. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 319
0x00 parameterCount 0x02 index 0x0000_0000 byteCount 0x0000_0004 Table 13-34. FlashReadOnce Response Format (Example) FlashReadOnce Parameter Value Response Framing packet start byte 0x5A packetType 0xA4 Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 320
0 - 3 start address Start address of specific non-volatile memory to be read 4 - 7 byteCount Byte count to be read 8 - 11 option 0: IFR 1: Flash firmware ID K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 324
Table 13-40. Parameters for read memory command Byte Parameter Description Start address Start address of memory to read from Byte count Number of bytes to read and return to caller K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 326
GenericResponse packet with a status code either set to kStatus_Success or an appropriate error status code. 13.3.6.13 Reset command The Reset command will result in flashloader resetting the chip. The Reset command requires no parameters. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Response: The target (Kinetis Flashloader) will return a GenericResponse packet with status code set to kStatus_Success, before resetting the chip. 13.4 Peripherals Supported This section describes the peripherals supported by the Kinetis Flashloader. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Figure 13-20. Host reads response from target via I2C 13.4.2 SPI Peripheral The Kinetis Flashloader supports loading data into flash via the SPI peripheral, where the SPI peripheral serves as a SPI slave. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 330
1 byte of ping response from target Send 0x00 to 0x5A 0xA7 Report Error shift out 1 byte received? received? from target Figure 13-21. Host reads ping packet from target via SPI K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
(2 bytes) Figure 13-23. Host reads response from target via SPI 13.4.3 UART Peripheral The Kinetis Flashloader integrates an autobaud detection algorithm for the UART peripheral, thereby providing flexible baud rate choices. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 332
• How the host detects an ACK from the target • How the host detects a ping response from the target • How the host detects a command response from the target K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 333
Wait for 1 byte of ping response from target packet 0x5A 0xA7 Wait for 1 byte Report Error received? received? from target Figure 13-25. Host reads a ping response from target via UART K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
48-MHz IRC. The flashloader also enables the USB clock recovery feature (by setting USBx_CLK_RECOVER_CTRL[CLOCK_RECOVER_EN] to 1 and USB_CLK_RECOVER_IRC_EN[IRC_EN] to 1). 13.4.4.2 Device descriptor The Kinetis flashloader configures the default USB VID/PID/Strings as below: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 335
• VID = 0x15A2 • PID = 0x0073 Default Strings: • Manufacturer [1] = "Freescale Semiconductor Inc." (Note that Freescale Semiconductor is now NXP Semiconductors.) • Product [2] = "Kinetis Bootloader" 13.4.4.3 Endpoints The HID peripheral uses 3 endpoints: • Control (0) •...
Current flashloader version. AvailablePeripherals The set of peripherals supported on this chip. FlashStartAddress Start address of program flash. FlashSizeInBytes Size in bytes of program flash. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 337
0 - FAC not supported 1 - FAC supported FlashAcessSegmentSize The size in bytes of 1 segment of flash FlashAcessSegmentCount FAC segment count (The count of flash access segments within the flash model.) K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
1. 1 is subtracted from the command tag because the lowest command tag value is 0x01. To get the bit mask for a given command, use this expression: mask = 1 << (tag - 1) K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The key provided does not match the programmed flash key. kStatus_FlashRegionExecuteOnly The area of flash is protected as execute only. kStatus_I2C_SlaveTxUnderrun I2C Slave TX Underrun error. kStatus_I2C_SlaveRxOverrun I2C Slave RX Overrun error. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 340
10403 CRC check is invalid, because the BCA is invalid or the CRC parameters are unset (all 0xFF bytes). kStatus_AppCrcCheckOutOfRange 10404 CRC check is valid but addresses are out of range. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Indicates a reset has been caused by an active-low level on the external RESET pin. Reset not caused by external reset pin Reset caused by external reset pin Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The reset state of these bits depends on what caused the MCU to reset. NOTE The reset value of this register depends on the reset source: • POR (including LVD) — 0x00 K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 344
Indicates a reset has been caused by the ARM core indication of a LOCKUP event. Reset not caused by core LOCKUP event Reset caused by core LOCKUP event Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Selects how the reset pin filter is enabled in run and wait modes. All filtering disabled Bus clock filter enabled for normal operation LPO clock filter enabled for normal operation Reserved K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Bus clock filter count is 22 10110 Bus clock filter count is 23 10111 Bus clock filter count is 24 11000 Bus clock filter count is 25 Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Reflects the state of the EZP_MS pin during the last Chip Reset Pin deasserted (logic 1) Pin asserted (logic 0) This field is reserved. Reserved This read-only field is reserved and always has the value 0. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Reset not caused by a loss of lock in the PLL Reset caused by a loss of lock in the PLL Sticky Loss-of-Clock Reset SLOC Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This read-only field is reserved and always has the value 0. This field is reserved. Reserved This read-only field is reserved and always has the value 0. Sticky Stop Mode Acknowledge Error Reset SSACKERR Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 350
Sticky JTAG Generated Reset SJTAG Indicates a reset has been caused by JTAG selection of certain IR codes: EZPORT, EXTEST, HIGHZ, and CLAMP. Reset not caused by JTAG Reset caused by JTAG K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The WFI or WFE instruction is used to invoke Sleep and Deep Sleep modes. Run, Wait, and Stop are the common terms used for the primary operating modes of Kinetis microcontrollers. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 352
The core, system, bus, and flash clock maximum frequencies are restricted in this mode. See the Power Management chapter for details about the maximum allowable frequencies. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
For more information about the types of reset on this chip, refer to the Reset section details. NOTE The SMC registers can be written only in supervisor mode. Write accesses in user mode are blocked and will result in a bus error. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
(PMPROT) register. NOTE This register is reset on Chip POR not VLLS and by reset types that trigger Chip POR not VLLS. It is unaffected by reset types K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 356
NOTE: When set to STOP, the PSTOPO bits in the STOPCTRL register can be used to select a Partial Stop mode if desired. Normal Stop (STOP) Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
PSTOP2 - Partial Stop with system clock disabled and bus clock enabled Reserved POR Power Option PORPO This bit controls whether the POR detect circuit is enabled in VLLS0 mode. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Address: 4007_E000h base + 3h offset = 4007_E003h Read PMSTAT Write Reset SMC_PMSTAT field descriptions Field Description PMSTAT Power Mode Status NOTE: When debug is enabled, the PMSTAT will not update to STOP or VLPS K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
15.4 Functional description 15.4.1 Power mode transitions The following figure shows the power mode state transitions available on the chip. Any reset always brings the MCU back to the normal RUN state. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 360
Sleep-now or sleep-on-exit modes entered with SLEEPDEEP clear, controlled in System Control Register in ARM core. See note. WAIT Interrupt or Reset STOP PMCTRL[RUNM]=00, PMCTRL[STOPM]=000 Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 361
Wakeup from enabled LLWU input source or RESET pin VLPR VLLSx PMPROT[AVLLS]=1, PMCTRL[STOPM]=100, STOPCTRL[LLSM]=x (VLLSx), Sleep-now or sleep-on-exit modes entered with SLEEPDEEP set, which is controlled in System Control Register in ARM core. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Entry into a low-power stop mode (Stop, VLPS, LLS, VLLSx) is initiated by a CPU executing the WFI instruction. After the instruction is executed, the following sequence occurs: 1. The CPU clock is gated off immediately. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 363
For wait modes (WAIT and VLPW), the CPU clock is gated off while all other clocking continues, as in RUN and VLPR mode operation. Some modules that support stop-in- wait functionality have their clocks disabled in these configurations. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• All clock monitors in the MCG must be disabled. • The maximum frequencies of the system, bus, flash, and core are restricted. See the Power Management details about which frequencies are supported. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 365
HSRUN mode. To reenter normal RUN mode, clear PMCTRL[RUNM]. Any reset also clears PMCTRL[RUNM] and causes the system to exit to normal RUN mode after the MCU exits its reset flow. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
A system reset causes an exit from VLPW mode, returning the device to normal RUN mode. 15.4.5 Stop modes This device contains a variety of stop modes to meet your application needs. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 367
A system reset will cause an exit from STOP mode, returning the device to normal RUN mode via an MCU reset. 15.4.5.2 Very-Low-Power Stop (VLPS) mode The two ways in which VLPS mode can be entered are listed here. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 368
NOTE 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. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 369
An asserted RESET pin will cause an exit from any VLLS mode, returning the device to normal RUN mode. When exiting VLLS via the RESET pin, RCM_SRS[PIN] and RCM_SRS[WAKEUP] are set. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
CPU operation to begin. The VLLDBGACK bit is cleared by the debugger (or can be left set as is) or clears automatically due to the reset generated as part of the next VLLS recovery. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The system is comprised of a power-on reset (POR) circuit and a LVD circuit with a user-selectable trip voltage: high (V ) or low (V ). The trip voltage is selected by LVDH LVDL LVDSC1[LVDV]. The LVD is disabled upon entering VLPx, LLS, and VLLSx modes. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
LVD voltage. The LVW also has an interrupt, which is enabled by setting LVDSC2[LVWIE]. If enabled, an LVW interrupt request occurs when LVDSC2[LVWF] is set. LVDSC2[LVWF] is cleared by writing 1 to LVDSC2[LVWACK]. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
PMC memory map Absolute Width Section/ address Register name Access Reset value (in bits) page (hex) Low Voltage Detect Status And Control 1 register 4007_D000 16.5.1/374 (PMC_LVDSC1) Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
PMC_LVDSC1 field descriptions Field Description Low-Voltage Detect Flag LVDF This read-only status field indicates a low-voltage detect event. Low-voltage event not detected Low-voltage event detected Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
LVWV is reset solely on a POR Only event. The other fields of the register are reset on Chip Reset Not VLLS. For more information about these reset types, refer to the Reset section details. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
CMP and ADC. The internal regulator provides a status bit (REGONS) indicating the regulator is in run regulation. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 377
Regulator is in stop regulation or in transition to/from it Regulator is in run regulation This field is reserved. Reserved NOTE: This reserved bit must remain cleared (set to 0). Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 378
Memory map and register descriptions PMC_REGSC field descriptions (continued) Field Description Bandgap Buffer Enable BGBE Enables the bandgap buffer. Bandgap buffer not enabled Bandgap buffer enabled K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
LLS or VLLS. See the chip configuration information for wakeup input sources for this device. • External pin wake-up inputs, each of which is programmable as falling-edge, rising- edge, or any change K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
When the wake-up pin filters are enabled, filter operation begins immediately. If a low leakage mode is entered within five LPO clock cycles of an active edge, the edge event will be detected by the LLWU. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
LLWU registers are unaffected by reset types that do not trigger Chip Reset not VLLS. For more information about the types of reset on this chip, refer to the Introduction details. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
External input pin enabled with any change detection 5–4 Wakeup Pin Enable For LLWU_P2 WUPE2 Enables and configures the edge detection for the wakeup pin. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Enables and configures the edge detection for the wakeup pin. External input pin disabled as wakeup input External input pin enabled with rising edge detection Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This register is reset on Chip Reset not VLLS and by reset types that trigger Chip Reset not VLLS. It is unaffected by reset types that do not trigger Chip Reset not VLLS. See the Introduction details for more information. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
LLWU_ME contains the bits to enable the internal module flag as a wakeup input source for inputs MWUF7–MWUF0. NOTE This register is reset on Chip Reset not VLLS and by reset types that trigger Chip Reset not VLLS. It is unaffected by reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 388
WUME1 Enables an internal module as a wakeup source input. Internal module flag not used as wakeup source Internal module flag used as wakeup source Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Indicates that an enabled external wakeup pin was a source of exiting a low-leakage power mode. To clear the flag, write a 1 to WUF6. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 390
Indicates that an enabled external wake-up pin was a source of exiting a low-leakage power mode. To clear the flag, write a 1 to WUF0. LLWU_P0 input was not a wakeup source LLWU_P0 input was a wakeup source K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Indicates that an enabled external wakeup pin was a source of exiting a low-leakage power mode. To clear the flag, write a 1 to WUF13. LLWU_P13 input was not a wakeup source LLWU_P13 input was a wakeup source Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
CMP module, the flag from the associated peripheral is accessible as the MWUFx bit. The flag will need to be cleared in the peripheral instead of writing a 1 to the MWUFx bit. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 393
Module 3 input was not a wakeup source Module 3 input was a wakeup source Wakeup flag For module 2 MWUF2 Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Indicates that the filtered external wakeup pin, selected by FILTSEL, was a source of exiting a low-leakage power mode. To clear the flag write a one to FILTF. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Indicates that the filtered external wakeup pin, selected by FILTSEL, was a source of exiting a low-leakage power mode. To clear the flag write a one to FILTF. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
5 cycles of delay before the detect circuit alerts the system to the wakeup or reset event when the filter function is enabled. Two wakeup detect filters are available for selected external pins. Glitch filtering is not provided on the internal modules. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
LLWU flag from being falsely set when PMC_REGSC[ACKISO] is cleared. The signal selected as a wake-up source pin must be a digital pin, as selected in the pin mux control. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The MCM_ISCR register includes the enable and status bits associated with the core’s floating-point exceptions. The individual event indicators are first qualified with their exception enables and then logically summed to form an interrupt request sent to the core’s NVIC. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 402
This read-only field is reserved and always has the value 0. FPU inexact interrupt enable FIXCE Disable interrupt Enable interrupt FPU underflow interrupt enable FUFCE Disable interrupt Enable interrupt Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 403
This read-only bit is a copy of the core’s FPSCR[DZC] bit and signals a divide by zero has been detected in the processor’s FPU. Once set, this bit remains set until software clears the FPSCR[DZC] bit. No interrupt Interrupt occurred Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This read-only field is reserved and always has the value 0. 18.2.5 Compute Operation Control Register (MCM_CPO) This register controls the Compute Operation. Address: E008_0000h base + 40h offset = E008_0040h Reset Reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• FPU invalid operation interrupt is enabled (FDZCE) and an invalid occurs (FDZC) 18.3.1.1 Determining source of the interrupt To determine the exact source of the interrupt qualify the interrupt status flags with the corresponding interrupt enable bits. 1. From MCM_ISCR[31:16] && MCM_ISCR[15:0] K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 406
Functional description 2. Search the result for asserted flags, which indicate the exact interrupt sources K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Symmetric crossbar bus switch implementation • Allows concurrent accesses from different masters to different slaves • Up to single-clock 32-bit transfer • Programmable configuration for fixed-priority or round-robin slave port arbitration (see the chip-specific information). K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This is done to save the initial clock of arbitration delay that otherwise would be seen if the same master had to arbitrate to gain control of the slave port. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• The new requesting master's priority level is higher than that of the current master. Both of the following are true: At the next arbitration point for the undefined length burst transfer Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
19.4 Initialization/application information No initialization is required for the crossbar switch. See the chip-specific crossbar switch information for the reset state of the arbitration scheme. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The slave devices connected to the peripheral bridge are modules which contain a programming model of control and status registers. The system masters read and write these registers through the peripheral bridge. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
All accesses to the peripheral slots must be sized less than or equal to the designated peripheral slot size. If an access is attempted that is larger than the targeted port, an error response is generated. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
21.1.1 Overview The Direct Memory Access Multiplexer (DMAMUX) routes DMA sources, called slots, to any of the 16 DMA channels. This process is illustrated in the following figure. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Each channel router can be assigned to one of the possible peripheral DMA slots or to one of the always-on slots. 21.1.3 Modes of operation The following operating modes are available: • Disabled mode K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The trigger is generated by the periodic interrupt timer (PIT); as such, the configuration of the periodic triggering interval is done via configuration registers in the PIT. See the section on periodic interrupt timer for more information on this topic. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 418
This trigger works by gating the request from the peripheral to the DMA until a trigger event has been seen. This is illustrated in the following figure. Peripheral request Trigger DMA request Figure 21-3. DMAMUX channel triggering: normal operation K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
21.4.2 DMA channels with no triggering capability The other channels of the DMAMUX provide the normal routing functionality as described in Modes of operation. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
DMA registers after every minor loop. For this option, the DMA channel must be disabled in the DMA channel MUX. • Use an always-enabled DMA source. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
DMA channels that have triggering capability. To configure source #5 transmit for use with DMA channel 1, with periodic triggering capability: 1. Write 0x00 to CHCFG1. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Local memory containing transfer control descriptors for each of the 16 channels 22.1.1 eDMA system block diagram Figure 22-1 illustrates the components of the eDMA system, including the eDMA module ("engine"). K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
After the minor loop completes execution, the address path hardware writes Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The eDMA module features: • All data movement via dual-address transfers: read from source, write to destination • Programmable source and destination addresses and transfer size • Support for enhanced addressing modes K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Support for complex data structures In the discussion of this module, n is used to reference the channel number. 22.2 Modes of operation The eDMA operates in the following modes: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
0, channel 1, ... channel 15. Each TCDn definition is presented as 11 registers of 16 or 32 bits. 22.3.2 TCD initialization Prior to activating a channel, you must initialize its TCD with the appropriate transfer profile. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
22.3.35/481 (DMA_TCD15_BITER_ELINKYES) TCD Beginning Minor Loop Link, Major Loop Count 4000_91FE (Channel Linking Disabled) Undefined 22.3.36/482 (DMA_TCD15_BITER_ELINKNO) 22.3.5 Control Register (DMA_CR) The CR defines the basic operating configuration of the DMA. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 442
NBYTES field is a 30-bit vector. When minor loop mapping is disabled (EMLM is 0), all 32 bits of TCDn word2 are assigned to the NBYTES field. Address: 4000_8000h base + 0h offset = 4000_8000h Reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 443
Halt DMA Operations HALT Normal operation Stall the start of any new channels. Executing channels are allowed to complete. Channel execution resumes when this bit is cleared. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• A cancel transfer with error bit that will be set when a transfer is canceled via the corresponding cancel transfer control bit Fault reporting and handling for more details. Address: 4000_8000h base + 4h offset = 4000_8004h Reset ERRCHN Reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 445
The last recorded error was a configuration error detected in the TCDn_NBYTES or TCDn_CITER fields. • TCDn_NBYTES is not a multiple of TCDn_ATTR[SSIZE] and TCDn_ATTR[DSIZE], or Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 447
The DMA request signal for the corresponding channel is disabled The DMA request signal for the corresponding channel is enabled Enable DMA Request 4 ERQ4 Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The DMA error indicator and the error interrupt enable flag must be asserted before an error interrupt request for a given channel is asserted to the interrupt controller. Address: 4000_8000h base + 14h offset = 4000_8014h Reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 449
The error signal for corresponding channel does not generate an error interrupt The assertion of the error signal for corresponding channel generates an error interrupt request Enable Error Interrupt 6 EEI6 Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
If the NOP bit is set, the command is ignored. This allows you to write multiple-byte registers as a 32-bit word. Reads of this register return all zeroes. Address: 4000_8000h base + 18h offset = 4000_8018h Read Write CAEE CEEI Reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Sets All Enable Error Interrupts SAEE Set only the EEI bit specified in the SEEI field. Sets all bits in EEI 5–4 This field is reserved. Reserved Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Clear only the ERQ bit specified in the CERQ field Clear all bits in ERQ 5–4 This field is reserved. Reserved CERQ Clear Enable Request Clears the corresponding bit in ERQ. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Set only the ERQ bit specified in the SERQ field Set all bits in ERQ 5–4 This field is reserved. Reserved SERQ Set Enable Request Sets the corresponding bit in ERQ. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Clears only the TCDn_CSR[DONE] bit specified in the CDNE field Clears all bits in TCDn_CSR[DONE] 5–4 This field is reserved. Reserved CDNE Clear DONE Bit Clears the corresponding bit in TCDn_CSR[DONE] K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Set only the TCDn_CSR[START] bit specified in the SSRT field Set all bits in TCDn_CSR[START] 5–4 This field is reserved. Reserved SSRT Set START Bit Sets the corresponding bit in TCDn_CSR[START] K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Clear only the ERR bit specified in the CERR field Clear all bits in ERR 5–4 This field is reserved. Reserved CERR Clear Error Indicator Clears the corresponding bit in ERR K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Clear only the INT bit specified in the CINT field Clear all bits in INT 5–4 This field is reserved. Reserved CINT Clear Interrupt Request Clears the corresponding bit in INT K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Address: 4000_8000h base + 24h offset = 4000_8024h Reset Reset DMA_INT field descriptions Field Description 31–16 This field is reserved. Reserved This read-only field is reserved and always has the value 0. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 459
The interrupt request for corresponding channel is active Interrupt Request 4 INT4 The interrupt request for corresponding channel is cleared The interrupt request for corresponding channel is active Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
A zero in any bit position has no affect on the corresponding channel’s current error status. The CERR is provided so the error indicator for a single channel can easily be cleared. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 461
An error in this channel has occurred Error In Channel 10 ERR10 An error in this channel has not occurred An error in this channel has occurred Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 462
An error in this channel has not occurred An error in this channel has occurred Error In Channel 0 ERR0 An error in this channel has not occurred An error in this channel has occurred K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Field Description 31–16 This field is reserved. Reserved This read-only field is reserved and always has the value 0. Hardware Request Status Channel 15 HRS15 Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 464
The HRS bit for its respective channel remains asserted for the period when a Hardware Request is Present on the Channel. After the Request is completed and Channel is free, the HRS bit is automatically cleared by hardware. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 465
A hardware service request for channel 3 is not present A hardware service request for channel 3 is present Hardware Request Status Channel 2 HRS2 Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Address: 4000_8000h base + 44h offset = 4000_8044h Reset Reset DMA_EARS field descriptions Field Description 31–16 This field is reserved. Reserved This read-only field is reserved and always has the value 0. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 467
Enable asynchronous DMA request in stop mode for channel 4 EDREQ_4 Disable asynchronous DMA request for channel 4. Enable asynchronous DMA request for channel 4. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Channel n cannot be suspended by a higher priority channel’s service request. Channel n can be temporarily suspended by the service request of a higher priority channel. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
NOTE: Using a Reserved value causes a configuration error. 8-bit 16-bit 32-bit Reserved 16-byte burst 32-byte burst Reserved Reserved 7–3 Destination Address Modulo DMOD See the SMOD definition DSIZE Destination data transfer size Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
TCD memory. If the major iteration count is completed, additional processing is performed. NOTE: An NBYTES value of 0x0000_0000 is interpreted as a 4 GB transfer. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The minor loop offset is applied to the SADDR Destination Minor Loop Offset enable DMLOE Selects whether the minor loop offset is applied to the destination address upon minor loop completion. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
= Undefined at reset. DMA_TCDn_DOFF field descriptions Field Description DOFF Destination Address Signed Offset Sign-extended offset applied to the current destination address to form the next-state value as each destination write is completed. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
CITER field from the Beginning Iteration Count (BITER) field. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
It is decremented each time the minor loop is completed and updated in the transfer control descriptor memory. After the major iteration count is exhausted, the channel performs a number of operations, for Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This channel reload is performed as the major iteration count completes. The scatter/gather address must be 0-modulo-32-byte, otherwise a configuration error is reported. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The software clears it, or the hardware when the channel is activated. NOTE: This bit must be cleared to write the MAJORELINK or ESG bits. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 480
If this flag is set, the channel generates an interrupt request by setting the appropriate bit in the INT when the current major iteration count reaches zero. The end-of-major loop interrupt is disabled. The end-of-major loop interrupt is enabled. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
CITER field. The channel-to-channel linking is disabled The channel-to-channel linking is enabled 14–13 This field is reserved. Reserved 12–9 Link Channel Number LINKCH Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
15 bits in place of a link channel number. If the major loop is exhausted, this link mechanism is suppressed in favor of the MAJORELINK channel linking. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
22.4.1 eDMA basic data flow The basic flow of a data transfer can be partitioned into three segments. As shown in the following diagram, the first segment involves the channel activation: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 484
The following diagram illustrates the second part of the basic data flow: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 485
(if scatter/ gather is enabled). The updates to the TCD memory and the assertion of an interrupt request are shown in the following diagram. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Each of these possible causes are detailed below: • The addresses and offsets must be aligned on 0-modulo-transfer-size boundaries. • The minor loop byte count must be a multiple of the source and destination transfer sizes. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 487
Due to pipeline effect, the next transfer is already in progress when the bus error is received by the eDMA. If a bus error K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 488
If a channel is terminated by an error and then issues another service request before the error is fixed, that channel executes and terminates with the same error condition. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
However, the microarchitecture of the eDMA also factors significantly into the resulting metric. 22.4.4.1 Peak transfer rates The peak transfer rates for several different source and destination transfers are shown in the following tables. These tables assume: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 490
In the case of an internal peripheral bus read and internal SRAM write, the combined data phase time is 4 cycles. For an SRAM read and internal peripheral bus write, it is 5 cycles. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 491
11.5 cycles (4 + (4+5)/2 + 3). This is the time from Cycle 4 to Cycle x +5. The resulting peak request rate, as a function of the system frequency, is shown in the following table. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 492
For an SRAM to internal peripheral bus transfer, PEAKreq = 150 MHz / [ 4 + (1 + 1) + (1 + 3) + 3 ] cycles = 11.5 Mreq/sec For an internal peripheral bus to SRAM transfer, K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
2. Write the channel priority levels to the DCHPRIn registers if a configuration other than the default is desired. 3. Enable error interrupts in the EEI register if so desired. 4. Write the 32-byte TCD for each channel that may request service. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 494
CPU intervention. DMA arbitration can occur after each minor loop, and one level of minor loop DMA preemption is allowed. The number of minor loops in a major loop is specified by the beginning iteration count (BITER). K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The eDMA performs various tests on the transfer control descriptor to verify consistency in the descriptor data. Most programming errors are reported on a per channel basis with the exception of channel priority error (ES[CPE]). K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
(TCDn_CITER = TCDn_BITER = 1). The data transfer begins after the channel service request is acknowledged and the channel is selected to execute. After the transfer is complete, the TCDn_CSR[DONE] bit is set and an interrupt generates if properly enabled. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 497
Write 32-bits to location 0x2008 → third iteration of the minor loop. g. Read byte from location 0x100C, read byte from location 0x100D, read byte from 0x100E, read byte from 0x100F. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 498
Write 32-bits to location 0x2004 → second iteration of the minor loop. e. Read byte from location 0x1008, read byte from location 0x1009, read byte from 0x100A, read byte from 0x100B. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 499
Write 32-bits to location 0x201C → last iteration of the minor loop → major loop complete. 14. eDMA engine writes: TCDn_SADDR = 0x1000, TCDn_DADDR = 0x2000, TCDn_CITER = 2 (TCDn_BITER). K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
There are two methods to test for minor loop completion when using software initiated service requests. The first is to read the TCDn_CITER field and test for a change. Another method may be extracted from the sequence shown below. The second method is K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 501
The true values of the SADDR, DADDR, and NBYTES are the values the eDMA engine currently uses in its internal register file and not the values in the TCD local memory for that channel. The addresses, SADDR and K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This section provides recommended methods to change the programming model during channel execution. 22.5.7.1 Dynamically changing the channel priority The following two options are recommended for dynamically changing channel priority levels: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 504
NOTE The user must clear the TCD.done bit before writing the TCD.major.e_link bit. The TCD.done bit is cleared automatically by the eDMA engine after a channel begins execution. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 505
1. When the descriptors are built, write a unique TCD ID in the TCD.major.linkch field for each TCD associated with a channel using dynamic scatter/gather. 2. Write 1b to the TCD.d_req bit. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 506
If e_sg = 0b, read the 32 bit TCD dlast_sga field. If e_sg = 0b and the dlast_sga did not change, the attempted dynamic link did not succeed (the channel was already retiring). K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Checker. To initialize the eDMA data output buffer, the eDMA must perform a one or more 32-bit data transfers using any data value. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 508
It saves the last recorded error. The VLD bit shows the user whether any error bits in the Error Register are set, thus indicating an error occurred that hasn't been cleared. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
EWM_out signal. 23.1.1 Features Features of EWM module include: • Independent LPO_CLK clock source • Programmable time-out period specified in terms of number of EWM LPO_CLK clock cycles. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
15 (EWM_refresh_time) peripheral bus clocks after exiting from stop mode. User must mask all interrupts prior to executing EWM refresh instructions. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
INEN, ASSIN and EWMEN bits can be written once after a CPU reset. Modifying these bits more than once, generates a bus transfer error. Address: 4006_1000h base + 0h offset = 4006_1000h Read INTEN INEN ASSIN EWMEN Write Reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This fixed number of cycles is called EWM_refresh_time. 23.3.3 Compare Low Register (EWM_CMPL) The CMPL register is reset to zero after a CPU reset. This provides no minimum time for the CPU to refresh the EWM counter. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
EWM_CMPH field descriptions Field Description COMPAREH To prevent runaway code from changing this field, software should write to this field after a CPU reset even if the (default) maximum refresh time is required. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The EWM_out is a digital output signal used to gate an external circuit (application specific) that controls critical safety functions. For example, the EWM_out could be connected to the high voltage transistors circuits that control an AC motor in a large appliance. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
(setting the CTRL[INEN] bit), the EWM_in signal must be in the deasserted state prior to the CPU start refreshing the EWM. This ensures that the EWM_out stays in the deasserted state; otherwise, the EWM_out output signal is asserted. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
EWM Service Register. The CPU must access the EWM service register with correct write of unique data within the windowed time frame as determined by the CMPL and CMPH registers for correct EWM refresh operation. Therefore, three possible conditions can occur: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
CLKPRESCALER[CLK_DIV]. This divided clock is used to run the EWM counter. NOTE The divided clock used to run the EWM counter must be no more than half the frequency of the bus clock. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• External system clock • Unlock sequence for allowing updates to write-once WDOG control/configuration bits. • All WDOG control/configuration bits are writable once only within 256 bus clock cycles of being unlocked. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Count of WDOG resets as they occur. • Configurable interrupt on time-out to provide debug breadcrumbs. This is followed by a reset after 256 bus clock cycles. 24.3 Functional overview K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 521
Software can adjust the period of servicing or the time-out value for the watchdog timer to meet the needs of the application. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The watchdog issues a reset, that is, interrupt-then-reset if enabled, to the system for any of these invalid unlock sequences: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Updates in the write-once registers take effect only after the WCT window closes with the following exceptions for which changes take effect immediately: • Stop, Wait, and Debug mode enable • IRQ_RST_EN The operations of refreshing the watchdog goes undetected during the WCT. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
However, the watchdog still generates a reset, or interrupt-then-reset if enabled, on a non- time-out exception. See Generated Resets and Interrupts. You need to unlock the watchdog before enabling it. A system reset brings the watchdog out of the disabled mode. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Do not enable the watchdog interrupt during these tests. If required, you must ensure that the effective time-out value is greater than WCT time. See Generated Resets and Interrupts more details. To run a particular test: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The byte test is a more thorough a test of the watchdog timer. In this test, the timer is split up into its constituent byte-wide stages that are run independently and tested for time-out against the corresponding byte of the time-out value register. The following figure explains the splitting concept: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Two successive timer time-outs without an intervening system reset result in the backup reset generator routing out the time-out signal as a reset to the system. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Also, jobs such as counting the number of watchdog resets would not be done. 24.7 Memory map and register definition This section consists of the memory map and register descriptions. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
WDOG functional test mode is disabled permanently until reset. 13–12 This 2-bit field selects the byte to be tested when the watchdog is in the byte test mode. BYTESEL[1:0] Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 530
Selects clock source for the WDOG timer and other internal timing operations. CLKSRC WDOG clock sourced from LPO . WDOG clock sourced from alternate clock source. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
WDOG_TOVALH field descriptions Field Description TOVALHIGH Defines the upper 16 bits of the 32-bit time-out value for the watchdog timer. It is defined in terms of cycles of the watchdog clock. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
A refresh outside this window resets the system or if IRQRSTEN is set, it interrupts and then resets the system. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
20 bus cycles, resets the system, or if IRQRSTEN is set, it interrupts and then resets the system. 24.7.8 Watchdog Unlock register (WDOG_UNLOCK) Address: 4005_2000h base + Eh offset = 4005_200Eh Read WDOGUNLOCK Write Reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Address: 4005_2000h base + 12h offset = 4005_2012h Read TIMEROUTLOW Write Reset WDOG_TMROUTL field descriptions Field Description TIMEROUTLOW Shows the value of the lower 16 bits of the watchdog timer. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
When performing 8-bit accesses to the watchdog's 16-bit registers where the intention is to access both the bytes of a register, place the two 8-bit accesses one after the other in your code. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
16-bit value is correctly written, write4. Hence, the requirement of writing value2 of the sequence within 20 bus clock cycles of value1 is checked by measuring the gap between write2 and write4. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• The time-out value of the watchdog should be set to a minimum of four watchdog clock cycles. This is to take into account the delay in new settings taking effect in the watchdog clock domain. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 538
If the second refresh value is not written within 20 bus cycles of the first value, the system is reset, or interrupt-then- reset if enabled. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Option to program and maximize DCO output frequency for a low frequency external reference clock source. • Option to prevent FLL from resetting its current locked frequency when switching clock modes if FLL reference frequency is not changed. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 540
• External clock monitor with reset and interrupt request capability to check for external clock failure when running in FBE, PEE, BLPE, or FEE modes • Lock detector with interrupt request capability for use with the PLL K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 541
• MCG Fixed Frequency Clock (MCGFFCLK) is provided as a clock source for other on-chip peripherals • MCG Internal Reference Clock (MCGIRCLK) is provided as a clock source for other on-chip peripherals This figure presents the block diagram of the MCG module. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 542
LOLS LOCK VDIV Filter /(24,25,26..55) Multipurpose Clock Generator (MCG) Figure 25-1. Multipurpose Clock Generator (MCG) block diagram NOTE Refer to the chip configuration chapter to identify the oscillator used in this MCU. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
MCG Auto Trim Compare Value Low Register 25.3.10/ 4006_400B (MCG_ATCVL) 25.3.11/ 4006_400C MCG Control 7 Register (MCG_C7) 25.3.12/ 4006_400D MCG Control 8 Register (MCG_C8) 25.3.13/ 4006_4011 MCG Control 12 Register (MCG_C12) Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
If RANGE = 0 or OSCSEL=1 , Divide Factor is 128; for all other RANGE values, Divide Factor is 1536 . Internal Reference Select IREFS Selects the reference clock source for the FLL. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Selects the frequency range for the crystal oscillator or external clock source. See the Oscillator (OSC) chapter for more details and the device data sheet for the frequency ranges used. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The SCTRIM bits are binary weighted, that is, bit 1 adjusts twice as much as bit 0. Increasing the binary value increases the period, and decreasing the value decreases the period. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The DRS bits select the frequency range for the FLL output, DCOOUT. When the LP bit is set, writes to the DRS bits are ignored. The DRST read field indicates the current frequency range for DCOOUT. The Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
OSCINIT 0 bit should be checked to make sure it is set. MCGPLLCLK is inactive. MCGPLLCLK is active. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
IREFS bit due to internal synchronization between clock domains. Source of FLL reference clock is the external reference clock. Source of FLL reference clock is the internal reference clock. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Writing to C1, C3, C4, and SC registers or entering Stop mode aborts the auto trim operation and clears this bit. Auto Trim Machine disabled. Auto Trim Machine enabled. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 553
The LOCS0 indicates when a loss of OSC0 reference clock has occurred. The LOCS0 bit only has an effect when CME0 is set. This bit is cleared by writing a logic 1 to it when set. Loss of OSC0 has not occurred. Loss of OSC0 has occurred. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Values are used by Auto Trim Machine to compare and adjust Internal Reference trim values during ATM SAR conversion. 25.3.11 MCG Control 7 Register (MCG_C7) Address: 4006_4000h base + Ch offset = 4006_400Ch Read OSCSEL Write Reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Enables the loss of clock monitoring circuit for the output of the RTC external reference clock. The LOCRE1 bit will determine whether an interrupt or a reset request is generated following a loss of RTC Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Address: 4006_4000h base + 12h offset = 4006_4012h Read Write Reset MCG_S2 field descriptions Field Description Reserved This field is reserved. This read-only field is reserved and always has the value 0. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Returns to the state that was active before the MCU enters Stop mode Stop the MCU entered Stop mode, unless a reset occurs while in Stop mode. Figure 25-2. MCG mode state diagram K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 558
• C1[FRDIV] must be written to divide external reference clock to be within the range of 31.25 kHz to 39.0625 kHz • 0 is written to C6[PLLS]. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 559
The FLL is disabled in a low-power state. PLL Bypassed External PLL Bypassed External (PBE) mode is entered when all the following conditions occur: (PBE) • 10 is written to C1[CLKS]. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 560
2’b10 and S[LOCK] bit will clear without setting S[LOLS]. If C5[PLLSTEN]=1, the S[LOCK] bit will not get cleared and on exit the MCG will continue to run in PEE mode. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
(slow IRC) and 4 MHz (fast IRC). The fast IRC frequency can be divided down by programming of the FCRDIV to produce a frequency range of 32 kHz to 4 MHz. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
LOCRE bit is set. Otherwise the MCG sets the respective LOCS bit and the MCG generates a LOCS interrupt request. In the case where a OSC loss of clock is detected, the PLL LOCK status bit is cleared. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Therefore, it is required that the MCG is configured in a clock mode where the reference clock used to generate the system clock is the external reference clock such as K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The following sections include examples on how to initialize the MCG and properly switch between the various available modes. 25.5.1 MCG module initialization sequence The MCG comes out of reset configured for FEI mode. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 565
• If the MCG is in FEE, FBE, PEE, PBE, or BLPE mode, and C2[EREFS] was also set in step 1, wait here for S[OSCINIT0] bit to become set indicating that the external clock source has finished its initialization cycles and stabilized. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 566
5. Wait for the FLL lock time to guarantee FLL is running at new C4[DRST_DRS] and C4[DMX32] programmed frequency. To change from FEI clock mode to FBI clock mode, follow this procedure: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Each time any of these bits are changed (C6[PLLS], C1[IREFS], C1[CLKS], C2[IRCS], or C2[EREFS], the corresponding bits in the MCG status register (PLLST, IREFST, CLKST, IRCST, or OSCINIT) must be checked before moving on in the application software. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 568
This section will include several mode switching examples, using an 4 MHz external crystal. If using an external clock source less than 2 MHz, the MCG must not be configured for any of the PLL modes (PEE and PBE). K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 569
• C5[PRDIV] set to 5'b00001, or divide-by-2 resulting in a pll reference frequency of 4MHz/2 = 2 MHz. 3. Then, FBE must transition either directly to PBE mode or first through BLPE mode and then to PBE mode: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 570
Loop until S[CLKST] are 2'b11, indicating that the PLL output is selected to feed MCGOUTCLK in the current clock mode. • Now, with PRDIV of divide-by-2, and C6[VDIV] of multiply-by-24, MCGOUTCLK = [(4 MHz / 2) * 24] = 48 MHz. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 571
S[CLKST] = %11? ENTER BLPE MODE ? CONTINUE IN PEE MODE C2 = 0x1E (C2[LP] = 1) Figure 25-3. Flowchart of FEI to PEE mode transition using an 4 MHz crystal K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 572
PLLS clock is the FLL. 3. Next, FBE mode transitions into FBI mode: a. C1 = 0x54 • C1[CLKS] set to 2'b01 to switch the system clock to the internal reference clock. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 573
C2 = 0x02 • C2[LP] is 1 • C2[RANGE], C2[HGO], C2[EREFS], C1[IRCLKEN], and C1[IREFSTEN] bits are ignored when the C1[IREFS] bit is set. They can remain set, or be cleared at this point. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 574
BLPE MODE ? BLPE MODE ? (C2[LP]=1) CONTINUE IN BLPI MODE C2 = 0x1C (C2[LP] = 0) Figure 25-4. Flowchart of PEE to BLPI mode transition using an 4 MHz crystal K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 575
At this point, by default, the C4[DRST_DRS] bits are set to 2'b00 and C4[DMX32] is cleared to 0. If the MCGOUTCLK frequency of 40 MHz is desired instead, set the C4[DRST_DRS] bits to 0x01 to switch the FLL K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 576
C2 = 0x1C CHECK S[CLKST] = %00? C1 = 0x10 CONTINUE IN FEE MODE CHECK S[OSCINIT] = 1 ? Figure 25-5. Flowchart of BLPI to FEE mode transition using an 4 MHz crystal K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Optionally external input bypass clock from EXTAL signal directly • One clock for MCU clock system • Two clocks for on-chip peripherals that can work in Stop modes Functional Description describes the module's operation in more detail. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Control and Decoding OSCCLK OSC clock selection logic STOP Figure 26-1. OSC Module Block Diagram 26.4 OSC Signal Descriptions The table found here shows the user-accessible signals available for the OSC module. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
2. With the low-power mode, the oscillator has the internal feedback resistor R . Therefore, the feedback resistor must not be externally with the Connection 3. XTAL EXTAL Crystal or Resonator Figure 26-2. Crystal/Ceramic Resonator Connections - Connection 1 K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
In external clock mode, the pins can be connected as shown in the figure found here. NOTE XTAL can be used as a GPIO when the GPIO alternate function is configured for it. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
After OSC is enabled and starts generating the clocks, the configurations such as low power and frequency range, must not be changed. Address: 4006_5000h base + 0h offset = 4006_5000h Read ERCLKEN EREFSTEN SC2P SC4P SC8P SC16P Write Reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 582
Disable the selection. Add 8 pF capacitor to the oscillator load. Oscillator 16 pF Capacitor Load Configure SC16P Configures the oscillator load. Disable the selection. Add 16 pF capacitor to the oscillator load. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Functional details of the module can be found here. 26.8.1 OSC module states The states of the OSC module are shown in the following figure. The states and their transitions between each other are described in this section. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 584
MCU, refer to the chip configuration details. The EXTAL and XTAL pins are also decoupled from all other oscillator circuitry in this state. The OSC module circuitry is configured to draw minimal current. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
(MCG, Timer, and so on) is configured to use the oscillator output clock (OSC_CLK_OUT). Table 26-3. Oscillator modes Mode Frequency Range Low-frequency, high-gain (32.768 kHz) up to f (39.0625 kHz) osc_lo osc_lo Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 586
(not sensitive to the DC level of EXTAL). Also in this mode, all external components except for the resonator itself are integrated, which includes the load capacitors and feeback resistor that biases EXTAL. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
There is no reset state associated with the OSC module. The counter logic is reset when the OSC is not configured to generate clocks. There are no sources of reset requests for the OSC module. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
OSC is still functional in these modes. After waking up from Very Low Leakage Stop (VLLSx) modes, all OSC register bits are reset and initialization is required through software. 26.11 Interrupts The OSC module does not generate any interrupts. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Automatic Gain Control (AGC) to optimize power consumption The RTC oscillator operations are described in detail in Functional Description 27.1.2 Block Diagram The following is the block diagram of the RTC oscillator. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
27.2.1 EXTAL32 — Oscillator Input This signal is the analog input of the RTC oscillator. 27.2.2 XTAL32 — Oscillator Output This signal is the analog output of the RTC oscillator module. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
EXTAL32 and XTAL32. In addition, there are two programmable capacitors with this oscillator, which can be used as the Cload of the oscillator. The programmable range is from 0pF to 30pF. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Reset Overview 27.6 Reset Overview There is no reset state associated with the RTC oscillator. 27.7 Interrupts The RTC oscillator does not generate any interrupts. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
64-bit flash memory location, and both a 4-way, 8-set cache and a single-entry 64-bit buffer can store previously accessed flash memory data for quick access times. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The programming model consists of the FMC control registers and the program visible cache (data and tag/valid entries). NOTE Program the registers only while the flash controller is idle (for example, execute from RAM). Changing configuration settings K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 595
[63:32] of data entry way 1, and U and L represent upper and set 0, and DATAW1S0L lower word, respectively. represents bits [31:0] of data entry way 1, set 0. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 596
Cache Data Storage (upper word) (FMC_DATAW0S0U) 0000_0000h 28.4.8/610 4001_F204 Cache Data Storage (lower word) (FMC_DATAW0S0L) 0000_0000h 28.4.9/611 4001_F208 Cache Data Storage (upper word) (FMC_DATAW0S1U) 0000_0000h 28.4.8/610 Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 597
4001_F26C Cache Data Storage (lower word) (FMC_DATAW1S5L) 0000_0000h 28.4.10/ 4001_F270 Cache Data Storage (upper word) (FMC_DATAW1S6U) 0000_0000h 28.4.11/ 4001_F274 Cache Data Storage (lower word) (FMC_DATAW1S6L) 0000_0000h Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 598
4001_F2C4 Cache Data Storage (lower word) (FMC_DATAW3S0L) 0000_0000h 28.4.14/ 4001_F2C8 Cache Data Storage (upper word) (FMC_DATAW3S1U) 0000_0000h 28.4.15/ 4001_F2CC Cache Data Storage (lower word) (FMC_DATAW3S1L) 0000_0000h Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
These bits control whether prefetching is enabled, based on the logical number of the requesting crossbar switch master. This field is further qualified by the PFBnCR[BxDPE,BxIPE] bits. Prefetching for this master is enabled. Prefetching for this master is disabled. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 601
No access may be performed by this master Only read accesses may be performed by this master Only write accesses may be performed by this master Both read and write accesses may be performed by this master K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The bit setting definitions are for each bit in the field. Cache way is unlocked and may be displaced Cache way is locked and its contents are not displaced 23–20 Cache Invalidate Way x CINV_WAY[3:0] Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 603
Do not cache data references. Cache data references. Bank 0 Instruction Cache Enable B0ICE This bit controls whether instruction fetches are loaded into the cache. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 604
This bit controls whether the single entry page buffer is enabled in response to flash read accesses. Its operation is independent from bank 1's cache. A high-to-low transition of this enable forces the page buffer to be invalidated. Single entry buffer is disabled. Single entry buffer is enabled. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This read-only field is reserved and always has the value 0. 18–17 Bank 1 Memory Width B1MW[1:0] This read-only field defines the width of the bank 1 memory. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 606
This bit controls whether the single entry buffer is enabled in response to flash read accesses. Its operation is independent from bank 0's cache. A high-to-low transition of this enable forces the page buffer to be invalidated. Single entry buffer is disabled. Single entry buffer is enabled. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This read-only field is reserved and always has the value 0. 18–5 14-bit tag for cache entry tag[18:5] 4–1 This field is reserved. Reserved This read-only field is reserved and always has the value 0. 1-bit valid for cache entry valid K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This read-only field is reserved and always has the value 0. 18–5 14-bit tag for cache entry tag[18:5] 4–1 This field is reserved. Reserved This read-only field is reserved and always has the value 0. 1-bit valid for cache entry valid K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This read-only field is reserved and always has the value 0. 18–5 14-bit tag for cache entry tag[18:5] 4–1 This field is reserved. Reserved This read-only field is reserved and always has the value 0. 1-bit valid for cache entry valid K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This section represents data for the upper word (bits [63:32]) of all sets in the indicated way. Address: 4001_F000h base + 200h offset + (8d × i), where i=0d to 7d data[63:32] Reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This section represents data for the upper word (bits [63:32]) of all sets in the indicated way. Address: 4001_F000h base + 240h offset + (8d × i), where i=0d to 7d data[63:32] Reset FMC_DATAW1SnU field descriptions Field Description data[63:32] Bits [63:32] of data entry K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This section represents data for the upper word (bits [63:32]) of all sets in the indicated way. Address: 4001_F000h base + 280h offset + (8d × i), where i=0d to 7d data[63:32] Reset FMC_DATAW2SnU field descriptions Field Description data[63:32] Bits [63:32] of data entry K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This section represents data for the upper word (bits [63:32]) of all sets in the indicated way. Address: 4001_F000h base + 2C0h offset + (8d × i), where i=0d to 7d data[63:32] Reset FMC_DATAW3SnU field descriptions Field Description data[63:32] Bits [63:32] of data entry K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• The cache is configured for least recently used (LRU) replacement for all four ways. • The cache is configured for data or instruction replacement. • The single-entry buffer is enabled. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
When speculative reads are enabled, the FMC immediately requests the next sequential address after a read completes. By requesting the next word immediately, speculative reads can help to reduce or even eliminate wait states when accessing sequential code and/or data. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Most secure state is supervisor/privileged secure: allows execute-only and provides supervisor-only access control. • Mid-level state is execute-only. • Unsecure state is where no access control states are set. Features: • Lightweight access control logic for on-chip flash memory K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 617
See section 28.5.4.1.2/ Execute-only Access Register Low (x_XACCL) See section 28.5.4.1.3/ Supervisor-only Access Register High (x_SACCH) See section 28.5.4.1.4/ Supervisor-only Access Register Low (x_SACCL) See section 28.5.4.1.5/ Configuration Register (x_CR) See section K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 618
For more about NVM characteristics, see the functional description. Any change made to an NVM location takes effect on the next system reset. The flash basis for the values is signified by x in the reset value. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 619
Reset * Notes: • Pre-programmed flash valuex = Undefined at reset. x_SACCH field descriptions Field Description SA[63:32] Supervisor Access Control for segments 63-32 K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 620
The NUMSG and SGSIZE values are fixed for a device. The chip-specific basis for the values is signified by * in the reset value. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 622
The next table shows segment assignments relative to the flash location. Table 28-4. Flash Protection Ranges SAn and XAn Protected Segment Address Range Segment Size (Fraction of total Flash) 64 Segment Encodings Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 623
Figure 28-1. Program flash protection (64 segments) 28.5.4.2.1 Interface Signals Table 28-5. Interface Signals Signal Width From Description xacc 64 or 32 Platform Direct xacc (execute-only access control) register Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 624
(FPROT), it will be erased. RD1XA The target regions of the command is controlled by FAC. For RD1XA, if a flash sector is in an execute-only protected segment, it will be erase verified. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 625
• If any portion of a protected segment is not used by pre-loaded code, then it (the portion of a protected segment that is not used by pre-loaded code) should be programmed with NOPs, to prevent additional code from being programmed in that segment by hackers. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
FMC's cache might need to be disabled and/or flushed to prevent the possibility of returning stale data. Use the PFB0CR[CINV_WAY] field to invalidate the cache in this manner. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 628
Initialization and application information K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
('1') states and/or programmed ('0') states. Therefore, it is recommended that each flash block or sector be re-erased immediately prior to factory programming to ensure that the full data retention capability is achieved. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Supports MCU security mechanisms which prevent unauthorized access to the flash memory contents 29.1.2 Block Diagram The block diagram of the flash memory module is shown in the following figure. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
HSRUN — An MCU power mode enabling high-speed access to the memory resources in the flash module. The user has no access to the flash command set when the MCU is in HSRUN mode. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Word — 16 bits of data with an aligned word having byte-address[0] = 0. 29.2 External Signal Description The flash memory module contains no signals that connect off-chip. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Read Resource commands in Read Once Command, Program Once Command Read Resource Command). The contents of the program flash IFR are summarized in the table found here and further described in the subsequent paragraphs. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The flash memory module contains a set of memory-mapped control and status registers. NOTE While a command is running (FSTAT[CCIF]=0), register writes are not accepted to any register except FCNFG and K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 635
(FTFA_FCCOB9) Flash Common Command Object Registers 29.3.3.5/ 4002_000F (FTFA_FCCOB8) 29.3.3.6/ 4002_0010 Program Flash Protection Registers (FTFA_FPROT3) Undefined 29.3.3.6/ 4002_0011 Program Flash Protection Registers (FTFA_FPROT2) Undefined Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 636
Flash Access Segment Size Register (FTFA_FACSS) Undefined 29.3.3.10/ 4002_002B Flash Access Segment Number Register (FTFA_FACSN) Undefined 29.3.3.1 Flash Status Register (FTFA_FSTAT) The FSTAT register reports the operational status of the flash memory module. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 637
The FPVIOL bit is cleared by writing a 1 to FPVIOL while CCIF is set. Writing a 0 to the FPVIOL bit has no effect. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 638
Read collision error interrupt enabled. An interrupt request is generated whenever a flash memory read collision error is detected (see the description of FSTAT[RDCOLERR]). Erase All Request ERSAREQ Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 639
X in the reset value. Address: 4002_0000h base + 2h offset = 4002_0002h Read KEYEN MEEN FSLACC Write Reset * Notes: • x = Undefined at reset. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 640
NVM at reset. The function of the bits is defined in the device's Chip Configuration details. All bits in the register are read-only . K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 641
Some commands return information to the FCCOB registers. Any values returned to FCCOB are available for reading after the FSTAT[CCIF] flag returns to 1 by the memory controller. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 642
KB of program flash memory or less, FPROT1 is not used. For configurations with 16 KB of program flash memory, FPROT2 is not used. The bitfields are defined in each register as follows: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 643
Trying to alter data in any protected area in the program flash memory results in a protection violation error and sets the FSTAT[FPVIOL] bit. A full block erase of a program flash block is not possible if it contains any protected region. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 644
XACCL0 0xA7 0xAF XACCL1 0xA6 0xAE XACCL2 0xA5 0xAD XACCL3 0xA4 0xAC Use the Program Once command to program the execute-only access control fields that are loaded during the reset sequence. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 645
Supervisor-only access register Program Flash IFR address A Program Flash IFR address B SACCH0 0xB3 0xBB SACCH1 0xB2 0xBA SACCH2 0xB1 0xB9 SACCH3 0xB0 0xB8 Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 646
The contents of this register are loaded during the reset sequence. Address: 4002_0000h base + 28h offset = 4002_0028h Read SGSIZE Write Reset * Notes: • x = Undefined at reset. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 647
Program flash memory is divided into 32 segments (64 Kbytes, 128 Kbytes) 0x28 Program flash memory is divided into 40 segments (160 Kbytes) 0x4x Program flash memory is divided into 64 segments (256 Kbytes, 512 Kbytes) K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
NOTE Flash protection features are discussed further in AN4507: Using the Kinetis Security and Flash Protection Features . Not all features described in the application note are available on this device. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 649
Figure 29-3. Program flash execute-only access control (256KB or 512KB of program flash) • FTFA_SACC — • For 2 program flash sizes greater than 128KB, eight registers control 64 segments of the program flash memory as shown in the following figure K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Some devices also generate a bus error response as a result of a Read Collision Error event. See the chip configuration information to determine if a bus error response is also supported. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Chip Configuration details of this device for how to activate each mode. 29.4.6 Flash Reads and Ignored Writes The flash memory module requires only the flash address to execute a flash memory read. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Flash command operations are typically used to modify flash memory contents. The next sections describe: • The command write sequence used to set flash command parameters and launch execution • A description of all flash commands available K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 653
The command processing has several steps: 1. The flash memory module reads the command code and performs a series of parameter checks and protection checks, if applicable, which are unique to each command. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 654
FCCOB and FSTAT registers. 4. The flash memory module sets FSTAT[CCIF] signifying that the command has completed. The flow for a generic command write sequence is illustrated in the following figure. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 655
The following table summarizes the function of all flash commands. FCMD Command Program flash 0 Program flash 1 Function 0x00 Read 1s Block × × Verify that a program flash block is erased. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 656
0x45 Verify Backdoor × × Release MCU security Access Key after comparing a set of user-supplied security keys to those stored in the program flash. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 657
Only the operations marked 'OK' in the following table are permitted to run simultaneously on the program flash memories. Some operations cannot be executed simultaneously because certain hardware resources are shared by the memories. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
If unexpected read results are encountered when checking flash memory contents at the 'user' margin levels, loss of information might soon occur during 'normal' readout. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
MCU with the collision error flag (FSTAT[RDCOLERR]) set. CAUTION Flash data must be in the erased state before being programmed. Cumulative programming of bits (adding more zeros) is not allowed. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 660
The Read 1s Section command checks if a section of program flash memory is erased to the specified read margin level. The Read 1s Section command defines the starting address and the number of phrases to be verified. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 661
The requested number of phrases is 0. FSTAT[ACCERR] Read-1s fails. FSTAT[MGSTAT0] 29.4.11.3 Program Check Command The Program Check command tests a previously programmed program flash longword to see if it reads correctly at the specified margin level. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 662
Table 29-12. Program Check Command Error Handling Error Condition Error Bit Command not available in current mode/security FSTAT[ACCERR] An invalid flash address is supplied FSTAT[ACCERR] Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 663
Resource Description Resource Size Local Address Range Select Code 0x00 Program Flash 0 IFR 256 Bytes 0x00_0000–0x00_00FF 0x01 Version ID 8 Bytes 0x00_0000–0x00_0007 1. Located in program flash 0 reserved space. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 664
Flash address [15:8] Flash address [7:0] Byte 0 program value Byte 1 program value Byte 2 program value Byte 3 program value 1. Must be longword aligned (Flash address [1:0] = 00). K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 665
Flash address [23:16] in the flash block to be erased Flash address [15:8] in the flash block to be erased Flash address [7:0] in the flash block to be erased 1. Must be longword aligned (Flash address [1:0] = 00). K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 666
FPROT registers). If the erase-verify fails the FSTAT[MGSTAT0] bit is set. The CCIF flag is set after the Erase Flash Sector operation completes. The Erase Flash Sector command is suspendable (see the FCNFG[ERSSUSP] bit and Figure 29-6). K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 667
Erase Flash Sector operation (CCIF is cleared) and the request to suspend the operation again (ERSSUSP is set). This minimum time period is required to ensure that the Erase Flash Sector operation will eventually complete. If the minimum period is continually K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 668
Aborting the erase leaves the bitcells in an indeterminate, partially-erased state. Data in this sector is not reliable until a new erase command fully completes. The following figure shows how to suspend and resume the Erase Flash Sector operation. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 669
Set CCIF ERSSCR Suspended Resume Erase? ERSSUSP: Bit in FCNFG register No, Abort SUSPACK: Internal Suspend Acknowledge Clear ERSSUSP User Cmd Interrupt/Suspend Figure 29-6. Suspend and Resume of Erase Flash Sector Operation K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 670
Apply the 'Factory' margin to the normal read-1 level Table 29-24. Read 1s All Blocks Command Error Handling Error Condition Error Bit Command not available in current mode/security FSTAT[ACCERR] An invalid margin choice is specified FSTAT[ACCERR] Read-1s fails FSTAT[MGSTAT0] K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 671
The Read Once command can be executed any number of times. Table 29-26. Read Once Command Error Handling Error Condition Error Bit Command not available in current mode/security FSTAT[ACCERR] An invalid record index is supplied FSTAT[ACCERR] K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 672
Command not available in current mode/security FSTAT[ACCERR] An invalid record index is supplied FSTAT[ACCERR] The requested record has already been programmed to a non-FFFF value FSTAT[ACCERR] Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 673
Error Condition Error Bit Command not available in current mode/security FSTAT[ACCERR] Any region of the program flash memory is protected FSTAT[FPVIOL] Any errors have been encountered during the verify operation FSTAT[MGSTAT0] K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Flash security features are discussed further in AN4507: Using the Kinetis Security and Flash Protection Features . Note that not all features described in the application note are available on this device. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 678
If the keys match, the FSEC[SEC] bits are changed to unsecure the chip. The entire 8-byte key cannot be all 0s or all 1s; that is, 0000_0000_0000_0000h and FFFF_FFFF_FFFF_FFFFh are not accepted by the Verify K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
29.4.13 Reset Sequence On each system reset the flash memory module executes a sequence which establishes initial values for the flash block configuration parameters, FPROT, FOPT, FSEC, FXACC, FSACC, and FACNFG registers. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 680
If a reset occurs while any flash command is in progress, that command is immediately aborted. The state of the word being programmed or the sector/block being erased is not guaranteed. Commands and operations do not automatically resume after exiting reset. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Memory contents can be read/erased/programmed from an external source, in a format that is compatible with many standalone flash memory chips, without requiring the removal of the microcontroller from the system board. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Ability to reset the microcontroller, allowing it to boot from the flash memory after the memory has been configured. 30.1.3 Modes of operation The EzPort can operate in one of two modes, enabled or disabled. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
EZP_CK is the serial clock for data transfers. The serial data in (EZP_D) and chip select (EZP_CS) are registered on the rising edge of EZP_CK, while serial data out (EZP_Q) is driven on the falling edge of EZP_CK. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
WRFCCOB) to be accepted. The write enable register field clears on reset, on a Write Disable command, and at the completion of write command. This command must not be used if a write is already in progress. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 686
Table 30-3. EzPort status register BEDIS Reset: 1. Reset value reflects the status of flash security out of reset. 3. Reset value reflects whether bulk erase is enabled or disabled out of reset. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 687
Flash security can be disabled by performing a BE command. 0 = Flash is not secure. 1 = Flash is secure. 30.3.1.4 Read Data K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 688
This command can be run with an EzPort clock (EZP_CK) frequency of half the internal system clock frequency of the microcontroller or slower. This command is not accepted if the WEF, WIP, or FS field in the EzPort status register is set. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 689
This command is not accepted if the WEF, WIP, or FS field is set or if the WEN field is not set in the EzPort status register. 30.3.1.7 Sector Erase EZP_CK EZP_CS EZP_D CMD[7:0]=0xD8 ADDRESS[23:0] EZP_Q Figure 30-8. Sector Erase command sequence K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 690
WIP field is set or if the WEN field is not set in the EzPort status register. 30.3.1.9 EzPort Reset Chip EZP_CK EZP_CS EZP_D CMD[7:0]=0xB9 EZP_Q Figure 30-10. Reset Chip command sequence K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 691
This command is not accepted if the WEF or WIP field is set or if the WEN field is not set in the EzPort status register. 30.3.1.11 Read FCCOB Registers at High Speed K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Can be directly connected to the following asynchronous or synchronous slave-only devices with little or no additional circuitry: • External ROMs • Flash memories • Programmable logic devices • Other simple target (slave) devices K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Output Enable—Sent to the external memory or peripheral to enable a read transfer. This signal is asserted during read accesses only when a chip-select matches the current address decode. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 695
FB_TA is asserted during a read transfer, FlexBus latches the data and then terminates the transfer. When FB_TA is asserted during a write transfer, the transfer is terminated. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
NOTE: Because the FlexBus module is one of the slaves connected to the crossbar switch, it is only accessible within a certain memory range. See the chip memory map for the applicable FlexBus Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Specifies whether the corresponding CSAR, CSMR, and CSCR contents are valid. Programmed chip- selects do not assert until the V bit is 1b (except for FB_CS0, which acts as the global chip-select). Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
CSCR0 reset value. Address: 4000_C000h base + 8h offset + (12d × i), where i=0d to 5d EXTS ASET RDAH WRAH Reset BEM BSTR Reset * Notes: • x = Undefined at reset. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 700
1 cycle (default for all but FB_CS0 ) 2 cycles Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 701
Enabled. Enables data burst reads larger than the specified port size, including 32-bit reads from 8- and 16-bit ports, 16-bit reads from 8-bit ports, and line reads from 8-, 16-, and 32-bit ports. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
FlexBus Signal Group 2 Multiplex control GROUP2 Controls the multiplexing of the FB_CS4, FB_TSIZ0, and FB_BE_31_24 signals. 0000 FB_CS4 0001 FB_TSIZ0 0010 FB_BE_31_24 Any other value Reserved Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Multiplexed 32-bit address and 32-bit data • Multiplexed 32-bit address and 16-bit data (non-multiplexed 16-bit address and 16- bit data) K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
31.4.4 Connecting address/data lines The external device must connect its address and data lines as follows: • Address lines • FB_AD from FB_AD0 upward • Data lines K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The following figure shows the byte lanes that external memory or peripheral connects to and the sequential transfers of a 32-bit transfer for the supported port sizes when byte lane shift is disabled. For example, an 8-bit memory connects to the single lane K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 706
The following figure shows the byte lanes that external memory or peripheral connects to and the sequential transfers of a 32-bit transfer for the supported port sizes when byte lane shift is enabled. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
CSCRn[BLS] is 0b. FB_AD Port size and phase 31–24 23–16 15–8 7–0 Address phase Address 32-bit Data phase Data Address phase Address 16-bit Data phase Data Address Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The FlexBus state machine controls the data-transfer operation. This figure shows the state-transition diagram for basic read and write cycles. Next Cycle Wait States The states are described in this table. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• FB_A[Y] indicates an address bus that can be 32, 24, or 16 bits wide. 31.4.11.1 Basic Read Bus Cycle During a read cycle, the MCU receives data from memory or a peripheral device. The following figure shows a read cycle flowchart. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 710
However, some applications may find this feature beneficial. The address and data busses are muxed between the FlexBus and another module. At the end of the read bus cycles the address signals are indeterminate. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 711
Figure 31-4. Basic Read-Bus Cycle 31.4.11.2 Basic Write Bus Cycle During a write cycle, the device sends data to memory or to a peripheral device. The following figure shows the write cycle flowchart. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 712
The following figure shows the write cycle timing diagram. Note The address and data busses are muxed between the FlexBus and another module. At the end of the write bus cycles, the address signals are indeterminate. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 713
The following figure illustrates the basic byte read transfer to an 8-bit device with no wait states: • The address is driven on the full FB_AD[31:0] bus in the first clock. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 714
AA=0 FB_TSIZ[1:0] TSIZ = 01 Figure 31-7. Single Byte-Read Transfer The following figure shows the similar configuration for a write transfer. The data is driven from the second clock on FB_AD[31:24]. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 715
FB_AD[15:0] throughout the bus cycle. • The external device returns the read data on FB_AD[31:16] and may tristate the data line or continue driving the data one clock after FB_TA is sampled asserted. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 716
AA=0 FB_TSIZ[1:0] TSIZ = 10 Figure 31-9. Single Word-Read Transfer The following figure shows the similar configuration for a write transfer. The data is driven from the second clock on FB_AD[31:16]. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 717
AA=1 FB_TA AA=0 FB_TSIZ[1:0] TSIZ=10 Figure 31-10. Single Word-Write Transfer 31.4.11.3.3 Bus Cycle Sizing—Longword Transfer, 32-bit Device, No Wait States The following figure depicts a longword read from a 32-bit device. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 718
FB_TS FB_ALE AA=1 FB_CSn AA=0 FB_OEn BEM=0 FB_BE/BWEn BEM=1 AA=1 FB_TA AA=0 FB_TSIZ[1:0] TSIZ = 00 Figure 31-11. Longword-Read Transfer The following figure illustrates the longword write to a 32-bit device. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 719
Wait states can give the peripheral or memory more time to return read data or sample write data. The following figures show the basic read and write bus cycles (also shown in Figure 31-4 Figure 31-9) with the default of no wait states respectively. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 720
TSIZ FB_AD[Y:0] indicates a 32-, 16-, 8-bit address bus (or custom size). FB_AD[31:X] indicates a 32-, 16-, 8-bit address/data bus (or custom size). Figure 31-13. Basic Read-Bus Cycle (No Wait States) K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 721
If wait states are used, the S1 state repeats continuously until the chip-select auto- acknowledge unit asserts internal transfer acknowledge or the external FB_TA is recognized as asserted. The following figures show a read and write cycle with one wait state respectively. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 723
Each chip-select can be programmed to assert one to four clocks after transfer start/address-latch enable (FB_TS/FB_ALE) is asserted. The following figures show read- and write-bus cycles with two clocks of address setup respectively. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 724
FB_AD[Y:0] indicates a 32-, 16-, 8-bit address bus (or custom size). FB_AD[31:X] indicates a 32-, 16-, 8-bit address/data bus (or custom size). Figure 31-17. Read-Bus Cycle with Two-Clock Address Setup (No Wait States) K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 725
Address and attributes can be held one to four clocks after chip-select, byte- selects, and output-enable negate. The following figures show read and write bus cycles with two clocks of address hold respectively. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 726
Address Hold Address Address Data FB_RW FB_TS FB_ALE AA=1 FB_CSn AA=0 FB_OEn BEM=0 FB_BE/BWEn BEM=1 AA=1 FB_TA AA=0 FB_TSIZ[1:0] TSIZ Figure 31-19. Read Cycle with Two-Clock Address Hold (No Wait States) K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 727
AA=1 FB_TA AA=0 FB_TSIZ[1:0] TSIZ Figure 31-20. Write Cycle with Two-Clock Address Hold (No Wait States) The following figure shows a bus cycle using address setup, wait states, and address hold. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
8-bit port takes two beats (two byte-sized transfers), for which FB_TSIZ[1:0] equals 10b throughout. A 32-bit transfer to an 8-bit port takes four beats (four byte-sized transfers), for which FB_TSIZ[1:0] equals 00b throughout. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 729
The transfer results in a 4-beat burst and the data is driven on FB_AD[31:24]. The transfer size is driven at 32-bit (00b) throughout the bus cycle. Note • In non-multiplexed address/data mode: the address on FB_A increments only during internally-terminated burst K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 731
Data Data Data Data AA=1 FB_TBST AA=0 FB_RW FB_TS FB_ALE FB_CSn FB_OEn FB_BE/BWEn AA=1 FB_TA AA=0 FB_TSIZ[1:0] TSIZ=00 AA=1 AA=0 Figure 31-23. 32-bit-Write burst to 8-Bit port 3-1-1-1 (no wait states) K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 732
The following figure shows a 32-bit write to an 8-bit device with burst inhibited. The transfer results in four individual transfers. The transfer size is driven at 32-bit (00b) during the first transfer and at byte (01b) during the next three transfers. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 733
Note CSCRn[WS] determines the number of wait states in the first beat. However, for subsequent beats, the CSCRn[WS] (or CSCRn[SWS] if CSCRn[SWSEN] = 1b) determines the number of wait states. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 734
Figure 31-25. 32-bit-read burst from 8-bit port 3-2-2-2 (one wait state) 31.4.12.8 32-bit-write burst to 8-bit port 3-2-2-2 (one wait state) The following figure illustrates a write burst transfer with one wait state. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 735
The following figure shows a read cycle with one clock of address setup and address hold. Note In non-multiplexed address/data mode, the address on FB_A increments only during internally-terminated burst cycles (CSCRn[AA] = 1b). The attached device must be able to K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 736
Figure 31-27. 32-bit-read burst from 8-bit port 3-1-1-1 (address setup and hold) 31.4.12.10 32-bit-write burst to 8-bit port 3-1-1-1 (address setup and hold) The following figure shows a write cycle with one clock of address setup and address hold. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
FB_CSn asserts. See the following figure. NOTE When EXTS is set, CSCRn[WS] must be programmed to have at least one primary wait state. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• An access whose address is in a range covered by more than one chip-selects • A write to a reserved address in the memory map • A write to a reserved field in the CSPMCR • Any FlexBus accesses when FlexBus is secure K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
1. Invalidate the chip-select by writing 0b to the associated CSMR's Valid field (CSMRn[V]). 2. Write to the associated CSAR. 3. Write to the associated CSCR. 4. Write to the associated CSMR, including writing 1b to the Valid field (CSMRn[V]). K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Option for inversion of final CRC result • 32-bit CPU register programming interface 32.1.2 Block diagram The following is a block diagram of the CRC. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
CRC Low Lower Byte When CTRL[WAS] is 1, values written to this field are part of the seed value. When CTRL[WAS] is 0, data written to this field is used for CRC checksum generation. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
CRC calculation. A new CRC calculation is initialized by asserting CTRL[WAS] and then writing the seed into the CRC data register. Address: 4003_2000h base + 8h offset = 4003_2008h TOTR FXOR WAS Reset Reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Writes to the CRC data register are seed values. Width of CRC protocol. TCRC 16-bit CRC protocol. 32-bit CRC protocol. Reserved This field is reserved. This read-only field is reserved and always has the value 0. 32.3 Functional description K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
8. When all values have been written, read the final CRC result from CRC_DATA[LU:LL]. Transpose and complement operations are performed on the fly while reading or writing values. See Transpose feature CRC result complement for details. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
CTRL[TOT] or CTRL[TOTR] fields, according to the CRC calculation being used. The following types of transpose functions are available for writing to and reading from the CRC data register: 1. CTRL[TOT] or CTRL[TOTR] is 00. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 748
= {reg[0:7], reg[8:15],reg[16:23], reg[24:31]} Figure 32-3. Transpose type 10 4. CTRL[TOT] or CTRL[TOTR] is 11. Bytes are transposed, but bits are not transposed. reg[31:0] becomes {reg[7:0], reg[15:8], reg[23:16], reg[31:24]} K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
CRC data register every time the CRC data register is read. When CTRL[FXOR] is cleared, reading the CRC data register accesses the raw checksum value. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
NIST-approved pseudo-random-number generator based on DES or SHA-1 and defined in NIST FIPS PUB 186-2 Appendix 3 and NIST FIPS PUB SP 800-90. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
(randomness) from the clocks and stores it in shift registers. Sleep The ring-oscillator clocks are inactive; RNGA does not generate entropy. 33.2.1 Entering Normal mode To enter Normal mode, write 0 to CR[SLP]. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
0) 4002_900C RNGA Output Register (RNG_OR) 0000_0000h 33.3.4/757 33.3.1 RNGA Control Register (RNG_CR) Controls the operation of RNGA. Address: 4002_9000h base + 0h offset = 4002_9000h Reset INTM CLRI Reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 754
Disabled Enabled Specifies whether random-data generation and loading (into OR[RANDOUT]) is enabled. NOTE: This field is sticky. You must reset RNGA to stop RNGA from loading OR[RANDOUT] with data. Disabled Enabled K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
NOTE: If you read OR[RANDOUT] when SR[OREG_LVL] is not 0, then the contents of a random number contained in OR[RANDOUT] are returned, and RNGA writes 0 to both OR[RANDOUT] and SR[OREG_LVL]. No words (empty) One word (valid) Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 756
Used only when high assurance is enabled (CR[HA]). Indicates that a security violation has occurred. NOTE: This field is sticky. To clear SR[SECV], you must reset RNGA. No security violation Security violation K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Reset RNG_OR field descriptions Field Description RANDOUT Random Output Stores a random-data word generated by RNGA. This is a read-only field. NOTE: Before reading RANDOUT, be sure it is valid (SR[OREG_LVL]=1). K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
OR when it is empty, RNGA returns all zeros and, if the interrupt is enabled, RNGA drives a request to the interrupt controller. Polling SR[OREG_LVL] is very important to make sure random values are present before reading from OR. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
2. Write 1 to CR[INTM], CR[HA], and CR[GO]. 3. Poll SR[OREG_LVL] until it is not 0. 4. When SR[OREG_LVL] is not 0, read the available random data from OR[RANDOUT]. 5. Repeat steps 3 and 4 as needed. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 760
Initialization/application information For application information, see Overview. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Output format in 2's complement 16-bit sign extended for differential modes • Output in right-justified unsigned format for single-ended • Single or continuous conversion, that is, automatic return to idle after single conversion K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Temperature sensor • Hardware average function • Selectable voltage reference: external or alternate • Self-Calibration mode 34.1.2 Block diagram The following figure is the ADC module block diagram. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The ADC module supports up to 4 pairs of differential inputs and up to 24 single-ended inputs. Each differential pair requires two inputs, DADPx and DADMx. The ADC also requires four supply/reference/ground connections. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
, and a ground reference that must be at the same potential as . The two pairs are external (V and V ) and alternate (V and V REFH REFL ALTH ALTL These voltage references are selected using SC2[REFSEL]. The alternate V ALTH K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
(ADC0_CLM1) ADC Minus-Side General Calibration Value Register 34.3.24/ 4003_B06C 0000_0020h (ADC0_CLM0) 34.3.1 ADC Status and Control Registers 1 (ADCx_SC1n) SC1A is used for both software and hardware trigger modes of operation. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 769
SC1B–SC1n registers do not initiate a new conversion. Address: Base address + 0h offset + (4d × i), where i=0d to 1d Reset AIEN DIFF ADCH Reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 770
When DIFF=0, AD6 is selected as input; when DIFF=1, it is reserved. 00111 When DIFF=0, AD7 is selected as input; when DIFF=1, it is reserved. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 771
Voltage reference selected is determined by SC2[REFSEL]. 11110 When DIFF=0,V is selected as input; when DIFF=1, it is reserved. Voltage reference REFSL selected is determined by SC2[REFSEL]. 11111 Module is disabled. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
When ADLSMP=1, the long sample time select bits, (ADLSTS[1:0]), can select the extent of the long sample time. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Configuration Register 2 (CFG2) selects the special high-speed configuration for very high speed conversions and selects the long sample time duration during long sample mode. Address: Base address + Ch offset Reset ADLSTS Reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The data result registers (Rn) contain the result of an ADC conversion of the channel selected by the corresponding status and channel control register (SC1A:SC1n). For every status and channel control register, there is a corresponding data result register. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 775
Address: Base address + 10h offset + (4d × i), where i=0d to 1d Reset ADCx_Rn field descriptions Field Description 31–16 This field is reserved. Reserved This read-only field is reserved and always has the value 0. Data result K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Address: Base address + 18h offset + (4d × i), where i=0d to 1d Reset ADCx_CVn field descriptions Field Description 31–16 This field is reserved. Reserved This read-only field is reserved and always has the value 0. Compare Value. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Conversion not in progress. Conversion in progress. Conversion Trigger Select ADTRG Selects the type of trigger used for initiating a conversion. Two types of trigger are selectable: Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 778
. This pair may be additional external pins or ALTH ALTL internal sources depending on the MCU configuration. See the chip configuration information for details specific to this MCU Reserved Reserved K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Calibration failed. ADC accuracy specifications are not guaranteed. 5–4 This field is reserved. Reserved This read-only field is reserved and always has the value 0. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Address: Base address + 28h offset Reset ADCx_OFS field descriptions Field Description 31–16 This field is reserved. Reserved This read-only field is reserved and always has the value 0. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
MG[15] and MG[14]. This register must be written by the user with the value described in the calibration procedure. Otherwise, the gain error specifications may not be met. For more information regarding the calibration procedure, please refer to the Calibration function section. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Address: Base address + 34h offset CLPD Reset ADCx_CLPD field descriptions Field Description 31–6 This field is reserved. Reserved This read-only field is reserved and always has the value 0. CLPD Calibration Value Calibration Value K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Address: Base address + 3Ch offset CLP4 Reset ADCx_CLP4 field descriptions Field Description 31–10 This field is reserved. Reserved This read-only field is reserved and always has the value 0. CLP4 Calibration Value Calibration Value K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Address: Base address + 44h offset CLP2 Reset ADCx_CLP2 field descriptions Field Description 31–8 This field is reserved. Reserved This read-only field is reserved and always has the value 0. CLP2 Calibration Value Calibration Value K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Address: Base address + 4Ch offset CLP0 Reset ADCx_CLP0 field descriptions Field Description 31–6 This field is reserved. Reserved This read-only field is reserved and always has the value 0. CLP0 Calibration Value Calibration Value K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Address: Base address + 58h offset CLMS Reset ADCx_CLMS field descriptions Field Description 31–6 This field is reserved. Reserved This read-only field is reserved and always has the value 0. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Address: Base address + 60h offset CLM3 Reset ADCx_CLM3 field descriptions Field Description 31–9 This field is reserved. Reserved This read-only field is reserved and always has the value 0. CLM3 Calibration Value Calibration Value K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Address: Base address + 68h offset CLM1 Reset ADCx_CLM1 field descriptions Field Description 31–7 This field is reserved. Reserved This read-only field is reserved and always has the value 0. CLM1 Calibration Value Calibration Value K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The ADC module has the capability of automatically comparing the result of a conversion with the contents of the CV1 and CV2 registers. The compare function is enabled by setting SC2[ACFE] and operates in any of the conversion modes and configurations. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
If the available clocks are too fast, the clock must be divided to the appropriate frequency. This divider is specified by CFG1[ADIV] and can be divide-by 1, 2, 4, or 8. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
ADHWT signal to trigger a new conversion. The channel and status fields selected for the conversion depend on the active trigger select signal: • ADHWTSA active selects SC1A. • ADHWTSn active selects SC1n. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
SC2[ADTRG]=1, and a hardware trigger select event, ADHWTSn, has occurred. The channel and status fields selected depend on the active trigger select signal: • ADHWTSA active selects SC1A. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 793
SC1n[COCO] sets only if the last of the selected number of conversions is completed and the compare condition is true. An interrupt is generated if the respective SC1n[AIEN] is high at the time that the respective SC1n[COCO] is set. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 794
CFG2[ADACKEN]=1, it remains active regardless of the state of the ADC or the MCU power mode. Power consumption when the ADC is active can be reduced by setting CFG1[ADLPC]. This results in a lower maximum value for f ADCK K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 795
2. When sampling is completed, the converter is isolated from the input channel and a successive approximation algorithm is applied to determine the digital value of the analog signal. 3. The result of the conversion is transferred to Rn upon completion of the conversion algorithm. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 797
• 10-bit mode, with the bus clock selected as the input clock source • The input clock divide-by-1 ratio selected • Bus frequency of 8 MHz • Long sample time disabled • High-speed conversion disabled K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 799
After the selected input is sampled and converted, the result is placed in an accumulator from which an average is calculated once the selected number of conversions have been completed. When hardware averaging is selected, the completion of a single conversion will not set SC1n[COCO]. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
CV1 And the result is less than or equal to CV2. Greater than Outside range, inclusive Compare true if the result is greater than or equal to CV1 Or the result is less than or equal to CV2. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Prior to calibration, the user must configure the ADC's clock source and frequency, low power configuration, voltage reference selection, sample time, and high speed configuration according to the application's clock source availability and needs. If the K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 802
7. Repeat the procedure for the minus-side gain calibration value. When calibration is complete, the user may reconfigure and use the ADC as desired. A second calibration may also be performed, if desired, by clearing and again setting SC3[CAL]. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
ADC error specifications may not be met. Storing the value generated by the calibration function in memory before overwriting with a user- specified value is recommended. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• m is referred as temperature sensor slope in the device data sheet. It is the hot or cold voltage versus temperature slope in V/°C. For temperature calculations, use the V and temperature sensor slope values from TEMP25 the ADC Electricals table. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
34.4.10 MCU Normal Stop mode operation Stop mode is a low-power consumption Standby mode during which most or all clock sources on the MCU are disabled. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Therefore, the module must be re-enabled and re-configured following exit from Low-Power Stop mode. NOTE For the chip specific modes of operation, see the power management information for the device. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
5. Update SC1:SC1n registers to select whether conversions will be single-ended or differential and to enable or disable conversion complete interrupts. Also, select the input channel which can be used to perform conversions. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 808
Bit 5 DIFF 0 Single-ended conversion selected. Bit 4:0 ADCH 00001 Input channel 1 selected as ADC input channel. RA = 0xxx Holds results of conversion. CV = 0xxx Holds compare value when compare function enabled. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Measurements. 34.6.1 External pins and routing 34.6.1.1 Analog supply pins Depending on the device, the analog power and ground supplies, V and V , of the ADC module are available as: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 810
V and V loop. The REFH REFL best external component to meet this current demand is a 0.1 μF capacitor with good K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
RAS + RADIN =SC / (FMAX * NUMTAU * CADIN) Figure 34-3. Sampling equation Where: RAS = External analog source resistance SC = Number of ADCK cycles used during sample window K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 812
REFL plane. • Operate the MCU in Wait or Normal Stop mode before initiating (hardware-triggered conversions) or immediately after initiating (hardware- or software-triggered conversions) the ADC conversion. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 813
12-bit modes. As a consequence, however, the code width of the first (0x000) conversion is only 1/2 LSB and the code width of the last (0xFF or 0x3FF) is 1.5 LSB. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 814
However, even small amounts of system noise can cause the converter to be indeterminate, between two codes, for a range of input voltages around the transition voltage. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 815
• Missing codes: Missing codes are those values never converted for any input value. In 8-bit or 10-bit mode, the ADC is guaranteed to be monotonic and have no missing codes. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
35.1.1 CMP features The CMP has the following features: • Operational over the entire supply range • Inputs may range from rail to rail • Programmable hysteresis control K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The 6-bit DAC has the following features: • 6-bit resolution • Selectable supply reference source • Power Down mode to conserve power when not in use • Option to route the output to internal comparator input K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Two 8-to-1 channel mux • Operational over the entire supply range 35.1.4 CMP, DAC and ANMUX diagram The following figure shows the block diagram for the High-Speed Comparator, DAC, and ANMUX modules. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Reference Input 6 Window ANMUX and filter control CMPO MSEL[2:0] Figure 35-1. CMP, DAC and ANMUX block diagram 35.1.5 CMP block diagram The following figure shows the block diagram for the CMP module. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 821
CR0[FILTER_CNT] is set greater than 0x01. • If CR1[SE] = 1, the external SAMPLE input is used as sampling clock • If CR1[SE] = 0, the divided bus clock is used as sampling clock K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
CMPx_CR0 field descriptions Field Description This field is reserved. Reserved This read-only field is reserved and always has the value 0. 6–4 Filter Sample Count FILTER_CNT Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
WE is cleared. However, avoid writing 1s to both field locations because this "11" case is reserved and may change in future implementations. Sampling mode is not selected. Sampling mode is selected. Windowing Enable Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 824
Enables the Analog Comparator module. When the module is not enabled, it remains in the off state, and consumes no power. When the user selects the same input from analog mux to the positive and negative port, the comparator is disabled automatically. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Enables the DMA transfer triggered from the CMP module. When this field is set, a DMA request is asserted when CFR or CFF is set. DMA is disabled. DMA is enabled. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Write Reset CMPx_DACCR field descriptions Field Description DAC Enable DACEN Enables the DAC. When the DAC is disabled, it is powered down to conserve power. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Minus Input Mux Control Determines which input is selected for the minus input of the comparator. For INx inputs, see CMP, DAC, and ANMUX block diagrams. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The external sample input is enabled using CR1[SE]. When set, the output of the comparator is sampled only on rising edges of the sample input. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 829
SAMPLE=1 to generate COUTA, which is then resampled and filtered to generate COUT. See the Windowed/Filtered mode (#7). All other combinations of CR1[EN], CR1[WE], CR1[SE], CR0[FILTER_CNT], and FPR[FILT_PER] are illegal. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 830
Filter Interrupt control block control select CMPO COUT To other system functions WINDOW/SAMPLE bus clock Clock COUTA CMPO to prescaler divided FILT_PER CGMUX clock Figure 35-3. Comparator operation in Continuous mode K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 831
In Sampled, Non-Filtered mode, the analog comparator block is powered and active. The path from analog inputs to COUTA is combinational unclocked. Windowing control is completely bypassed. COUTA is sampled whenever a rising-edge is detected on the filter block clock input. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 832
COUTA is sampled whenever a rising edge is detected on the filter block clock input. The only difference in operation between Sampled, Non-Filtered (# 3A) and Sampled, Filtered (# 4A) is that, now, CR0[FILTER_CNT]>1, which activates filter operation. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 833
CMPO COUT To other SOC functions WINDOW/SAMPLE bus clock Clock COUTA CMPO to prescaler divided FILT_PER CGMUX clock SE=1 Figure 35-6. Sampled, Filtered (# 4A): sampling point externally driven K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 834
WINDOW signal is high. In actual operation, COUTA may lag the analog inputs by up to one bus clock cycle plus the combinational path delay through the comparator and polarity select logic. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 835
COUTA Clock CMPO to divided prescaler FILT_PER CGMUX clock SE=0 Figure 35-9. Windowed mode For control configurations which result in disabling the filter block, see Filter Block Bypass Logic diagram. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 836
FPR[FILT_PER] and the bus clock rate. Configuration for this mode is virtually identical to that for the Windowed/Filtered Mode shown in the next section. The only difference is that the value of CR0[FILTER_CNT] must be 1. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Figure 35-11. Windowed/Filtered mode 35.3.2 Power modes 35.3.2.1 Wait mode operation During Wait and VLPW modes, the CMP, if enabled, continues to operate normally and a CMP interrupt can wake the MCU. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The filter delay is specified in the Low-pass filter. • During operation, the propagation delay of the selected data paths must always be considered. It may take many bus clock cycles for COUT and SCR[CFR]/SCR[CFF] K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
In other words, SCR[COUT] will be 0 for some initial period, even when COUTA is at logic 1. Setting both CR1[SE] and FPR[FILT_PER] to 0 disables the filter and eliminates switching current associated with the filtering process. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 840
> 0x01 Sampled, Filtered mode + (CR0[FILTER_CNT] * ) + T SAMPLE > 0x01 > 0x00 + (CR0[FILTER_CNT] * FPR[FILT_PER] x T ) + T Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
DMA transfer request and clears the flag to allow a subsequent change on comparator output to occur and force another DMA request. The comparator can remain functional in STOP modes. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
STOP modes. After the data transfer has finished, system will go back to STOP modes. Refer to DMA chapters in the device reference manual for the asynchronous DMA function for details. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This section provides DAC functional description information. 35.8.1 Voltage reference source select • V connects to the primary voltage source as supply reference of 64 tap resistor ladder • V connects to an alternate voltage source K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This module has a single reset input, corresponding to the chip-wide peripheral reset. 35.10 DAC clocks This module has a single clock input, the bus clock. 35.11 DAC interrupts This module has no interrupts. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Static operation in Normal Stop mode • 16-word data buffer supported with configurable watermark and multiple operation modes • DMA support 36.3 Block diagram The block diagram of the DAC module is as follows: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
DACBFRP & DACBBIEN DACBFMD DACTRGSE Figure 36-1. DAC block diagram 36.4 Memory map/register definition The DAC has registers to control analog comparator and programmable voltage divider to perform the digital-to-analog functions. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 847
DAC Control Register 1 (DAC1_C1) 36.4.5/852 4002_8023 DAC Control Register 2 (DAC1_C2) 36.4.6/853 4003_F000 DAC Data Low Register (DAC0_DAT0L) 36.4.1/849 4003_F001 DAC Data High Register (DAC0_DAT0H) 36.4.2/849 Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 848
DAC Data High Register (DAC0_DAT15H) 36.4.2/849 4003_F020 DAC Status Register (DAC0_SR) 36.4.3/850 4003_F021 DAC Control Register (DAC0_C0) 36.4.4/851 4003_F022 DAC Control Register 1 (DAC0_C1) 36.4.5/852 4003_F023 DAC Control Register 2 (DAC0_C2) 36.4.6/853 K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
When the DAC Buffer is not enabled, DATA[11:0] controls the output voltage based on the following formula. V * (1 + DACDAT0[11:0])/4096 When the DAC buffer is enabled, DATA[11:0] is mapped to the 16-word buffer. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
DAC trigger making the DAC read pointer increase. Write to this bit is ignored in FIFO mode. The DAC buffer read pointer is not equal to C2[DACBFUP]. The DAC buffer read pointer is equal to C2[DACBFUP]. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The DAC buffer read pointer top flag interrupt is disabled. The DAC buffer read pointer top flag interrupt is enabled. DAC Buffer Read Pointer Bottom Flag Interrupt Enable DACBBIEN Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Buffer read pointer is disabled. The converted data is always the first word of the buffer. Buffer read pointer is enabled. The converted data is the word that the read pointer points to. It means converted data can be from any word of the buffer. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
When both the DAC and the buffer are enabled, the DAC converts the data in the data buffer to analog output voltage. The data buffer read pointer advances to the next word whenever a hardware or software trigger event occurs. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 854
FIFO access, address bit[1] needs to be 0; otherwise, the write is ignored. For any 32bit FIFO access, the Write_Pointer needs to be an EVEN number; otherwise, the write is ignored. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
During reset, the DAC is configured in the default mode and is disabled. 36.5.4 Low-Power mode operation The following table shows the wait mode and the stop mode operation of the DAC module. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 856
In low-power stop modes, the DAC is fully shut down. NOTE The assignment of module modes to core modes is chip- specific. For module-to-core mode assignments, see the chapter that describes how modules are configured. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
ADC, DAC, or CMP. The voltage reference has three operating modes that provide different levels of supply rejection and power consumption. The following figure is a block diagram of the Voltage Reference. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
37.1.2 Features The Voltage Reference has the following features: • Programmable trim register with 0.5 mV steps, automatically loaded with factory trimmed value upon reset • Programmable buffer mode selection: • Off K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The following table shows the Voltage Reference signals properties. Table 37-1. VREF Signal Descriptions Signal Description VREF_OUT Internally-generated Voltage Reference output NOTE When the VREF output buffer is disabled, the status of the VREF_OUT signal is high-impedence. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
NOTE: Min = minimum and max = maximum voltage reference output. For minimum and maximum voltage reference output values, refer to the Data Sheet for this chip. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Internal 1.75 V regulator is enabled. Second order curvature compensation enable ICOMPEN This bit should be written to 1 to achieve the performance stated in the data sheet. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
100 nF capacitor is required. Voltage Reference enabled, VREF_OUT available for low power buffer on internal and external use. 100 nF capacitor is required. Reserved Reserved K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
(Tstup) and the value is specified in the appropriate device data sheet. If this mode is entered when the VREF module is enabled then you must wait the longer of K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The TRM[CHOPEN], SC[REGEN] and SC[ICOMPEN] bits must be written to 1 to achieve the performance stated in the device data sheet. NOTE See section "Internal voltage regulator" for details on the required sequence to enable the internal regulator. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Trigger outputs can be enabled or disabled independently • One 16-bit delay register per pre-trigger output • Optional bypass of the delay registers of the pre-trigger outputs • Operation in One-Shot or Continuous modes K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• y—Pulse-Out number, valid value is from 0 to Y-1. NOTE The number of module output triggers to core is chip-specific. For module to core output triggers implementation, see the chip configuration information. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
38.1.4 DAC External Trigger Input Connections The implementation of DAC external trigger inputs is chip-specific. See the chip configuration information for details. 38.1.5 Block diagram This diagram illustrates the major components of the PDB. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 870
In this diagram, only one PDB channel n, one DAC interval trigger x, and one Pulse-Out y are shown. The PDB-enabled control logic and the sequence error interrupt logic are not shown. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
External Trigger Input Source If the PDB is enabled and external trigger input source is selected, a positive edge on the EXTRG signal resets and starts the counter. 38.3 Memory map and register definition K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Enables the PDB sequence error interrupt. When this field is set, any of the PDB channel sequence error flags generates a PDB sequence error interrupt. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 874
1011 Trigger-In 11 is selected. 1100 Trigger-In 12 is selected. 1101 Trigger-In 13 is selected. 1110 Trigger-In 14 is selected. 1111 Software trigger is selected. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 875
• LDOK is automatically cleared when the values in the internal buffers are loaded into the registers or when PDBEN bit (PDB Enable) is cleared. • Writing 0 to LDOK has no effect. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
PDBx_CNT field descriptions Field Description 31–16 This field is reserved. Reserved This read-only field is reserved and always has the value 0. PDB Counter Contains the current value of the counter. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Description 31–24 This field is reserved. Reserved This read-only field is reserved and always has the value 0. 23–16 PDB Channel Pre-Trigger Back-to-Back Operation Enable Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This read-only field is reserved and always has the value 0. PDB Channel Sequence Error Flags Only the lower M bits are implemented in this MCU. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Specifies the delay value for the channel's corresponding pre-trigger. The pre-trigger asserts when the counter is equal to DLY. Reading this field returns the value of internal register that is effective for the current PDB cycle. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
PDBx_DACINTCn field descriptions Field Description 31–2 This field is reserved. Reserved This read-only field is reserved and always has the value 0. DAC External Trigger Input Enable Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Specifies the interval value for DAC interval trigger. DAC interval trigger triggers DAC[1:0] update when the DAC interval counter is equal to the DACINT. Reading this field returns the value of internal register that is effective for the current PDB cycle. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Specifies the delay 2 value for the PDB Pulse-Out. Pulse-Out goes low when the PDB counter is equal to the DLY2. Reading this field returns the value of internal register that is effective for the current PDB cycle. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The waveforms shown in the following diagram show the pre-trigger and trigger outputs of PDB channel n. The delays can be independently set using the CHnDLYm registers, and the pre-triggers can be enabled or disabled in CHnC1[EN[m]]. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 884
A PDB interrupt can be generated if SC[PDBIE] is set and SC[DMAEN] is cleared. If SC[DMAEN] is set, then the PDB requests a DMA transfer when the SC[PDBIF] flag is set. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
ADC pre-trigger/trigger outputs and Pulse-Out generation have the same time base, because they both share the PDB counter. The pulse-out connections implemented in this MCU are described in the device's chip configuration details. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The following registers control the timing of the PDB operation; and in some of the applications, they may need to become effective at the same time. • PDB Modulus register (MOD) • PDB Interrupt Delay register (IDLY) • PDB Channel n Delay m register (CHnDLYm) K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 887
The following diagrams show the cases of the internal registers being updated with SC[LDMOD] is 00 and x1. CHnDLY1 CHnDLY0 PDB counter SC[LDOK] Ch n pre-trigger 0 Ch n pre-trigger 1 Figure 38-4. Registers update with SC[LDMOD] = 00 K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
SC[PDBEIE] = 1 38.4.6 DMA If SC[DMAEN] is set, PDB can generate a DMA transfer request when SC[PDBIF] is set. When DMA is enabled, the PDB interrupt is not issued. 38.5 Application information K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 889
If the applications need a really long delay value and use a prescaler set to 128, then the resolution would be limited to 128 peripheral clock cycles. Therefore, use the lowest possible prescaler and multiplication factor for a given application. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Prescaler divide-by 1, 2, 4, 8, 16, 32, 64, or 128 • 16-bit counter • It can be a free-running counter or a counter with initial and final value • The counting can be up or up-down K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Dual edge capture for pulse and period width measurement • Quadrature decoder with input filters, relative position counting, and interrupt on position count or capture of position count on external event K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
For example, if a module instance supports only six channels, references to channel numbers 6 and 7 do not apply for that instance. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This section presents a high-level summary of the FTM registers and how they are mapped. The registers and bits of an unavailable function in the FTM remain in the memory map and in the reset value, but they have no active function. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
0000_0000h 39.3.7/909 4002_6044 Channel (n) Status And Control (FTM3_C7SC) 0000_0000h 39.3.6/906 4002_6048 Channel (n) Value (FTM3_C7V) 0000_0000h 39.3.7/909 4002_604C Counter Initial Value (FTM3_CNTIN) 0000_0000h 39.3.8/909 Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 898
4003_800C Channel (n) Status And Control (FTM0_C0SC) 0000_0000h 39.3.6/906 4003_8010 Channel (n) Value (FTM0_C0V) 0000_0000h 39.3.7/909 4003_8014 Channel (n) Status And Control (FTM0_C1SC) 0000_0000h 39.3.6/906 Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 899
Input Capture Filter Control (FTM0_FILTER) 0000_0000h 39.3.20/ 4003_807C Fault Control (FTM0_FLTCTRL) 0000_0000h 39.3.21/ 4003_8080 Quadrature Decoder Control And Status (FTM0_QDCTRL) 0000_0000h 39.3.22/ 4003_8084 Configuration (FTM0_CONF) 0000_0000h Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 900
Synchronization (FTM1_SYNC) 0000_0000h 39.3.12/ 4003_905C Initial State For Channels Output (FTM1_OUTINIT) 0000_0000h 39.3.13/ 4003_9060 Output Mask (FTM1_OUTMASK) 0000_0000h 39.3.14/ 4003_9064 Function For Linked Channels (FTM1_COMBINE) 0000_0000h Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 901
4003_A034 Channel (n) Status And Control (FTM2_C5SC) 0000_0000h 39.3.6/906 4003_A038 Channel (n) Value (FTM2_C5V) 0000_0000h 39.3.7/909 4003_A03C Channel (n) Status And Control (FTM2_C6SC) 0000_0000h 39.3.6/906 Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
TOF remains set indicating an overflow has occurred. In this case, a TOF interrupt request is not lost due to the clearing sequence for a previous TOF. FTM counter has not overflowed. FTM counter has overflowed. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Reset clears the CNT register. Writing any value to COUNT updates the counter with its initial value, CNTIN. When BDM is active, the FTM counter is frozen. This is the value that you may read. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Address: Base address + 8h offset Reserved Reset FTMx_MOD field descriptions Field Description 31–16 This field is reserved. Reserved Modulo Value K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
(set on channel (n) match, and clear on channel (n+1) match) Low-true pulses (clear on channel (n) match, and set on channel (n +1) match) Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 908
FTM counter is not reset when the selected channel (n) input event is detected. FTM counter is reset when the selected channel (n) input event is detected. DMA Enable Enables DMA transfers for the channel. Disable DMA transfers. Enable DMA transfers. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
FTM counter starts with the value 0x0000. To avoid this behavior, before the first write to select the FTM clock, write the new value to the the CNTIN register and then initialize the FTM counter by writing any value to the CNT register. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
CHnF remains set indicating an event has occurred. In this case, a CHnF interrupt request is not lost due to the clearing sequence for a previous CHnF. Address: Base address + 50h offset Reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 911
Channel 3 Flag CH3F See the register description. No channel event has occurred. A channel event has occurred. Channel 2 Flag CH2F See the register description. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• Capture Test mode • PWM synchronization • Write protection • Channel output initialization These controls relate to all channels within this module. Address: Base address + 54h offset Reset FAULTM INIT Reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 913
The INIT bit is always read as 0. FTM Enable FTMEN This field is write protected. It can be written only when MODE[WPDIS] = 1. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The synchronization event selection also depends on the PWMSYNC (MODE register) and SYNCMODE (SYNCONF register) bits. See synchronization. Address: Base address + 58h offset Reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 915
The REINIT bit configures the synchronization when SYNCMODE is zero. FTM counter continues to count normally. FTM counter is updated with its initial value when the selected trigger is detected. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Selects the value that is forced into the channel output when the initialization occurs. The initialization value is 0. The initialization value is 1. Channel 6 Output Initialization Value CH6OI Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This feature is used for BLDC control where the PWM signal is presented to an electric motor at specific times to provide electronic commutation. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 918
Channel output is masked. It is forced to its inactive state. Channel 3 Output Mask CH3OM Defines if the channel output is masked or unmasked. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Dual Edge Capture mode, Complementary, and Combine mode for each pair of channels (n) and (n+1), where n equals 0, 2, 4, and 6. Address: Base address + 64h offset Reset Reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 920
This field is write protected. It can be written only when MODE[WPDIS] = 1. The channel (n+1) output is the same as the channel (n) output. The channel (n+1) output is the complement of the channel (n) output. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 921
The Dual Edge Capture mode in this pair of channels is disabled. The Dual Edge Capture mode in this pair of channels is enabled. Complement Of Channel (n) For n = 4 COMP2 Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 922
Enables the Dual Edge Capture mode in the channels (n) and (n+1). This bit reconfigures the function of MSnA, ELSnB:ELSnA and ELS(n+1)B:ELS(n+1)A bits in Dual Edge Capture mode according to Table 39-2. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 923
DECAP bit is cleared automatically by hardware if dual edge capture – one-shot mode is selected and when the capture of channel (n+1) event is made. The dual edge captures are inactive. The dual edge captures are active. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Selects the division factor of the system clock. This prescaled clock is used by the deadtime counter. This field is write protected. It can be written only when MODE[WPDIS] = 1. Divide the system clock by 1. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Several channels can be selected to generate multiple triggers in one PWM period. See Channel trigger output Initialization trigger. Channels 6 and 7 are not used to generate channel triggers. Address: Base address + 6Ch offset Reserved Reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 926
Enables the generation of the channel trigger when the FTM counter is equal to the CnV register. The generation of the channel trigger is disabled. The generation of the channel trigger is enabled. Channel 5 Trigger Enable CH5TRIG Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
That is, the safe value of a channel is the value of its POL bit. Address: Base address + 70h offset Reserved Reset Reserved POL7 POL6 POL5 POL4 POL3 POL2 POL1 POL0 Reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 928
Channel 1 Polarity POL1 Defines the polarity of the channel output. This field is write protected. It can be written only when MODE[WPDIS] = 1. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
39.3.18 Fault Mode Status (FTMx_FMS) This register contains the fault detection flags, write protection enable bit, and the logic OR of the enabled fault inputs. Address: Base address + 74h offset Reset Reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 930
Writing a 1 to FAULTF2 has no effect. FAULTF2 bit is also cleared when FAULTF bit is cleared. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Writing to the FILTER register has immediate effect and must be done only when the channels 0, 1, 2, and 3 are not in input modes. Failure to do this could result in a missing valid signal. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
39.3.20 Fault Control (FTMx_FLTCTRL) This register selects the filter value for the fault inputs, enables the fault inputs and the fault inputs filter. Address: Base address + 7Ch offset Reset FFVAL Reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 933
Enables the fault input. This field is write protected. It can be written only when MODE[WPDIS] = 1. Fault input is disabled. Fault input is enabled. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 934
Fault Input 0 Enable FAULT0EN Enables the fault input. This field is write protected. It can be written only when MODE[WPDIS] = 1. Fault input is disabled. Fault input is enabled. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
CH0FVAL field of FILTER. The phase A filter is also disabled when CH0FVAL is zero. Phase A input filter is disabled. Phase A input filter is enabled. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 936
The Quadrature Decoder mode has precedence over the other modes. See Table 39-2. This field is write protected. It can be written only when MODE[WPDIS] = 1. Quadrature Decoder mode is disabled. Quadrature Decoder mode is enabled. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Selects the FTM behavior in BDM mode. See mode. This field is reserved. Reserved This read-only field is reserved and always has the value 0. NUMTOF TOF Frequency Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Fault Input 2 Polarity FLT2POL Defines the polarity of the fault input. This field is write protected. It can be written only when MODE[WPDIS] = 1. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Reset INVC Reset FTMx_SYNCONF field descriptions Field Description 31–21 This field is reserved. Reserved This read-only field is reserved and always has the value 0. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 940
The software trigger activates the FTM counter synchronization. Synchronization Mode SYNCMODE Selects the PWM Synchronization mode. Legacy PWM synchronization is selected. Enhanced PWM synchronization is selected. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
This register has a write buffer. The INVmEN bit is updated by the INVCTRL register synchronization. Address: Base address + 90h offset Reset K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• The CHnOCV bits select the value that is forced at the corresponding channel (n) output. This register has a write buffer. The fields are updated by the SWOCTRL register synchronization. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 943
The software output control forces 0 to the channel output. The software output control forces 1 to the channel output. Channel 0 Software Output Control Value CH0OCV Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 944
The channel output is affected by software output control. Channel 0 Software Output Control Enable CH0OC The channel output is not affected by software output control. The channel output is affected by software output control. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Include the channel in the matching process. Channel 5 Select CH5SEL Do not include the channel in the matching process. Include the channel in the matching process. Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Include the channel in the matching process. 39.4 Functional description The notation used in this document to represent the counters and the generation of the signals is shown in the following figure. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
FTM information for further details. Due to FTM hardware implementation limitations, the frequency of the fixed frequency clock must not exceed 1/2 of the system clock frequency. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The FTM counter has these modes of operation: • Up counting • Up-down counting • Quadrature Decoder mode 39.4.3.1 Up counting Up counting is selected when: • QUADEN = 0, and • CPWMS = 0 K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 949
FTM counting is up and signed. CNTIN[15] = 0 and CNTIN ≠ 0x0000 The initial value of the FTM counter is a positive number, so the FTM counting is up and unsigned. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 950
• Setting CNTIN to be greater than the value of MOD is not recommended as this unusual setting may make the FTM operation difficult to comprehend. However, there is no restriction on this configuration, and an example is shown in the following figure. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 951
The TOF bit is set when the FTM counter changes from MOD to (MOD – 1). If (CNTIN = 0x0000), the FTM counting is equivalent to TPM up-down counting, that is, up-down and unsigned counting. See the following figure. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 952
0x0000 0x0001 0x0002 0x0003 0x0004 0x0005 0x0006 FTM counter TOF bit set TOF bit Figure 39-8. Example when the FTM counter is free running The FTM counter is also a free running counter when: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
While in BDM, the input capture function works as configured. When a selected edge event occurs, the FTM counter value, which is frozen because of BDM, is captured into the CnV register and the CHnF bit is set. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 955
As long as the new state is stable on the input, the counter continues to increment. When the counter is equal to CHnFVAL[3:0], the state change of the input signal is validated. It is then transmitted as a pulse edge to the edge detector. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 956
The figure below shows an example of input capture with filter enabled and the delay added by each part of the input capture logic. Note that the input signal is delayed only by the synchronizer and edge dector logic if the filter is disabled. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 957
The figure below shows the FTM counter reset when the selected input capture event is detected in a channel in input capture mode with ICRST = 1. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The CHnF bit is set and the channel (n) interrupt is generated if CHnIE = 1 at the channel (n) match (FTM counter = CnV). K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
CHnF bit is set and the channel (n) interrupt is generated if CHnIE = 1, however the channel (n) output is not modified and controlled by FTM. 39.4.6 Edge-Aligned PWM (EPWM) mode The Edge-Aligned mode is selected when: • QUADEN = 0 K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 960
If (ELSnB:ELSnA = X:1), then the channel (n) output is forced low at the counter overflow when the CNTIN register value is loaded into the FTM counter, and it is forced high at the channel (n) match (FTM counter = CnV). See the following figure. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
0x0001 to 0x7FFF because values outside this range can produce ambiguous results. In the CPWM mode, the FTM counter counts up until it reaches MOD and then counts down until it reaches CNTIN. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 962
If (ELSnB:ELSnA = X:1), then the channel (n) output is forced low at the channel (n) match (FTM counter = CnV) when counting down, and it is forced high at the channel (n) match when counting up. See the following figure. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
(n) match (FTM counter = C(n)V). The CH(n+1)F bit is set and the channel (n +1) interrupt is generated, if CH(n+1)IE = 1, at the channel (n+1) match (FTM counter = C(n+1)V). K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 965
0% duty cycle channel (n) output with ELSnB:ELSnA = X:1 Figure 39-29. Channel (n) output if (CNTIN < C(n)V < MOD) and (C(n)V is Almost Equal to CNTIN) and (C(n+1)V = MOD) K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 966
0% duty cycle with ELSnB:ELSnA = 1:0 channel (n) output 100% duty cycle with ELSnB:ELSnA = X:1 Figure 39-31. Channel (n) output if C(n)V and C(n+1)V are not between CNTIN and MOD K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
(n+1) match occurs, that is, FTM counter = C(n+1)V. So, Combine mode allows the generation of asymmetrical PWM signals. 39.4.9 Complementary mode The Complementary mode is selected when: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
COMP = 1 Figure 39-42. Channel (n+1) output in Complementary mode with (ELSnB:ELSnA = X:1) NOTE The complementary mode is not available in Output Compare mode. 39.4.10 Registers updated from write buffers K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 972
When CnV register is written, independent of FTMEN bit. • CLKS[1:0] ≠ 0:0, and According to the selected mode, that is: • FTMEN = 0 Table continues on the next page... K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
If (HWTRIGMODE = 0) then the TRIGn bit is cleared when 0 is written to it or when the trigger n event is detected. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 974
Boundary cycle and loading points and the following figure. If (PWMSYNC = 0) and (REINIT = 1) then SWSYNC bit is cleared when the software trigger event occurs. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 975
For both counting modes, if neither CNTMIN nor CNTMAX are 1, then the boundary cycles are not used as loading points for registers updates. See the register synchronization descriptions in the following sections for details. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 976
= 0). However, it is expected that the MOD register be synchronized only by the enhanced PWM synchronization. In the case of enhanced PWM synchronization, the MOD register synchronization depends on SWWRBUF, SWRSTCNT, HWWRBUF, and HWRSTCNT bits according to this flowchart: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 977
If the trigger event was a software trigger, then the SWSYNC bit is cleared on the next selected K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 978
SWSYNC bit is cleared according to the following example. If the trigger event was a hardware trigger, then the TRIGn bit is cleared according to Hardware trigger. Examples with software and hardware triggers follow. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 979
1 to SWSYNC bit SWSYNC bit software trigger event selected loading point MOD register is updated Figure 39-51. MOD synchronization with (SYNCMODE = 0) and (PWMSYNC = 1) K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 980
SYNCMODE = 0). However, it is expected that the OUTMASK register be synchronized only by the enhanced PWM synchronization. In the case of enhanced PWM synchronization, the OUTMASK register synchronization depends on SWOM and HWOM bits. See the following flowchart: K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 981
? clear TRIGn bit Figure 39-52. OUTMASK register synchronization flowchart In the case of legacy PWM synchronization, the OUTMASK register synchronization depends on PWMSYNC bit according to the following description. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 982
If (SYNCMODE = 0), (SYNCHOM = 1), and (PWMSYNC = 1), then this synchronization is made on the next enabled hardware trigger. The TRIGn bit is cleared according to Hardware trigger. An example with a hardware trigger follows. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 983
PWM synchronization (INVC = 1 and SYNCMODE = 1) according to the following flowchart. In the case of enhanced PWM synchronization, the INVCTRL register synchronization depends on SWINVC and HWINVC bits. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 984
HWTRIGMODE bit ? clear TRIGn bit Figure 39-56. INVCTRL register synchronization flowchart 39.4.11.9 SWOCTRL register synchronization The SWOCTRL register synchronization updates the SWOCTRL register with its buffer value. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 985
? bit ? wait hardware trigger n update SWOCTRL with its buffer value update SWOCTRL with its buffer value HWTRIGMODE bit ? clear TRIGn bit Figure 39-57. SWOCTRL register synchronization flowchart K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 986
= 0). However, the FTM counter must be synchronized only by the enhanced PWM synchronization. In the case of enhanced PWM synchronization, the FTM counter synchronization depends on SWRSTCNT and HWRSTCNT bits according to the following flowchart. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 987
SWSYNC bit is cleared according to the following example. If the trigger event was a hardware trigger then the TRIGn bit is cleared according to Hardware trigger. Examples with software and hardware triggers follow. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 988
Figure 39-62. FTM counter synchronization with (SYNCMODE = 0), (HWTRIGMODE = 0), (REINIT = 1), (PWMSYNC = 1), and a hardware trigger was used K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
NOTE INV(m) bit selects the inverting to the pair channels (n) and (n+1). Figure 39-63. Channels (n) and (n+1) outputs after the inverting in High-True (ELSnB:ELSnA = 1:0) Combine mode K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
The software output control forces the channel output according to software defined values at a specific time in the PWM generation. The software output control is selected when: • QUADEN = 0 • DECAPEN = 0, and • CHnOC = 1 K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 991
Software output control forces the following values on channels (n) and (n+1) when the COMP bit is one. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
If POL(n) = 1, POL(n+1) = 1, and the deadtime is enabled, then when the channel (n) match (FTM counter = C(n)V) occurs, the channel (n) output remains at the high value until the end of the deadtime delay when the channel (n) output is cleared. Similarly, K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 993
• The deadtime feature must be used only in Complementary mode. • The deadtime feature is not available in Output Compare mode. 39.4.14.1 Deadtime insertion corner cases If (PS[2:0] is cleared), (DTPS[1:0] = 0:0 or DTPS[1:0] = 0:1): K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 994
Figure 39-69. Example of the deadtime insertion (ELSnB:ELSnA = 1:0, POL(n) = 0, and POL(n+1) = 0) when the deadtime delay is comparable to channels (n) and (n+1) duty cycle K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Table 39-10. Output mask result for channel (n) before the polarity control CHnOM Output Mask Input Output Mask Result inactive state inactive state active state active state inactive state inactive state active state K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
FAULTFn* control detector Fault filter (5-bit counter) system clock * where n = 3, 2, 1, 0 Figure 39-71. Fault input n control block diagram K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 997
If the automatic fault clearing is selected (FAULTM[1:0] = 1:1), then the channels output disabled by fault control is again enabled when the fault input signal (FAULTIN) returns to zero and a new PWM cycle begins. See the following figure. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
Page 998
If the manual fault clearing is selected (FAULTM[1:0] = 0:1 or 1:0), then the channels output disabled by fault control is again enabled when the FAULTF bit is cleared and a new PWM cycle begins. See the following figure. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
• If POLn = 1, the channel (n) output polarity is low, so the logical zero is the active state and the logical one is the inactive state. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 NXP Semiconductors...
See the description of the CLKS field in the Status and Control register. 39.4.19 Features priority The following figure shows the priority of the features used at the generation of channels (n) and (n+1) outputs signals. K22F Sub-Family Reference Manual, Rev. 4, 08/2016 1000 NXP Semiconductors...
Need help?
Do you have a question about the K22F series and is the answer not in the manual?
Questions and answers