background image

CY4636 WirelessUSB™ LP Keyboard Mouse Reference Design Kit User Guide, Doc. # 001-70355 Rev. *A

55

Code Examples

Figure 5-3.  USB Device/Config Descriptors

Keyboard HID Report Descriptor

The keyboard HID report descriptor defines a Boot Protocol keyboard. This enables a LP RDK key-
board with the LP RDK bridge to work on different BIOS versions that do not correctly support the
USB Report Protocol. Only standard 101 (104) keys are sent using this format over endpoint 1.

Summary of Contents for CY4636

Page 1: ...elessUSB LP Keyboard Mouse Reference Design Kit User Guide Doc 001 70355 Rev A Cypress Semiconductor 198 Champion Court San Jose CA 95134 1709 Phone USA 800 858 1810 Phone Intnl 408 943 2600 http www cypress com ...

Page 2: ...ibited without the express written permission of Cypress Disclaimer CYPRESS MAKES NO WARRANTY OF ANY KIND EXPRESS OR IMPLIED WITH REGARD TO THIS MATERIAL INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE Cypress reserves the right to make changes without further notice to the materials described herein Cypress does not assume any liability ...

Page 3: ...f Battery level and Link Quality Application 15 2 6 Install Hardware 15 3 Kit Operation 17 3 1 Introduction 17 3 2 Bridge 17 3 3 Mouse 19 3 4 Keyboard 21 4 Hardware 25 4 1 Bridge 25 4 1 1 Functional Description 26 4 1 2 Power Supply System 32 4 2 Mouse 33 4 2 1 Functional Description 34 4 2 2 Power Supply System 39 4 3 Keyboard 40 4 3 1 Functional Description 41 4 3 2 Power Supply System 46 5 Code...

Page 4: ...ent 100 A 3 5 Network ID 100 A 3 6 Manufacturing ID 100 A 3 7 Channel Selection Algorithm 100 A 3 8 Protocol Modes 101 A 3 9 Packet Structures 102 A 3 10 Bind and Reconnect Timing 105 A 3 11 Back Channel Support for NumLk ScrLk Caps Lock 107 A 3 12 Signature Byte 108 A 3 13 Encryption 108 A 4 Manufacturing Test Support MTK 110 A 4 1 Introduction 110 A 4 2 MTK Block Diagram 110 A 4 3 MTK Serial Pro...

Page 5: ...ted chapter on page 9 describes the installation and configuration of the CY4636 Reference Design Kit Kit Operation chapter on page 17 describes the kit operation Hardware chapter on page 25 describes the hardware operation Code Examples chapter on page 47 describes the code examples provided along with the kit The Appendix on page 93 section provides the schematics bill of materials BOM and proto...

Page 6: ...nCoRe II Low Voltage Microcontroller http www cypress com rID 13556 CY7C63310 CY7C638xx enCoRe II Low Speed USB Peripheral Controller http www cypress com rID 14212 CY7C603xx enCoRe III Low Voltage http www cypress com rID 13558 ADNS 3040 Ultra Low Power Optical Mouse Sensor http www avagotech com docs AV02 0150EN CY4636_RDK_Kit Schematic pdf http www cypress com docID 23090 MiniProg http www cypr...

Page 7: ...for Guides Convention Usage Courier New Displays file locations user entered text and source code C cd icc Italics Displays file names and reference documentation Read about the sourcefile hex file in the PSoC Designer User Guide Bracketed Bold Displays keyboard commands in procedures Enter or Ctrl C File Open Represents menu paths File Open New Project Bold Displays commands menu paths and icon n...

Page 8: ...8 CY4636 WirelessUSB LP Keyboard Mouse Reference Design Kit User Guide Doc 001 70355 Rev A Introduction ...

Page 9: ...e CD DVD drive of your PC The CD DVD is designed to auto run and the kit installer startup screen appears To download the latest kit installer go to http www cypress com go CY4636 Download the kit installer ISO file and create an installer CD DVD or extract the ISO using WinRar and install the executables 2 Click Install CY4636 WirelessUSB LP RDK to start the installation Figure 2 1 Kit Installer ...

Page 10: ...etting Started Figure 2 2 Root Directory of the CD DVD 3 The InstallShield Wizard screen appears The default location for setup is shown on the InstallShield Wizard screen You can change the location for setup using Change 4 Click Next to launch the Kit installer Figure 2 3 InstallShield Wizard ...

Page 11: ...70355 Rev A 11 Getting Started 5 On the Product Installation Overview screen select the installation type that best suits your requirement The drop down menu has three options Typical Complete and Custom 6 Click Next to start the installation Figure 2 4 Installation Type Options ...

Page 12: ...egins a list of all packages appears on the installation page 8 A green check mark appears next to every package that is downloaded and installed 9 Wait until all the packages are downloaded and installed successfully Figure 2 5 Installation Page 10 Click Finish to complete the installation Figure 2 6 Installation Completion Page ...

Page 13: ...C Designer 1 Click Start All Programs Cypress PSoC Designer version PSoC Designer version 2 Click File Create New Project to create a new project on the PSoC Designer 5 2 menu or click File Open Project Workspace on PSoC Designer 5 2 menu to work with the existing project Figure 2 7 PSoC Designer Interconnect View 3 To experiment with the code examples go to Code Examples chapter on page 47 ...

Page 14: ...og from the port selection Figure 2 8 PSoC Programmer Window 6 Click File Load from the Programmer menu bar navigate and select the hex file to load 7 Use Program to load the hex file to the chip 8 Once programming is successful Programming Succeeded appears in the Actions Pane 9 Close PSoC Programmer Note For more details on PSoC Programmer go to the Programmer user guide at Installed_directory C...

Page 15: ...ries to the desired directory C Cypress WirelesUSB 2 Click Start Run and manually execute the WirelessUSB exe application with the setup option C Cypress WirelesUSB WirelessUSB exe setup or double click WirelessUSB exe 3 The application now runs and registers to auto run at startup To uninstall battery level and link quality application 1 Click Start Run and manually execute the WirelessUSB exe ap...

Page 16: ...16 CY4636 WirelessUSB LP Keyboard Mouse Reference Design Kit User Guide Doc 001 70355 Rev A Getting Started ...

