Kituserguide 1
Kituserguide 1
Kituserguide 1
Cypress Semiconductor
198 Champion Court
San Jose, CA 95134-1709
Phone (USA): 800.858.1810
Phone (Intnl): 408.943.2600
http://www.cypress.com
Copyrights
Copyrights
© Cypress Semiconductor Corporation, 2011-2012. The information contained herein is subject to change without notice.
Cypress Semiconductor Corporation assumes no responsibility for the use of any circuitry other than circuitry embodied in a
Cypress product. Nor does it convey or imply any license under patent or other rights. Cypress products are not warranted
nor intended to be used for medical, life support, life saving, critical control or safety applications, unless pursuant to an
express written agreement with Cypress. Furthermore, Cypress does not authorize its products for use as critical components
in life-support systems, where a malfunction or failure may reasonably be expected to result in significant injury to the user.
The inclusion of Cypress products in life-support systems application implies that the manufacturer assumes all risk of such
use, and in doing so indemnifies Cypress against all charges.
Any Source Code (software and/or firmware) is owned by Cypress Semiconductor Corporation (Cypress), and is protected
by, and subject to worldwide patent protection (United States and foreign), United States copyright laws, and international
treaty provisions. Cypress hereby grants to licensee a personal, non-exclusive, non-transferable license to copy, use, modify,
create derivative works of, and compile the Cypress Source Code and derivative works for the sole purpose of creating
custom software and/or firmware in support of licensee product to be used only in conjunction with a Cypress integrated
circuit as specified in the applicable agreement. Any reproduction, modification, translation, compilation, or representation of
this Source Code except as specified above is prohibited 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 arising out of the application, or use of any product or circuit
described herein. Cypress does not authorize its products for use as critical components in life-support systems, where a
malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress’ product
in a life-support systems application implies that the manufacturer assumes all risk of such use, and in doing so indemnifies
Cypress against all charges.
Use may be limited by and subject to the applicable Cypress software license agreement.
PRoC™, PSoC Designer™, and Programmable System-on-Chip™ are trademarks and PSoC® is a registered trademark of
Cypress Semiconductor Corp. All other trademarks or registered trademarks referenced herein are property of the respective
corporations.
Flash Code Protection
Cypress products meet the specifications contained in their particular Cypress PSoC Data Sheets. Cypress believes that its
family of PSoC products is one of the most secure families of its kind on the market today, regardless of how they are used.
There may be methods, unknown to Cypress, that can breach the code protection features. Any of these methods, to our
knowledge, would be dishonest and possibly illegal. Neither Cypress nor any other semiconductor manufacturer can
guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as "unbreakable."
Cypress is willing to work with the customer who is concerned about the integrity of their code. Code protection is constantly
evolving. We at Cypress are committed to continuously improving the code protection features of our products.
1. Introduction 5
1.1 Kit Contents .................................................................................................................5
1.2 PSoC Designer ............................................................................................................5
1.3 PSoC Programmer ......................................................................................................5
1.4 Additional Learning Resources....................................................................................6
1.4.1 Reference Documents .....................................................................................6
1.5 Document History ........................................................................................................6
1.6 Documentation Conventions .......................................................................................6
2. Getting Started 7
2.1 Kit Installation ..............................................................................................................7
2.2 PSoC Designer ..........................................................................................................11
2.3 PSoC Programmer ....................................................................................................12
2.4 Installation of Battery Level and Link Quality Application ..........................................13
2.5 Install Hardware.........................................................................................................13
3. Kit Operation 15
3.1 Introduction ................................................................................................................15
3.2 Bridge ........................................................................................................................15
3.3 Mouse ........................................................................................................................16
3.4 Keyboard ...................................................................................................................18
4. Hardware 21
4.1 Bridge ........................................................................................................................21
4.1.1 Functional Description....................................................................................22
4.1.2 Power Supply System ....................................................................................26
4.2 Mouse ........................................................................................................................26
4.2.1 Functional Description....................................................................................27
4.2.2 Power Supply System ....................................................................................32
4.3 Keyboard ...................................................................................................................33
4.3.1 Functional Description....................................................................................34
4.3.2 Power Supply System ....................................................................................40
5. Code Examples 41
5.1 Project 1- PRoC_LP_RDK_Bridge ............................................................................41
5.1.1 Project Description .........................................................................................41
5.1.2 Device Configurations ....................................................................................42
5.1.3 Model .............................................................................................................44
5.1.4 Verify Output ..................................................................................................57
5.2 Project 2 - PRoC_LP_RDK_Mouse ...........................................................................58
5.2.1 Project Description .........................................................................................58
5.2.2 Device Configurations ....................................................................................58
A. Appendix 87
A.1 Schematic.................................................................................................................. 87
A.2 Board Layout ............................................................................................................. 90
A.3 WirelessUSB Two-Way HID Protocol Overview........................................................ 94
A.3.1 Radio Channel Management ......................................................................... 94
A.3.2 Pseudo-Noise Codes ..................................................................................... 94
A.3.3 Chip Error Correction ..................................................................................... 94
A.3.4 Automatic Acknowledgment........................................................................... 94
A.3.5 Network ID ..................................................................................................... 95
A.3.6 Manufacturing ID ........................................................................................... 95
A.3.7 Channel Selection Algorithm.......................................................................... 95
A.3.8 Protocol Modes ..............................................................................................96
A.3.9 Packet Structures ........................................................................................102
A.3.10 Bind and Reconnect Timing.........................................................................105
A.3.11 Signature Byte .............................................................................................107
A.3.12 Encryption ....................................................................................................107
A.4 Manufacturing Test Support, MTK...........................................................................109
A.4.1 Introduction ..................................................................................................109
A.4.2 MTK Block Diagram .....................................................................................109
A.4.3 MTK Serial Protocol .....................................................................................110
A.4.4 MTK RF Protocol .........................................................................................111
A.4.5 MTK DUT Source Code Porting...................................................................111
A.4.6 Accessing MTK in the DUT..........................................................................111
A.5 Regulatory Testing Results .....................................................................................112
A.5.1 Introduction ..................................................................................................112
A.6 Power Considerations .............................................................................................112
A.6.1 RDK Keyboard .............................................................................................112
A.6.2 RDK Mouse .................................................................................................113
A.7 Software Guide........................................................................................................115
A.7.1 Introduction ..................................................................................................115
A.7.2 Software Code Modules...............................................................................115
A.8 Bill of Materials (BOM).............................................................................................121
A.8.1 Bridge ..........................................................................................................121
A.8.2 Mouse ..........................................................................................................122
A.8.3 Keyboard .....................................................................................................123
Thank you for your interest in the CY4672 PRoC™ LP Reference Design Kit (RDK). This kit provides
an implementation of a low-power, 2.4 GHz bidirectional wireless keyboard, mouse, and USB bridge
based on the PRoC LP single-chip MCU 2.4 GHz transceiver. Schematics, source code, firmware,
and RF gerber files are provided to guide PC human interface device (HID) designers with their
applications.
Chapter 2 describes the installation and configuration of the CY4672 PRoC LP RDK. Chapter 3
describes the kit operation. Chapter 4 describes the hardware operation. Chapter 5 describes the
code examples provided along with the kit. The Appendix section provides the schematics, bill of
materials (BOM), and protocols for the kit.
This chapter describes the installation of the CY4672 PRoC LP Reference Design Kit.
Note If auto-run does not execute, double-click on the cyautorun.exe file in the root directory of
the CD, as shown in Figure 2-2.
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, as shown in
Figure 2-3.
4. Click Next to launch the kit installer.
Figure 2-3. InstallShield Wizard
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, as
shown in Figure 2-4.
6. Click Next to start the installation.
7. When the installation begins, all packages are listed on the Installation page. A green check mark
appears adjacent to every package that is downloaded and installed, as shown in Figure 2-5.
8. Wait until all the packages are downloaded and installed successfully.
Figure 2-5. Installation Page
12.To experiment with the code examples, go to Code Examples on page 41.
Note For more details on PSoC Designer, see the PSoC Designer IDE Guide at:
<Install_directory>\Cypress\PSoC Designer\<version>\Documentation.
3. Click the File Load button in the PSoC Programmer menu bar; navigate and select the appropri-
ate hex file.
4. Use the Program button to load the hex file on to the chip.
5. When programming is successful, the Programming Succeeded message is displayed on the
Actions pane.
6. Close PSoC Programmer.
Note For more details on PSoC Programmer, see the user guide at:
C:\Program Files\Cypress\Programmer\<version>\Documents.
3.1 Introduction
The CY4672 PRoC LP RDK includes the following components:
■ PRoC LP Bridge/Dongle - A single-chip USB bridge based on the CYRF69213 PRoC LP for
bridges. Supports Microsoft Windows Vista HotStart (Direct Application Launch) via two dedi-
cated I/Os.
■ PRoC LP Mouse - The RDK mouse is a three-button optical mouse with a scroll wheel. It is
based on the CYRF69103 PRoC LP for peripherals and the Avago 3040 optical sensor.
■ WirelessUSB LP Keyboard - The RDK keyboard is a 101-key keyboard with multimedia keys
(such as internet and mail) and power keys. It features AES 128-bit encryption and bidirectional
communication for toggling CAPS LOCK and NUM LOCK LEDs. It is based on the CYRF6936
WirelessUSB LP radio SoC and CY7C60123 Wireless enCoRe II MCU.
3.2 Bridge
The CY4672 RDK uses PRoC LP CYRF69213 for the bridge. The PRoC LP RDK Bridge has the
capability of being programmed through the USB connector using a Cypress USB adapter board,
CY3655-PLG.
Figure 3-1. Cypress USB Programming Adapter
7. When Programming Succeeded appears in the Actions pane, detach the MiniProg.
8. Connect the Bridge dongle through the USB port to the PC, wait for the bridge to enumerate.
When the dongle is first plugged in, the red LED turns ON. It turns OFF when 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 blinks the LED. The LED blinks continuously until the dongle
is removed from the computer.
9. Start using the Bridge, after it is enumerated.
10.To bind the bridge with the mouse or keyboard, press the bind button on the bridge; the bridge
goes into Bind Mode. In Bind Mode, the bridge uses the Bind ID to communicate with the mouse
or keyboard to bind to the system.
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.
The red LED also blinks ON/OFF when the PC is suspended. The blinking rate is approximately 1
second, which is the frequency of the wake up interrupts.
The green LED turns ON when the dongle receives data from mouse or keyboard. It remains on for
250 ms after the last received data packet.
The green LED turns ON and remains ON if a key is pressed and held (due to the keyboard's send-
ing Keep Alive packets).
The green LED turns ON and remains ON during Ping Mode (in normal operation, Ping Mode is a
very short period. You may not notice this period).
The red and green LEDs blink alternately when in Manufacturing Test mode.
3.3 Mouse
The CY4672 RDK uses a low cost PRoC LP for the RDK mouse. The RDK mouse is enclosed in a
skin that is designed for the Avago ADNS-3040 Ultra Low-Power mouse sensor. The mouse features
three buttons with one button combined with the scroll wheel function. There is a connect button on
the bottom of the mouse enabling you to perform an explicit bind with the bridge.
J10 is a programming header. Either the ICE-Cube or the MiniProg may be used to program the
mouse microcontroller using this ISSP header.
Connect your computer to the ISSP header J10 on the mouse using the MiniProg and a USB cable
(A to Mini B). Programming can be done using PSoC Programmer.
1. To program the hex file onto the mouse using the MiniProg, open PSoC Programmer and select
the MiniProg from the Port Selection window.
2. Click Program. While Programming is in progress, the Target Power LED on the MiniProg is ON.
Figure 3-4. Programming Mouse
3. When the Programming Succeeded message appears in the Actions pane, detach the MiniProg.
4. Place a 2-pin jumper installed from a 2-pin jumper installed from J11 to J10.1 to enable the radio
to power the processor. Jumper removal is required when programming U2 to disconnect the
radio from the MiniProg 5 V source. The mouse is powered using two AA batteries.
5. To start using the mouse, place the batteries in the battery terminal, switch ON the mouse, and
bind it with the bridge.
6. 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 communicate
with the mouse to bind to the system and then press the bind button on the mouse.
When the mouse is bound with the Bridge dongle, the mouse works smoothly with the system. The
green LED turns ON when the dongle receives data from mouse. It remains ON for 250 ms after the
last received data packet.
3.4 Keyboard
The CY4672 Reference Design Kit uses an enCoRe™ II LV controller and CYRF6936 LP Radio for
the RDK keyboard.
Figure 3-5. Keyboard Plastic
Keyboard PCB
Figure 3-6 shows the keyboard with the top removed. The radio/enCoRe II LV board (PDC-9265) is
shown in the upper right hand corner.
Bind Button
Battery Compartment
Figure 3-7 shows the integrated battery compartment and bind button located on the bottom side of
the keyboard. The battery compartment cover is also shown.
The CY4672 keyboard can be programmed using a MiniProg or ICE-Cube. Connect your computer
to the keyboard's ISSP connector (J2) using the MiniProg and a USB cable (A to Mini B). Program-
ming can be done using PSoC Programmer.
1. To program the hex file onto the keyboard using the MiniProg, open PSoC Programmer and
select the MiniProg from the Port Selection window.
2. Click Program. While Programming is in progress, the Target Power LED on the MiniProg is ON.
Figure 3-8. Programming Keyboard
3. When the Programming Succeeded message appears in the Actions pane, detach the MiniProg.
4. A 2-pin jumper installed from J3.1 to J2.1 enables the radio to power the processor. Jumper
removal is required when programming U2 to disconnect the radio from the MiniProg 5 V source.
5. The keyboard is powered using two AA batteries. To start using the keyboard, place the batteries
in battery compartment and bind it with the bridge.
6. 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 communi-
cate with the keyboard to bind to the system and then press the bind button on the keyboard.
When the keyboard is bound with the Bridge dongle, the keyboard works smoothly with the system.
The green LED turns ON when the dongle receives data from the keyboard. It remains ON for 250
ms after the last received data packet.
The green LED turns ON and remains ON if a key is pressed and held (due to the keyboard's send-
ing Keep Alive packets).
4.1 Bridge
The CY4672 Reference Design Kit uses PRoC LP CYRF69213 for the bridge. This bridge may be
plugged into the USB port on a PC to provide the wireless USB bridge functionality. The architecture
is designed to be modular for extendibility and maintainability. It can also be easily ported from one
hardware platform to another assuming the use of an equivalent microprocessor. Porting to another
microprocessor requires more work to account for the USB hardware support and other hardware
specific changes.
Design efforts are 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
PRoC LP.
The bridge connects the remote RoC LP HIDs to a low-speed USB host. This firmware supports two-
way communication with bridge and HID devices configured as transceivers. Packets similar to stan-
dard USB HID packets are encapsulated inside wireless PRoC LP packets, which also contain a
packet header and CRC to help the bridge correctly process the USB HID data packets. Valid pack-
ets are then sent via USB to the USB host.
Figure 4-1. Bridge Block Diagram
Antenna
Bind Button
Chip
LEDs
CYRF69213
USB A 12 MHz
Connector Oscillator
4.1.1.4 LEDs
The CY4672 Bridge board has dual LEDs to indicate different status.
LED2 (red):
■ When the dongle is first plugged in, the red LED turns ON. It turns OFF when 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.
■ 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.
■ The red LED also blinks ON/OFF when the PC is suspended. The blinking rate is approximately
1 second, which is the frequency of the wake up interrupts.
LED1 (green):
■ The green LED turns ON when the dongle receives data from mouse or keyboard. It remains ON
for 250 ms after the last received data packet.
■ The green LED turns ON and remains ON if a key is pressed and held (due to the keyboard's
sending Keep Alive packets).
■ The green LED turns ON and remains ON during Ping Mode (in normal operation, Ping Mode is a
very short period. You may not notice this period).
The red and green LEDs blink alternately when in Manufacturing Test mode.
VBUS (5 V)
USB
Figure 4-8. Schematic View of Power Supply System Structure for Bridge
4.2 Mouse
The CY4672 Reference Design Kit uses a low-cost PRoC LP for the RDK mouse. The architecture is
designed to be modular for extendibility and maintainability. It can also be easily ported from one
hardware platform to another assuming the use of an equivalent microprocessor. Porting to another
microprocessor family requires more work to account for hardware specific changes.
Design efforts are made to reduce the 'on' time of the microprocessor and radio to conserve battery
life. This includes protocol optimizations along with using sleep features of the PRoC LP and optical
sensor.
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 V to 2.7 V VBAT voltage range at different tempera-
tures (–10 °C to 80 °C). The mouse is a higher power consumption device compared to the key-
board. Extending the battery life is one of the crucial design considerations in the mouse design. The
trade off for a higher efficiency boost circuitry is the component costs and the board size (these com-
ponents are slightly bigger in size compared to the ones used in the keyboard design). These com-
ponents do not provide enough current capacity at the low end of the VBAT voltage range to handle
the worst case optical sensor load and the PMU output voltage may droop under these conditions.
The recommendation is to use an external DC/DC boost circuit for the optical system only.
Figure 4-9. Mouse Block Diagram
ISSP header
Antenna
Buttons
Chip
CYRF69103
Scroll Wheel
Optical Sensor
Battery
VCC
ISSP
Figure 4-17. Schematic View of Power Supply System Structure for Mouse Board
4.3 Keyboard
The CY4672 Reference Design Kit uses an enCoRe II LV controller for the RDK keyboard. The
architecture is designed to be modular for extendibility and maintainability. It can also be easily
ported from one hardware platform to another assuming the use of an enCoRe II LV microprocessor.
While porting to another microprocessor requires more work, the hardware design is done to mini-
mize use of advanced enCoRe II LV features to expedite this effort.
Design efforts are made to reduce 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 boost efficiency. Preliminary characterization data shows a range of 68% to 81%
efficiency for the 1.8 V to 2.7 V VBAT voltage range at different temperatures (–10 °C to 80 °C).
Higher efficiency components such as the ones in the mouse design may be used at the expense of
component costs and board size (these low cost components are smaller in size compared to the
ones used in the mouse design.)
Keyboard
Interface ISSP Header
■ White goods
■ Consumer electronics
■ Home automation
■ Automatic meter readers
■ Personal health and entertainment
Figure 4-20. Schematic View of CYRF6936 Chip
Battery
VCC
ISSP
Figure 4-26. Schematic View of Power Supply System Structure for Keyboard
All code examples are available at: <install directory>\Cypress\CY4672 PRoC LP RDK\<ver>\Firm-
ware\
Note* The ENCRYPT_DATA option requires 64 bytes of extra ROM space to store the nonvolatile
session key.
5.1.3 Model
Figure 5-2. Firmware Architecture Model
The bridge firmware is partitioned into two logical groups. The Common group is a collection of code
modules that provide the underlying support for the application. This group provides services such
as, radio protocol, radio driver, USB, timing, flash access, SPI, and interrupts.
The Application group implements the core functionality and features of the RDK wireless bridge.
This includes USB HID packet formatting and reporting, encryption, and manufacturing test mode.
The code modules for each of these groups are described here.
The following module descriptions have corresponding <module name>.c 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 file.
■ Master Protocol: The module includes LP RDK master protocol routines to handle ping, button
bind, channel agility, and data packets. This module depends on the radio driver to send and
receive formatted packets and the flash module.
USB Module
This module parses the radio packets, builds the appropriate keyboard and mouse USB packets,
and loads these packets into the endpoints.
Mfgtest Module
The manufacturing test module may be conditionally compiled to provide manufacturing test sup-
port. The module configures the radio for reception and then enters a loop waiting for command
packets to be sent from the tester. The test echoes all echo command packets appended with the
number of invalid bits received and all other 'valid' command packets (no invalid bits). The manufac-
turing test code can only be exited by cycling power. The manufacturing test code in this bridge is
compatible with Cypress’s CY3631 Manufacturing Test Kit.
The manufacturing test mode on the PRoC LP RDK bridge can be entered by three different meth-
ods depending on the compile-time configuration.
■ Method 1: Press the bind button during dongle insertion into the USB host to enter the manufac-
turing test mode.
■ Method 2: Force an SE1 condition (D+ and D– are both high) on the USB bus and at the same
time apply power to the bridge.
■ Method 3: Ground the P0.7 pin during dongle insertion into the USB host to enter the manufactur-
ing test mode.
Encrypt Module
This module may be conditionally compiled 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.
■ MFG_ENTER_BY_USBSE1
This configuration definition is used to selectively compile a method to enter the manufacturing
test code. When this value is defined, the manufacturing test code may be executed by causing a
USB SE1 condition on the D+ and D– signals, when inserting the LP RDK bridge into a powered
USB port or applying external power.
■ ENCRYPT_TEA
This configuration definition is used to selectively compile TEA encryption for the bridge. Contact
Cypress Applications support for the encryption source code.
■ ENCRYPT_AES
This configuration definition is used to selectively compile AES encryption for the bridge. Contact
Cypress Applications support for the encryption source code.
■ GREEN_LED_ON_TIME
This configuration definition defines the number of milliseconds the green LED stays on after a
valid USB report is loaded in an endpoint.
■ DOWNKEY_TIME_OUT
This configuration definition defines the number of milliseconds before upkey reports are gener-
ated by the bridge in the absence of valid packets from an attached keyboard device.
■ BACK_CHANNEL_SUPPORT
This configuration definition is used to selectively compile the Back Channel Data Support fea-
ture. See Back Channel Data Support on page 100 for more information.
■ MASTER_PROTOCOL
This configuration definition is used to select the Master radio protocol or Slave radio protocol.
For the bridge application, it should be defined.
■ PAYLOAD_LENGTH
This configuration definition is used to define the payload length. For the bridge application, it
should be defined as 8.
■ POWER_BIND
This configuration definition is used to selectively compile Power Bind feature. When the Power
Bind feature is selected, the bridge enters the bind mode twice at power up. Each time the bridge
stays in bind mode for 1.5 seconds, and if a device is in the bind mode during this time, the
device will be bound to this bridge.
■ KISS_BIND
This configuration definition is used to selectively compile the Enhanced KissBind feature. See
Enhanced KISSBind on page 98 for more information. The bridge can be unbound by holding the
bind button for 5 seconds. After being unbound, the bridge enters an infinite loop and the red LED
is always on until it is unplugged from and plugged into a host PC.
After being unbound, the device bound flags are cleared, and the HIDs can be bound to this
bridge by KissBind.
■ RSSI_QUALIFY
This configuration definition is used to enable the RSSI qualification for the Enhanced KissBind.
Only if the RSSI reading is above KISS_BIND_RSSI_THRESHOLD, can the KissBind request/
response be accepted by the Bridge/Devices.
■ PROMISCUOUS_MODE
This configuration definition is used to enable the Promiscuous mode qualification for the
Enhanced KissBind. With this mode, multiple mice or keyboards can be bound to one bridge.
■ DAL_ENABLE
This configuration definition is used to enable Microsoft's Direct Application Launch (DAL) fea-
ture. When this feature is enabled, the DAL1 LED is turned on by holding the F11 key; the DAL2
LED is turned on by holding the F12 key. Direct Application Launch is a new feature that the Win-
dows Vista operating system provides built-in support, for a fast system startup experience. More
information on this can be found on Microsoft's Windows Hardware Developer Central website
(http://msdn.microsoft.com/en-us/windows/hardware/gg463078.aspx).
5.1.3.5 Initialization
The initialization of the PRoC LP chip is done by code that is generated in boot.asm by PSoC
Designer. The module boot.asm calls main when the PRoC LP is 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.
■ Keyboard HID Report Descriptor: The keyboard HID report descriptor defines a Boot Protocol
keyboard. This enables a LP RDK keyboard 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.
Figure 5-4. Keyboard HID Report Descriptor (Endpoint 1)
■ Mouse/Keyboard HID Report Descriptor: The mouse/keyboard HID Report Descriptor uses
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-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.
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)
Keyboard Report Format: The keyboard standard keys information is sent to the host PC via the
data endpoint 1. The keyboard multimedia keys and power keys information is sent to the host PC
via the data endpoint 2 using Report ID (the first byte in the report). The mouse uses Report ID 1.
The keyboard multimedia keys use Report ID 2. The keyboard power keys use Report ID 3. The for-
mats of the keyboard report are shown in Figure 5-10.
Figure 5-10. Keyboard Report Format
Mouse Report Format: The mouse data is sent over the data endpoint 2 using Report ID 1. The for-
mat of the mouse report is shown in Figure 5-12.
Figure 5-12. Mouse 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 is located in the user custom code section of the user module source file
usb_1_cls_hid.asm.
The RadioParams HID report is a vendor-defined HID report for communicating several radio
parameters of the WirelessUSB LP HID devices.
The HID Report Page is defined as:
Cypress WirelessUSB HID RadioParams Report Page (0xFF01 - Vendor Defined)
The RadioParams Report is 8 bytes long and has the 6 data fields listed in Table 5-4.
When the bridge receives the Get Report control request code, it returns a RadioParams report and
then resets the Packets Transferred parameter for the specified device to zero. The Link Quality
value is updated whenever the bridge receives a radio packet from the wireless device. Battery
Level is only updated when the device sends an updated battery level report. At startup, the Battery
Level, Corrupt Packets, and Packets Transferred are initialized to zero.
Example USB Bus Analyzer (CATC) Traces: Figure 5-13 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 endpoint 1 while the multimedia key reports are
sent via the endpoint 2 with Report ID 2.
Figure 5-13. Example Keyboard CATC Trace (Standard and MM Keys)
Figure 5-14 shows the 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 is pressed and held down as the mouse
is moved, and then the left button is released. The second part of the trace shows the Z-wheel being
moved down and up.
Figure 5-15 shows the Sleep key being pressed. Note the power key reports are sent via endpoint 2
and Report ID 3.
Figure 5-16 shows the Get_Report requests used to retrieve the keyboard and mouse battery level
and link quality information. Note the data transfers occurred on the control endpoint, endpoint 0,
and Report ID are used to differentiate keyboard and mouse requests.
Figure 5-16. CATC Trace of Battery and Link Quality Data Requests
5.2.3 Model
Figure 5-18. Firmware Architecture Model
The mouse firmware is partitioned into two logical groups. The Common group is a collection of code
modules that provide the underlying support for the application. This group provides services such
as radio protocol, radio driver, timing, polling, flash access, contact debounce, SPI, and interrupts.
The Application group implements the core functionality and features of the PRoC LP RDK mouse.
This includes power management, optical sensor, button, z-wheel, packet formatting and reporting,
various test modes, and battery level sensing.
The following module descriptions have corresponding <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.
■ Debounce Module
The debounce module is an assembly coded routine to perform debounce on button presses and
z-wheel motion. The algorithm is one that is published in EDN article as a way to perform hard-
ware debounce in software.
The debounce is performed by polling the inputs at a fixed period and by adding a weighted value
of the input to an accumulated value carried from the previous poll. The output is then passed to
threshold logic, with built in hysteresis, and a logic value of one or zero is computed. The thresh-
olds can be changed to adjust the hysteresis crossings by setting SCHMITT_HIGH_THRESH
and SCHMITT_LOW_THRESH. When an input has changed state, the output can be observed
to change approximately 10x the poll period later with the current threshold settings. With a poll
period of 250 µs the input latency is about 2.5 ms. Refer to Contact-debouncing algorithm emu-
lates Schmitt trigger at http://www.edn.com for more details on the operation of this algorithm.
■ SPI Module
This module provides an interface to the SPI bus for the optical sensor only. Physically the SPI
bus is connected to the radio and the optical sensor. The radio driver is responsible for interfacing
with the radio. The PRoC LP SPI Master module does not manage the selection of slave devices.
This module is created to provide that functionality. This module has a dependency on the instan-
tiation of a SPIM module in PSoC Designer that is properly connected to the devices.
In the PRoC RDK mouse design, the master SPI communicates with both the radio and optical
sensor. Because the optical sensor does not supports 3-wire SPI mode, the 4-wire mode is
employed. To save the GPIO pin, the IRQ pin function is multiplexed onto the MOSI pin.
■ Radio Driver
The radio driver module is a low level module providing basic radio communication and configu-
ration. 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 codes and initialization of
the radio and transmitting or receiving packets. See the PRoC LP 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 interfer-
ence immunity by channel hopping. This module has a dependency on the Radio Driver for send-
ing formatted packets and the flash module for storing the manufacturing ID of the bridge the
device is bound to.
■ Flash Module
The flash module is a smaller version of E2PROM module provided in PSoC Designer. It is lim-
ited in functionality and only implements the read/write routines required by the device. The flash-
security.txt file must be modified so that the block being modified by this module is given read/
write privilege, such as unprotected. Currently the very top most block in flash is used for this
module.
■ Port Module
GPIO pins on the PRoC LP ports can be configured as outputs with a pull up resistor. This is the
case for mouse buttons and the bind button. To activate the pull up, a data value of one must be
written to the port data latch for the pin. This feature presents a problem when performing a read-
modify- write on the port. For example, if a button is pressed (grounding the pin), a zero is read
and written back out on the read-modify-write operation. This turns OFF the pull up for the button
thereby, essentially disables the button. The port module provides an interface to treat ports,
using the pull up feature, in a special way by caching the drive data for the port.
■ Poll Module
The poll module manages the timing, enabling/disabling and polling of the mouse buttons and
zwheel inputs. When the mouse is active, polling is enabled and occurs at a rate of about 250 µs
for the z-wheel (see the Timer Module) and a rate of about 3 ms for the mouse buttons. When the
mouse is inactive, the buttons are changed to interrupt mode and the z-wheel is polled for
change only when the sleep timer expires; see the Buttons Module and Wheel Module.
■ Timer Module
The PRoC LP has an internal low-power oscillator (ILO) that is used for generating a clock to a
Programmable Interval Timer. This clock is affected by voltage and temperature and may drift
over time. This module provides an interface to calibrate this clock to the system clock. The Pro-
grammable Interval Timer period is calibrated to be approximately 250 µs. Be especially careful
when changing this period because the poll/debounce modules are coupled to this time value;
see the Poll Module and Debounce Module. The timer module also provides a set of functions for
performing busy waits in the microsecond resolution. For more coarse timing requirements, an
API is provided for millisecond delays. The millisecond delay routines must be used as often as
possible to provide for better power consumption because the microcontroller sleep feature is
used. Also, when polling is enabled, it is performed as a background task during the millisecond
delay. This module also adjusts the tick advancement based upon the sleep resolution. Turning
OFF the timer provides for more power savings, yet a sense of time is still preserved for non-crit-
ical timing.
Note When using the ICE-Cube, define the macro PSOC_ICE so that busy waits are used
instead of the sleep instruction. Using the sleep instruction with the ICE-Cube generates errors
due to synchronization issues between the OCD part and the emulator.
■ ISR Module
This module provides an interface to initialize the interrupt.
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 using a state machine to manage the various power modes that it executes at any
given time. The mouse initially enters a disconnected state. When there is any mouse activity, it
enters the active state.
In the active state, the timer is turned on so that more accurate timing and mouse events can be col-
lected, formatted and reported to the bridge. The mouse remains in this state as long as there is
mouse activity to report to the bridge or a period of time without any mouse activity has expired, after
which it returns to the idle state. If the mouse is unable to deliver a packet while in this state, it transi-
tions to the disconnected state.
In idle state, the optical sensor is allowed to transition through its various rest modes to conserve
power. In this state, the mouse application is waiting for input from the optical sensor, z-wheel or but-
tons. The timer is turned OFF to conserve power and the notion of time is maintained using the sleep
timer. This state is maintained indefinitely until the batteries drop below 1.8 V at which point the
mouse enters the OFF state. The OFF state is where the radio and optical sensor are prevented
from turning on. This state is reached when the battery voltage drops below 1.8 V. It is designed to
keep the battery drain to an absolute minimum to prevent battery leakage as a result of completely
draining the batteries.
The battery level is reported by the mouse application when it detects a change from the discon-
nected state to the connected state. The battery level is measured when exiting the idle state. If
there is a change in the battery level, it is reported in the active state. In the active state the mouse
attempts to deliver a packet for the amount of time designated in MOUSE_TX_TIMEOUT_MS. If it is
unable to send the packet in this time, then it transitions to the disconnected state.
The mouse application is responsible for detecting the bind button press and then calling the bind
function in the protocol module; see the Protocol Module. The mouse application sends mouse
reports as frequently as events arrive, but not any faster than the time defined in the macro
MOUSE_REPORT_IN_MS. Carefully set this time so that the report rate does not exceed that which
the USB bus is capable of handling. Keep in mind that the report rate varies slightly due to drift of the
internal oscillator used to keep track of time.
Optical Module
The optical sensor module encapsulates the initialization, calibration and reading of the optical sen-
sor. This module also handles any power management required by the sensor, along with motion
detection if supported. The contents of this module potentially change with every design and are
unique to the sensor used. This module has the responsibility to format the X and Y data into the
mouse packet payload. See Wireless Protocol Data Payload on page 48 for a definition of the packet
payload.
Testmode Module
The Testmode module provides code to continuously perform a vector drawing test within a drawing
application. This test mode is used to check radio range, co-location and interoperability of the
mouse with the keyboard. The test mode, when compiled in, is entered by holding down the left and
right button while inserting the batteries. The buttons must be held down until the optical sensor
begins to flash. As soon as the buttons are released the mouse repeatedly draws 'LP' in the drawing
application. Each successive 'LP' must be drawn on top of the previous one. The test mode may only
be exited by removing the batteries. All button presses and mouse movement are ignored when in
the test mode. However, care must be taken not to bump other mice connected to the PC.
Note The mouse 'acceleration' or 'enhance pointer precision' option needs to be turned OFF in the
Windows mouse Control Panel for this test to execute properly. If the letters are drawn erratically
with uneven sides or excessive amounts of space in between them, then check this setting or its
equivalent (based upon your PC operating system).
When the macro DEBUG_INDEX is defined, code is generated to move the mouse pointer to the
right and back again without the pen down. This is done in an incrementing fashion so that when
observing packet data on a Listener, a correlation can be made with a USB protocol analyzer. This is
useful for debugging data loss because the test mode guarantees packet delivery. Entry to this test
mode can be changed by modifying the macro TESTMODE_BUTTONS in the testmode.c file. The
button macros are defined in the buttons.h file.
Buttons Module
The buttons module provides an API for handling both the bind and mouse buttons. This module
must be changed when adding or removing buttons for a new mouse design. The button portion of
the packet payload is formatted by this module and needs to change if more buttons are added. See
the Mouse Module for a definition of the packet payload format.
This module manages power configurations that may be implemented to conserve power related to
button presses. For example, button polling is turned OFF and interrupts are used to detect button
presses in the idle state. It also manages the acquisition of button information depending on the
implementation: interrupts or polling.
When changes in a button state are detected, the mouse module is notified for collection and report-
ing of the data. Note It is important for the buttons module to always report the button state when a
button is pressed. This condition frequently occurs when the mouse is moved with the button held
down.
Mfgtest Module
The manufacturing test module may be optionally compiled in, at the expense of code space, by
defining the macro MFG_TEST_CODE. In addition, a more complete version may be compiled in by
defining MFG_TX_MODES. The TX modes include code to perform a carrier test and 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. For more information on how to use this test
mode, refer to the CY3631 Manufacturing Test Kit documentation.
It is recommended that you not make changes to this module unless similar changes are made to
the CY3631 Tester.
Wheel Module
The wheel module implements the functionality of the z-wheel. It is responsible for power modes
associated with the z-wheel, polling, z-wheel interrupts, wheel position tracking, and partial packet
formatting for z-wheel reports.
When the z-wheel is being polled, the GPIO pins are turned on with internal pull up resistors just
long enough to read the state. This is done to conserve power when the mouse is active. When the
polling timer is turned OFF the wheel_poll_sleep() function is called which only looks for change
from the last state; it does not keep track of wheel position.
Z-wheel position tracking is done by comparing debounced wheel input to the previous two states.
Depending upon the wheel input phase transition the direction of the wheel can be determined. The
poll rate must be frequent enough to debounce and catch these transitions for a smooth response.
The RDK mouse is shipped with a mechanical encoder. It is typical for this decoder to rest on a
detent such that the z-wheel inputs are either both high or both low, hence the reason for only turning
on the pull ups when polling the input. Transition from one of these states to the other is reported as
a ±1 motion. Note Sometimes the mechanical detents do not align with the high-high or low-low
state and movement may not be seen every time from detent to detent.
When z-wheel motion is detected, the mouse module is notified for collection and reporting of the
data; see the Mouse Module.
Battery Module
The battery monitor circuit is implemented using the Low Voltage Interrupt (LVI) on the LP radio. Fol-
lowing is an explanation of the process to measure the battery voltage. The process first sets the LVI
threshold to 1.8 V and then checks for an LVI interrupt. If the interrupt does not occur then it repeat-
edly sets the LVI TH and PMU OUTV with the following combination and checks the status.
It then returns a battery level between 1 and 10: 1 being below 1.8 V and 10 being above 2.7 V.
This value sets the attempt times for the mouse trying to connect to the bridge before entering the
Briefcase Mode. The default value is 20.
■ PLATFORM_H
This configuration value identifies the header file that has the platform configuration information.
The default value is pdc9347.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 definition is used to select between 800 or 400 counts per inch (cpi) when con-
figuring the optical chip. If it is defined then 800 cpi is selected. If it not defined then 400 cpi is
selected. The default is 800 cpi.
■ MOUSE_BATTERY_STATUS
Enabling this feature causes the battery level measurement code to be compiled into the mouse
image. The mouse then measures the battery level and reports any changes to the bridge. Notifi-
cation of the battery level is done at the following events: the battery level changes, the mouse
transitions from the idle state to the active state, mouse transitions from the disconnected state to
the connected state.
■ MOUSE_TEST_MODE
This configuration definition is used to selectively compile code for mouse test mode. If this value
is defined, then the test mode is compiled into the executable image. The test mode moves the
mouse in a fashion to repeatedly draw the letters 'LP' in a drawing program. When performing
this test, turn OFF Mouse acceleration or advanced motion. See the Testmode Module for more
information on entering this test mode.
■ MFG_TEST_CODE
This configuration definition is used to selectively compile the manufacturing test code. The man-
ufacturing test code in this mouse is compatible with the CY3631 Manufacturing Test Kit offered
by Cypress Semiconductor. See the Mfgtest Module for a description of how this test mode is
executed. The CY3631 Manufacturing Test Kit documentation has a description of the test opera-
tion.
■ MFG_TX_MODES
When the MFG_TEST_CODE is defined, then the definition of this name adds in a carrier and
random data TX test option. See the Mfgtest Module for more information on these TX modes.
■ MASTER_PROTOCOL
This configuration definition is used to select the Master radio protocol or Slave radio protocol.
For the mouse application, it should be undefined.
■ PAYLOAD_LENGTH
This configuration definition is used to define the payload length. For the mouse application, it
should be defined as 3.
■ KISS_BIND
This configuration definition is used to selectively compile the Enhanced KissBind feature. See
Enhanced KISSBind on page 98 for more information. The mouse can be unbound by holding the
right and middle buttons, and pressing the bind button. After being unbound, the mouse enters an
infinite loop until a POR. After being unbound, the mouse can be bound to a bridge by KissBind.
■ RSSI_QUALIFY
This configuration definition is used to enable the RSSI qualification for the Enhanced KissBind.
Only if the RSSI reading is above KISS_BIND_RSSI_THRESHOLD, can the KissBind request/
response be accepted by the Bridge/Devices.
■ AUTO_CONNECT
5.2.3.5 Initialization
Initialization of the PRoC LP chip is done by code that is generated in boot.asm by PSoC Designer.
The module boot.asm calls main() in the mouse module when the Wireless PRoC LP is configured
and initialized; see the Mouse Module.
■ Packet Format 2: When there is either z-wheel data or button data, the transmitted packet is
three bytes. In the case where there is no X, Y delta data, but there is z-wheel or button data, the
X, Y delta bytes is set to zero. The z-wheel data is a signed value with bit 4 as the sign bit.
■ Packet Format 3: When battery voltage level is communicated, the transmitted packet is 1 byte.
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 mouse the red LED stops blinking on binding the mouse with the bridge.
3. Press any switch on the mouse the green LED turns on when the dongle receives data from the
mouse.
Note *ENCRYPT_TEA option needs 64 bytes extra flash space to store the nonvolatile session key.
Notes
■ Yellow indicates Multimedia Key (16-bit value)
■ Red indicates Power Key
■ Blue indicates Modifier Key
■ No color indicates a Standard 101 Key
5.3.3 Model
Figure 5-20. Firmware Architecture Model
The keyboard firmware is partitioned into two logical groups. The Common group is a collection of
code modules that provide the underlying support for the application. This group provides services
such as, radio protocol, radio driver, timing, flash access, and interrupts.
The Application group implements the core functionality and features of RDK wireless keyboard.
This includes power management, encryption, packet formatting and reporting, various test modes,
and battery level sensing. The code modules for each of these groups are described below in further
detail.
All the following module descriptions have corresponding <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.
Keyboard Module
The keyboard module is the controlling code for the application. It has many responsibilities in imple-
menting various features and functions offered by the keyboard.
The function main() is the entry point for the keyboard application. This function is called from the
boot.asm file. The keyboard first initializes all of the application modules and then initializes the pro-
tocol module. There is an order dependency for some of these, so care must be taken in modifying
the keyboard_init() function. For example, other modules depend upon the timer facility running to
perform initialization. When each module is initialized, then the application checks for entry to the
manufacturing test mode. If the manufacturing test mode is not indicated, then normal keyboard
operation begins.
There are two states for the keyboard operation: the idle state and the active state. The keyboard ini-
tially enters idle state; when there is any keystroke, it enters the active state. In active state the key-
board is scanned for both the keys and the bind button. The keystrokes are collected, formatted and
reported to the bridge. 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 keystroke after it has
been in an idle state for 8 seconds.
In the active state, the keyboard attempts to deliver a packet for the amount of time designated in
KEYBOARD_TX_TIMEOUT. The keyboard application is also responsible for detecting the bind but-
ton press and then calling the bind function in the protocol module.
The keyboard application sends keyboard reports as frequently as events arrive, but not any faster
than the time defined in the macro KEY_DOWN_DELAY_SAMPLE_PERIOD. Carefully set this time
so that the report rate does not exceed that which the USB bus is capable of handling. Keep in mind
that the report rate varies slightly due to drift of the internal oscillator used to keep track of time.
Mfgtest Module
The RDK provides a compile-time option of adding a manufacturing test mode to the keyboard. The
manufacturing test code in this keyboard is compatible with the CY3631 Manufacturing Test Kit
offered by Cypress Semiconductor.
If MFG_TEST_CODE is defined and ENTER_BY_PIN is not defined, holding down the system sleep
key and the bind button while inserting the batteries into the keyboard enters the manufacturing test
mode.
If MFG_TEST_CODE and ENTER_BY_PIN are both defined, connecting pin 4 and 5 on the ISP
header with a shunt and then inserting the batteries into the keyboard enters the manufacturing test
mode.
The only way to exit this mode is to cycle power.
Battery Module
The battery monitor circuit is implemented using the Low Voltage Interrupt (LVI) on the LP radio. Fol-
lowing is an explanation of the process to measure the battery voltage.
The process first sets the LVI threshold to 1.8 V and then checks for an LVI interrupt. If the interrupt
does not occur then it repeatedly sets the LVI TH and PMU OUTV with the following combination
and checks the status.
It then returns a battery level between 1 and 10: 1 being below 1.8 V and 10 being above 2.7 volts.
Test Module
This RDK keyboard provides a compile-time option of adding test modes to the keyboard. The test
mode module is implemented in a way that it can be easily extended to add other test modes. Cur-
rently there are only two test modes supported in the module. When this option is not enabled then
all test mode code is removed from the compilation.
The first test mode is initiated by holding down the left Ctrl, left Alt, right Alt, right Ctrl, and F1 keys at
the same time. If PANGRAM_TEST_MODE is defined, the test sends the key up/down scan codes
for the test pangram:"a quick brown fox jumps over the lazy dog.<carriage return>". Otherwise the
up/down scan codes are repeatedly sent for the test sequence 'wirelessusb' followed by the same
number of backspaces. The test repeats the appropriate sequence until the escape key is pressed.
When the test has finished execution, the keyboard returns to normal operation.
The repeating 'x' test selection is initiated by holding down the left Ctrl, left Alt, right Alt, right Ctrl, and
F3 keys at the same time. The test continuously sends the 'x' key up/down scan codes. The test con-
tinues until the escape key is pressed. When the test has finished 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.
This configuration value sets the debounce time for buttons that are pressed. It is measured in
units of the poll rate. For example, if KEYBOARD_DEBOUNCE_COUNT is defined as '2' and
KEY_DOWN_DELAY_SAMPLE_PERIOD is defined as 10, the button debounce time is 20 milli-
seconds. The default setting is '2'.
■ KEYBOARD_MULTIMEDIA_SUPPORT
This configuration definition is used to selectively compile support for multimedia (hot) keys. If
this value is defined, then multimedia key support is compiled into the executable image. If it is
not defined, then the multimedia support code is omitted.
■ KEYBOARD_TEST_MODES
This configuration definition is used to selectively compile code for keyboard test modes. If this
value is defined, then test modes are compiled into the executable image. If it is not defined, then
the test mode code is omitted.
■ KEYBOARD_TEST_MODE_PERIOD
This configuration value sets the period that the keyboard generates on test key presses. A key
press consists of a scan code as the down key and a NULL as the up key. The default value is 10
ms.
■ PANGRAM_TEST_MODE
This configuration definition is used to selectively compile the pangram test mode. A pangram is
a sentence that contains all of the letters of the alphabet at least once.
■ KEYBOARD_BATTERY_VOLTAGE_SUPPORT
This configuration definition is used to selectively compile support for battery voltage level report-
ing. If this value is defined, then battery voltage level reporting 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 the keyboard matrix for the RDK key-
board hardware.
■ KEYBOARD_TX_TIMEOUT
This configuration value sets the maximum time that the keyboard tries to send a report to the
bridge. The default value is 5000 ms.
■ TIMER_CAL
This configuration definition is used to selectively compile the one-millisecond timer calibration
routine. The routine is called on power on and during protocol reconnect.
■ ENCRYPT_TEA
This configuration definition is used to selectively compile TEA encryption for the keyboard. Con-
tact Cypress Applications support for the encryption source code.
■ ENCRYPT_AES
This configuration definition is used to selectively compile AES encryption for the keyboard. Con-
tact Cypress Applications support for the encryption source code.
■ MFG_TEST_CODE
This configuration definition is used to selectively compile the manufacturing test code. The man-
ufacturing test code in this keyboard is compatible with the CY3631 Manufacturing Test Kit
offered by Cypress Semiconductor. See the Mfgtest Module for a description of how this test
mode is executed. The CY3631 Manufacturing Test Kit documentation has a description of the
test operation.
■ MFG_ENTER_BY_PIN
This configuration definition is used to select whether the manufacturing test code is executed by
connecting pin 4 and 5 on the ISP (programming) header. When this value is not defined, then
the manufacturing test code may be executed by holding the system sleep key and the bind but-
ton when the batteries are inserted into the keyboard.
■ MFG_TX_MODES
When the MFG_TEST_CODE is defined, the definition of this name adds in a carrier and random
data TX test option. See the Mfgtest Module for more information on these TX modes.
■ MOUSE_EMULATION_MODE
This configuration definition is used to selectively compile the mouse Emulation mode. The Scroll
Lock key is used to toggle this mode ON/OFF. When in this mode, the arrow keys are used to
move the mouse. The Delete key is the left mouse button, the End key is the right mouse button,
and Page Up and Page Down emulate the scroll wheel.
■ BACK_CHANNEL_SUPPORT
This configuration definition is used to selectively compile the Back Channel Data Support fea-
ture. See Back Channel Data Support on page 100 for more information.
■ MASTER_PROTOCOL
This configuration definition is used to select the Master radio protocol or Slave radio protocol.
For the keyboard application, it should be undefined.
■ PAYLOAD_LENGTH
This configuration definition is used to define the payload length. For the keyboard application, it
should be defined as 8.
■ KISS_BIND
This configuration definition is used to selectively compile the Enhanced KissBind feature. See
Enhanced KISSBind on page 98 for more information. The keyboard can be unbound by holding
the 'Esc' key and 'Delete' key. After being unbound, the keyboard enters an infinite loop until a
POR. After being unbound, the keyboard can be bound to a bridge by KissBind.
■ RSSI_QUALIFY
This configuration definition is used to enable the RSSI qualification for the Enhanced KissBind.
Only if the RSSI reading is above KISS_BIND_RSSI_THRESHOLD, can the KissBind request/
response be accepted by the Bridge/Devices.
■ PLATFORM_H
This configuration value identifies the header file that has the platform configuration information.
The default value is pdc9265.h, which is identifier for the keyboard board that is shipped with the
RDK. It is anticipated that this macro will change when the code is ported to another platform.
5.3.3.5 Initialization
Initialization of the enCoRe II LV chip is done by code that is generated in boot.asm by PSoC
Designer. The module boot.asm calls main when the enCoRe II LV is configured and initialized.
Main initializes the components of the keyboard along with timer, isr and radio modules. The main
routine then goes into an infinite loop monitoring keyboard activity and sleeping between keystrokes.
Example: The following reports is sent if you press an 'a' on the keyboard. The down key packet sent
from the keyboard to the bridge is shown in Table 5-17.
Table 5-17. Example 'a' down key Standard 101 Keys Report
The bridge adds the trailing zeros, inserts the reserved byte, rearranges the modifier, and scans
code 1 bytes and remove the packet header to produce the USB report shown in Table 5-18.
Table 5-18. Example USB report for the 'a' down key
The up key packet sent from the keyboard to the bridge (all data bytes are zero) is shown in
Table 5-19.
The bridge adds the trailing zeros, inserts the reserved byte, and removes the packet header to pro-
duce the USB report shown in Table 5-20.
Table 5-20. Example USB report for a Standard 101 Key Null Packet Report
Example: The following reports is sent if you press 'Volume Increase' (Hot Key 8) key on the key-
board. The 'Volume Increase' down key packet sent from the keyboard to the bridge is shown in
Table 5-22.
Table 5-22. Example 'Volume Increase' down key Multimedia Keys Report
■ Power
The up key packet sent from the keyboard to the bridge is shown in Table 5-23.
Example: The following reports is sent if you press the Suspend/Sleep (Power Key 0) key on the
keyboard.
The Suspend/Sleep down key packet sent from the keyboard to the bridge is shown in Table 5-25.
The up key packet sent from the keyboard to the bridge is shown in Table 5-26.
Table 5-27. Example Keep Alive Report (Null Packet Support disabled)
If the bridge does not receive a Keep Alive packet or an up key within a specified interval
(DOWNKEY_TIME_OUT) while a down key is present, the bridge generates an up key to the com-
puter.
■ Battery Voltage Level Report
An Application Report Header of 0xFD indicates that this report is a Battery Voltage Level Report.
The Battery Voltage Level report format is shown in Table 5-28.
The Battery Voltage Level ranges from 1 (low) to 10 (full). The Battery Voltage Level Report is sent
after a keystroke that occurs whenever the keyboard has been in idle for more than 8 seconds. An
example of a Battery Voltage Level Report with fully charged batteries is shown in Table 5-29.
An example of a Battery Voltage Level Report with low batteries is shown in Table 5-30.
■ MCU calls function scan_keyboard() to detect which key is pressed. This function consumes 1.15
ms.
■ MCU calls function generate_standard_report () to format the report and send the report to the
bridge. This step takes 2.01 ms, which includes 1.66 ms radio transmission time.
As a result, it takes 3.20 ms for the keyboard to report a key press to the bridge.
A.1 Schematic
Figure A-1. Bridge
VREG0
C16
0402
0.047 uFd
5V
VREG0
C9 C8 C14
0402 0402 0805
0.047 uFd 0.047 uFd 2.2 uFd
C7 C6
0402 0402
0.047 uFd 0.047 uFd
C15 C11
0402 0402
0.047 uFd 0.047 uFd
C5
0402
0.47 uFd
U1
CYRF69213
39
33
40
23
16
36
9
6
3
7
ANT1
WIGGLE 32
VBAT2
VBAT1
VBAT0
VIO
VREG
VDD
VCC1
VCC2
VCC3
VDD18
"CONNECT/ACTIVITY"
5V
D1 L1
RFbias 10
1
2
IND0603
R2 2 4 RED_LED RST 34 11 22 nH C1
0402
RD C RST RFp 0402
1.8 nH C3 0402C4
0402
LED Green Red TV10 IRQ 27 31 TV5 2.0 pFd 1.5 pFd
IRQ PACTL
37 L/D XTAL 2
"BIND"
5 P_0_1
S1 4 30 TV1 Y1
BIND_BUTTON P_0_3 XOUT
1A 2A 1 P_0_4 12 MHz Crystal
1B 2B IRQ R3 38 P_0_7
0402
RESV1 19
SW RA PUSH NO LOAD 21 25 TV6
DP RESV2 TV7
22 DM RESV3 26
24 28 TV8
MISO R4 Regout RESV4
32 P_1_6
0402 RST 35 14
NO LOAD P_1_7 NC1
NC2 17
5V TP2 DAL_1 15 18
TP3 DAL_2 P_2_0 NC3
8 P_2_1 NC4 20
J1 TP4
E-PAD
GND1
1 VBUS
VBUS USB_DM
DM 2
3 USB_DP
DP
4
12
41
GND
S1 5
S2 6 E-PAD must be soldered to ground.
USB A SMT PLUG
VREG0
R1
zero
0402
0603
R19
VBAT VCC
The power supply decoupling shown for VBAT0 R9 Layout J11 and J10.1 in
0805
47
BH1
C6=47uF ceramic R9=0ohm C7=.047uF. C8 C9
For this configuration, it is not required
1 VBAT TP1
0402
1 uFd
0402
0.047 uFd
POS1 to load C18.
SW1
1 For reference design part numbers, please
NEG1 2 2 refer to the Bill of Materials file
3
121-34700_A.xls.
SPDT
POS2 3
C13 C10
0402 0402
0.047 uFd 0.047 uFd
4 BATT- TP2
NEG2
BATTHLDR 2 AA
VBAT
C17 C5
0402
0402
0.47 uFd 0.47 uFd
VBAT VCC U1
CYRF69103
39
33
40
23
16
36
9
6
3
7
L3 D1 ANT1
D-64
2 1 TP3 WIGGLE 63
VBAT2
VBAT1
VBAT0
VIO
VREG
VDD
VCC1
VCC2
VCC3
VDD18
10 uH DIODE SS12
10 L1
RFbias
1
2
IND0603
E
+ C18 C6 C12 TV8 RST 34 11 22 nH C1
RST RFp
0402
1210 0805
100 uFd 10v No Load 10 uFd 6.3V 13 L2 15 pFd
TV2 O_MISO RFn
29
IND0402
MISO 1.8 nH C3 C4
TP4
0402
0402
37 L/D XTAL 2
BIND LF_SW 5
RT_SW P_0_1 XOUT Z_PWR TV1 Y1
4 P_0_3 XOUT 30
S1 MID_SW 1
Bind_SW P_0_4 12 MHz Crystal
1A 2A 38 P_0_7
1B 2B RESV1 19
TV10 MFG_IN P_1_0 21 25 TV9
SW PUSHBUTTON TV7 P_1_1 P_1_0 RESV2 O_SCLK TV3
Mouse Optical Sensor 22 P_1_1 RESV3 26
O_MOTION 24 28 O_MOSI TV4
O_MISO P_1_2 RESV4
32 P_1_6
VCC AVCC DVCC VCC O_nCS 35 14
P_1_7 NC1
NC2 17
Zwheel1 15 18
R6 R7 Zwheel2 P_2_0 NC3
8 P_2_1 NC4 20
0603 0603
E-PAD
GND1
5.11 1% 5.11 1%
C23 C26 C27 C24
0402 0603 0603 0402
0.01 uFd 1.0 uFd 1.0 uFd 0.01 uFd
12
41
VCC
11
15
U2
R8
AVDD
VDD
5.11 1%
0603
O_nCS 1
O_SCLK nCS D2
3 SCLK
O_MISO 2 6 1 2
O_MOSI MISO XY_LED
4 MOSI
7 LED Red Mouse Buttons and Z-Wheel
LED_GND C25 C28 Z_PWR
0402 0603
O_MOTION 5 0.01 uFd 1.0 uFd
MOTION
NC1 8
17 S2 R4 R5
O_SHTDWN NC2 LF_SW
10 SHTDWN NC3 18 1 2
NO LOAD NO LOAD
0603
0603
NC4 20
SW PUSHBUTTON
EN1
S3 1 2 Zwheel1
COM QA
AGND
AGND
AGND
MID_SW 1 2
GND
GND
GND
4 3 Zwheel2
SW PUSHBUTTON GND1 QB
5 GND2 PCB: PDC
ADNS-3040
14
19
12
13
16
Size Document
C REF-13634
Date: Tuesday
VBAT VCC
An alternate decoupling configuration is
the following: R2 C15
C6=47uF ceramic R2=0ohm C7=.047uF.
0402
0805
0402
For reference design part numbers, please 0.047 uFd
refer to the Bill of Materials file R3
C11
Radio Decoupling Caps
121-26504_A.xls. 0402
47
0402
RF VCO
C8 0.047 uFd
and VCO
0402
C9
Buffer
1 uFd 6.3V
EVCC Filter
0402
0.047 uFd
C10
C13
0402
C19 C20 0.047 uFd
0402
0.047 uFd
0402 0402
0.01 uFd 0.01 uFd
C5
Power Supply
0402
U2 0.47 uFd
27
5
BH1 VBAT U1
"+" VBAT CYRF6936
38
33
40
16
35
VDD2
VDD1
8
6
3
7
ANT1
POS 1 BIND WIGGLE 63
VDD
VBAT2
VBAT1
VBAT0
VIO
VREG
VCC1
VCC2
VCC3
P1_0 25 23 COL1 C17 IND0603
1
2
NEG1 2 2A 2B
SCK
29 P1_3 / SSEL P0_3 / INT1 20
COL5 TV8 RST
30 P1_4 / SCLK P0_4 / INT2 19 34 RST RFp 11
MOSI COL6
0402
NEG2 3 31 18
IND0402
0402
27 MOSI 0402
COL9 34 15 ROW1 TV5 MISO 28 MISO PACTL TV6 2.0 pFd 1.5 pFd
COL10 P3_0 P2_0 ROW2 PACTL 30
35 P3_1 P2_1 14
COL11 36 13 ROW3
COL12 P3_2 P2_2 ROW4 TV7 IRQ
37 P3_3 P2_3 12 26 IRQ XTAL 1
COL13 38 11 ROW5
COL14 P3_4 P2_4 ROW6
39 P3_5 P2_5 10
COL15 40 9 ROW7
COL16 P3_6 P2_6 ROW8 CLKOUT TV1 Y1
41 P3_7 P2_7 8 XOUT 29
37 L/D 12 MHz Crystal
COL17 7 1 19
J4 COL18 P4_0 NC1 RESV
Keyboard Interface 6 P4_1 NC2 2 2 NC1 NC9 20
Serial debug 3 42
43
P4_2 NC3 3
4
4
5
NC2 NC10 21
22
J1 header 2
1
P4_3 NC4
NC5 45 9
NC3
NC4
NC11
NC12 23
NC6 46 14 NC5 NC13 31
1 ROW1 47 15 32
1 ROW2 3 PIN HDR NC7 NC6 NC14
2 2 NC8 48 17 NC7 NC15 36
3 ROW3 18 39
3 ROW4 NC8 NC16
VSS2
VSS1
E-PAD
4
GND1
5 ROW5
5 ROW6
6 6
7 ROW7 CY7C60123-PVXC
44
24
7 ROW8
8
12
41
8 COL18
9 9
10 COL17 E-PAD must be soldered to ground.
10 COL16
11 11
12 COL15
12 COL14
13 13
14 COL13 VBAT VCC
14 COL12 D1
15 15
16 COL11 L3
16 COL10
SOT23
TP1
17 17 2 1
18 COL9
18 COL8 10 uH BAT400D
19 19 E
20 COL7 + C18 C6 C12
20 COL6 VCC EVCC
21 21 A 2-pin jumper 1210 0805
A.3.5 Network ID
The network ID contains the parameters for the channel selection algorithm and the PN code to be
used. HIDs retrieve the network ID information from the bridge during the bind procedure. A special
network ID is reserved for bind mode, known as the bind ID. The bind ID gives a common channel
subset so that any two devices can communicate with each other during bind mode. The network ID
is composed of the following fields:
PIN - This is a random number, between 2 and 5, that defines the channel subset and is used in the
channel selection algorithm.
Base Channel - This is the first channel to be used in the channel selection algorithm that deter-
mines which channels are contained in the channel subset.
PN Code - This is used as an index to select one of 10 used SOP PN codes, as noted in the 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 WirelessUSB radio contains a 4-byte manufacturing ID (MID), that is laser fused into the
device during manufacturing. The bridge uses its MID to help randomize channel subsets, PN
codes, and network CRC seeds. The bridge sends its MID to the HIDs when binding. The HID then
stores the bridge's MID in nonvolatile memory after binding. The HID sends the bridge's MID as part
of the connect request packet, allowing the bridge to verify the identity of the HID when establishing
a connection.
Both the bridge and the HID use the bridge's MID to generate the device network ID components.
The following equations ensure that each network has a unique set of network ID components:
PN Code = [(mid_1 << 2) + mid_2 + mid_3] mod 10
Base Channel = [(mid_2 >> 2) - (mid_1 << 5) + mid_3] mod 78
PIN = [(((mid_1 -mid_2) & PIN_MASK) + MIN_PIN)] mod 78
CRC Seed = ((mid_2 >> 6)) + mid_1 + mid_3 if=0 then Seed = 1
A.3.8.6 Unbind
An 'unbind' mechanism allows the bridge and HIDs to return to their default unbind mode as if they
had never bound to any system before. The bridge dedicates a bind flag to each device type that it
supports. A bind flag is a 1-bit field in =Flash. When the bridge is bound to an HID by either KISS-
Bind or button bind mechanism, the bridge sets the corresponding bind flag for that device type and
stores the flag in its flash. If the bind flag for a particular device type is set, the bridge treats future
KISSBind packets from this device type as nonfunctional packets. The bridge unbind process clears
all bind flags, and the bridge allows devices to KISSBind. The HID dedicates a byte in its flash, called
SIGNATURE, to indicate whether or not the HID has bound to a bridge before. The SIGNATURE is
set to 0x90 after a successful KISSBind or button bind. If the SIGNATURE is not set to 0x90, the HID
tries to KISSBind to any bridge in the area that allows the HID to KISSBind. When the SIGNATURE
is set, the HID does not attempt to KISSBind.
Note When the HID enters unbind mode, power-cycle the HID to exit this mode. When the bridge is
unbound, the bridge continues to communicate with any HID that already has the bridge MID. To
completely unbind the system, the HIDs and bridge must be unbound.
100 CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A
Figure A-14. Back Channel Transaction Sequence
CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A 101
If the HID transmits application data successfully, the retries for PKT_NUM packets are summed up
in 'total_retry'. If the total_retry exceeds the threshold 'total_retry_threshold', the HID changes to
another data mode.
The total_retry_threshold is an adaptive number that has a minimum value of
TOTAL_RETRY_THRESHOLD_LOW. The following rules are applied to it:
❐ When the data mode is toggled, the total_retry for the previous data mode is used as current
total_retry_threshold.
❐ If the total_retry is zero, the total_retry_threshold is decreased by one until
TOTAL_RETRY_THRESHOLD_LOW.
■ Dynamic PA
If the total_retry is zero and the RSSI reading for the bridge AutoACK packet is above
PA_RSSI_RX_THRESHOLD, the PA is decreased by one until DATA_MODE_PA_MIN. When one of
the following cases occurs, the PA is set back to its maximum value of
DATA_MODE_PA_MAX:
❐ The data mode is toggled.
❐ The RSSI reading for the bridge AutoACK packet is equal to or below
PA_RSSI_RX_THRESHOLD.
❐ The retries for any packet exceeds PA_RETRY_THRESHOLD.
Bridge
The bridge does not need to implement the dynamic PA because it is bus powered. Its PA is always
set to the maximum value DATA_MODE_PA_MAX to get the highest transmission power. The
dynamic data rate is driven by the devices. When the bridge receives the packet, it sets the transmis-
sion data mode to the data mode of received packet. As a result, when it sends the back channel
data, it uses the same data mode as the device.
102 CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A
ENCRYPT_KEY_RESP = 0x8, // Key Packet Type for encryption
KISS_BIND_REQ = 0xD, // KISSBind request
KISS_BIND_RESP = 0xD, // KISSBind response
Res[3:0]: The lower nibble is used for packet specific information. The packet definitions below
define how these four bits are used in each case.
Byte 1
Packet Type: 0 for bind request and 0xD for KISSBind request.
Device Type: This is a 2-bit field that specifies a vendor-defined device type. This allows the bridge
to determine HID type.
Currently the following device types are defined in the PRoC LP RDK:
0x0 Presenter
0x1 Reserved
0x2 Keyboard
0x3 Mouse
Byte 1
Packet Type: 0 for bind request, 0xD for KISSBind request
Device Type: This is a 2-bit field that specifies a vendor-defined device type. This allows the bridge
to determine HID type.
Currently the following device types are defined in the KBM RDK:
0x0 Presenter
0x1 Reserved
0x2 Keyboard
0x3 Mouse
Byte 2-5
Manufacturing ID (MID 1-MID 4): This is the 4-byte manufacturing ID retrieved from the bridge's
radio and is used by the HID.
CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A 103
A.3.9.3 Connect Request (HID)
Byte 1
Device Type: 0x1
Byte 2-5
Manufacturing ID (MID 1-MID 4): This is the 4-byte MID that is received from the bridge during the
bind procedure. This enables the bridge to identify if the HID belongs to its network.
Byte 1
Packet Type: 2
Flag (F): This is a 1-bit field that specifies a positive or negative connect response packet (1 = posi-
tive, 0 = negative).
Byte 1
Packet Type - 3
Flag (F) - This is a 1-bit field specifying a Ping or Ping Response (0 = Ping, 1 = Ping Response).
Byte 1
Data Packet Type:
4 = Data Packet type
5 = Back Channel Packet Type
104 CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A
BCDR: This is a 1-bit field used to request back channel data. Setting this bit indicates to the bridge
that the HID is listening for data following the transaction.
Data Toggle Bit: This is a 1-bit field that is toggled for each new data packet. It is used to distinguish
between new and retransmitted packets.
Data Device Type 0/1: This is a 2-bit field that specifies a vendor-defined device type. This allows the
bridge to determine HID type. The two bits are swapped to be backward compatible. In most cases
the data device type is the same as the device type in the bind request and connect request. How-
ever, they may differ when one device tries to simulate the other device, for instance, the keyboard
simulates the mouse.
DT0=0, DT1= 0 Presenter (0x0)
DT0=1, DT1= 0 Undefined (0x1)
DT0=0, DT1= 1 Keyboard (0x2)
DT0=1, DT1= 1 Mouse (0x3)
Byte 2-N
Data Byte 0-N - This is byte-aligned application data.
CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A 105
Figure A-15. Bind Timing Diagram
The bridge uses the RSSI to determine the noise level on the channel. If the channel has become
noisy, the bridge moves to ping mode to find a quieter channel in its channel subset. When the HID
loses connection with the bridge, it moves to reconnect mode to find the bridge. The HID sends a
connect request 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 channel using the channel selection algorithm
and repeats this procedure. As shown in the reconnect timing diagram below, the reconnect attempt
takes approximately 1.76 ms/channel. The HID moves through its channel subset up to 19 times
before it times out and exits reconnect mode. The keyboard tries to send the data for up to five sec-
onds, and the mouse tries for two seconds, causing the HID to re-enter reconnect mode multiple
times if necessary.
106 CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A
Figure A-16. Reconnect Timing Diagram
A.3.12 Encryption
WirelessUSB PRoC LP RDK supports Tiny Encryption Algorithm (TEA) and Advanced Encryption
Standard (AES) 128 to encrypt application data. Data packets may be encrypted for privacy. All
encrypted data packets must have a payload of 8 or 16 bytes depending on the method chosen; this
is the minimum block size for the encryption algorithm.
CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A 107
To use the TEA algorithm both the bridge and HIDs must possess the data encryption key. The
bridge is responsible for creating the key, which is then shared with the HIDs. There are a variety of
possible methods to share the key between the two devices. The key may be exchanged over the
WirelessUSB link using the encryption key request and encryption key response packets.
TEA Key Management over WirelessUSB
After binding and connecting to the bridge, the HID transmits an encryption key request packet and
listens for an AutoACK followed by an encryption key response packet that contains the first half of
the data encryption key. The HID then uses the key encryption key (calculated from the bridge and
the HID MIDs) to decrypt the data encryption key. The HID repeats this process for the second half
of the data encryption key and stores the key in flash. After receiving both halves of the data encryp-
tion key the HID may begin transmitting encrypted data to the bridge.
Figure A-17. TEA Encryption Key Management
108 CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A
AES Encryption
AES_Encrypt requires the two variables tx_packet and AES_Key to be set before the call. Each con-
tains a 16 byte (128 bit) value. At the completion of the function, tx_packet is encrypted in place and
contains the cipher text. AES_Key is scheduled in-place during the encryption process, so multiple
calls to AES_Encrypt each need to be proceeded with reloading of AES_Key.
AES_Decrypt is the same as the AES_Encrypt; rx_packet and AES_Key both need to be loaded
before each call. However there is one small difference (because the decrypt key schedule is in
reverse order), the decryption key is not the same as the encryption key. The key used by
AES_Decrypt is the same as the key left in the AES_Key field after an execution of AES_Encrypt.
This is the key after it has gone through ten rounds of Key scheduling.
AES Key Management
The encrypt key is stored on the keyboard and the decrypt key is stored on the bridge during compil-
ing time. There is no dynamic encrypt key exchange in the running time.
Encryption and Power Consumption Trade Off
If the keyboard encryption is enabled, each key code is encrypted into an 8 byte key code (TEA) or
16 byte key code (AES). When a single key is pressed, a non-encrypted key down packet consists of
a 16-bit Preamble + 2 bytes SOP + 1 byte packet header + 1 byte key code + 2 bytes CRC; an
encrypted key down packet consists of the same overhead packets plus 8 or 16 byte key code
instead of one byte key code. This results in an increase in the average power consumption when
encryption is enabled.
CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A 109
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 a configuration value that is stored in nonvolatile
storage. All remaining serial commands only affect the current setting and are not stored (reset
across power cycles). Commands are not case sensitive. All commands are of the form <command>
space <command parameter>. For example 'TC 20'. Table A-1 describes the serial port protocol in
the PC to tester direction.
Every serial command issued by the PC is returned with a response when the command is com-
plete. The valid responses are shown in Table A-2.
All serial commands must end in either a carriage return or carriage return and line feed. All
responses end with a carriage return and linefeed.
The serial port settings for the MTK Tester are shown in Table A-3. Neither software nor hardware
handshake is supported.
110 CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A
Table A-3. Serial Port Parameter Settings
The 'Transmit carrier' and 'Transmit random pattern' test mode can be conditionally compiled with
the define MFG_TX_MODES.
CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A 111
A.5 Regulatory Testing Results
A.5.1 Introduction
The LP mouse is tested in a certified lab and meets FCC part 15, Subpart B, Title 47 CFR -Uninten-
tional radiators, FCC Part 15 Subpart C -Intentional radiators, and Industry Canada RSS-Gen. The
following table outlines the results of the testing.
Testing for the keyboard and bridge is expected in the near future.
112 CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A
The following is the results of RDK keyboard current measurement:
The RDK keyboard uses two AA cells and enables the PMU function. Therefore, it is able to access
approximately 2850-mAh battery capacity, which yields a battery life estimate of 829 days or 27
months.
CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A 113
A.6.2.2 Current Measurements
The following is the results of RDK mouse current measurement:
The RDK mouse uses two AA cells and enables the PMU function. Therefore, it is able to access
approximately 2850-mAh battery capacity, which yields a battery life estimate of 338 days or 11
months.
114 CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A
A.7 Software Guide
A.7.1 Introduction
This section describes the software source code modules used to communicate with the PRoC LP
bridge HID device to obtain the current radio parameters for the attached WirelessUSB LP devices.
It does not cover the details of the Microsoft Foundation Class (MFC) Library or the HID Library that
contains standard system-supplied routines that user-mode applications use to communicate with
USB devices that comply with the USB HID Standard. Refer to the Microsoft Visual C++ documenta-
tion for more on MFC and HID Class concepts, in addition to the Device Class Definition for Human
Interface Devices (HID) defined by the USB Implementers Forum, Inc. (http://www.usb.org/develop-
ers/hidpage).
CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A 115
CHidDevice Class Methods
116 CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A
CHidManager Class Methods
CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A 117
A.7.2.2 System Tray Module
The System Tray module defines the CCySysTray class, which provides the interface to the system
tray for the application. This module is not expected to require any modification; however, all source
code is provided for reference.
CCySysTray Class Methods
118 CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A
CMainFrame Class Methods
The CMainFrame class is the Visual C++ generated file that is a derived frame-window class for the
system tray application's main frame window. This class is modified to also perform the timer based
polling of the PRoC LP bridge HID device to obtain the radio parameters and display any appropriate
pop up messages. Additionally, this class also processes the command message to create the Wire-
lessUSB Status Property Sheet.
CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A 119
CWirelessUSBStatusPropertySheet Class Methods
The CWirelessUSBStatusPropertySheet class is the Visual C++ generated file that implements the
WirelessUSB Status Property Sheet, which generates a unique WirelessUSB Device Status Prop-
erty Page for each WirelessUSB device enumerated.
120 CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A
A.8 Bill of Materials (BOM)
A.8.1 Bridge
CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A 121
A.8.2 Mouse
122 CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A
No. Qty. Reference Description Manufacturer Mfr Part Number
2.5GHZ H-STUB WIGGLE ANTENNA FOR
30 1 ANT1 NA NA
63MIL PCB
Do not install the following components - these parts will be installed at Cypress, Boise
31 1 BH1 BATTERY HOLDER BTC MOUSE SKIN Recycled BTC Mouse M957U
32 2 BATTERY CLIPS POSITIVE Recycled BTC Mouse Unknown
33 2 BATTERY CLIPS NEGATIVE Recycled BTC Mouse Unknown
34 1 EN1 ENCODER CHICONY MOUSE Recycled BTC Mouse Unknown
35 1 SW1 SWITCH SLIDE MINI SPDT BTC ON/OFF Recycled BTC Mouse 1101M2S3CQE2
36 1 S1 LT SWITCH SMD BTC BIND Recycled BTC Mouse BTC_PUSH
37 3 S2,S3,S4 SWITCH 6MM VERT LEFT MIDDLE RIGHT Recycled BTC Mouse Unknown
IC, ULTRA LOW POWER MOUSE SENSOR
38 1 U2 Avago Technologies ADNS-3040
DIP20
39 1 MOUSE SENSOR PLASTIC SPACER Recycled BTC Mouse Unknown
40 1 D2 LED 3MM RED DIFFUSED TH Lite-On LTL-4261N
41 1 LED CLIP Recycled BTC Mouse Unknown
42 1 LENS Stuart Lens 5042-8121
43 1 Z-WHEEL Recycled BTC Mouse Unknown
A.8.3 Keyboard
CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A 123
No. Qty. Reference Description Manufacturer Mfr Part Number
18 1 L3 COIL 10UH 1100MA CHOKE 0805 Newark 30K5421
9C08052A1R00FKH
19 1 R2 RES 1.00 OHM 1/8W 1% 0805 SMD Yageo
FT
20 1 R3 RES 47 OHM 1/16W 5% 0402 SMD Panasonic - ECG ERJ-2GEJ470X
21 1 S1 LT SWITCH 6MM 100GF H=7MM TH Panasonic - ECG EVQ-PAC07K
Cypress Semiconduc-
22 1 U1 IC, LP 2.4 GHz RADIO SoC QFN-40
tor
IC WIRELESS EnCore II CONTROLLER Cypress Semiconduc-
23 1 U2
SSOP48 tor
24 1 Y1 CRYSTAL 12.00MHZ HC49 SMD eCERA GF-1200008
Cypress Semiconduc-
25 1 PCB PRINTED CIRCUIT BOARD
tor
26 1 LABEL1 Serial Number
27 1 LABEL2 PCA # 121-26505 **
No load components - Do not install
28 1 C6 CAP 47UF 6.3 V CERAMIC X5R 1210 Panasonic ECJ-4YB0J476M
9C08052A0R00JLH
29 1 R2 RES CHIP 0.0 OHM 1/10W 5% 0805 SMD Phycomp USA Inc
FT
30 1 C7 CAP 0.047 uF 50 V CERAMIC X5R 0402 AVX 0402YD473KAT2A
31 1 J4 HEADER 3POS FRIC STRGHT MTA 100 AMP/Tyco 644456-3
32 1 R1 RES ZERO OHM 1/16W 5% 0603 SMD Panasonic - ECG ERJ-3GEY0R00V
124 CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A
CY4672 PRoC LP Reference Design Kit Guide, Doc. # 001-69289 Rev.*A 125