Application Report SLAA514 – December 2011 USB Keyboard Using MSP430™ Microcontrollers David Racine, Luis Reynoso ............................................................................................ MSP430 Apps ABSTRACT This application report describes a low-cost highly-flexible composite USB keyboard implementation based on MSP430F5xx/MSP430F6xx families. Schematics and software are included allowing for an easy implementation and customization. The document explains basic necessary concepts but familiarity with the MSP430™ USB Developers Package (MSP430USBDEVPACK) and USB HID specification is assumed. Source code and additional information described in this application report can be downloaded from http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/USBKBD_430/latest/index_FDS.html. 1 2 3 4 5 6 7 Contents Introduction .................................................................................................................. 2 Implementation .............................................................................................................. 2 Software ...................................................................................................................... 6 Hardware and Peripheral Usage ........................................................................................ 12 Using the USB Keyboard ................................................................................................. 12 Schematics ................................................................................................................. 15 References ................................................................................................................. 16 List of Figures 1 Key Matrix .................................................................................................................... 3 2 Keyboard Schematic........................................................................................................ 3 3 Detection of a Key Using Column-Interrupt Method .................................................................... 4 4 Detection of a Key Using Polling Method ................................................................................ 4 5 "Ghost" Key Detection ...................................................................................................... 5 6 USB Keyboard Software Modules ........................................................................................ 6 7 USB Keyboard Flow Diagram ............................................................................................. 7 8 Digital Keyscan Flow Diagram ............................................................................................ 9 9 USB Keyboard in Windows Device Manager .......................................................................... 13 10 Testing the HID Custom Interface ....................................................................................... 14 11 Schematics ................................................................................................................. 15 List of Tables 1 VID/PID Used by the Device .............................................................................................. 5 2 HID Keyboard Report Format ............................................................................................. 8 3 Communication Protocol Report Descriptor ............................................................................. 8 4 Implemented Protocol ...................................................................................................... 8 5 Configuration Constant Table ............................................................................................ 11 6 ScanCodes ................................................................................................................. 11 7 MSP430F550x/5510 Peripheral Usage ................................................................................. 12 8 MSP430F550x/5510 Pinout Usage ..................................................................................... 12 MSP430, Code Composer Studio are trademarks of Texas Instruments. IAR Embedded Workbench is a trademark of IAR Systems. SLAA514 – December 2011 Submit Documentation Feedback USB Keyboard Using MSP430™ Microcontrollers Copyright © 2011, Texas Instruments Incorporated 1 Introduction 1 www.ti.com Introduction This application report describes the implementation of a USB keyboard with the following characteristics: • 101 keys, 2 LEDs: standard HID keyboard and LED usage • 16x8 matrix: allows for easy customization of different keyboard layouts • Composite USB device: In addition to the keyboard interface, it includes an HID-datapipe back-channel which can be used to transmit any custom data • HID boot protocol support, allowing keyboard to be used to interface with a PC's BIOS • "Ghost" key handling in software, to prevent errors from multiple key presses • Uses MSP430F550x/5510 low-cost USB family The Texas Instruments MSP430F550x/5510 devices are ultra-low power microcontrollers featuring a powerful 16-bit RISC CPU, 16-bit registers, and constant generators that contribute to maximum code efficiency. In addition, this MSP430 family includes an integrated USB and PHY supporting USB 2.0 fullspeed communication, four 16-bit timers, a high-performance 10-bit analog-to-digital converter (ADC), two universal serial communication interfaces (USCI), hardware multiplier, DMA, real-time clock module with alarm capabilities, and 31 or 47 I/O pins. 2 Implementation 2.1 Key Matrix The USB keyboard presented in this application report implements a key matrix of rows and columns similar to smaller keypads like the one shown in the application report Implementing An Ultralow-Power Keypad Interface with MSP430 (SLAA139). This implementation uses a 16 rows x 8 columns matrix, which allows up to 128 keys, but it actually uses only 101 keys in total. The key matrix is shown in Figure 1. 2 USB Keyboard Using MSP430™ Microcontrollers Copyright © 2011, Texas Instruments Incorporated SLAA514 – December 2011 Submit Documentation Feedback Implementation www.ti.com Row0 P2.0 Col0 P1.0 Col1 P1.1 Col2 P1.2 Col3 P1.3 Col4 P1.4 Col5 P1.5 Col6 P1.6 Col7 P1.7 Keypad Enter Keypad - Keypad + Keypad 2 Keypad 3 Keypad . Keypad 1 Keypad / Keypad 9 Win Keypad 7 Home PageUp Keypad NumLock Tab ~ ` 1 Q A Row1 P2.1 Row2 P2.2 Keypad 0 Row3 P2.3 Right Alt Left Alt Row4 P2.4 C Space bar F3 F4 CapsLock 3 E D Row5 P2.5 X Z F2 F1 Esc 2 W S Row6 P2.6 V B G T 5 4 R F Row7 P2.7 M N H Y 6 7 U J Row8 P3.0 > . ê | \ F11 F10 9 O L Row9 P3.1 Right Shift Left Shift Row10 P3.2 < , Keypad * F7 F6 F5 8 I K Keypad 8 F9 Row11 P3.3 ç Row12 P3.4 Right Ctrl Left Ctrl Row13 P5.0 ? / é _ - F12 0 P { [ : ; Row14 P5.1 “ ‘ Enter PrtScr End + = Back space } ] Page Down è F8 Pause Scroll Lock Keypad 4 Keypad 5 Keypad 6 Row15 P2.0 Figure 1. Key Matrix ... Coln Col1 Col0 Each key works like a switch, and pulldowns are implemented on each column, keeping the idle state low (see Figure 2). Row0 Row1 ... Rown-1 Rown Figure 2. Keyboard Schematic There are multiple ways to scan a key matrix, but this application report uses two methods, referred in this application report as: column-interrupt and polling. SLAA514 – December 2011 Submit Documentation Feedback USB Keyboard Using MSP430™ Microcontrollers Copyright © 2011, Texas Instruments Incorporated 3 Implementation www.ti.com In the column-interrupt approach, all rows are actively driven at the same time and columns are configured to interrupt the processor when any single key is pressed. This method is useful in low-power modes, because any key can wake up the microcontroller; however, it is important to remark that the key press is only used for that purpose, because it does not provide the exact key being pressed. Figure 3 shows the key matrix behavior when the Enter key is pressed in column-interrupt mode. Actively driven rows and columns are shown in red. Notice that the Col1 pin would detect a change when the Enter key is pressed, but the effect would be the same for any other pin pressed in the same column. Row0 P2.0 Col0 P1.0 Col1 P1.1 Col2 P1.2 Keypad Enter Keypad - Keypad + Row1 P2.1 . . . Row14 P5.1 ... Keypad 9 “ ‘ Row15 P2.0 Enter PrtScr è F8 Figure 3. Detection of a Key Using Column-Interrupt Method After the system is awake due to a key press using the column-interrupt approach, the polling method can be used to determine which key(s) is(are) being pressed (see Figure 4). In the polling method, each row is scanned separately driving one row at a time in sequential order. The columns are then read giving the exact keys being pressed. Row0 P2.0 Col0 P1.0 Col1 P1.1 Col2 P1.2 Keypad Enter Keypad - Keypad + Row1 P2.1 . . . Row14 P5.1 Row15 P2.0 ... Keypad 9 “ ‘ Enter PrtScr è F8 Figure 4. Detection of a Key Using Polling Method One of the caveats when using this method is that particular patterns can cause unwanted connections, known as "ghost" keys. This behavior is caused when three or more keys sharing rows and columns are pressed at the same time (see Figure 5). 4 USB Keyboard Using MSP430™ Microcontrollers Copyright © 2011, Texas Instruments Incorporated SLAA514 – December 2011 Submit Documentation Feedback Implementation www.ti.com Row0 P2.0 Col0 P1.0 Col1 P1.1 Col2 P1.2 Keypad Enter Keypad - Keypad + Row0 P2.0 Keypad 9 Row1 P2.1 Row1 P2.1 . . . Row14 P5.1 “ ‘ Row15 P2.0 Enter PrtScr è F8 ... . . . Row14 P5.1 Row15 P2.0 1. Enter, PtrScr and è keys are pressed Col0 P1.0 Col1 P1.1 Col2 P1.2 Keypad Enter Keypad - Keypad + Row0 P2.0 Keypad 9 Row1 P2.1 “ ‘ Enter PrtScr è F8 ... . . . Row14 P5.1 Row15 P2.0 Col0 P1.0 Col1 P1.1 Col2 P1.2 Keypad Enter Keypad - Keypad + ... Keypad 9 “ ‘ Enter PrtScr è F8 3. Driving Row15 detects è but it incorrectly detects F8 2. Driving Row14 detects Enter and PtrScr Figure 5. "Ghost" Key Detection The software included in this application report detects potential "ghost" keys and does not report them to the host. 2.2 USB HID This application report uses the MSP430 application programming interface (API) stack found in the MSP430 USB Developers Package (MSP430USBDEVPACK). The stack is configured to work as a composite HID-HID interface with the first interface being a standard Keyboard and the second interface used as a DataPipe. One of the advantages of using this implementation, which using only HID interfaces, is that no drivers are required. Although the relevant code for the keyboard implementation uses the standard keyboard interface, the DataPipe interface was added to provide users with more flexibility and to facilitate customization. This interface can be used to send or receive any type of data to/from the host, so that the MSP430 microcontroller not only performs the job of a digital keyboard, but it can also be used to perform other jobs taking advantage of the same USB interface and the rest of the peripherals. Some examples include reading sensors using ADC and reporting to PC, controlling actuators using timer PWMs, etc. It should be noted that while the host OS interprets and uses the data from the standard keyboard interface without additional applications or drivers, in the case of the Datapipe interface, a host application is required. Texas Instruments provides an HID API which enables communication between a PC and a MSP430 microcontroller running the HID API stack. This HID API is available in executable format and source code in the MSP430 USB Developers Package (MSP430USBDEVPACK). The keyboard interface supports Boot protocol, which allows it to work with HID-limited hosts (such as some BIOS). VID and PID can be modified according to the particular application but the default code used for this example uses the values shown in Table 1. Table 1. VID/PID Used by the Device SLAA514 – December 2011 Submit Documentation Feedback VID 0x2047 PID 0x0401 USB Keyboard Using MSP430™ Microcontrollers Copyright © 2011, Texas Instruments Incorporated 5 Software 3 Software 3.1 Tools www.ti.com The software included in this application report was built and tested using: • IAR Embedded Workbench™ for MSP430 5.30.4 IDE • Code Composer Studio™ (CCS) 5.1.0 IDE 3.2 Software Implementation Figure 6 shows the software layers for the USB keyboard. Application USB Keyboard Comm Protocol Keyboard Report USB HID DKS (Digital Keyscan) USB API MSP430 Driverlib UCS PMM ticktimer Timer GPIOs DMA USB Hardware Figure 6. USB Keyboard Software Modules Software is designed in a modular way, re-using existing TI libraries such as driverlib and the USB API and adding new modules from low-level drivers to application level. These modules include: • USB Keyboard Description Main application initializing the microcontroller, peripherals, and executing a loop checking and servicing the rest of the modules. Files Src\TI_USBKBD_main.c Flow Diagram 6 USB Keyboard Using MSP430™ Microcontrollers Copyright © 2011, Texas Instruments Incorporated SLAA514 – December 2011 Submit Documentation Feedback Software www.ti.com Initialize: PMM, UCS (clocks), GPIOs, Timers, USB, Timer, USB Keyboard Initialization USB Active? Y USB Suspended? N Disable DKS Y Sleep Y Process RX data from HID0/HID1 N Data received? N Initialize DKS and KBD_Report modules Y First loop? N USB or Keyboard activity? N Y Wake MCU Attend DKS module Attend KBD_Report module Y Force Remote Wakeup Pending tasks? N Sleep N USB, Timer or Keyboard activity? Y Figure 7. USB Keyboard Flow Diagram SLAA514 – December 2011 Submit Documentation Feedback USB Keyboard Using MSP430™ Microcontrollers Copyright © 2011, Texas Instruments Incorporated 7 Software • www.ti.com Keyboard Report Description Handles the HID Keyboard report, adding and removing keys from the report depending on press/release events and sends the report to the USB Host. Files Src\TI_USBKBD_HIDKBD_report.c Src\Include\ TI_USBKBD_HIDKBD_report_public.h HID Keyboard Report Format Table 2. HID Keyboard Report Format Byte0 • Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Right GUI Right Alt Right Shift Right Ctrl Left GUI Left Alt Left Shift Left Ctrl Byte1 Reserved Byte2 Key_array[0] Byte3 Key_array[1] Byte4 Key_array[2] Byte5 Key_array[3] Byte6 Key_array[4] Byte7 Key_array[5] Communication Protocol Description Handles the HID custom interface, which is used to transfer data to/from an USB host. The current implementation shows a template that can be used for custom development. This module uses the HID-Datapipe as defined in the USB API included in MSP430 USB Developers Package (MSP430USBDEVPACK). Files Src\TI_USBKBD_comm_protocol.c Src\Include\ TI_USBKBD_comm_protocol_public.h HID Custom Interface Report Descriptor Table 3. Communication Protocol Report Descriptor Field Size Description 1 byte The report ID of the chosen report (automatically assigned to 0x3F by the HID-Datapipe calls) Size 1 byte The number of valid bytes in the data field Data 62 bytes IN Report Report ID Data payload OUT Report 1 byte The report ID of the chosen report (must be assigned to 0x3F by the host) Size 1 byte The number of valid bytes in the data field Data 62 bytes Report ID Data payload Data Payload Protocol Table 4. Implemented Protocol 8 Field Size CMD 1 byte Data 61 bytes Description 1 = Toggle CAPS LED 2 = Toggle NUM LED Unused USB Keyboard Using MSP430™ Microcontrollers Copyright © 2011, Texas Instruments Incorporated SLAA514 – December 2011 Submit Documentation Feedback Software www.ti.com • DKS (Digital KeyScan) Description Handles the digital keyboard scanning, detecting key press/release events, and reporting them to the keyboard report module. Files Src\TI_USBKBD_DKS.c Src\Include\TI_USBKBD_DKS_public.h Flow Diagram DKS is initialized in “interrupt-column” mode by default if no key is pressed. Digital KeyScan Interrupt-column polling Mode? N Key press detected? Scan key matrix Y Change to Polling mode Release None Inactive timer N expired? Key event? Y Press Remove key from report Change to Interrupt-Column mode Y “Ghost” key? N N Key debounced? Increment debounce counter Y Add key to report Return Figure 8. Digital Keyscan Flow Diagram SLAA514 – December 2011 Submit Documentation Feedback USB Keyboard Using MSP430™ Microcontrollers Copyright © 2011, Texas Instruments Incorporated 9 Software www.ti.com • USB API / USB HID Description The MSP430 USB API stack is a software solution provided by Texas Instruments that includes support for: – Communications Device Class (CDC) – Human Interface Device class (HID) – Mass Storage Class (MSC) – Personal HealthCare Device Class (PHDC) This software solution, including detailed documentation, is available in the MSP430 USB Developers Package (MSP430USBDEVPACK). Files Src\USB_API\*.* Src\USB_config\*.* Src\USB_App\*.* Ticktimer Description Handles a general purpose interrupt timer that is used as a timebase, to wake-up the processor, and to trigger a new keyboard scan, among other functions. The ticktimer is implemented using TA0.0 with a default time base of 2 ms. Files Src\TI_USBKBD_ticktimer.c Src\Include\TI_USBKBD_ticktimer_public.h MSP430 Driverlib Description The Texas Instruments MSP430 Peripheral Driver Library (Driverlib) is a set of drivers that provide an easy mechanism to use the MSP430 peripherals. This software uses Driverlib to initialize the PMM and UCS modules. Source code and detailed documentation are available in MSP430Ware (www.ti.com/msp430ware). For simplicity purposes, this project includes only the pre-compiled libraries for IAR and CCS using a small memory model and header files. Files Src\ driverlib\*.h Src\ driverlib\driverlib_small_CCS.lib Src\ driverlib\driverlib_small_IAR.r43 • • 3.3 Configuration and ScanCode Tables For modularity purposes and to allow for an easier optimization or upgrade, the USB keyboard software reserves some Flash sectors for constant tables that define some of the functionality of the application and define the ScanCode table. • Configuration Constant Table Description Contains the USB keyboard version and configuration constants defining the KeyScan functionality, such as debounce counter, ticktimer period, etc. Files Src\TI_USBKBD_SharedTables.c (declaration) Src\Include\TI_USBKBD_public.h (typedef) Declaration const USBKBD_config_const_t USBKBD_configconst_s 10 USB Keyboard Using MSP430™ Microcontrollers Copyright © 2011, Texas Instruments Incorporated SLAA514 – December 2011 Submit Documentation Feedback Software www.ti.com Location USBKBD_CONFIGCONST_SEGMENT (0xFC00-0xFDFF) Contents Table 5. Configuration Constant Table Field • Size Description MagicKey 4 bytes Indicates the start of the table. 0xDEADC0DE is used by default. Version 2 bytes USB keyboard version in BCD format: 0x0101 - 1.0.1 ticktimer_div 2 bytes TickTimer divider (based on ACLK): 66 represents a period of 66 / 32768 = ~2 ms debounce_cycles 2 bytes Number of debounce cycles in tick counts: 2 represents a debounce of 4 ms with Ticktimer = 2 ms inactive_timeout 2 bytes Number of tick counts before going to interrupt_column mode if no key is detected: 8 represents 16 ms with Ticktimer = 2 ms ScanCode Table Description Contains the USB Keyboard scancode table, mapping each row and column to the corresponding value based on HID Usage Tables. Files Src\TI_USBKBD_SharedTables.c(declaration) Src\Include\TI_USBKBD_public.h(typedef) Declaration const USBKBD_scancodest_t USBKBD_scancodes_s Location USBKBD_SCANCODES_SEGMENT (0xFA00-0xFBFF) Contents Table 6. ScanCodes Field Size MagicKey 4 bytes keycode SLAA514 – December 2011 Submit Documentation Feedback Description Indicates the start of the table. 0xDEADC0DE is used by default. 128 bytes Keycodes for each key in the following order: Row0,Col0 Row0,Col1 … Row0,Col7 Row1,Col0 Row1,Col1 … Row15,Col6 Row15,Col7 USB Keyboard Using MSP430™ Microcontrollers Copyright © 2011, Texas Instruments Incorporated 11 Hardware and Peripheral Usage 4 www.ti.com Hardware and Peripheral Usage In addition to system modules (UCS, PMM), this keyboard implementation uses the peripherals shown in Table 7. Table 7. MSP430F550x/5510 Peripheral Usage Peripheral Usage USB Communication with host (Composite HID-HID) Timer_A0 (TA0.0) TimerTick used as a time base to perform periodic polling, debounce, etc. In addition to the circuitry required for USB and common functionality (reset, VCC, VSS, crystal, etc.), the USB keyboard uses the pins shown in Table 8. Table 8. MSP430F550x/5510 Pinout Usage Columns KSO0 KSO1 KSO2 KSO3 KSO4 KSO5 KSO6 KSO7 KSO8 KSO9 KSO10 KSO11 KSO12 KSO13 KSO14 KSO15 P2.0 P2.1 P2.2 P2.3 P2.4 P2.5 P2.6 P2.7 P3.0 P3.1 P3.2 P3.3 P3.4 P5.0 P5.1 P5.4 Rows LEDs KSI0 KSI1 KSI2 KSI3 KSI4 KSI5 KSI6 KSI7 LED0 (CAPS) LED1 (NUM) P1.0 P1.1 P1.2 P1.3 P1.4 P1.5 P1.6 P1.7 P4.7 P4.6 Schematics showing the implementation on the USB keyboard are found in Section 6. 5 Using the USB Keyboard When connected to a PC, the USB keyboard should be detected by the operating system and enumerated without drivers. Windows shows three devices in the Device Manager (see Figure 9). • Human Interface Devices – USB Human Interface Device: Standard keyboard in intf0 (MI_00) – USB Human Interface Device: Custom interface in intf1 (MI_01) • Keyboards – HID Keyboard Device: Standard keyboard in intf0 (MI_00) 12 USB Keyboard Using MSP430™ Microcontrollers Copyright © 2011, Texas Instruments Incorporated SLAA514 – December 2011 Submit Documentation Feedback Using the USB Keyboard www.ti.com Figure 9. USB Keyboard in Windows Device Manager The keyboard can now be tested and used as a standard keyboard. In addition to the regular key functionality, the custom interface can be tested using the MSP430 HID USB Application following these steps (see Figure 10): 1. Select the VID and PID (default: VID = 0x2047, PID = 0x0401). 2. Click Set VID PID. 3. Click Connect. 4. The LED should turn green. 5. Write one of the commands in the Send & Receive field. 6. Observe the response from the USB keyboard. SLAA514 – December 2011 Submit Documentation Feedback USB Keyboard Using MSP430™ Microcontrollers Copyright © 2011, Texas Instruments Incorporated 13 Using the USB Keyboard www.ti.com 3 2 4 1 5 6 Figure 10. Testing the HID Custom Interface The MSP430 HID USB Application is available in the MSP430 USB Developers Package (MSP430USBDEVPACK). 5.1 Performance The usual response time for keyboards is approximately 5 to 50 ms. While this depends on different factors such as the mechanical implementation of the keyboard, USB bus load, etc., by using this software, developers have more flexibility to customize the application according to their needs. Whether response time, price, or power consumption is the most important requirement, parameters such as debounce time, polling scan rate, USB polling interval, and microcontroller internal frequency can be adjusted to meet particular requirements. One important factor affecting the response time is the polling rate, which defines the time required to scan all keys. While a key press is detected in a few cycles in column-interrupt mode, the algorithm to recognize the particular pressed key, debounce it, discard "ghost" keys, etc. can take more cycles. During bench tests, this implementation was measured to take ~1870 cycles (which is equivalent to ~233 µs at 8 MHz) for the first pressed key and ~520 cycles (~65 µs at 8 MHz) for each additional pressed key. 5.2 Memory Footprint The following memory footprint was obtained using IAR Embedded Workbench 5.30.4 using the maximum optimization level: Code: 7626 Bytes Constants: 1096 Bytes Data: 679 Bytes 14 USB Keyboard Using MSP430™ Microcontrollers Copyright © 2011, Texas Instruments Incorporated SLAA514 – December 2011 Submit Documentation Feedback Schematics www.ti.com 6 Schematics R8 R11 1M 10p C35 10p C36 KSI5 LED1 LED0 R14 KSI6 4.7M R15 NC0 R16 IC7 KSI7 4.7M 4.7M GND IO1 VCC 6 2 IO2 IO4 5 3 GND IO3 4 TPD4E004 GND GND 4.7u C39 VBUS D- USB1 D- 2 1 D+ 3 GND D+ 4 SHIELD SBW/Power SBW_VCC JP3 14 12 10 8 6 4 2 JTAG1 JP1 int 2 LL103A D3 1 2 3 ext 1 2 DVCC1 13 11 9 7 5 3 1 SBWTCK SBWTDIO VBUS 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 GND IN OUT 1 GND NR/FB 3 EN C20 Q1G$1 3 2 Q1G$2 4 C3 47pF 4MHz XT2 1 C4 47pF GND 220n VBUS_LDO 4.7uF XT2OUT XT2IN C21 10nF GND 220n C38 8 4 C11 100nF GND V18 VUSB VBUS PU.1/DM PUR PU.0/DP VSSU C33 5 LED0 LED1 DVCC1 KSO12 KSO11 KSO10 KSO9 KSO8 KSO7 Digital Keyboard 1uF GND R42 JP6 C19 330R SBWTCK XT2OUT XT2IN AVSS V18 VUSB VBUS PU.1/DM PUR PU.0/DP GND 1 VUSB_VCC VCC1 SBW_VCC 470nF VBUS_LDO3 SBWTDIO 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 GND VCC1 R5 47K GND GND SHIELD1 C8 KSO13 KSO14 KSO15 GP C9 GND KSO0 KSO1 KSO2 KSO3 KSO4 KSO5 KSO6 KSI0 KSI1 KSI2 KSI3 KSI4 KSI5 KSI6 KSI7 TP 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 5 6 C13 100nF 33k DNP LL103A D2 R36 GND + 10uF/6,3V VBUS 0.1u C40 GND C5 C7 100nF AVCC GND 1 GND AVCC DVCC1 C10 GND 10uF/6,3V + R35 27R R13 4.7M 2 R34 27R KSI4 4.7M GND R19 330R R18 330R KSI3 4.7M R10 1 GND GND GND KSI2 R7 100R S3 USB Interface R6 4.7M R33 1.4k PUR PU.0/DP PU.1/DM KSI1 4.7M VUSB R3 GND Digital Keys KSI0 LED1 GP KSO7 KSO0 KSI1 KSI7 KSO9 KSI6 KSI5 KSO3 KSI4 KSI2 KSO1 KSI3 KSI0 KSO13 KSO5 KSO2 KSO4 KSO8 KSO6 KSO11 KSO10 KSO12 KSO14 KSO15 Digital Connector LEDs GND LED0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 P$1 P$2 P$3 P$4 P$5 P$6 P$7 P$8 P$9 P$10 P$11 P$12 P$13 P$14 P$15 P$16 P$17 P$18 P$19 P$20 P$21 P$22 P$23 P$24 P$25 P$26 P$27 P$28 P$29 P$30 A GND VUSB_VCC GND D4 LL103A Figure 11. Schematics SLAA514 – December 2011 Submit Documentation Feedback USB Keyboard Using MSP430™ Microcontrollers Copyright © 2011, Texas Instruments Incorporated 15 References 7 References 1. 2. 3. 4. 5. 6. 16 www.ti.com USB HID specification (www.usb.org/developers/devclass_docs/HID1_11.pdf) MSP430x5xx/MSP430x6xx Family User's Guide (SLAU208) MSP430F550x/MSP430F5510 Mixed Signal Microcontroller data sheet (SLAS645) MSP430 USB Developers Package (MSP430USBDEVPACK) (www.ti.com/tool/msp430usbdevpack). MSP430Ware (www.ti.com/msp430ware) Implementing an Ultralow-Power Keypad Interface With the MSP430 (SLAA139) USB Keyboard Using MSP430™ Microcontrollers Copyright © 2011, Texas Instruments Incorporated SLAA514 – December 2011 Submit Documentation Feedback IMPORTANT NOTICE Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications, enhancements, improvements, and other changes to its products and services at any time and to discontinue any product or service without notice. Customers should obtain the latest relevant information before placing orders and should verify that such information is current and complete. All products are sold subject to TI’s terms and conditions of sale supplied at the time of order acknowledgment. TI warrants performance of its hardware products to the specifications applicable at the time of sale in accordance with TI’s standard warranty. Testing and other quality control techniques are used to the extent TI deems necessary to support this warranty. Except where mandated by government requirements, testing of all parameters of each product is not necessarily performed. TI assumes no liability for applications assistance or customer product design. Customers are responsible for their products and applications using TI components. To minimize the risks associated with customer products and applications, customers should provide adequate design and operating safeguards. TI does not warrant or represent that any license, either express or implied, is granted under any TI patent right, copyright, mask work right, or other TI intellectual property right relating to any combination, machine, or process in which TI products or services are used. Information published by TI regarding third-party products or services does not constitute a license from TI to use such products or services or a warranty or endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property of the third party, or a license from TI under the patents or other intellectual property of TI. Reproduction of TI information in TI data books or data sheets is permissible only if reproduction is without alteration and is accompanied by all associated warranties, conditions, limitations, and notices. Reproduction of this information with alteration is an unfair and deceptive business practice. TI is not responsible or liable for such altered documentation. Information of third parties may be subject to additional restrictions. Resale of TI products or services with statements different from or beyond the parameters stated by TI for that product or service voids all express and any implied warranties for the associated TI product or service and is an unfair and deceptive business practice. TI is not responsible or liable for any such statements. TI products are not authorized for use in safety-critical applications (such as life support) where a failure of the TI product would reasonably be expected to cause severe personal injury or death, unless officers of the parties have executed an agreement specifically governing such use. Buyers represent that they have all necessary expertise in the safety and regulatory ramifications of their applications, and acknowledge and agree that they are solely responsible for all legal, regulatory and safety-related requirements concerning their products and any use of TI products in such safety-critical applications, notwithstanding any applications-related information or support that may be provided by TI. Further, Buyers must fully indemnify TI and its representatives against any damages arising out of the use of TI products in such safety-critical applications. TI products are neither designed nor intended for use in military/aerospace applications or environments unless the TI products are specifically designated by TI as military-grade or "enhanced plastic." Only products designated by TI as military-grade meet military specifications. Buyers acknowledge and agree that any such use of TI products which TI has not designated as military-grade is solely at the Buyer's risk, and that they are solely responsible for compliance with all legal and regulatory requirements in connection with such use. TI products are neither designed nor intended for use in automotive applications or environments unless the specific TI products are designated by TI as compliant with ISO/TS 16949 requirements. Buyers acknowledge and agree that, if they use any non-designated products in automotive applications, TI will not be responsible for any failure to meet such requirements. Following are URLs where you can obtain information on other Texas Instruments products and application solutions: Products Applications Audio www.ti.com/audio Automotive and Transportation www.ti.com/automotive Amplifiers amplifier.ti.com Communications and Telecom www.ti.com/communications Data Converters dataconverter.ti.com Computers and Peripherals www.ti.com/computers DLP® Products www.dlp.com Consumer Electronics www.ti.com/consumer-apps DSP dsp.ti.com Energy and Lighting www.ti.com/energy Clocks and Timers www.ti.com/clocks Industrial www.ti.com/industrial Interface interface.ti.com Medical www.ti.com/medical Logic logic.ti.com Security www.ti.com/security Power Mgmt power.ti.com Space, Avionics and Defense www.ti.com/space-avionics-defense Microcontrollers microcontroller.ti.com Video and Imaging www.ti.com/video RFID www.ti-rfid.com OMAP Mobile Processors www.ti.com/omap Wireless Connectivity www.ti.com/wirelessconnectivity TI E2E Community Home Page e2e.ti.com Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265 Copyright © 2012, Texas Instruments Incorporated