Page 17: ...media keys internet mail and so on and power keys 3 2 Bridge The LP RDK Bridge is programmed through the USB connector using a Cypress USB adapter board PDC 9241 Figure 3 1 Cypress USB Programming Adapter 1 Connect the LP RDK bridge to the USB adapter board connect the MiniProg to the ISSP Header on the USB adapter as shown in Figure 3 2 on page 18 Connect the MiniProg to the PC through USB A to M...

Page 18: ...rd press the bind button on the bridge The bridge then goes into Bind Mode In Bind Mode the bridge uses the Bind ID to communicate with the mouse key board to bind to the system 6 The red LED blinks ON OFF when the dongle is in Bind Mode The ON and OFF time is approxi mately 320 ms which is the rate at which the dongle changes channels during the Bind process 7 The red LED also blinks ON OFF when ...

Page 19: ...the bridge Figure 3 3 Battery Compartment and Bottom View of Bind Connect Button Figure 3 4 On Off Switch and Optics Window Figure 3 3 and Figure 3 4 show the bottom of the mouse with the Optics window power switch and bind button J10 is a programming header You can use either the ICE Cube or the PSoC MiniProg to program the mouse microcontroller using this ISSP header 1 Remove jumper from J1 Conn...

Page 20: ... the mouse J1 to enable the radio to power the processor The mouse is powered using two AA batteries To start using the mouse place the batteries in the battery terminal switch on the mouse and bind it with the bridge 5 To bind the mouse with the bridge press the bind button on the bridge The bridge goes into Bind Mode In Bind Mode the red LED blinks ON OFF The bridge uses the Bind ID to communica...

Page 21: ...rd The CY4636 RDK uses an enCoRe II LV controller for the RDK keyboard This section presents the RDK keyboard assembly Figure 3 6 Keyboard Plastic Figure 3 7 Exploded Keyboard Figure 3 7 shows the keyboard with the top removed The radio enCoRe II LV board PDC 9265 is shown in the upper right hand corner Keyboard PCB ...

Page 22: ...r from J3 Connect your computer to the keyboard s ISSP Connector J2 using the PSoC MiniProg and a USB cable A to Mini B You can program using PSoC Programmer The jumper must be removed when programming U2 to disconnect the radio from the MiniProg 5 V source After programming is complete place the jumper on J3 To program the hex file to the keyboard using the MiniProg open PSoC Programmer and selec...

Page 23: ...it with the bridge To bind the keyboard with the bridge press the bind button on the bridge the bridge goes into Bind Mode In Bind Mode the red LED blinks ON OFF The bridge uses the Bind ID to communicate with the keyboard to bind to the system and then press the bind button on the keyboard Once the keyboard is bound with the bridge dongle the keyboard works smoothly with the system The green LED ...

Page 24: ...24 CY4636 WirelessUSB LP Keyboard Mouse Reference Design Kit User Guide Doc 001 70355 Rev A Kit Operation ...

Page 25: ...o account for the USB hardware support and other hardware specific changes Design efforts have been made to reduce the ON time of the microprocessor and radio to conserve battery life of attached devices This includes protocol optimizations along with using sleep features of the radio and enCoRe II microprocessor The bridge connects the remote WirelessUSB LP HIDs to a low speed USB host This firmw...

Page 26: ...ltage range reduced supply current in all operating modes higher data rate options reduced crystal startup synthesizer settling and link turnaround times The CYRF6936 chip operates with a 2 4 GHz direct sequence spread spectrum DSSS radio trans ceiver and operates in the unlicensed worldwide industrial scientific and medical ISM band 2 400 GHz to 2 483 GHz The operating current is 21 mA transmit a...

Page 27: ...ted to VREG 4 NC Connect to GND 5 NC Connect to GND 6 VBAT 0 2 VBAT 1 8 V to 3 6 V Main supply 7 VCC VCC 2 4 V to 3 6 V Typically connected to VREG 8 VBAT 0 2 VBAT 1 8 V to 3 6 V Main supply 9 NC Connect to GND 10 RFBIAS RF I O 1 8 V reference voltage 11 RFP Differential RF signal to and from antenna 12 GND Ground 13 RFN Differential RF signal to and from antenna 14 NC Connect to GND 15 NC Connect...

Page 28: ...k PACTL or GPIO Tristates in sleep mode configure as GPIO drive LOW 30 PACTL Control signal for external PA T R switch or GPIO 31 NC Connect to GND 32 NC Connect to GND 33 VIO I O interface voltage 1 8 3 6 V 34 RST Device reset Internal 10 kohm pull down resistor Active HIGH connect through a 0 47 μF capacitor to VBAT Must have RST 1 event the first time power is applied to the radio Otherwise the...

Page 29: ...3 V regulators Internal USB pull up resistor Configurable I O for real world interface without external components Enhanced 8 bit microcontroller with Harvard architecture M8C CPU speed of up to 24 MHz or sourced by an external clock signal The CY7C63803 is targeted for the following applications PC HID devices Mice optomechanical optical trackball Gaming Joysticks Game pad General purpose Barcode...

Page 30: ...an input to reduce current draw 10 P1 1 D GPIO Port 1 bit 1 USB D 1 If this pin is used as a general purpose output it draws current This pin must be configured as an input to reduce current draw 11 VCC Supply 12 P1 2 VREG GPIO Port 1 bit 2 Configured individually 3 3V if regulator is enabled The 3 3 V regulator is not avail able in the CY7C63310 and CY7C63801 A 1 mF min 2 mF max capacitor is requ...

Page 31: ...en the USB enumera tion process completes Note If the bind button is pushed when the dongle is first plugged in the firmware enters MTK test mode and the LED blinks The LED blinks continuously until the dongle is removed from the computer 2 The red LED blinks ON OFF when the dongle is in Bind Mode The ON and OFF time is approxi mately 320 ms which is the rate at which the dongle changes channels d...

Page 32: ...ink alternately in Manufacturing Test mode Figure 4 7 Schematic View of the LEDs 4 1 2 Power Supply System The CY4636 Bridge board gets power from the USB A connector on the board Figure 4 8 Power Supply System Structure for the Bridge Figure 4 9 Schematic View of the Power Supply System Structure for the Bridge USB VBUS 5 V ...

