TWR K20D50M Tower Module User's Manual

 TWR‐K20D50M Tower Module User’s Manual TWR‐K20D50M‐UM Rev. 1.1 Freescale Semiconductor Inc. Microcontroller Solutions Group | Table of Contents 1 TWR­K20D50M ........................................................................................................................................ 3 2 Contents ...................................................................................................................................................... 4 3 TWR­K20D50M Features ...................................................................................................................... 4 4 Get to Know the TWR­K20D50M ........................................................................................................ 5 5 Reference Documents ............................................................................................................................ 6 6 Hardware description ............................................................................................................................ 7 6.1 Block Diagram ...................................................................................................................................................................... 7 6.2 Microcontroller .................................................................................................................................................................... 7 6.3 Clocking ................................................................................................................................................................................... 9 6.4 System Power .................................................................................................................................................................... 10 6.5 Debug Interface ................................................................................................................................................................ 10 6.6 OSJTAG ................................................................................................................................................................................. 10 6.7 Infrared Port ...................................................................................................................................................................... 11 6.8 Accelerometer ................................................................................................................................................................... 12 6.9 Potentiometer, Pushbuttons, LEDs .............................................................. Error! Bookmark not defined. 6.10 Microphone ...................................................................................................................................................................... 12 6.11 General Purpose Tower Plug‐in (TWRPI) Socket ............................................................................................ 13 6.12 Accelerometer ................................................................................................... Error! Bookmark not defined. 6.13 Potentiometer, Pushbuttons, LEDs ........................................................................................................................ 13 6.14 Touch Interface .............................................................................................................................................................. 14 6.15 USB ...................................................................................................................................................................................... 15 7 Jumper options ...................................................................................................................................... 15 8 Useful links ............................................................................................................................................. 18 TWRK20D50M Tower Module User’s Manual Page 2 of 19 | 1
