Example: tourism industry

USB Keyboard Using MSP430 Microcontrollers - …

1 SLAA514 December2011 SubmitDocumentationFeedbackCopyright 2011,TexasInstrumentsIncorporatedUSBK eyboardUsingMSP430 MicrocontrollersApplicationReportSLAA514 December2011 USBK eyboardUsingMSP430 MicrocontrollersDavidRacine,Luis applicationreportdescribesa low-costhighly-flexiblecompositeUSBkeybo ardimplementationbasedon MSP430F5 includedallowingfor an easyimplementationand documentexplainsbasicnecessaryconceptsbu t familiaritywiththe MSP430 USBD evelopersPackage( MSP430 USBDEVPACK) and USBHID specificationis additionalinformationdescribedin this applicationreportcan be of Figures1 Key a Key a Key "Ghost" Key HID of Tables1 VID/PIDU sedby the December2011 SubmitDocumentationFeedbackCopyright 2011,TexasInstrumentsIncorpor

Application Report SLAA514– December 2011 USB Keyboard Using MSP430™ Microcontrollers David Racine, Luis Reynoso..... MSP430 Apps ABSTRACT This application report describes a low-costhighly-flexiblecomposite USB keyboard implementation based

Tags:

  Using, Microcontrollers, Keyboard, Msp430, Usb keyboard using msp430 microcontrollers

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of USB Keyboard Using MSP430 Microcontrollers - …

1 1 SLAA514 December2011 SubmitDocumentationFeedbackCopyright 2011,TexasInstrumentsIncorporatedUSBK eyboardUsingMSP430 MicrocontrollersApplicationReportSLAA514 December2011 USBK eyboardUsingMSP430 MicrocontrollersDavidRacine,Luis applicationreportdescribesa low-costhighly-flexiblecompositeUSBkeybo ardimplementationbasedon MSP430F5 includedallowingfor an easyimplementationand documentexplainsbasicnecessaryconceptsbu t familiaritywiththe MSP430 USBD evelopersPackage( MSP430 USBDEVPACK) and USBHID specificationis additionalinformationdescribedin this applicationreportcan be of Figures1 Key a Key a Key "Ghost" Key HID of Tables1 VID/PIDU sedby the December2011 SubmitDocumentationFeedbackCopyright 2011,TexasInstrumentsIncorporatedUSBK eyboardUsingMSP430 MicrocontrollersTrademarksMSP430,CodeCom poserStudioare trademarksof EmbeddedWorkbenchis a trademarkof IAR applicationreportdescribesthe implementationof a USBkeyboardwith the followingcharacteristics.

2 101 keys,2 LEDs:standardHID keyboardand LEDusage 16x8matrix:allowsfor easycustomizationof differentkeyboardlayouts CompositeUSBdevice:In additionto the keyboardinterface,it includesan HID-datapipeback-channelwhichcan be usedto transmitany customdata HID bootprotocolsupport,allowingkeyboardto be usedto interfacewith a PC'sBIOS "Ghost"key handlingin software,to preventerrorsfrommultiplekey presses UsesMSP430F550x/5510low-costUSBfamilyThe TexasInstrumentsMSP430F550x/5510devicesa re ultra-lowpowermicrocontrollersfeaturinga powerful16-bitRISCCPU,16-bitregisters,an d constantgeneratorsthat contributeto addition.