Page 33: ...ptimizations along with using sleep features of the radio mouse optics and the microprocessor The mouse design uses the SS12 schottky diode D1 and CDH53100LC inductor L3 for its boost circuitry With these high efficiency components preliminary characterization data shows a range of approximately 74 to 87 efficiency for the 1 8 2 7 V VBAT voltage range at different temperatures 10 C to 80 C The mou...

Page 34: ... 1 Functional Description The mouse board includes the CY7C60323 chip CY7C6396 chip ISSP header optical sensor encoder three buttons scroll wheel 12 MHz oscillator and an antenna The following figure shows the different functional blocks on the CY4636 mouse board Figure 4 11 Functional Blocks of the Mouse ...

Page 35: ...ful engine that supports a rich feature set It encompasses SRAM for data storage an interrupt controller sleep and watchdog timers internal main oscillator IMO and internal low speed oscillator ILO The CPU core called the M8C is a powerful processor with speeds up to 12 MHz The M8C is a four MIPS 8 bit Harvard architecture microprocessor The core includes a CPU memory clocks and configurable gener...

Page 36: ...ing a cost effective low voltage 8 bit microcontroller Figure 4 13 Schematic view of the CY7C60323 Chip Table 4 3 Pin Details of the CY7C60323 Chip Pin Name Description 1 P0 7 Analog column mux input 2 P0 5 Analog column mux input and column output 3 P0 3 Analog column mux input and column output integrating input 4 P0 1 Analog column mux input integrating input 5 P2 7 6 P2 5 7 P2 3 Direct switche...

Page 37: ...llator and LED driver to minimize external components Figure 4 14 Schematic View of the Optical Sensor 12 P1 3 13 P1 1 I2C Serial Clock SCL ISSP SCLK 14 Vss Ground connection 15 P1 0 I2C Serial Data SDA ISSP SDATA 16 P1 2 17 P1 4 Optional External Clock Input EXTCLK 18 P1 6 19 XRES Active HIGH external reset with internal pull down 20 P2 0 Direct switched capacitor block input 21 P2 2 Direct switc...

Page 38: ... Name Description 1 NCS Chip select active low input 2 MISO Serial data output Master In Slave Out 3 SCLK Serial clock input 4 MOSI Serial data input Master Out Slave In 5 MOTION Motion Detect active low output 6 XY_LED LED control 7 LED_GND Ground for LED current 8 NC No connection 9 AGND Analog Ground 10 SHTDWN Shutdown active high input 11 AVDD Analog Supply Voltage 12 GND Ground 13 GND Ground ...

Page 39: ...te with the mouse to bind to the system Figure 4 16 Schematic View of the Bind Button 4 2 1 6 Wheel and Buttons There are three buttons S2 S3 and S4 for the left middle and right button operations of the mouse The wheel with the encoder is used for scroll operation Figure 4 17 Schematic view of the Buttons and Wheel 4 2 2 Power Supply System The CY4636 mouse board has power sources from the batter...

Page 40: ...e reduced the ON time of the microprocessor and radio to conserve battery life This includes protocol optimizations along with using sleep features of the radio and enCoRe II LV microprocessor The keyboard design uses the BAT400D 7 F schottky diode D1 and CDH53100LC inductor L3 for its boost circuitry These low cost components are used to reduce the overall system cost at the expense of lower boos...

Page 41: ... 4 3 1 Functional Description The following figure shows the different functional blocks on the CY4636 Keyboard Figure 4 21 Functional blocks of the Keyboard PCB 4 3 1 1 Chip CYRF6936 Figure 4 22 Schematic View of the CYRF6936 Chip Refer to the pin details of the CYRF6936 chip in Table 4 1 on page 27 ...

Page 42: ...hout external components It has an enhanced 8 bit microcontroller with Harvard architecture and a M8C CPU speed up to 12 MHz or sourced by an external crystal resonator or clock signal The CY7C60123 is targeted for the following applications PC wireless human interface devices HID Mice optomechanical optical trackball Key boards Presenter tools Gaming Joysticks Gamepad General purpose wireless app...

Page 43: ...NT1 21 P0 2 INT0 GPIO port 0 bit 2 Configured individually Optional rising edge interrupt INT0 22 P0 1 CLKOUT GPIO port 0 bit 1 Configured individually On CY7C601xx optional Clock Out when external oscillator is disabled or external oscillator output drive when external oscillator is enabled On CY7C602xx oscillator output when configured as Clock Out 23 P0 0 CLKIN GPIO port 0 bit 0 Configured indi...

Page 44: ...group byte 37 P3 3 GPIO port 3 Configured as a group byte 38 P3 4 GPIO port 3 Configured as a group byte 39 P3 5 GPIO port 3 Configured as a group byte 40 P3 6 GPIO port 3 Configured as a group byte 41 P3 7 GPIO port 3 Configured as a group byte 42 P4 2 GPIO port 4 Configured as a group nibble 43 P4 3 GPIO port 4 Configured as a group nibble 44 VSS Ground 45 NC No connect 46 NC No connect 47 NC No...

Page 45: ...board interface J1 is present on the board which takes an input from eight rows and 18 columns input from 101 keys Figure 4 24 Schematic View of the Keyboard Interface 4 3 1 4 ISSP Header ISSP header J2 is used to program the keyboard Programming can be done using the MiniProg programmer device Figure 4 25 Schematic View of the ISSP Header ...

Page 46: ...bridge goes into Bind Mode The bind button on the keyboard is then pressed to bind the keyboard Figure 4 26 Schematic View of the Bind Button 4 3 2 Power Supply System The CY4636 keyboard has power sources from the battery supply terminal and ISSP header on the board Figure 4 27 Power Supply System Structure for the Keyboard Figure 4 28 Schematic View of the Power Supply System Structure for the K...

Page 47: ...the USB Suspend When suspended the bridge supports remote wakeup by intermittently turning the radio on when the sleep timer interrupt occurs checking for valid data from the HID devices and then turning the radio off again if no HID traffic is detected Table 5 1 ROM RAM Usage The ENCRYPT_DATA option requires 64 bytes of extra ROM space to store the nonvolatile session key 5 1 2 Device Configurati...

