ETC DRM055

Freescale Semiconductor, Inc...
Freescale Semiconductor, Inc.
High Data Rate
Wireless USB
Optical Mouse
Solution Using the
MC68HC908QY4
and MC68HC908JB12
Designer Reference
Manual
M68HC08
Microcontrollers
DRM055/D
Rev. 0
1/2004
MOTOROLA.COM/SEMICONDUCTORS
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc...
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
High Data Rate Wireless USB Optical Mouse
Solution Using the MC68HC908QY4
and MC68HC908JB12
Designer Reference Manual
by: Dennis Lui
Ernest Chan
Applications Engineering
Motorola Microcontroller Division
Hong Kong
To provide the most up-to-date information, the revision of our documents on
the World Wide Web will be the most current. Your printed copy may be an
earlier revision. To verify you have the latest information available, refer to:
http://motorola.com/semiconductors
Motorola and the Stylized M Logo are registered trademarks of Motorola, Inc.
DigitalDNA is a trademark of Motorola, Inc.
This product incorporates SuperFlash® technology licensed from SST.
All brand names and product names appearing in this document
are registered trademarks or trademarks of their respective holders.
High Data Rate Wireless USB Optical Mouse Solution
MOTOROLA
© Motorola, Inc., 2004
DRM055
3
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Revision History
Revision History
Revision
Level
January,
2004
N/A
Description
Initial release
Page
Number(s)
N/A
Freescale Semiconductor, Inc...
Date
DRM055
4
High Data Rate Wireless USB Optical Mouse Solution
Revision History
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM055
Table of Contents
Section 1. System Overview
Freescale Semiconductor, Inc...
1.1
1.2
1.3
1.4
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
System Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Transmitter and Receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Section 2. RF Front End
2.1
2.2
2.3
2.4
2.5
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RF Transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RF Receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PCB Layout Guidelines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13
13
13
14
14
Section 3. Universal Serial Bus (USB) Overview
3.1
3.2
3.2.1
3.2.2
3.2.3
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
JB12 USB Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
USB Module Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
USB Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
USB Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15
15
16
17
17
Section 4. Optical Mouse Transmitter
4.1
4.2
4.2.1
4.2.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
System Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
QY4 Microcontroller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Optical Mouse Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
19
20
20
Section 5. Mouse Transmitter Firmware
5.1
5.2
5.3
5.3.1
5.3.2
5.3.3
5.3.4
Firmware Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Power Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Data Packet Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Coding Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Packet Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Button Status and Z Displacement Packet . . . . . . . . . . . . . . . . .
X-Y Displacements Packet . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
High Data Rate W ireless USB Optical Mouse Solution
MOTOROLA
Table of Contents
For More Information On This Product,
Go to: www.freescale.com
21
22
23
23
23
24
25
DRM055
5
Freescale Semiconductor, Inc.
Table of Contents
Section 6. Universal Serial Bus (USB) Receiver
6.1
6.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
System Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Section 7. Receiver Firmware
Freescale Semiconductor, Inc...
7.1
7.2
7.3
7.3.1
7.3.2
7.4
Firmware Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
USB Report. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Remote Wakeup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Wakeup Detection Mechanism . . . . . . . . . . . . . . . . . . . . . . . . . .
Power Consideration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ID Updating Process. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29
35
35
35
37
37
Section 8. Testing and Customization
8.1
8.2
8.2.1
8.2.2
8.3
8.3.1
8.3.2
DRM055
6
Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Hardware Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Optical Mouse Transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RF Circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Firmware Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Mouse Transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
39
39
41
42
42
42
High Data Rate Wireless USB Optical Mouse Solution
Table of Contents
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM055
List of Figures and Tables
Freescale Semiconductor, Inc...
Figure
Title
1-1
System Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3-1
3-2
3-3
USB Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
USB Connection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
USB Packet Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4-1
Transmitter Block Diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5-1
5-2
5-3
5-4
5-5
5-6
5-7
5-8
5-9
5-10
Firmware Structure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Power Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Manchester Coding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Packet Format for Button and Z Displacement . . . . . . . . . . . . . . .
Start Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Button Status Byte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Z Displacement or ID Byte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Checksum Byte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Packet Format for X-Y Displacements . . . . . . . . . . . . . . . . . . . . . .
Start Field for X-Y Displacement Packet . . . . . . . . . . . . . . . . . . . .
6-1
USB Receiver. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
7-1
7-2
7-3
7-4
7-5
7-6
7-7
7-8
7-9
Firmware Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
USB Interrupt Routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Setup Routine. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
OUT EP0 Handler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
IN EP0 Handler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Timer Capture Interrupt For Receiver . . . . . . . . . . . . . . . . . . . . . .
Timing Parameters for Packet Detection . . . . . . . . . . . . . . . . . . . .
Detection of Valid Wakeup Packets . . . . . . . . . . . . . . . . . . . . . . . .
JB12 Rejecting Packet-Like Noise
to Prevent False Wakeup . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8-1
8-2
21
22
23
24
24
24
24
24
25
25
30
31
32
32
33
34
36
36
37
USB Report for JB12 to Host for the Test Setup . . . . . . . . . . . . . . 40
Loop Antenna Impedance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
High Data Rate Wireless USB Optical Mouse Solution
MOTOROLA
Page
List of Figures and Tables
For More Information On This Product,
Go to: www.freescale.com
DRM055
7
Freescale Semiconductor, Inc.
List of Figures and Tables
Table
Title
Page
Interface 1 Mouse Input Report . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
8-1
8-2
Tx Matching Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Rx Matching Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Freescale Semiconductor, Inc...
7-1
DRM055
8
High Data Rate Wireless USB Optical Mouse Solution
List of Figures and Tables
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM055
Section 1. System Overview
1.1 Introduction
Freescale Semiconductor, Inc...
This manual describes a reference design for a high data rate wireless
universal serial bus (USB) optical mouse solution by using the
MC68HC908QY4 and the MC68HC908JB12.
Because of the lower cost, adoption of wireless PC peripherals has been fast
paced. Consumers are quickly recognizing the advantages of using wireless
PC peripherals, which include portability and placement flexibility. However,
there are two major performance issues in general 27-MHz wireless platforms.
These issues affect wireless mouse applications in particular.
1. The mouse cursor motion tracking speed is slow
2. There is a long legacy time in response to an end-user action
These issues can be resolved by implementation of a new high-speed
transmission link. The tracking speed of the high data rate wireless mouse is
almost doubled and the response time is reduced by half. The performance is
even compatible to a corded mouse in terms of data report rates uploaded to
the PC host from the peripheral device. From the end users point of view, the
overall movement of the mouse can be fully cached up and reflected on the
computer screen without any noticeable delay in cursor response.
The following reference materials are available at:
http://motorola.com/semiconductors
•
Schematic diagram
•
PCB layout
•
PCB Gerber
•
Bill of materials
•
Source code
High Data Rate Wireless USB Optical Mouse Solution
MOTOROLA
System Overview
For More Information On This Product,
Go to: www.freescale.com
DRM055
9
Freescale Semiconductor, Inc.
System Overview
1.2 Features
Freescale Semiconductor, Inc...
Main features of the mouse include:
•
A high data rate 27-MHz RF link
•
Windows® 98, Windows 2000, and Windows XP compatibility
•
User identity code to avoid conflict with other devices
•
USB 2.0 low-speed compliance
•
4.8 kbps transmission data rate
•
2 meter communication distance
•
3361 compatible device for RF receiver design
1.3 System Overview
The system consists of:
•
A high data rate wireless optical mouse using the MC68HC908QY4
(hereafter referred as QY4)
•
A USB receiver using the MC68HC908JB12 (hereafter referred as
JB12).
The QY4 was chosen as the mouse transmitter because it includes:
•
An internal oscillator circuit
•
An auto wakeup function
The JB12 is suitable for this high data rate wireless optical mouse application
because it has:
NOTE:
•
12-K FLASH memory
•
6-MHz bus processing power
•
USB function
•
An enhanced timer capture module
The traditional track-ball type X-Y detection method was replaced by the
advance optical navigation technology that serves as a non-mechanical motion
estimation.
A block diagram of the system is shown in Figure 1-1.
Windows is a registered trademark of Microsoft Corporation in the United States and other
countries.
DRM055
10
High Data Rate Wireless USB Optical Mouse Solution
System Overview
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
Freescale Semiconductor, Inc.
System Overview
Transmitter and Receiver
LOOP
ANTENNA
LOOP
ANTENNA
455 kHz
FILTER
TWO-STAGE
AMPLIFIER
(DISCRETE)
xx3361
FSK
DEMODULATOR
MIXER
Freescale Semiconductor, Inc...
CRYSTAL
OSCILLATOR
(DISCRETE)
FSK
MODULATION
BY SWITCHING
LOADING
CAPACITOR
AMP
AMP
LO
13.5225 MHz/
13.5725 MHz
26.59 MHz/
26.64 MHz
MC68HC908QY4
I/O
DIRECTION
455 kHz
QUAD COIL
I/O
INPUT
MC68HC908JB12
DATA
OUTPUT
DATA
INPUT
USB
PC HOST
USB RECEIVER
WIRELESS OPTICAL MOUSE
Figure 1-1. System Block Diagram
1.4 Transmitter and Receiver
On the transmitter side:
The data generated from a displacement detection / button status in the
mouse application is encoded with a pre-defined serial type protocol
handled by firmware in the MCU. In the RF stage, the encoded data is used
for FSK modulation.
On the receiver side:
The captured data from the RF receiver stage is decoded with a
corresponding packet format used for mouse applications. The final data is
sent to the host through the USB interface.
High Data Rate Wireless USB Optical Mouse Solution
MOTOROLA
System Overview
For More Information On This Product,
Go to: www.freescale.com
DRM055
11
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
System Overview
DRM055
12
High Data Rate Wireless USB Optical Mouse Solution
System Overview
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM055
Section 2. RF Front End
Freescale Semiconductor, Inc...
2.1 Introduction
A high data rate 27-MHz RF link is designed as the wireless communication
media for this application. The RF frequency is determined by the crystal
frequency used at the oscillator circuit stage and there are two selectable
channels for transmission. The transmission data rate is 4.8 kbps.
2.2 Functional Description
The high-frequency carrier signal on the transmitter side is modulated by the
digital encoded data from the QY4 using a FSK modulation scheme. The
modulated RF signal is propagated through free-air space and received by an
integrated chip, the 3361, on the receiver side which includes all mixer, local
oscillator, and demodulator circuits. The demodulated data output is received
by the JB12 for decoding and processing. The data will then be converted to
the USB mouse report format and sent to the host.
2.3 RF Transmitter
The RF transmitter consists of three parts:
•
The crystal type oscillator
•
The FSK modulation switching circuit
•
The RF amplifier
The crystal oscillator works with a crystal frequency at half of the target channel
frequency and the second harmonic frequency is filtered out by the RF amplifier
together with a high Q-factor antenna. For example, a 13.5225-MHz crystal is
used for a frequency channel at 27.045-MHz.
The FSK modulation is achieved by changing the loading capacitance at the
crystal with a transistor switching circuit controlled by the encoding data
generated from the MCU. The maximum data rate for a particular FSK
transmission is limited by the RF bandwidth of the system and controlled by the
frequency deviation which represents the logic “0” and logic “1” data. In
general, the frequency deviation should be adjusted proportionally to the
change on the required transmission data rate. Higher data rates require more
bandwidth / frequency deviation. The frequency deviation for this 4.8-kbps data
High Data Rate Wireless USB Optical Mouse Solution
MOTOROLA
RF Front End
For More Information On This Product,
Go to: www.freescale.com
DRM055
13
Freescale Semiconductor, Inc.
RF Front End
rate wireless mouse application is increased from ±2.5 kHz to ±4.5 kHz which
is controlled by the crystal characteristics.
The gain of the RF amplifier in the final stage should be adjusted to
compensate the gain loss at the oscillator stage with extend bandwidth
operation. Two stages of RF amplifier are used in this reference design to
maintain the performance in communication distance.
2.4 RF Receiver
Freescale Semiconductor, Inc...
The RF receiver is implemented by using a single-chip solution (3361
compatible part) which includes:
•
A frequency downward conversion mixer
•
A local oscillator circuit
•
A baseband FSK quadrature demodulation unit
The RF input signal from the antenna, is frequency down converted into an IF
signal at 455 kHz by the mixer and oscillator circuits. The IF frequency value is
equal to the RF input frequency plus or minus the LO input frequency. The
higher frequency components should be filtered out by using a passive IF filter.
The bandwidth should be increased from 15 kHz to 20 kHz to match the data
rate change on the transmitter side.
However, the image frequency component would not be filtered out by the IF
filter. This should be considered in the PCB layout in order to prevent any noise
component at image frequency to be injected into the mixer input. An example
of this would be a noise pattern generated from the MCU.
The frequency used for a 3361 mixer local oscillator is selected by the crystal
connected at the oscillator base input pin. There are two frequency channels
that can be selected to match the transmitter channel.
2.5 PCB Layout Guidelines
Care should be taken in PCB layout in order to avoid any noise generated from
MCU coupling into the RF stage. For example:
DRM055
14
•
The power supply traces used for digital and analog circuit blocks should
be separated.
•
The location of decoupling capacitors should be as close as possible to
device's supply input pins (VDD/VSS or VCC/GND).
•
The VDD to VSS ground loop area should be reduced to minimize the
magnetic coupling effect.
•
The PCB trace loop formed by any input/output (I/O) signal pin should
be kept to a minimum.
•
The RF receiver uses a loop antenna formed by using a PCB trace line.
High Data Rate Wireless USB Optical Mouse Solution
RF Front End
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM055
Section 3. Universal Serial Bus (USB) Overview
Freescale Semiconductor, Inc...
3.1 Introduction
The universal serial bus (USB) is an industry-standard extension to PC
architecture providing a low-cost plug-and-play solution for PC peripheral
devices. It is a serial data link with a high data-transfer rate and device-control
capability. Peripheral USB devices can be configured automatically when
connected to a host because the USB software driver is mapped and loaded in
the operating system (OS) according to the peripheral device class.
The USB driver knows how to communicate with the devices and the USB
devices will report their attributes (using a specific report format called
descriptor) to the host during device configuration. The descriptor is a data
structure with a defined format that describes the device’s capabilities and
resource requirements.
For more detailed information regarding the descriptor format, please refer to
the Universal Serial Bus Specification Revision 2.0 at:
http://www.usb.org/developers/docs
3.2 JB12 USB Module
Features of the JB12 USB module include:
•
Universal Serial Bus Specification 2.0 low-speed functions
•
1.5-Mbps data rate
•
On-chip 3.3 -V regulator
•
Endpoint 0 with 8-byte transmit buffer and 8-byte receive buffer
•
Endpoint 1 with 8-byte transmit buffer
•
Endpoint 2 with 8-byte transmit buffer and 8-byte receive buffer
•
USB data control logic
•
USB reset options
•
Suspend and resume operations with remote wakeup support
•
USB-generated interrupts
•
STALL, NAK, and ACK handshake generation
High Data Rate Wireless USB Optical Mouse Solution
MOTOROLA
Universal Serial Bus (USB) Overview
For More Information On This Product,
Go to: www.freescale.com
DRM055
15
Freescale Semiconductor, Inc.
Universal Serial Bus (USB) Overview
3.2.1 USB Module Description
Freescale Semiconductor, Inc...
Figure 3-1 shows a block diagram of the USB module. The USB module
manages communications between the host and the USB function. The module
is partitioned into three functional blocks. These blocks consist of:
•
USB transceiver
•
USB control logic
•
USB registers
USB
CONTROL
LOGIC
VPIN
VMIN
TRANSCEIVER
RCV
D+
D–
USB
UPSTREAM
PORT
VPOUT
VMOUT
CPU BUS
USB REGISTERS
Figure 3-1. USB Block Diagram
The USB transceiver provides the physical interface to the USB D+ and D–
data lines. The USB transceiver uses a differential output driver to drive the
USB data signal onto the USB cable. The output swings between the
differential high and low state are well balanced to minimize signal skew.
The USB control logic manages data movement between the CPU and the
transceiver. The control logic handles both transmit and receive operations on
the USB. It contains the logic used to manipulate the transceiver and the
endpoint registers.
The MCU program controls and monitors the USB operation and data transfer
status through the corresponding USB registers.
Please refer to the MC68HC908JB16 Technical Data (Motorola document
order number MC68HC908JB16/D) and to it’s Addendum (Motorola document
order number HC908JB16AD/D) for a more detailed description of each block.
DRM055
16
High Data Rate Wireless USB Optical Mouse Solution
Universal Serial Bus (USB) Overview
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
Freescale Semiconductor, Inc.
Universal Serial Bus (USB) Overview
JB12 USB Module
3.2.2 USB Connection
The USB devices are connected to the host by a 4-wire cable. The USB signals
are transmitted over two wires (D+ and D–) on each point-to-point segment.
The cable also carries VBUS and GND wires (+5 V and ground) to deliver power
to devices. The USB data lines are required by the USB specification to have
an output voltage between 2.8 V and 3.6 V. The data lines also are required to
have an external 1.5-kΩ pullup resistor connected between a data line and a
voltage source between 3.0 V and 3.6 V. Figure 3-2 shows the worst-case
electrical connection for the voltage regulator.
Freescale Semiconductor, Inc...
4.0 V–5.5 V
3.3-V
REGULATOR
USB DATA LINES
R1
LOW-SPEED
TRANSCEIVER
D+
HOST
OR
HUB
USB CABLE
D–
R1 = 1.5 kΩ ± 5%
R2 = 15 kΩ ± 5%
R2
R2
Figure 3-2. USB Connection
For detailed electrical specifications, please refer to Universal Serial Bus
Specification Revision 2.0 at:
http://www.usb.org/developers/docs
3.2.3 USB Protocol
The USB is a polled bus and the physical layers are configured in a tiered star
topology with point-to-point connections between the host and a hub or a
device. All data transfers are initiated and controlled by the host on a scheduled
basis. Each transaction is comprised of up to three packets. Figure 3-3 shows
the USB packet types.
The host will send out a token packet describing the type and direction of
transaction, device address, and endpoint number. The target device will
respond to the token if the address field decoding is a match. The transaction
direction is indicated in the token packet. The source of the transaction sends
a data packet, or indicates there is no information to transfer, and the
destination will respond with a handshake packet indicating if the transaction is
correct or not.
High Data Rate Wireless USB Optical Mouse Solution
MOTOROLA
Universal Serial Bus (USB) Overview
For More Information On This Product,
Go to: www.freescale.com
DRM055
17
Freescale Semiconductor, Inc.
Universal Serial Bus (USB) Overview
Token Packet:
IN
OUT
SYNC
PID
PID
SYNC
PID
PID
ADDR
ENDP
CRC5
EOP
CRC16
EOP
SETUP
Data Packet:
DATA0
DATA1
DATA
0–8 BYTES
Freescale Semiconductor, Inc...
Handshake Packet:
ACK
NAK
SYNC
PID
PID
EOP
STALL
Figure 3-3. USB Packet Types
Please refer to the MC68HC908JB16 Technical Data (Motorola document
order number MC68HC908JB16/D) for a detailed description of each packet
format.
DRM055
18
High Data Rate Wireless USB Optical Mouse Solution
Universal Serial Bus (USB) Overview
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM055
Section 4. Optical Mouse Transmitter
Freescale Semiconductor, Inc...
4.1 Introduction
The features of the high data rate wireless USB optical mouse solution include
an internal oscillator circuit which can generate a clock of 12.8 MHz with no
external components needed. The auto wakeup module generates a periodic
interrupt during stop mode to wake the part up without requiring an external
signal. These features make the QY4 MCU suited for wireless optical mouse
applications.
The main features of the reference design include:
•
27-MHz RF transmitter
•
4.8-kbps transmission data rate
•
800-DPI resolution
•
Smart power management
4.2 System Overview
The mouse transmitter consists of:
•
The QY4
•
The Agilent optical mouse sensor (ADNS-2030)
•
The RF front end
Refer to Figure 4-1 for a block diagram of the system.
NOTE:
RF data is transmitted by means of setting and clearing the RF_Data and the
RF_Off pin.
High Data Rate Wireless USB Optical Mouse Solution
MOTOROLA
Optical Mouse Transmitter
For More Information On This Product,
Go to: www.freescale.com
DRM055
19
Freescale Semiconductor, Inc.
Optical Mouse Transmitter
BUTTONS
LOOP
ANTENNA
MC68HC908QY4
L
CRYSTAL
OSCILLATOR
(DISCRETE)
AMP
PTA5
C
R
Freescale Semiconductor, Inc...
SCLK
PTB6
SDIO
PTB5
PD
XY_LED
OSC_IN
PTA0
18 MHz
DGND
OSC_OUT
RF DATA
RF_OFF
Z-AXIS ENCODER
PTB7
IMAGE
SENSOR
PTA4
PTA3
ID
13.5225 MHz/
13.5725 MHz
ADNS2003
REFA
PTA1/TCH1
PTB2
+
100 nF
2u2 F
REFB
LD3
IR
R_BIN
Z LED
IR Rx MODULE
PTB0
PTB1
27 K
PTB3
750
A GND
(16-PIN PDIP)
(16-PIN PDIP)
Figure 4-1. Transmitter Block Diagram
4.2.1 QY4 Microcontroller
The functions of the QY4 are:
• To get the XY displacement from the sensor
• Detect the Z displacement
• Check button status
• Control the RF circuitry to send out data
• Perform the overall power management
Three standard left, middle, and right buttons together with one button for the
identity device (ID) code are implemented. The ID code can either be stored in
the RAM or in the FLASH of the QY4. When the ID button in the transmitter and
the one in the receiver are pressed, a random ID code is generated at the
transmitter and sent to the receiver. After receiving the new ID code, the
receiver stores it in the FLASH of the receiver MCU.
4.2.2 Optical Mouse Sensor
The ADNS-2030 is a 3-V supply sensor is specially design for wireless optical
mouse applications. The communication between the sensor and the QY4 is
through a serial peripheral interface (SPI) with clock input at the SCLK pin and
bidirectional data interface at the SDIO pin. The power down (PD) pin is used
to power down the sensor when not in use.
DRM055
20
High Data Rate Wireless USB Optical Mouse Solution
Optical Mouse Transmitter
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM055
Section 5. Mouse Transmitter Firmware
5.1 Firmware Structure
Freescale Semiconductor, Inc...
The firmware structure consists of two main parts:
•
Main routine
•
Timer interrupt routine
Figure 5-1 shows the flow of the main program and the timer interrupt routine.
It also indicates the main functions that the QY4 are to perform. The main
challenge in wireless optical mouse design is the power management to
minimize the power consumption and maximize the performance.
MAIN PROGRAM
TIMER
INTERRUPT
GET XY DISPLACEMENT
FROM SENSOR
TRANSMIT DATA
IF ANY
GET Z DISPLACEMENT
FOR EVERY MILLISECOND
POWER OFF RF CIRCUIT
IF ALL DATA TRANSMITTED
CHECK BUTTON
FOR EVERY MILLISECOND
SET TIMER
TICK FLAGS
POWER MANAGEMENT
RETURN
Figure 5-1. Firmware Structure
The main program continually checks one of the sensor registers to see if any
XY movement has happened. If any XY movement is detected, it gets the X and
Y displacements from the sensor registers, puts them in the FIFO buffer and
sets the corresponding flags. For every millisecond timer tick, it checks the Z
movement and the buttons status.
High Data Rate Wireless USB Optical Mouse Solution
MOTOROLA
Mouse Transmitter Firmware
For More Information On This Product,
Go to: www.freescale.com
DRM055
21
Freescale Semiconductor, Inc.
Mouse Transmitter Firmware
A timer interrupt is set for every 104 µs which is the base time for the 4.8-kHz
data rate transmission. By configuring the timer to output compare mode, the
RF_Data output pin can be set, cleared, or toggled for every 104 µs. The timer
interrupt routine determines whether to set or clear the RF_Data pin at the next
interrupt time. It also determines what the current RF_Off pin status should be.
5.2 Power Management
Freescale Semiconductor, Inc...
Power management plays a very important role in the wireless optical mouse
solution.
SENSOR FULLY TURNED ON
ZLED TURNED ON
FOR EVERY 1 MILLISECOND
XY NO MOVEMENT
FOR 5 SECONDS
HIGH CURRENT
XY MOVEMENT
XY MOVEMENT
SENSOR AND ZLED TURNED ON
FOR EVERY 200 MILLISECONDS
(EVERY 500 MILLISECONDS IF IN
SLEEP FOR MORE THAN 10 MINUTES)
Z MOVEMENT
OR BUTTON
SENSOR TURNED ON EVERY
20 MILLISECONDS, ZLED TURNED
ON FOR EVERY 1 MILLISECOND
SLEEP
POWER SAVING
(STARTUP)
XYZ NO MOVEMENT
AND
NO BUTTON FOR 90 SECONDS
Figure 5-2. Power Management
Figure 5-2 shows the power management flow. There are three defined
stages:
•
Power saving
•
High current
•
Sleep
After power up, the mouse is put in the power saving stage. In this stage, the
sensor is only turned on every 20 milliseconds to see if any XY movement
happened. The Z movement and buttons are sensed every millisecond.
If no activity happens for 90 seconds, it enters sleep stage. In this stage, the
QY4 is put in stop mode and will wake up every 200 milliseconds to monitor any
DRM055
22
High Data Rate Wireless USB Optical Mouse Solution
Mouse Transmitter Firmware
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
Freescale Semiconductor, Inc.
Mouse Transmitter Firmware
Data Packet Format
activity. If still no activity happens for 10 minutes, the activities are monitored
every 500 milliseconds.
Any XY movement will cause the mouse to enter high current stage. At this
stage, the sensor is powered on and XY movement is continually monitored.
The Z movement and button activities are still monitored every millisecond. If
no XY movement happens for 5 seconds, it then enters power saving stage.
NOTE:
Except for the 1 millisecond timer tick, all of the above mentioned timings can
be configured by changing their constant values.
Freescale Semiconductor, Inc...
5.3 Data Packet Format
A data packet consists of a start field, a data field, and a checksum field.
5.3.1 Coding Method
Except for the start field, both the data and the checksum fields are encoded
by using the Manchester Coding method. That is, a logic '0' is represented by
two equal times 'T' of a logic high or a logic low and vice verse for a logic '1'. An
additional '0' is added to the end of each byte of these two fields as stop bits.
Refer to Figure 5-3.
"0"
(2T PERIOD)
"1"
(2T PERIOD)
Figure 5-3. Manchester Coding
The order of transmission will be from least significant bit (LSB) to most
significant bit (MSB). For example, bit 0 will be transmitted first.
The basic time of each logic level toggle is 104 µs(T). Therefore, each bit in the
data and checksum fields will be a 2T period according to the Manchester
Coding.
5.3.2 Packet Types
There are two types of packets:
•
X-Y displacements packet
•
Button status and Z displacement packet
As the header patterns between these two packet types are different, the
receiver will not interpret a X-Y displacement packet as a Z and button status
packet or vice versa.
High Data Rate Wireless USB Optical Mouse Solution
MOTOROLA
Mouse Transmitter Firmware
For More Information On This Product,
Go to: www.freescale.com
DRM055
23
Freescale Semiconductor, Inc.
Mouse Transmitter Firmware
5.3.3 Button Status and Z Displacement Packet
Figure 5-4 shows the packet format for button and Z displacement.
Start
Button Status
Z or ID
Checksum
DATA FIELD
START FIELD
CHECKSUM FIELD
Figure 5-4. Packet Format for Button and Z Displacement
Freescale Semiconductor, Inc...
The start field consists of the SYNC pattern, preamble, and a header as shown
in Figure 5-5.
SYNC PATTERN AND PREAMBLE
(12T PERIOD)
HEADER
(6T PERIOD)
Figure 5-5. Start Field
The button status byte (Figure 5-6) represents the status of the four buttons. It
shows which buttons are pressed or released. The bit value of '1' means the
button was pressed and '0' means the button was released
R
ID
M-BTN R-BTN L-BTN
R
R
R
STOP
Figure 5-6. Button Status Byte
This byte represents either the Z displacement or the new ID code (Figure 5-7).
The Z displacement byte represents the Z displacement in 2's complement if
the ID bit in the button status equals '0'. If the ID bit equals '1', it represents the
new ID code.
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
STOP
Figure 5-7. Z Displacement or ID Byte
The checksum is the sum of the button status byte, the Z Displacement byte,
and the stored ID byte. See Figure 5-8.
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
STOP
Figure 5-8. Checksum Byte
DRM055
24
High Data Rate Wireless USB Optical Mouse Solution
Mouse Transmitter Firmware
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
Freescale Semiconductor, Inc.
Mouse Transmitter Firmware
Data Packet Format
5.3.4 X-Y Displacements Packet
Figure 5-9 shows the packet format for X-Y displacements with the start field
illustrations in Figure 5-10.
Start
X Displacement
Y Displacement
DATA FIELD
START FIELD
Checksum
CHECKSUM FIELD
Freescale Semiconductor, Inc...
Figure 5-9. Packet Format for X-Y Displacements
SYNC PATTERN AND PREAMBLE
(12T PERIOD)
HEADER
(6T PERIOD)
Figure 5-10. Start Field for X-Y Displacement Packet
The X or Y displacement is represented in 2's complement and the checksum
byte is the sum of the X displacement, the Y displacement, and the stored ID
byte.
High Data Rate Wireless USB Optical Mouse Solution
MOTOROLA
Mouse Transmitter Firmware
For More Information On This Product,
Go to: www.freescale.com
DRM055
25
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Mouse Transmitter Firmware
DRM055
26
High Data Rate Wireless USB Optical Mouse Solution
Mouse Transmitter Firmware
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM055
Section 6. Universal Serial Bus (USB) Receiver
Freescale Semiconductor, Inc...
6.1 Introduction
The features of the JB12 include a configurable universal serial bus (USB) and
PS/2 interface, which makes this MCU suited for personal computer human
interface devices (HID) applications, such as mice. The enhanced timer
function also allows it to capture and decode data easily, especially for high
data rate wireless HID applications. Refer to Figure 6-1.
The main features of the receiver include:
•
27-MHz RF receiver
•
Fully USB specification 2.0 low-speed compliant
•
Windows 98, 2000, and XP compatible
455 kHz
FILTER
MC68HC908JB12
xx3361
MIXER
FSK
DEMODULATOR
ID
PTA0
455 kHz
QUAD COIL
PTA1
ICP
INTERFACE
PTA2
PTA3
LO
AMP
5V
RF_DATA
RF_OFF
26.59 MHz/
26.64 MHz
5V
PTE1
VDD
VREG
USB
PTA4
1K5
PC
HOST
PTE4 D–
D+
PTE3
VSS
1K
SLEEP
GND
PTC0
RST
OSC2
WAKEUP
CIRCUIT
10 M
IRQ
X1
10 nF
OSC1
NC
PTA7–PTA5
30 pF
12 MHz
30 pF
(SO20)
Figure 6-1. USB Receiver
High Data Rate Wireless USB Optical Mouse Solution
MOTOROLA
Universal Serial Bus (USB) Receiver
For More Information On This Product,
Go to: www.freescale.com
DRM055
27
Freescale Semiconductor, Inc.
Universal Serial Bus (USB) Receiver
6.2 System Overview
The receiver consists of:
•
The JB12
•
A button for identity device (ID) code setting
•
A in-circuit programming (ICP) connector
•
RF front-end circuitry
Freescale Semiconductor, Inc...
The functions of the JB12 are to handle the USB transactions, capture and
process data from RF receiver front end. The processed data is converted into
USB report format and sent to the host.
The ID button is used to interrupt the MCU for a new ID code detection. The
MCU will search if there is any ID code embedded in the RF data packet and
store the new ID in FLASH memory.
There is a transistor wakeup circuit connected at the IRQ pin and is controlled
by a I/O pin. The MCU will configure the wakeup circuit before entering stop
mode for power saving. The RC components connected at the transistor base
input will be charged up, and eventually turn on the transistor and pull low the
IRQ to wakeup the MCU.
The ICP interface is connected at port A. The ICP is used for future firmware
updating through the Cyclone Programming Tools.
DRM055
28
High Data Rate Wireless USB Optical Mouse Solution
Universal Serial Bus (USB) Receiver
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM055
Section 7. Receiver Firmware
7.1 Firmware Structure
Freescale Semiconductor, Inc...
The firmware consists of three main parts:
•
Main routine
•
Timer interrupt routine to capture and decode mouse data
•
USB interrupt routine
The USB routine includes reference codes for both universal serial bus (USB)
mouse and keyboard. Thus, it can be a reference on how to implement a
composite USB keyboard-mouse device using the JB12.
Figure 7-1 shows the flow of the main program for the JB12 receiver. The main
routine continually checks to see if there is any valid mouse data in the receiver
buffer queue. If there is new data received, the data will be converted to USB
report format and sent to the host via the USB endpoints.
Figure 7-2 shows the USB interrupt routines. The USB engine automatically
responds to a valid USB token with either ACK, NAK, or STALL, depending on
the register settings, and ignores it if it’s invalid. The firmware has to set the
registers for the USB engine to give correct response to the token in different
stages. The USB interrupt will be executed whenever there is an EOP, resume
signal from host, valid data received, or data transmitted. The USB interrupt
routine also makes preparation for the next USB transaction and handles any
valid command or data received.
Figure 7-3, Figure 7-4, and Figure 7-5 show the routines handling control
transfers. Control transfers have two or three transaction stages: setup, data
(optional), and status as shown below:
•
Control write: SETUP, OUT, OUT, OUT... IN
•
Control read: SETUP, IN, IN, IN... OUT
•
No Data control: SETUP, IN
The firmware first distinguishes the kind of control transfer and then does the
corresponding preparation for the next stage.
High Data Rate Wireless USB Optical Mouse Solution
MOTOROLA
Receiver Firmware
For More Information On This Product,
Go to: www.freescale.com
DRM055
29
Freescale Semiconductor, Inc.
Receiver Firmware
MAIN
Freescale Semiconductor, Inc...
NO
NO
DEVICE
CONFIGURED?
NEW
RECEIVED MOUSE
DATA IN BUFFER?
YES
CONVERT DATA
TO MOUSE REPORT
NEW ENDPOINT 1
REPORT?
YES
EP1 TX BUFFER
EMPTY?
YES
TX EP1 IN REPORT
NO
NEW ENDPOINT 2
REPORT?
YES
EP2 TX BUFFER
EMPTY?
YES
TX EP2 IN REPORT
NO
NO
USB IDLE FOR
3 ms?
YES
SUSPEND DEVICE
RF PACKET
DETECTED OR RESUME
FROM HOST?
YES
Figure 7-1. Firmware Flow
DRM055
30
High Data Rate Wireless USB Optical Mouse Solution
Receiver Firmware
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
Freescale Semiconductor, Inc.
Receiver Firmware
Firmware Structure
USB INTERRUPT ROUTINE
NO
EOP?
YES
Freescale Semiconductor, Inc...
RESET SUSPEND COUNTER
YES
SETUP?
SETUP HANDLER
NO
OUT TOKEN
TO EP0?
YES
OUT EP0 HANDLER
NO
EP0 TX COMPLETED?
YES
IN EP0 HANDLER
NO
EP1 TX COMPLETED?
YES
DISABLE EP1 TRANSMIT
AND CLEAR EP1 TX FLAG
YES
DISABLE EP2 TRANSMIT
AND CLEAR EP2 TX FLAG
NO
EP2 TX COMPLETED?
NO
RESUME FROM
HOST?
YES
CLEAR RESUME FLAG
NO
RETURN FROM INTERRUPT
Figure 7-2. USB Interrupt Routine
High Data Rate Wireless USB Optical Mouse Solution
MOTOROLA
Receiver Firmware
For More Information On This Product,
Go to: www.freescale.com
DRM055
31
Freescale Semiconductor, Inc.
Receiver Firmware
SETUP HANDLER
1. UNINSTALL EP0 IN AND OUT
2. COPY 8-BYTE SETUP DATA
TO RAM BUFFER
3. CLEAR EP0 RX FLAG
4. SET NAK TO IN EP0
Freescale Semiconductor, Inc...
STANDARD DEVICE
REQUEST?
YES
HANDLE STANDARD
DEVICE REQUEST
YES
HANDLE HID
CLASS REQUEST
NO
HID CLASS
REQUEST?
NO
RETURN STALL
RETURN
Figure 7-3. Setup Routine
OUT EP0 HANDLER
STATUS STAGE?
YES
1. SET NAK TO EP0 IN
2. SET STALL TO EP0 OUT
(CONTROL TRANSFER
COMPLETED)
NO
VALID DATA
YES
1. COPY DATA TO BUFFER
2. PROCESS OUT DATA
NO
RETURN STALL
RETURN
Figure 7-4. OUT EP0 Handler
DRM055
32
High Data Rate Wireless USB Optical Mouse Solution
Receiver Firmware
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
Freescale Semiconductor, Inc.
Receiver Firmware
Firmware Structure
OUT EP0 HANDLER
SET NAK TO IN EP0
Freescale Semiconductor, Inc...
STATUS STAGE?
YES
SET STALL T0 EP0 OUT
(CONTROL TRANSFER
COMPLETED)
YES
PREPARE FOR
OUT STAGE
NO
ALL DATA
SENT?
NO
PREPARE FOR
NEXT DATA STAGE
RETURN
Figure 7-5. IN EP0 Handler
One timer interrupt routine is used to capture the RF mouse data. The firmware
flow is shown Figure 7-6. This timer is set to input capture mode. When an
interrupt happens on the falling and rising edge, it can calculate the pulse width
of the RF data.
The routine will proceed to detect data only if the pulse width matches the data
structure of the RF packet. The detected data bit will be put into a temporary
buffer. The timer interrupt events will continue to occur until one complete RF
packet has been received. All the received data will then be put into a receiver
buffer queue for the main program to process. In the case where an USB bus
is being suspended, a received mouse packet means the USB bus and the host
computer needed to wake up. The routine will then signal the main routine to
wakeup the host instead of update the receiver buffer queue.
For more detailed information, refer to 7.3.1 Wakeup Detection Mechanism.
High Data Rate Wireless USB Optical Mouse Solution
MOTOROLA
Receiver Firmware
For More Information On This Product,
Go to: www.freescale.com
DRM055
33
Freescale Semiconductor, Inc.
Receiver Firmware
TIMER INTERRUPT ROUTINE
FOR RF RECEIVER
MONITOR RF FRONT END
VALID RF
DATA ARRIVED?
NO
Freescale Semiconductor, Inc...
YES
DECODE AND UPDATE
TEMPORARY BUFFER
NO
ONE COMPLETE
PACKET IS RECEIVED?
YES
USB BUS BEING
SUSPENDED?
YES
NO
PUT DATA INTO RECEIVER
BUFFER QUEUE
SIGNAL MAIN ROUTINE
TO WAKE UP HOST
RESET RECEIVER STATUS
EXIT AND WAIT FOR NEXT
TIMER INTERRUPT
Figure 7-6. Timer Capture Interrupt For Receiver
DRM055
34
High Data Rate Wireless USB Optical Mouse Solution
Receiver Firmware
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
Freescale Semiconductor, Inc.
Receiver Firmware
USB Report
7.2 USB Report
As previously mentioned, the USB routine in the JB12 is a composite device of
keyboard and mouse. It implements two HID interfaces on endpoint 1 and
endpoint 2. HID interface 0 (endpoint 1) implements a standard HID keyboard
with identical report and boot protocols. HID interface 1 (endpoint 2)
implements multimedia, power management keys, and mouse data.
The mouse report uses report ID number 3 in the HID interface 1. The report
structure is shown in Table 7-1.
Freescale Semiconductor, Inc...
Table 7-1. Interface 1 Mouse Input Report
Byte
Bit 7
Bit 6
0
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Middle
button
Right
button
Left
button
Report ID = 3
1
2
X displacement
3
Y displacement
4
Z displacement
Reports with ID numbers 1 and 2 in interface 1 have been used for keyboard
power management keys and multimedia keys for the keyboard protocol. If you
are interested in the composite keyboard mouse device report format in detail,
please refer to the reference design entitled USB Wireless Optical Mouse and
Multimedia Keyboard Solution (Motorola document order number, DRM042/D).
7.3 Remote Wakeup
The JB12 receiver supports remote wakeup functions that can wake up the
host computer during USB suspend.
During suspend, the MCU will be periodically awakened by the IRQ interrupt.
The MCU then turns on the RF front end and detects whether valid mouse RF
packets have arrived to wake up the host. This periodic IRQ interrupt signal is
generated through the external RC charging and discharging circuit. The MCU
initializes this charging and discharging cycle before it enters power saving
mode.
7.3.1 Wakeup Detection Mechanism
After suspend, the MCU will wakeup for a short period of time for each IRQ
interrupt. This period is shorter than one complete RF packet. In the case that
an RF packet has arrived, the MCU can only determine that a portion of the
packet is being received.
High Data Rate Wireless USB Optical Mouse Solution
MOTOROLA
Receiver Firmware
For More Information On This Product,
Go to: www.freescale.com
DRM055
35
Freescale Semiconductor, Inc.
Receiver Firmware
For this short detection period, there is the possibility that the noise hit into the
RF front end would have a pattern like a packet portion. Therefore, if a packet
portion is detected, the MCU will turn on for a longer duty cycle. This duty cycle
is for receiving the next complete RF packet that can wake up the host.
The mechanism and the timing parameters for detecting a wakeup packet are
shown in Figure 7-7, Figure 7-8, and Figure 7-9.
TRANSMITTER
MOUSE PACKET
RF PACKET
Freescale Semiconductor, Inc...
tPKT
JB12 IRQ
tIRQ
JB12 WAKEUP
DUTY CYCLE
tON1
tSleep
tPKT: Length of one complete RF packet
tIRQ: Time interval of successive IRQ wakeup periods during device suspend.
tON1: Duration of MCU being turned on in each IRQ wakeup period. MCU is turned
on in this period to detect a (portion of) RF packet has been received.
Figure 7-7. Timing Parameters for Packet Detection
TRANSMITTER
MOUSE PACKET
RF PACKET
RF PACKET
NEXT MOUSE PACKET
JB12 IRQ
JB12 WAKEUP
DUTY CYCLE
tON1
tON2
PORTION OF
PACKET DETECTED
VALID DATA DETECTED
JB12 WILL WAKE UP
THE HOST
If during a tON1 period a portion of a RF packet is detected, the RF receiver will turn on (tON2)
for a longer time to detect a complete RF packet.
If one complete RF packet is received, the MCU will wake up the host.
Figure 7-8. Detection of Valid Wakeup Packets
DRM055
36
High Data Rate Wireless USB Optical Mouse Solution
Receiver Firmware
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
Freescale Semiconductor, Inc.
Receiver Firmware
ID Updating Process
RECEIVER RF
FRONT END
NOISE SIMILAR TO
PORTION OF PACKET
RANDOM NOISE
JB12 IRQ
JB12 WAKEUP
DUTY CYCLE
tON1
tON2
Freescale Semiconductor, Inc...
PORTION OF
PACKET DETECTED
NO VALID DATA
DETECTED
SLEEP AGAIN
If during a tON1 period a portion of a RF packet is detected, the RF receiver will be
turned on (tON2) for a longer time to detect a complete RF packet.
If the receiver does not receive a complete RF packet, the MCU/receiver will sleep again.
If the receiver receives a complete RF packet, the MCU/receiver will wakeup the host.
Figure 7-9. JB12 Rejecting Packet-Like Noise to Prevent False Wakeup
7.3.2 Power Consideration
The average power consumption during suspend is given by the following
equation:
PON x tON + PSleep x (tIRQ – tON)
PAverage =
tIRQ
Power consumption can be decreased by increasing tIRQ. But, if tIRQ is larger
than tPKT the receiver may not catch the incoming RF packet. Therefore,
choosing tIRQ equal to tPKT could be an optimizing value for tIRQ.
Another way for reducing power consumption is to shorten tON. But, tON cannot
be too small in practice. Otherwise, the false wakeup for 2nd stage complete
packet detection can occur more frequently resulting in more power being
actually consumed (refer to Figure 7-9). Note that this parameter can be
fine-tuned in the actual application system.
7.4 ID Updating Process
The user must following these steps to update the mouse ID:
1. Press and hold the “PTA0” button in the receiver
2. Press the "CONNECT" button once in the mouse
3. Release the “PTA0” button in the receiver
Once these steps are complete, the new mouse ID will be updated in the
receiver.
High Data Rate Wireless USB Optical Mouse Solution
MOTOROLA
Receiver Firmware
For More Information On This Product,
Go to: www.freescale.com
DRM055
37
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Receiver Firmware
DRM055
38
High Data Rate Wireless USB Optical Mouse Solution
Receiver Firmware
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM055
Section 8. Testing and Customization
Freescale Semiconductor, Inc...
8.1 Testing
This solution was tested under different Windows Operating Systems on
several different PCs for USB compatibility. These tests included:
•
USB compliance test using Command Verifier, Version 1.2
•
Compatibility tests under Windows 98SE, 2000, and XP
•
Compatibility tests under AMD 750, Intel 810 and 845 chip set desktops,
and IBM Thinkpad T23, DELL Latitude C640
The integrity of the RF data link between the mouse and receiver had been
verified by recording the actual USB report from the receiver to host.
A test had been setup where the mouse transmitter was sending some
pre-defined RF data continuously. At the receiver side, an USB analyzer had
been connected between the JB12 and the host computer. The analyzer
captured the USB data from the JB12 to host PC. The captured data was then
compared with pre-defined data from the mouse.
These tests showed that the JB12 solution can achieve an average valid USB
data report rate of about 10 ms without loss of any data from the transmitter
side. Refer to Figure 8-1.
8.2 Hardware Customization
8.2.1 Optical Mouse Transmitter
The step-up DC-to-DC converter (NCP1400ASN33T1) is for reference only,
customers can choose any regulator they prefer. The LEDs for the sensor and
ZLED can be connected to the regulator output or connected to the batteries
output. The advantage of connecting to the regulator output is that the system
can work in a lower voltage, but the drawback is higher current consumption.
The advantage of connecting to the batteries output is the lower power
consumption but the system will not work properly if battery voltage is below
2.5 V.
High Data Rate Wireless USB Optical Mouse Solution
MOTOROLA
Testing and Customization
For More Information On This Product,
Go to: www.freescale.com
DRM055
39
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Testing and Customization
SYNC
IN
ADDR
ENDP
CRC5
EOP
TIME STAMP
00000001
0x96
2
2
0x01
1.867 µs
00003.7135 0035
SYNC
DATA1
DATA
CRC16
EOP
TIME STAMP
00000001
0xD2
03 00 01 01 00
0xF3F5
1.867 µs
00003.7135 1627
SYNC
ACK
EOP
TIME STAMP
00000001
0x4B
1.867 µs
00003.7135 4947
SYNC
IN
ADDR
ENDP
CRC5
EOP
TIME STAMP
00000001
0x96
2
2
0x01
1.867 µs
00003.7198 7391
SYNC
DATA0
DATA
CRC16
EOP
TIME STAMP
00000001
0xC3
03 00 02 02 00
0xFCFA
1.867 µs
00003.7199 1499
SYNC
ACK
EOP
TIME STAMP
00000001
0x4B
1.867 µs
00003.7199 4803
SYNC
IN
ADDR
ENDP
CRC5
EOP
TIME STAMP
00000001
0x96
2
2
0x01
1.867 µs
00003.7262 7255
SYNC
DATA1
DATA
CRC16
EOP
TIME STAMP
00000001
0xD2
03 00 03 03 00
0xF6F0
1.867 µs
00003.7263 1355
SYNC
ACK
EOP
TIME STAMP
00000001
0x4B
1.867 µs
00003.7263 4627
SYNC
IN
ADDR
ENDP
CRC5
EOP
TIME STAMP
00000001
0x96
2
2
0x01
1.867 µs
00003.7326 7119
Figure 8-1. USB Report for JB12 to Host for the Test Setup
DRM055
40
High Data Rate Wireless USB Optical Mouse Solution
Testing and Customization
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
Freescale Semiconductor, Inc.
Testing and Customization
Hardware Customization
8.2.2 RF Circuitry
If the PCB loop antenna is changed in term of trace length or width, the
corresponding loop antenna inductance, L, would be different and the matching
network should be adjusted to maintain the maximum signal transfer condition.
RF
CIRCUITRY
LOOP
ANTENNA
RF
CIRCUITRY
LOOP
ANTENNA
C46
C14
Freescale Semiconductor, Inc...
C45
L1
Z1
L2
Z2
Z3
TRANSMITTER
Z4
RECEIVER
Figure 8-2. Loop Antenna Impedance
On the transmitter side, the value for matching component C can be easily
calculated by the following equation:
1
2πf = -----------LC
Where:
f = 27 MHz
L = Loop antenna inductance
Table 8-1. Tx Matching Examples
L1
C = C14
Smaller inductance
Case
200 nH
= 173 pF (~180 pF)
Original reference design
240 nH
= 145 pF (~150 pF)
Larger inductance
300 nH
= 116 pF (~120 pF)
On the receiver side, one of the simple methods to keep the matching condition
for different inductance values is to adjust the capacitance value C such that
the sum of L and C impedance [XL + (– XC)] at 27 MHz is equal to a
pre-matching impedance value (Z4 = 26.3 j).
1
Z4 = jωL + ---------- @ 26.3j
jωC
Table 8-2. Rx Matching Examples
Case
L2
C = C45 + C46
Smaller inductance
200 nH (34j)
765.5 pF (–7.7j) ~ (470 + 300) pF
Original reference design
236 nH (40j)
430 pF (–13.7j) = (330 + 100) pF
Larger inductance
300 nH (51j)
238.6 pF (–24.7j) ~ (200 + 39) pF
High Data Rate Wireless USB Optical Mouse Solution
MOTOROLA
Testing and Customization
For More Information On This Product,
Go to: www.freescale.com
DRM055
41
Freescale Semiconductor, Inc.
Testing and Customization
8.3 Firmware Customization
8.3.1 Mouse Transmitter
To customize the mouse transmitter:
•
Set compiler option to store the ID code in RAM or in FLASH
•
Set the timing parameters for power management
8.3.2 Receiver
Freescale Semiconductor, Inc...
To customize the receiver:
DRM055
42
•
Change vendor ID, product ID, and product revision number in the
device descriptor table in "KBD-MSE.H"
•
Change the report descriptor in "KBD-MSE.H" if necessary
High Data Rate Wireless USB Optical Mouse Solution
Testing and Customization
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
Freescale Semiconductor, Inc...
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
HOW TO REACH US:
USA/EUROPE/LOCATIONS NOT LISTED:
Motorola Literature Distribution
P.O. Box 5405
Denver, Colorado 80217
1-800-521-6274 or 480-768-2130
Freescale Semiconductor, Inc...
JAPAN:
Motorola Japan Ltd.
SPS, Technical Information Center
3-20-1, Minami-Azabu, Minato-ku
Tokyo 106-8573, Japan
81-3-3440-3569
ASIA/PACIFIC:
Motorola Semiconductors H.K. Ltd.
Silicon Harbour Centre
2 Dai King Street
Tai Po Industrial Estate
Tai Po, N.T., Hong Kong
852-26668334
HOME PAGE:
http://motorola.com/semiconductors
Information in this document is provided solely to enable system and software implementers to use Motorola products.
There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits or
integrated circuits based on the information in this document.
Motorola reserves the right to make changes without further notice to any products herein. Motorola makes no warranty,
representation or guarantee regarding the suitability of its products for any particular purpose, nor does Motorola assume
any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability,
including without limitation consequential or incidental damages. “Typical” parameters that may be provided in Motorola
data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. All
operating parameters, including “Typicals”, must be validated for each customer application by customer’s technical experts.
Motorola does not convey any license under its patent rights nor the rights of others. Motorola products are not designed,
intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications
intended to support or sustain life, or for any other application in which the failure of the Motorola product could create a
situation where personal injury or death may occur. Should Buyer purchase or use Motorola products for any such
unintended or unauthorized application, Buyer shall indemnify and hold Motorola and its officers, employees, subsidiaries,
affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising
out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even
if such claim alleges that Motorola was negligent regarding the design or manufacture of the part.
MOTOROLA and the Stylized M Logo are registered in the US Patent and Trademark Office. All other product or service
names are the property of their respective owners. Motorola, Inc. is an Equal Opportunity/Affirmative Action Employer.
© Motorola Inc. 2004
DRM055/D
Rev. 0
1/2004
For More Information On This Product,
Go to: www.freescale.com