3 This MSP430familyincludesan integratedUSBand full-speedcommunication,four 16-bittimers,a high-performance10-bitanalog-to-digitalc onverter(ADC),twouniversalserialcommunic ationinterfaces(USCI),hardwaremultiplier ,DMA,real-timeclockmodulewithalarmcapabi lities,and 31 or 47 I/O MatrixThe USBkeyboardpresentedin this applicationreportimplementsa key matrixof rowsand columnssimilarto smallerkeypadslike the one shownin the applicationreportImplementingAn Ultralow-PowerKeypadInterfacewith MSP430 (SLAA139).This implementationusesa 16 rowsx 8 columnsmatrix,whichallowsup to 128 keys,but it actuallyusesonly 101 keysin key matrixis shownin + ~`1 QARightAltLeftAltCSpace barF3F4 CapsLock3 EDXZF2F1 Esc2 WSVBGT54 RFMNHY67UJ>.

4 |\F11F109 OLRightShiftLeftShift<,Keypad*F7F6F58 IKKeypad8F9 RightCtrlLeftCtrl?/ _-F120P{[:; EnterPrtScrEnd+=Backspace}]PageDown December2011 SubmitDocumentationFeedbackCopyright 2011,TexasInstrumentsIncorporatedUSBK eyboardUsingMSP430 MicrocontrollersFigure1. Key MatrixEachkey workslike a switch,and pulldownsare implementedon eachcolumn,keepingthe idle statelow(seeFigure2).Figure2. KeyboardSchematicThereare multiplewaysto scana key matrix,but this applicationreportusestwo methods,referredin thisapplicationreportas.

5 Column-interruptand Enter Keypad+ Enter Keypad+ December2011 SubmitDocumentationFeedbackCopyright 2011,TexasInstrumentsIncorporatedUSBK eyboardUsingMSP430 MicrocontrollersIn the column-interruptapproach,all rowsare activelydrivenat the sametime and columnsare configuredto interruptthe processorwhenany singlekey is methodis usefulin low-powermodes,becauseany key can wakeup the microcontroller;however,itis importantto remarkthat the key pressis only usedfor that purpose,becauseit doesnot providetheexactkey showsthe key matrixbehaviorwhenthe Enterkey is pressedin columnsare shownin red.

6 Noticethat the Col1pin woulddetecta changewhenthe Enterkey is pressed,but the effectwouldbe the samefor any otherpin pressedin the Detectionof a Key UsingColumn-InterruptMethodAfterthe systemis awakedue to a key pressusingthe column-interruptapproach,the pollingmethodcanbe usedto determinewhichkey(s)is(are)beingpressed( seeFigure4). In the pollingmethod,eachrow isscannedseparatelydrivingone row at a time in columnsare Detectionof a Key UsingPollingMethodOne of the caveatswhenusingthis methodis that particularpatternscan causeunwantedconnections,knownas "ghost" behavioris causedwhenthreeor morekeyssharingrowsand columnsarepressedat the sametime (seeFigure5).

7 Enter Keypad+ Enter Keypad+ Enter, PtrScr andkeys are pressed 2. Driving Row14 detects Enterand Enter Keypad+ Driving Row15 detectsbutit incorrectly detects F8 December2011 SubmitDocumentationFeedbackCopyright 2011,TexasInstrumentsIncorporatedUSBK eyboardUsingMSP430 MicrocontrollersFigure5. "Ghost" Key DetectionThe softwareincludedin this applicationreportdetectspotential"ghost" keysand doesnot reportthemtothe applicationreportusesthe MSP430applicationprogramminginterface(AP I)stackfoundin theMSP430 USBD evelopersPackage( MSP430 USBDEVPACK).

8 The stackis configuredto workas a compositeHID-HIDinterfacewith the first interfacebeinga standardKeyboardand the secondinterfaceusedas a of the advantagesof usingthisimplementation,whichusingonly HID interfaces,is that no driversare relevantcodefor the keyboardimplementationusesthe standardkeyboardinterface,theDataPipeint erfacewas addedto provideuserswith moreflexibilityand to interfacecan be usedto sendor receiveany type of datato/fromthe host,so that the MSP430microcontrollernot only performsthe job of a digitalkeyboard,but it can also be usedto performotherjobs takingadvantageof the sameUSBinterfaceand the rest of the reportingto PC, controllingactuatorsusingtimerPWMs, shouldbe notedthat whilethe host OS interpretsand usesthe datafromthe standardkeyboardinterfacewithoutaddition alapplicationsor drivers,in the caseof the Datapipeinterface.

9 A host applicationis HID API whichenablescommunicationbetweena PC and aMSP430microcontrollerrunningthe HID API HID API is availablein executableformatandsourcecodein the MSP430 USBD evelopersPackage( MSP430 USBDEVPACK).The keyboardinterfacesupportsBootprotocol,wh ichallowsit to workwith HID-limitedhosts(suchassomeBIOS).VID and PID can be modifiedaccordingto the particularapplicationbut the defaultcodeusedfor thisexampleusesthe valuesshownin VID/PIDU sedby the DeviceVID0x2047 PID0x0401 USBGPIOsTimerPMMUCSDMAUSB APIUSB HIDticktimerMSP430 DriverlibDKS (Digital Keyscan) Keyboard ReportCommProtocolUSB December2011 SubmitDocumentationFeedbackCopyright 2011,TexasInstrumentsIncorporatedUSBK eyboardUsingMSP430 softwareincludedin this applicationreportwas built and testedusing.

10 IAR EmbeddedWorkbench for CodeComposerStudio (CCS) showsthe softwarelayersfor the USBK eyboardSoftwareModulesSoftwareis designedin a modularway,re-usingexistingTI librariessuchas driverliband the USBAPIand addingnew modulesfromlow-leveldriversto : USBK eyboardDescriptionMainapplicationinitial izingthe microcontroller,peripherals,and executinga loop checkingandservicingthe rest of the \ KeyboardInitialize:PMM,UCS (clocks),GPIOs,Timers,USB,Timer,USB Active?Disable DKSUSBS uspended?USB orKeyboardactivity?


Related search queries