Page 48: ...on CPU Clock This parameter is set to Internal 24 MHz In order to run the CPU at 12 MHz CPU Clock N must be set to 2 This operating frequency provides for faster code execution CPU Clock N This parameter is set to 2 to provide a 12 MHz clock Timer Clock This parameter is set to TCAP Timer Clock N This parameter is set to 4 Capture Clock This parameter is set to Internal 24 MHz Capture Clock N This...

Page 49: ...municate with the LP radio The interrupt API to this module is not used USB Device User Module The USB Device User Module handles the enumeration and data trans fers over USB endpoints 1 Millisecond Interval Timer User Module The 1 millisecond Interval Timer User Module is used to determine when a USB suspend has occurred LED on off duration timing RSSI checking and others Flash Security The bridg...

Page 50: ...le API and definitions are exported in the header file while the module implementation and local definitions are contained in the C file 5 1 3 1 Common Code The modules consist of the common code logical grouping PSoC Generated Library Code There are currently only three files generated by PSoC Designer that are modified for the use of the application A minimal amount of code has been added to the...

Page 51: ... test mode If the manufacturing test mode is not indicated then normal bridge operation begins The bridge continuously checks the USB idle timer received packet the Bind button and the USB sus pend Check the USB Idle Timer The check_usb_idle function is called within the main function to properly handle the USB Set_Idle command The USB Set_Idle command from the host PC is used to silence the keybo...

Page 52: ...Forcing an SE1 condition D and D are both high on the USB bus and applying power to the bridge Method 3 Grounding P0 4 during insertion into a USB Host enters the manufacturing test mode Encrypt Module This module may be conditionally compiled in to provide encryption decryption support Encrypted data transfers are typically used between RDK keyboard devices and the RDK bridge Contact Cypress Appl...

Page 53: ...PSoC Designer software The module boot asm calls main once the enCoRe II has been configured and initialized Main initializes the components of the bridge along with the radio modules The bridge firmware enters a loop to receive and handle radio packets and generate USB packets 5 1 3 6 Wireless Protocol Data Payload The RDK HID protocol has been optimized to reduce the ON time of the radio which e...

Page 54: ...eps The bridge receives the keyboard report packet and process the packet This step takes 108 µs MCU calls function handle_keyboard_report to format USB packet and load this packet into the endpoint buffer This function consumes 118 µs Therefore it takes 226 µs for the bridge to process a keyboard report 5 1 3 10 USB Interface USB Descriptors The USB Descriptors can be viewed edited with the USB S...

Page 55: ...onfig Descriptors Keyboard HID Report Descriptor The keyboard HID report descriptor defines a Boot Protocol keyboard This enables a LP RDK key board with the LP RDK bridge to work on different BIOS versions that do not correctly support the USB Report Protocol Only standard 101 104 keys are sent using this format over endpoint 1 ...

Page 56: ...Report Descriptor Endpoint 1 Mouse Keyboard HID Report Descriptor The mouse keyboard HID Report Descriptor uses the report protocol format with a unique report ID for each report Mouse data uses Report ID 1 The mouse report include delta x delta y and scroll wheel data Figure 5 5 Mouse HID Report Descriptor Report ID 1 Endpoint 2 ...

Page 57: ... Keyboard multimedia keys use Report ID 2 Figure 5 6 Keyboard s MM Keys HID Report Descriptor Report ID 2 Endpoint 2 Keyboard power keys use Report ID 3 Figure 5 7 Keyboard s Power Keys HID Report Descriptor Report ID 3 Endpoint 2 Report ID 4 is used to send the mouse battery level and link quality report ...

Page 58: ...c 001 70355 Rev A Code Examples Figure 5 8 Mouse s Battery Link Quality Report Descriptor Report ID 4 Endpoint 2 Report ID 5 is used to send the keyboard battery level and link quality report Figure 5 9 Keyboard s Battery Link Quality Report Descriptor Report ID 5 Endpoint 2 ...

Page 59: ...power keys use Report ID 3 Figure 5 10 Keyboard Report Format Figure 5 11 Multimedia and Power Keys Report Format Battery Level and Link Quality Reports The WirelessUSB LP bridge implements a mechanism to report the radio parameters of attached HID devices via the USB control endpoint The code for this functionality can be found in the user custom code section of the User Module source file usb_1_...

Page 60: ...btaining the RadioParams Report When the bridge receives a control endpoint request from the host with the parameters listed in the following table it returns an 8 byte RadioParams report over the control endpoint Control endpoint request for RadioParams report are listed here Usage ID Usage Name 0x00 Undefined 0x01 WirelessUSB keyboard 0x 02 WirelessUSB mouse 0x03 0x1F RESERVED 0x 20 Battery Leve...

Page 61: ...ttery Level Corrupt Packets and Packets Transferred are initialized to zero Example USB Bus Analyzer CATC Traces Figure 5 12 shows the USB data transmissions between the bridge and the host PC captured with the USB CATC Bus Analyzer In this example the Right Shift g h keys were typed followed by the Volume Up Volume Down keys Note the key board regular key reports are sent to the PC via the endpoi...

Page 62: ... mouse data being transferred between the dongle and the host PC The first part of the trace shows the mouse data when the left button was pressed and held down as the mouse was moved and then the left button was released The second part of the trace shows the Z wheel being moved down and up Figure 5 13 Example Mouse CATC Trace ...

Page 63: ...ed to differentiate keyboard and mouse requests Figure 5 1 16 CATC Trace of Battery and Link Quality Data Requests 5 1 4 Verify Output 1 Connect the bridge to the PC and wait for the device to enumerate the red LED turns ON it turns OFF when the USB enumeration process completes Once enumeration is done start using the bridge 2 Press the bind button the red LED blinks ON OFF when the dongle is in ...

Page 64: ...ibits the ROM RAM usage for individual build options Table 5 7 ROM RAM Usage 5 2 2 Device Configurations The enCoRe III LV is configured using the Device Editor in PSoC Designer The mouse uses three digital blocks and two analog blocks to support three separate user modules The first module is an SPI master for communicating with the optical sensor and the radio The second module is a PWM configur...

Page 65: ...mproved power savings Slower clock frequencies increase power consumption of the microcontroller in the mouse design Sleep Timer The sleep timer is set to 1 Hz in order to reduce the microcontroller load The sleep timer is used to maintain a very coarse sense of time when the PWM User Module is turned off Changing this value affects timing operation of the timer code module VC1 VC3 The other clock...