TWR­K20D50M The TWR‐K20D50M microcontroller module is designed to work either in standalone mode or as part of the Freescale Tower System, a modular development platform that enables rapid prototyping and tool re‐use through reconfigurable hardware. Take your design to the next level and begin constructing your Tower System today by visiting www.freescale.com/tower for additional Tower System microcontroller modules and compatible peripherals. For TWR‐K20D50M specific information and updates visit www.freescale.com/TWR‐K20D50M
Figure 1 Freescale Tower System Overview TWRK20D50M Tower Module User’s Manual Page 3 of 19 | 2
Contents The TWR‐K20D50M contents include: • TWR‐K20D50M board assembly • 3ft A to mini‐B USB cable for debug interface and power • 3ft A to micro‐B USB cable for MK20DX128VLH5 USB interface • Micro‐B to A adapter for MK20DX128VLH5 USB Host applications • Quick Start Guide TWR­K20D50M Features 3
•
Tower compatible microcontroller module •
MK20DX128VLH5 MCU (50 MHz, 128KB Flash, 16 KB RAM, 32 KB FlexNVM, Low power, 64LQFP package
•
•
•
•
•
•
•
•
•
•
•
•
•
Dual role USB interface with Micro‐AB USB connector Touch Tower Plug‐in Socket General purpose Tower Plug‐in (TWRPI) socket On‐board debug circuit MC9S08JM60 open source JTAG (OSJTAG) with virtual serial port Three axis accelerometer (MMA8451Q) Four (4) user‐controllable LEDs Two (2) capacitive touch pads Two (2) user pushbutton switch Infrared transmit and receive Potentiometer Microphone (ADC) Buzzer Battery backup for RTC TWRK20D50M Tower Module User’s Manual Page 4 of 19 | 4
Get to Know the TWR­K20D50M VBat options GPIO Header
buzzer enable RESET
General Purpose TWRPI Plug‐In TWRPI TOUCH
Microphone Enable options 2
Potentiometer LED Green & Blue
Power/OSJTAG mini‐AB USB TSI Electrodes
LED Orange & Yellow
Enable options 1
SW2 SW3 JTAG
K20 MicroUSB Regulator Option Selector selector
JM60 BDM JM60 Bootloader Enable Board power selection
Figure 2 Front side of TWR‐K20D50M module (TWRPI devices not shown) TWRK20D50M Tower Module User’s Manual Page 5 of 19 | Buzzer
Accelerometer Battery Holder
Infrared port Figure 3 Back side of TWR‐K20D50M 5
Reference Documents The documents listed below should be referenced for more information on the Kinetis family, Tower System, and MCU Modules. These can be found in the documentation section of http://www.freescale.com/TWR‐
K20D50M or http://www.freescale.com/kinetis • TWRK20D50MQSG: Quick Start Guide • TWR‐K20D50M‐SCH: Schematics • TWR‐K20D50M‐PWA: Design Package • K20P64M50SF0RM Reference Manual • Tower Configuration Tool • Tower Mechanical Drawing TWRK20D50M Tower Module User’s Manual Page 6 of 19 | 6
Hardware description The TWR‐K20D50M is a Tower MCU Module featuring the MK20DX128VLH5—a Kinetis microcontroller with USB 2.0 full‐speed OTG controllers in a 64 LQFP package. It is intended for use in the Freescale Tower System but can operate stand‐alone. An on‐board debug circuit, OSJTAG, provides a JTAG interface and a power supply input through a single USB mini‐AB connector. The block diagram of the TWR‐K20D50M board is presented in the following figure: 6.1 Block Diagram Figure 4 Block Diagram of TWR‐K20D50M 6.2 Microcontroller The TWR‐K20D50M features the MK20DX128VLH5. This 50 MHz microcontroller is part of the Kinetis K20 family and is available in a 64 LQFP package. The following table notes the features of MK20DX128VLH5. TWRK20D50M Tower Module User’s Manual Page 7 of 19 | Table 1 Features of MK20DX128VLH5 Feature Description Ultra low power ‐11 low‐power modes with power and clock gating for optimal peripheral activity and recovery times. Stop currents of <190 nA (VLLS0), run currents of <280 uA/MHz, 4 µs wake‐up from Stop mode ‐Full memory and analog operation down to 1.71V for extended battery life ‐Low‐leakage wake‐up unit with up to eight internal modules and sixteen pins as wake‐up sources in low‐leakage stop (LLS)/very low‐leakage stop (VLLS) modes ‐Low‐power timer for continual system operation in reduced power states Flash, SRAM and FlexMemory ‐32 KB‐128 KB flash featuring fast access times, high reliability, and four levels of security protection ‐16 KB of SRAM ‐2 KB of FlexMemory (user‐segmentable byte write/erase EEPROM for data tables/system data) ‐EEPROM with over 10M cycles and flash with 70 µsec write time (brownouts without data loss or corruption) ‐No user or system intervention to complete programming and erase functions and full operation down to 1.71V ‐FlexNVM adds up 32 KB for extra program code, data or EEPROM backup Mixed‐signal capability ‐High‐speed 16‐bit ADC with configurable resolution ‐Single or differential output modes for improved noise rejection ‐500 ns conversion time achievable with programmable delay block triggering ‐Two high‐speed comparators providing fast and accurate motor over‐current protection by driving PWMs to a safe state ‐Optional analog voltage reference provides an accurate reference to analog blocks and replaces external voltage references to reduce system cost Performance ‐50 MHz ARM Cortex‐M4 core with DSP instruction set, single cycle MAC, and single instruction multiple data (SIMD) extensions ‐Up to four channel DMA for peripheral and memory servicing with reduced CPU loading and faster system throughput ‐Cross bar switch enables concurrent multi‐master bus accesses, increasing bus bandwidth ‐Independent flash banks allowing concurrent code execution and firmware updating with no performance degradation or complex coding routines TWRK20D50M Tower Module User’s Manual Page 8 of 19 | Timing and Control ‐Two FlexTimers with a total of 10 channels ‐Hardware dead‐time insertion and quadrature decoding for motor control ‐Carrier modulator timer for infrared waveform generation in remote control applications ‐ Four‐channel 32‐bit periodic interrupt timer provides time base for RTOS task scheduler or trigger source for ADC conversion and programmable delay block Human‐Machine Interface ‐Hardware touch‐sensing interface (TSI) with up to 16 inputs ‐TSI operates in low power modes (minimum current adder when enabled) ‐TSI hardware implementation avoids software polling methods ‐High sensitivity level allows use of overlay surfaces up to 5 mm thick. Connectivity and Communications ‐Full‐Speed USB Device/Host/On‐The‐Go with device charge detect capability ‐ Optimized charging current/time for portable USB devices, enabling longer battery life ‐ USB low‐voltage regulator supplies up to 120 mA off chip at 3.3 volts to power external components from 5‐volt input ‐Three UARTs (one UART supports RS232 with flow control, RS485, ISO7816 and IrDA while the other two UARTS support RS232 with flow control and RS485) ‐One Inter‐IC Sound (I2S) serial interface for audio system interfacing ‐One DSPI module and one I2C module Reliability, Safety and Security ‐Memory protection unit provides memory protection for all masters on the cross bar switch, increasing software reliability ‐Cyclic redundancy check (CRC) engine validates memory contents and communication data, increasing system reliability ‐Independent‐clocked computer operating properly (COP) guards against clock skew or code runaway for fail‐safe applications such as the IEC 60730 safety standard for household appliances ‐External watchdog monitor drives output pin to safe state for external components in the event that a watchdog timeout occurs ‐This product is included in Freescale’s product longevity program, with assured supply for a minimum of 10 years after launch 6.3 Clocking The Kinetis MCUs start up from an internal digitally controlled oscillator (DCO). Software can enable the main external oscillator (EXTAL0/XTAL0) if desired. The external oscillator/resonator can range from 32.768 KHz up to a 32 MHz. An 8 MHz crystal is the default external source for the MCG oscillator inputs (XTAL/EXTAL). A 32.768 KHz crystal is connected to the RTC oscillator inputs by default. TWRK20D50M Tower Module User’s Manual Page 9 of 19 | 6.4 System Power When installed into a Tower System, the TWR‐K20D50M can be powered from either an on‐board source or from another source in the assembled Tower System. In stand‐alone operation, the main power source (5.0V ) for the TWR‐K20D50M module is derived from either the OSJTAG USB mini‐B connector (J12) or the K20DX128VLH5 USB micro‐AB connector (J31). Two low‐dropout regulators provide 3.3V and 1.8V supplies from the 5.0V input voltage. Additionally, the 3.3V regulator built into the K20DX128VLH5 can be selected to power the 3.3V bus. All the user selectable options can be configured using two headers, J29 and J30. Refer to sheet 5 of the TWR‐K40X256 schematics for more details. 6.5 Real Time Clock (RTC) The Real Time Clock (RTC) module on the K20 has two modes of operation, system power‐up and system power‐
down. In system power‐up mode, the RTC may be powered by either the MCU regulator or the backup power supply, VBAT. During system power‐down, the RTC is only powered from the backup power supply, VBAT. The TWR‐K20D50M provides a battery holder for a coin cell battery that can be used as the VBAT supply. The holder can accept common 20mm diameter 3V lithium coin cell batteries. 6.6 Debug Interface There are two debug interface options provided: the on‐board OSJTAG circuit and an external ARM JTAG connector. 6.6.1 OSJTAG An on‐board MC9S08JM60 based Open Source JTAG (OSJTAG) circuit provides a JTAG debug interface to the K20DX128. A standard USB A male to mini‐B male cable (provided) can be used for debugging via the USB connector, J12. The OSJTAG interface also provides a USB to serial bridge. Drivers for the OSJTAG interface are provided in the P&E Micro OSBDM/OSJTAG Tower Toolkit. These drivers and more utilities can be found online at http://www.pemicro.com/osbdm. 6.6.2 Cortex Debug +ETM Connector The Cortex Debug +ETM connector is a standard 2x10‐pin (0.05") connector providing an external debugger cable with access to the SWD, JTAG, cJTAG, and EzPort interfaces of the K20DX128VLH5. Alternatively, the on‐
board OSJTAG debug interface can be used to access the debug interface of the K20DX128VLH5.The pinout of the debug connector, J22, is shown in following table. TWRK20D50M Tower Module User’s Manual Page 10 of 19 | Table 2 Cortex Debug connector Pin Function TWR‐K20D50M Connection 1 2 VTref TMS / SWDIO 3 4 GND TCK / SWCLK 5 6 GND TDO / SWO 7 8 9 10 11 12 Key TDI GNDDetect nRESET Target Power TRACECLK 3.3V MCU supply (MCU_PWR) PTA3/SCI0_RTS_b/FTM0_CH0/JTAG_MS/SWD
_DIO GND PTA0/SCI0_CTS_b/FTM0_CH5/JTAG_CLK/SWD
_CLK/EZP_CLK GND PTA2/SCI0_TX/FTM0_CH7/JTAG_DO/TRACE_S
WO/EZP_DO ― PTA1/SCI0_RX/FTM0_CH6/JTAG_DI/EZP_DI PTA4/FTM0_CH1/MS/NMI_b/EZP_CS_b RESET_b 5V supply (via J15) PTA6/FTM0_CH3/FB_CLKOUT/TRACE_CLKOU
T 5V supply (via J15) GND GND GND 13 Target Power 14 15 GND 16 17 GND 18 19 GND 20 Note: K20 50MHz family do not have trace port 6.7 Infrared Port An infrared transmit and receive interface is implemented as shown in Figure 5. The CMT_IRO pin directly drives an infrared diode. The receiver uses an infrared phototransistor connected to an on‐chip analog comparator through a low‐pass filter. Internal to the K20D50M device, the output of the analog comparator can be routed to a UART module for easier processing of the incoming data stream. TWRK20D50M Tower Module User’s Manual Page 11 of 19 | Figure 5 Infrared circuit 6.8 Accelerometer An MMA8451Q digital accelerometer is connected to the K20DX128MCU through I2C module, I2C0, and GPIO/IRQ signals, PTB0 and PTB1. The MMA8451Q is a smart low‐power, three‐axis capacitive micromachined accelerometer with 14 bits of resolution. The device can be configured to generate inertial wake‐up interrupt signals from any combination of the configurable embedded functions allowing the MMA8451Q to monitor events and remain in a low‐power mode during periods of inactivity. For more information on the MMA8451Q, please visit the MMA8451Q Product Summary Page. 6.9 Microphone A microphone circuit is provided to allow sampling of audio data. A single‐ended ADC signal (ADC0_DP3) is used to sample the value on the microphone IC output. Jumper, J16, is provided to isolate the ADC signal from the microphone so that it can be used for other purposes TWRK20D50M Tower Module User’s Manual Page 12 of 19 | 6.10 General Purpose Tower Plug­in (TWRPI) Socket The TWR‐K20D50M features a socket (J3 and J10) that can accept a variety of different Tower Plug‐in modules featuring sensors, RF transceivers, and more. The General Purpose TWRPI socket provides access to I2C, SPI, IRQs, GPIOs, timers, analog conversion signals, TWRPI ID signals, reset, and voltage supplies. The pinout for the TWRPI Socket is defined Table 1Table 3 Table 3 General Purpose TWRPI socket pinout J10 Pin Description 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 5V VCC 3.3 V VCC GND 3.3V VDDA VSS (Analog GND) VSS (Analog GND) VSS (Analog GND) ADC: Analog 0 ADC: Analog 1 VSS (Analog GND) VSS (Analog GND) ADC: Analog 2 VSS (Analog GND) VSS (Analog GND) GND GND ADC: TWRPI ID 0 ADC: TWRPI ID 1 GND Reset J3 Pin 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Description GND GND I2C: SCL I2C: SDA GND GND GND GND SPI: MISO SPI: MOSI SPI: SS SPI: CLK GND GND GPIO: GPIO0/IRQ GPIO: GPIO1/IRQ GPIO: GPIO2 GPIO: GPIO3 GPIO: GPIO4/Timer GPIO: GPIO5/Timer . 6.11 Potentiometer, Pushbuttons, LEDs The TWR‐K20D50M features two pushbutton switches connected to GPIO/interrupt signals, one pushbutton connected to the master reset signal, two capacitive touch pad electrodes, four user‐controllable LEDs, and a TWRK20D50M Tower Module User’s Manual Page 13 of 19 | potentiometer connected to an ADC input signal. Refer to Table 5 “I/O Connectors and Pin Usage Table” for information about which port pins are connected to these features. 6.12 Touch Interface The touch sensing input (TSI) module of the K20DX128VLH5 MCUs provides capacitive touch sensing detection with high sensitivity and enhanced robustness. Each TSI pin implements the capacitive measurement of an electrode. The TWR‐K20D50M provides two methods for evaluating the TSI module. There are two electrodes on‐board. Additionally, 12 TSI signals are connected to a Touch Tower Plug‐in (TWRPI) socket (J5) that can accept Touch TWRPI daughter cards that may feature keypads, rotary dials, sliders, etc. Table 4 Touch TWRPI socket pinout Pin 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Description P5V_TRG_USB 3.3 V VCC *V_BRD Electrode 0 3.3V VDDA Electrode 1 VSS (Analog GND) Electrode 2 Electrode 3 Electrode 4 Electrode 5 Electrode 6 Electrode 7 Electrode 8 Electrode 9 Electrode 10 Electrode 11 ADC: TWRPI ID 0 ADC: TWRPI ID 1 GND Reset TWRK20D50M Tower Module User’s Manual Page 14 of 19 | 6.13 USB The K20DX128VLH5 features a full‐speed/low‐speed USB module with OTG/Host/Device capability and built‐in transceiver. The TWR‐K20D50M routes the USB D+ and D‐ signals from the K20DX128 MCU directly to the on‐
board USB connector (J31) A power supply switch with an enable input signal and over‐current flag output signal is used to supply power to the USB connector when the K20DX128 is operating in host mode. Port pin PTC8 is connected to the flag output signal and port pin PTC9 is used to drive the enable signal. Both port pins can be isolated with jumpers J32 and J26 if needed. 7
TWR­K20D50M Jumper options The following is a list of all the jumper options. The default installed jumper settings are shown in bold. Note: Default Configuration, Board powered by OSJTAG USB, RTC powered by PWR_MCU
Jumper Jumper designator V_BRD J25 J23 VBAT J35 J36 P5V_TRG_USB J24 Signal Jumper Option V_BRD VDDA_HDR VBATD Enable VBAT VBATD Enable MCU_PWR P5V_TRG_USB DEF: 1‐2 VBRD to MCU_PWR DEF: 1‐2 VDDA to MCU_PWR DEF: 1‐2 DEF: 1‐2 DEF: open Disconnect target power of JTAG connector open OSJTAG mode 1‐2 JM60 bootloader mode JM60 Bootloader J34 JM60 BOOTLOAD EN VREG IN SELECTOR J30 VREG IN SELECTOR DEF: 1‐2 Regulator powered by OSJTAG USB 5‐6 K20 USB power the K20 Regulator 8‐6 TWR‐USB power up the K20 Regulator TWRK20D50M Tower Module User’s Manual Page 15 of 19 | BOARD POWER SELECTION J29 BOARD POWER SELECTION DEF: 3‐5 P3.3V_REG powers VBRD(MCU_PWR) 7‐5 1.8V powers VBRD(MCU & Interface circuit input power) 1‐2 K20 3.3 Regulator Output powers VBRD(MCU_PWR) TWRK20D50M Tower Module User’s Manual Page 16 of 19 | Table 5 Connectors and Pin Usage Module name Options DEF: 1‐2 DEF: 1‐2 open open DEF: 1‐2 DEF: 1‐2 DEF: 1‐2 DEF: 1‐2 J20 K20 USN ENA K20 USB FLGA IRDAJ CMP0_IN0 Microphone Enable Potentiometer Enable Buzzer Enable SDA Accelerometer Enable SCL Accelerometer Enable GPIO Header J18 J17 J2‐1 ACCELEROMETER INT1 ACCELEROMETER INT2 SAI0_RX_FS J2‐2 SAI0_TX_FS J2‐3 J2‐4 SAI0_RXD0 SAI0_TXD0 J2‐5 SAI0_RXD1 J2‐6 SAI0_TXD1 J2‐7 J2‐8 SAI0_RX_BCLK SAI0_TX_BCLK J2‐9 SAI0_MCLK LEDs J2‐10 J13 J11 GND LED orange Enable LED Yellow Enable Jumper Designator USB J26 J32 IRDA J9 J7 Microphone J16 Potentiometer J15 Buzzer J1 Accelerometer J19 Signal PTC9_EBI_AD6 PTC8_EBI_AD7/SSI0_CLK PTD7_CMT_IRO PTC7_EBI_AD8/CMP0_IN1 ADC0_DP3 ADC0_DM3 PTC4 PTB3_I2C0_SDA/ADC0_SE1
3/TSI0_CH8 DEF: 1‐2 PTB2_I2C0_SCL/ADC0_SE12
/TSI0_CH7 DEF: OPEN PTB0/ADC0_SE8/TSI0_CH0 DEF: OPEN PTB1/ADC0_SE9/TSI0_CH6 PTC10_EBI_AD5 /SSI0_RX_FS PTB19/SSI0_TX
_FS/TSI0_CH12 PTC5 PTC1/UART_RT
S/FTM0_CH0/T
SI0_CH14 PTC11_LLWU_S
SI0_RXD1 PTC0/SSI0_TXD
/TSI0_CH13 PTC6 PTB18/SSI0_TX
_BCLK/TSI0_CH
11 PTC8_EBI_AD7/
SSI0_CLK GND DEF: 1‐2 DEF: 1‐2 TWRK20D50M Tower Module User’s Manual PTC10 PTC9 Page 17 of 19 | Module Jumper Designator J4 J6 J28 name Options Signal LED Green Enable LED Blue PTA12 Push Buttons SW2 Pushbutton1 DEF: 1‐2 DEF: 1‐2 1 MCU_PWR 2 PTA12 3 GND PTC1 SW3 Pushbutton0 PTC2 TSI Electrodes Elec1 Elec2 Electrode1 Electrode2 TSI0_CH0 TSI0_CH6 PTC7 PTC8 This header can be used to power up an external circuit/sensor PTC1/UART_RTS/FTM0_CH
0/TSI0_CH14 PTC2/UART_CTS/FTM0_CH
1/TSI0_CH15 PTB0/ADC0_SE8/TSI0_CH0 PTB1/ADC0_SE9/TSI0_CH6 PTA12 ‐ Header 8
Useful links ► http://www.freescale.com/twr‐k20d50M ► www.freescale.com ► www.iar.com/freescale ► www.pemicro.com •
http://www.pemicro.com/osbdm •
OSBDM/OSJTAG Virtual Serial Toolkit ► www.freescale.com/codewarrior •
CodeWarrior MCUv10.x ► www.segger.com •
http://www.segger.com/jlink‐flash‐download.html TWRK20D50M Tower Module User’s Manual Page 18 of 19 | Revision 1.0 1.1 Date Jan, 2012 Feb, 2012 Revision History Description Initial release for PWA 700‐27272 A draft Initial release for PWA 700‐27272 A TWRK20D50M Tower Module User’s Manual Page 19 of 19