Page 66: ...dule must be configured to generate a terminal count interrupt The period parameter is ignored since it is programmed at run time based upon the calibration results See the timer code module for more details on calibration 5 2 2 4 ADC User Module The ADC User Module is only powered on when needed to make a battery voltage measurement The VC1 VC3 global clock resources are used to control the measu...

Page 67: ...rresponding module name c or module name asm and module name h source code files The module API and definitions are exported in the header file while the module implementation and local definitions are contained in the C assembly file 5 2 3 1 Common Code The modules in the common code group are a combination of two sources The first is PSoC Designer generated files in the lib directory that have b...

Page 68: ...odule has a dependency on the instantiation of a SPIM module in PSoC Designer that is properly connected to the devices Radio Driver The radio driver module is a low level module providing basic radio communication and configuration Its general application is such that it is likely not to be changed by the firmware developer It provides an interface for reading writing radio registers setting PN c...

Page 69: ...ion since the microcontroller sleep feature is used When polling is enabled it is performed as a back ground task during the millisecond delay This module also adjusts the tick advancement based upon the sleep resolution selected as a global parameter in the Device Editor when the timer is disabled Turning off the timer provides for more power savings yet a sense of time is still preserved for non...

Page 70: ... test mode If neither of the test modes is indicated then normal mouse operation begins The mouse module handles a variety of events at the main thread level Most interrupt routines post notification that an event occurred by using the macros provided by the mouse interface The mouse then processes these events at thread context rather than interrupt context The mouse application is implemented us...

Page 71: ...his input is then connected to a 10 bit single slope analog to digital converter User Module The firmware has been implemented to read the battery voltage and then provide a ten level mapping of the battery voltage The battery level is periodically measured and changes in level are transmitted to the bridge see the mouse module for the algorithm The battery module must be calibrated at power on re...

Page 72: ... to perform a carrier test as well as a random data test The manufacturing test code is designed to be compatible with the CY3631 Manufacturing Test Kit Tester Entry into this mode on the mouse is performed by placing a shorting block over pins four and five of the ISSP programming header and then inserting the batteries The test mode may only be exited by removing the batteries and shorting block...

Page 73: ...hat time out time The default value is 2000 This value is defined in milliseconds PLATFORM_H This configuration value identifies the header file that has the platform configuration information The default value is pdc9302 h which is the identifier for the mouse board that is shipped with the RDK This macro changes when the code is ported to another platform MOUSE_800_NOT_400_CPI This configuration...

Page 74: ...d is included in about every file by using the macro PLATFORM_H that is defined in config h Porting the code to another microprocessor architecture requires modification or leverage of the existing code for processor specific features along with pin definitions 5 2 3 4 Initialization Initialization of the enCoRe III LV chip is done by code that is generated in boot asm by the PSoC Designer softwar...

Page 75: ...e pragma interrupt_handler For example the interrupt handler in the optical module that handles detection of optical motion does not call any other C functions Instead it uses a macro provided by the mouse module to post an event flag See the optical mouse modules This method prevents the compiler from pushing all of its virtual registers onto the stack when a function is called at interrupt conte...

Page 76: ...to finish the wheel poll Firmware delays MOUSE_REPORT_IN_MS which is 10 ms for the default This delay is to pre vent excessive radio retries from the mouse Firmware calls function mouse_do_report to read the Delta_X and Delta_Y value and send the packet to the bridge This step takes 1 98 ms which includes 1 66 ms radio transmission time Therefore if a mouse is in the rest 1 state it takes 28 6 ms ...

Page 77: ...ogical organization of the source code modules that make up the keyboard application code and other support modules 5 3 1 1 ROM RAM Usage The following table shows the ROM RAM usage The top part exhibits the total ROM RAM usage for basic functions which disables all the build options below The bottom part exhibits the ROM RAM usage for individual build options The ENCRYPT_DATA option requires 64 b...

Page 78: ...able interval timer The following is a screen shot of the Device Editor showing the User Module mapping Further description of resources and User Modules follow the diagram Table 5 12 RDK Keyboard Matrix Row 0 Row 1 Row 2 Row 3 Row 4 Row 5 Row 6 Row 7 Column 0 0x09 0x0A 0x19 0x05 0x17 0x15 0x21 0x22 Column 1 0x0D 0x0B 0x10 0x11 0x1C 0x18 0x24 0x23 Column 2 0x0E 0x3F 0x36 NA 0x30 0x0C 0x25 0x2E Col...

Page 79: ...ameter is set to Internal 24 MHz In order to run the CPU at 12 MHz CPU Clock N must to be set to 2 This operating frequency provides for faster code execution so that when events are detected the microcontroller can be put back into the sleep state quicker for improved power savings CPU Clock N This parameter is set to 1 to provide a 24 MHz clock Timer Clock This parameter is set to TCAP Timer Clo...

Page 80: ...nd MSB first transmission as defaults A clock divider of 6 is chosen which generates an SPI clock of 2 MHz The interrupt API to this module is not used 5 3 2 3 Programmable Interval Timer User Module This module is used for timing 5 3 2 4 Flash Security The keyboard project within PSoC Designer has a file called FlashSecurity txt This file specifies access rules to blocks of Flash ROM See the docu...

Page 81: ...the radio and transmitting or receiving packets See the Radio Driver documentation for details Protocol Module The protocol module defines and implements the layer used to deliver packets from the device to the bridge It manages the binding of devices to a bridge as well as the connection and interference immunity by channel hopping This module has a dependency on the radio driver for sending and ...

Page 82: ...dge After that the keyboard goes into the idle state In idle state the MCU and radio go to sleep to save power and the keyboard application remains waiting for input from the keys or Bind button The timer is turned off to conserve power This state is maintained indefinitely until a keystroke or a button press occurs The battery level is reported by the keyboard application when it detects a keystr...

Page 83: ...codes The test continues until the escape key is pressed After the test finishes execution the keyboard returns to normal operation Encrypt Module This module may be conditionally compiled in to provide encryption decryption support Encrypted data transfers are typically used between RDK keyboard devices and the RDK bridge Contact Cypress Applications support for the encryption source code 5 3 3 3...

Page 84: ...eporting is compiled into the executable image If it is not defined then the battery voltage level reporting code is omitted LP_RDK_KEYBOARD_MATRIX This configuration definition is used to selectively compile in the keyboard matrix for the RDK keyboard hardware KEYBOARD_FAST_SCAN This configuration definition is used to selectively compile in the Cypress Semiconductor fast scan algorithm Fast Scan...

Page 85: ...platform to another platform with a simple re mapping of pins on the enCoRe II LV The file pdc9265 h maintains the pin mapping definitions that are used throughout the code and is included in about every file by using the macro PLATFORM_H that is defined in config h The keyboard scan matrix is defined in kdefs h and may need to be changed for different keyboards Porting the code to another micropr...

Page 86: ... scan codes Trailing zeros in the reports are also removed to further minimize the number of bytes sent by the radio The LP radio sends the reports with the format shown in Table 5 3 4 Table 5 14 LP Generic Report Standard 101 Keys Report If the Application Report Header byte is less than 0xFC then this indicates that this report is a Stan dard 101 Keys Report and the first byte is the actual scan...

Page 87: ...t Report Multimedia Keys Hot keys Report An Application Report Header of 0xFF indicates that this report is a Multimedia Keys Report Table 5 20 Multimedia Keys Report Format Example The following reports are sent if a user presses Volume Increase Hot Key 8 key on the keyboard The following table shows the Volume Increase down key packet sent from the keyboard to the bridge Table 5 16 Example a dow...

Page 88: ... down key packet sent from the keyboard to the bridge Table 5 24 Example Suspend Sleep Down Key Power Keys Report The up key packet sent from the keyboard to the bridge is shown in Example Up Key Power Keys Report Table 5 25 Example Up Key Power Keys Report Keep Alive Report An Application Report Header of 0xFC indicates that this report is a Keep Alive Report The following table shows an example ...

Page 89: ...ltage Level Report with low batteries Table 5 29 Example low Battery Voltage Level Report 5 3 3 7 Ghost Key Detection Ghost keys are possible on the RDK keyboard because it does not use diodes with the keyboard switches Ghost keys are caused when three keys are pressed at the same time and two of the keys are on the same column and two of the keys are on the same row When scanning the keyboard it ...

Page 90: ...8C to change program counter to inter rupt address Time for LJMP instruction in interrupt table to execute For example if the 5 cycle JMP instruction is executing when an interrupt becomes active the total number of CPU clock cycles before the ISR begins would be as follows 1 to 5 cycles for JMP to finish 13 cycles for interrupt routine 7 cycles for LJMP 21 to 25 cycles In the example above at 12 ...

Page 91: ... shown in Table A 6 1 Customers may modify the keyboard matrix or they may add new keys to their keyboard The following sections explain the procedure Modifying the Keyboard Matrix In the file kdefs h a table called default_keyboard_scan_table matches the keyboard matrix shown in Table A 6 1 By modifying this table the keyboard matrix is automatically modified Adding New Keys Example The customer ...

Page 92: ...dongle to the PC power the keyboard with the two AA batteries 2 Press the bind button on the bridge the red LED blinks ON OFF in the bind mode Now press the bind button on the keyboard the red LED stops blinking on binding the keyboard with the bridge 3 Press any key on the keyboard the green LED turns ON when the dongle receives data from the keyboard 4 The green LED turns ON and remains ON if a ...

Page 93: ...L D XTAL SS NC16 VREG E PAD VDD NC4 NC5 RFbias RFp GND1 NC6 NC7 NC8 NC10 PACTL NC11 VIO NC12 NC13 NC14 VBAT0 IND0402 L2 1 8 nH 0402 C9 0 047 uFd J1 USB A SMT PLUG 1 2 3 4 5 6 VBUS DM DP GND S1 S2 0402 C1 15 pFd D1 LED Green Red 1 2 3 4 GR RD C C 0402 R1 zero 0402 R2 620 ANT1 WIGGLE 32 1 2 0402 C12 1500 pFd 0402 C10 0 047 uFd 0402 C3 2 0 pFd 0402 C7 0 047 uFd 0805 C13 4 7 uFd 0805 C14 2 2 uFd S1 SW...

Page 94: ... 0805 R9 1 1 0603 R2 100K 1210 C6 No Load U2 CY7C60323 PVXC 15 13 16 12 17 11 18 10 20 8 21 7 22 6 23 5 19 9 24 4 25 3 26 2 27 1 28 14 P1_0 P1_1 P1_2 P1_3 P1_4 P1_5 P1_6 P1_7 P2_0 P2_1 P2_2 P2_3 P2_4 P2_5 P2_6 P2_7 XRES VSS P0_0 P0_1 P0_2 P0_3 P0_4 P0_5 P0_6 P0_7 VCC VSS U1 CYRF6936 36 4 8 19 16 20 2 25 27 26 29 34 28 3 7 5 13 6 37 1 24 39 40 41 35 9 14 10 11 12 15 17 18 21 30 22 33 23 31 32 38 NC...

Page 95: ...8 29 28 26 25 19 23 12 5 7 24 10 20 43 21 42 22 6 34 35 36 37 38 39 40 41 13 14 15 31 32 33 27 44 11 9 8 4 1 2 3 46 47 48 45 P1_4 SCLK P0_7 P0_6 TIO1 P0_5 TIO0 P1_3 SSEL P1_2 P1_1 P1_0 P0_4 INT2 P0_0 CLKIN P2_3 VDD1 P4_0 VSS1 P2_5 P0_3 INT1 P4_3 P0_2 INT0 P4_2 P0_1 CLKOUT P4_1 P3_0 P3_1 P3_2 P3_3 P3_4 P3_5 P3_6 P3_7 P2_2 P2_1 P2_0 P1_5 SMOSI P1_6 SMISO P1_7 VDD2 VSS2 P2_4 P2_6 P2_7 NC4 NC1 NC2 NC3...

Page 96: ...96 CY4636 WirelessUSB LP Keyboard Mouse Reference Design Kit User Guide Doc 001 70355 Rev A A 2 Board Layout Figure A 5 Bridge Top Figure A 6 Bridge Bottom ...

Page 97: ...CY4636 WirelessUSB LP Keyboard Mouse Reference Design Kit User Guide Doc 001 70355 Rev A 97 Figure A 7 Mouse Top Figure A 8 Mouse Bottom ...

Page 98: ...98 CY4636 WirelessUSB LP Keyboard Mouse Reference Design Kit User Guide Doc 001 70355 Rev A Figure A 9 Keyboard Top Figure A 10 Keyboard Bottom ...

Page 99: ...section for more details A designated channel subset is used during Bind Mode along with an associated pseudo noise code in order to enable all WirelessUSB devices to effectively communicate during this procedure A 3 2 Pseudo Noise Codes Pseudo noise codes PN codes are the codes used to achieve the special matched filter character istics of DSSS communication Certain codes referred to as multiplic...

Page 100: ...radio driver CRC Seed This 8 bit value is used for the CRC calculation that further diversifies transmissions from different networks All packets sent between non bound devices use the default CRC seed of 0x0000 All packets sent between bound devices use a CRC seed that is common to all devices bound to a particular bridge or network but unique from network to network A 3 6 Manufacturing ID Each W...

Page 101: ...r Bind Mode After a defined period of time in Idle Mode the HID enters Sleep Mode in order to conserve power When the HID wakes up due to a user action it re enters Idle Mode A 3 8 3 Reconnect Mode HID only Reconnect Mode is used by the HID to discover the current channel used by the bridge and to estab lish a connection with the bridge Upon entering Reconnect Mode the HID uses the Network ID to s...

Page 102: ...ER_SUBSET define A 3 8 5 Data Mode HID When the HID application has data to send to the bridge the HID transmits a DATA packet and listens for an AutoACK If an AutoACK is not received the HID retransmits the packet If the HID does not receive an AutoACK after a defined number of retransmissions of the DATA packet it assumes the channel has become unavailable due to excessive interference and moves...

Page 103: ...rmine the length of data packets which PN code to assign etc The keyboard device type is 2 and the mouse device type is 3 A 3 9 2 Bind Response Packet Bridge Byte 1 Packet Type 0 Pin This is a 3 bit field specifying the PIN element of the Network ID Byte 2 5 Manufacturing ID MID 1 MID 4 This is the 4 byte Manufacturing ID retrieved from the bridge s radio and will be used by the HID A 3 9 3 Connec...

Page 104: ...F This is a 1 bit field specifying a Ping or Ping Response 0 Ping 1 Ping Response A 3 9 6 Data Packet Bridge and HID Data packets are sent from the HID to the bridge in Connected Mode They are also sent from the bridge to the HID in Connected Mode if there is an asynchronous back channel Byte 1 Packet Type 4 Data Toggle Bit This is a 1 bit field that is toggled for each new Data packet It is used ...

Page 105: ...ind Response packet and exits the Bind Mode When the Bind button on the HID is pressed the HID goes into Bind Mode While in Bind Mode the HID also uses the Bind ID to communicate with the bridge The HID sends a Bind Request packet and listens for an AutoACK packet If the HID does not receive the AutoACK it moves to the next channel in the Bind Channel subset and repeats the Bind Request packet It ...

Page 106: ...quest packet and listens for an AutoACK packet If the HID receives the AutoACK it immediately enables its receiver and listens for the Connect Response packet from the bridge If the HID does not receive the AutoACK it selects the next chan nel using the Channel Selection Algorithm and repeats this procedure As shown in the Figure A 3 2 the reconnect attempt takes approximately 1 76 ms channel The ...

Page 107: ...AutoACK packet If an AutoACK is not received the keyboard retransmits the Data packet If the keyboard does not receive an AutoACK after a defined number of transmissions of the Data packet it assumes the channel has become unavailable due to exces sive interference and moves to Reconnect Mode If the keyboard receives the AutoACK it enables its receiver and starts listening for data from the bridge...

Page 108: ...termine its next action If the SIGNATURE byte is 0x90 the HID uses the retrieved MID to calculate the NetworkID and moves to Re connect mode If the SIGNATURE byte is not 0x90 the HID goes to sleep mode waiting for the user to initiate the Bind process A 3 13 Encryption Data packets may be encrypted for privacy All encrypted Data packets shall have a payload of 8 bytes this is the minimum block siz...

Page 109: ...sts of 16 bit Preamble 2 bytes SOF 1 byte packet header 1 byte key code 2 bytes CRC while an encrypted key down packet consists of the same overhead packets plus 8 byte key code instead of 1 byte key code As a result the active transmit Icc increases by approxi mately 50 This results in an increase in the average power consumption when encryption is enabled The measurement shows that the average I...

Page 110: ... MTK DUT code to different platforms Refer to the Manufacturing Test Kit User s Guide for instructions on operating the MTK Tester A 4 2 MTK Block Diagram Figure A 15 Block Diagram A 4 3 MTK Serial Protocol The MTK Tester implements a text based protocol over an RS232 serial port to provide both a con figurable standard test and script based testing All commands listed under the standard test set ...

Page 111: ...HOLD 0 65535 units of bit errors RT rx error threshold CONFIGURE RX ERROR THRESHOLD 0 65535 units of bit errors C1 channel CONFIGURE CHANNEL 0 77 C2 channel CONFIGURE SECOND CHANNEL 0 77 C3 channel CONFIGURE THIRD CHANNEL 0 77 CB of bytes CONFIGURE NUMBER OF BYTES PACKET PAYLOAD 0 15 CP of packets CONFIGURE NUMBER OF PACKETS 0 255 TC time TRANSMIT CARRIER 0 255 TR time TRANSMIT RANDOM 0 255 SC cha...

Page 112: ...n be conditionally compiled with the define MFG_TX_MODES A 4 5 MTK DUT source Code Porting The RDK keyboard bridge and mouse use the C source files mfgtest c and mfgtest h Select the appropriate source files for the target platform as a starting point Make code changes as necessary to work in your environment A 4 6 Accessing MTK in the DUT Mouse Apply a jumper across the ISSP header pins 4 5 and i...

Page 113: ...model there are 6 keystrokes per second in the active state and every key stroke includes one down key packet one up key packet and one keep alive packet The test mode firmware only sends out one down key packet and one up key packet for each keystroke Therefore we need to set the typing rate to 8 keystrokes per second in test mode in order to con sume the equivalent power of the usage model It is...

Page 114: ...ith the 3030 3040 sensor in active state 2 hours per day with the 3030 3040 sensor in rest1 state 2 hours per day with the 3030 3040 sensor in rest2 state 19 hours per day with the 3030 3040 sensor in rest3 state 5 days per week as above 2 days per week 24 hours in rest3 state Operation Mode Icc mA with Supply Voltage 2 5 V Icc mA with Supply Voltage 2 8 V Average Icc mA Active state Place the key...

Page 115: ...ry life estimate of 338 days or 11 months Operation Mode Icc mA with Supply Voltage 2 5 V Icc mA with Supply Voltage 2 8 V Average Icc mA Active state Move the mouse in a circle on white paper 7 7 6 4 7 1 Rest1 state Allow the mouse to sit idle for 1 sec ond after being in the active state 1 5 1 2 1 4 Rest2 state Allow the mouse to sit idle for 10 sec onds after being in the active state 0 15 0 12...

Page 116: ...classes CHidDevice and CHidManager The CHidDevice class is the primary interface to a HID device while the CHidManager class keeps track of the arrival and removal of HID devices along with notification to the application of such events The building blocks for the USB HID API module was derived from the HCLIENT sample code provided in the Windows DDK This module was designed to provide a generic i...

Page 117: ...hod packages the HID report based on the data in the structures GetManufacturerString Public This method obtains the USB manufacturer string from the HID device GetProductString Public This method obtains the USB product string from the HID device GetSerialNumber String Public This method obtains the USB serial number string from the HID device RegGetValue Public This method attempts to get a regi...

Page 118: ...eviceWithHandle Public This method scans the current list of HID devices and returns a pointer to the HID device that matches the device handle provided HidDeviceAlreadyExists Public This method determines if the HID device already exists in the list AddHidDevice Public This method checks if the provided HID device already exists and if not adds the new HID device to the end of the list increments...

Page 119: ...stem tray RemoveIcon Public This method removes the icon from the system tray SetToolTip Public This method sets the tool tip to be displayed on the system tray SetMenuItem Public This method sets the default menu item executed when the icon is double clicked on the system tray IsHidden Public This method is used to determine if the system tray icon is hidden ShowBalloonTip Public This method disp...

Page 120: ...thod performs basic initialization and checks for any com mand line parameters if command line parameters are found it takes the appropriate action and ends the application if no command line parameters are found then it checks to make sure the application is not currently running and if not then proceeds to run the system tray application ExitInstance Public This method performs some standard cle...

Page 121: ...rtyPage Methods Method Type Description OnInitDialog Public This method initializes the wireless status page reads the current value of the Disable Warning Message check box from the registry and makes a call to start the timer OnDestroy Public This method removes the wireless status page and stops the timer OnStartTimer Public This method starts the timer for the wireless status page based on the...

Page 122: ...estNewUsageValues Public This method sets up and issues a Set Feature request to the HID device which now simply requests the wireless device to provide an update of its battery level the next time it communicates with the USB bridge UpdateUsageValues Public This method retrieves the latest usage values from the USB bridge which includes wireless channel wireless PN code last reported bat tery lev...

Page 123: ... C0805C475K9PACTU 9 1 C14 CAP CER 2 2UF 10V 10 X7R 0805 Murata Electron ics North America GRM21BR71A225KA01L 10 1 D1 LED GREEN RED BICOLOR 1210 SMD LITEON LTST C155KGJRKT 11 1 J1 CONN USB PLUG TYPE A PCB SMT ACON UAR72 4N5J10 12 1 L1 INDUCTOR 22NH 2 FIXED 0603 SMD Panasonic ECG ELJ RE22NGF2 13 1 L2 INDUCTOR 1 8NH 3NH FIXED 0402 SMD Panasonic ECG ELJ RF1N8DF 14 1 R1 RES ZERO OHM 1 16W 0402 SMD Pana...

Page 124: ...SOT23 DIODES INC BAT400D 7 F 35 1 J1 PCB COPPER PADS NONE 36 1 J2 CONN HDR BRKWAY 5POS STR AU PCB AMP Division of TYCO 103185 5 37 1 J3 HEADER 1 POS 0 230 HT MODII 100CL AMP Tyco 103185 1 38 1 L1 INDUCTOR 22NH 2 FIXED 0603 SMD Panasonic ECG ELJ RE22NGF2 39 1 L2 INDUCTOR 1 8NH 3NH FIXED 0402 SMD Panasonic ECG ELJ RF1N8DF 40 1 L3 COIL 10UH 1100MA CHOKE 0805 Newark 30K5421 41 1 R2 RES 1 00 OHM 1 8W 1...

Page 125: ...nasonic ECG EEU FC1A101S 65 4 C20 C23 C24 C 25 CAP 10000PF 16V CERAMIC 0402 SMD Panasonic ECG ECJ 0EB1C103K 66 3 C26 C27 C28 CAP CERAMIC 1 0UF 10V X5R 0603 Kemet C0603C105K8PACTU 67 1 D1 DIODE SCHOTTKY 20V 1A SMA Taiwan Semicon ductor SS12 68 1 J1 HEADER 1 POS 0 230 HT MODII 100CL AMP Tyco 103185 1 69 1 J3 CONN HDR BRKWAY 5POS STR AU PCB AMP Division of TYCO 103185 5 70 1 L1 INDUCTOR 22NH 2 FIXED ...

Page 126: ...H1 BATTERY HOLDER BTC MOUSE SKIN Recycled BTC Mouse M957U 90 2 BATTERY CLIPS POSITIVE Recycled BTC Mouse Unknown 91 2 BATTERY CLIPS NEGATIVE Recycled BTC Mouse Unknown 92 1 EN1 ENCODER CHICONY MOUSE Recycled BTC Mouse Unknown 93 1 SW1 SWITCH SLIDE MINI SPDT BTC ON OFF Recycled BTC Mouse 1101M2S3CQE2 94 1 S1 LT SWITCH SMD BTC BIND Recycled BTC Mouse BTC_PUSH 95 3 S2 S3 S4 SWITCH 6MM VERT LEFT MIDDL...

Reviews: