
AT89RFD-11: USB Mouse with Flash
Memory Reference Design
..............................................................................................
User Guide

AT89RFD-11 User Guide 1
7648A–USB–06/06
Section 1
Introduction...........................................................................................1-1
1.1 Features....................................................................................................1-1
1.2 Introduction ...............................................................................................1-1
1.3 Key Reference Design Objectives ............................................................1-2
Section 2
Reference Design Overview.................................................................2-3
Section 3
Theory of Operation..............................................................................3-5
3.1 Mouse Buttons..........................................................................................3-5
3.2 Z-Wheel ....................................................................................................3-5
3.4 Sensor interface........................................................................................3-7
3.5 USB...........................................................................................................3-8
Section 4
Firmware Architecture.........................................................................4-15
Section 5
Schematic & BOM ..............................................................................5-17

AT89RFD-11 User Guide -1
7648A–USB–06/06
Section 1
Introduction
1.1 Features • One MCU = 2 devices (mouse and mass storage controllers) and one USB hub
• No hub required
• USB 2.0 Full Speed compliance
• 1 ms minimum Polling Interval
• Low Power bus-powered device
• Supported by all Microsoft O/S from Windows® 2000 and later
• 256 MB Nand Flash memory supported (driver support s me morie s up to 1G B)
• High speed motion detection up to 20 ips (inches per second) and 8 G
• Up to 800 CPI resolution
• No mechanical moving parts
• ISP (In System Programming) to upgrade the firmware
• 2K E2PROM to store parameters
• Project sources availble with royalty free licence agreement
1.2 Introduction This design guides describes the desig n of a composite device (mouse & mass storage
device) using the AT89C5131A Atmel microcontroller and the Avago ADNS-3030 optical sensor. The firmware implementation section describes the firmware architecture to
implement a composite device with the mouse and the memor y functions. The Appen dix
contains the hardware implementation and the BOM of this reference design.

-2 AT89RFD-11 User Guide
7648A–USB–06/06
A familiarity with the AT89C5131A-M microcontroller (datasheet available on atmel web
site www.atmel.com), the ADNS 3030 sensor (datasheet available on avago web site
www.avagotech.com) and the USB specification (http://www.usb.org) is assumed.
1.3 Key Reference
Design
Objectives
1. Offer a complete solution based on a full speed mouse with a mass storage
capability.
2. Highlight the AT89C5131A benifits to manage two devices simultaneously.
3. Highlight the low power benifit of the ADNS 3030.
4. Flash based development platform to facilitate customization and firmware
upgrade.
+ =

AT89RFD-11 User Guide -3
7648A–USB–06/06
Section 2
Reference Design Overview
The reference design offers a full speed mouse with a mass storage capability to allow
the user to save and exchange files using his mouse. This solution is based on a double
enumeration (composite device) process to allow the management of both devices with
one microcontroller the AT89C5131A-M. The mouse is based on the ADNS-3030 Avago
sensor to collect the X, Y motion value. An optical quadratur e encoder provides th e Zwheel movement. Each of the button switches is pulled up normally and provide s a
Ground when depressed.
Figure 2-1. .Reference Design Overview
AT89C5131A-M
ATMEL
microcontroller
AVAG O
ADN S-3030
Optical Mouse
Sensor
MOSI
MISO
SCLK
STDW
NCS
Z Optics
Wheel
Quad ratu re
signals
Left Butto n
Middle Button
Right Button
Nand Flash
Memory
I/Os
Control
&
command
MOTION

AT89RFD-11 User Guide -5
7648A–USB–06/06
Section 3
Theory of Operation
3.1 Navigation
Technology
The heart of the optical navigation sensor is a CMOS image array. An LED and an optical system illuminate the surface that the sensor is navigating on. The texture of the
surface casts bright and dark spots formin g distinct images as the sensor is move d
across the surface. A Digital Signal Processing (DSP) engine and its built-in algorithm
evaluate these images and determine the magnitude and direction of the movement.
The motion data is made available in the delta_X and delta_Y registers for the system
controller to retrieve. An extensive power saving topology is implemented within the
ADNS-3030 navigation engine. A Motion pin (output) is available to act as the system
interrupt. As long as there is no motion the system can remain in Sleep mode allowing
maximum battery power saving. Based on the last detected motion the optical navigation engine enters various power saving modes when no new motion occurs. These
power saving features are particularly beneficial for wireless.
Figure 3-1.

-6 AT89RFD-11 User Guide
7648A–USB–06/06
3.2 Sensor This reference design features the ADNS-3030 optical navigation engine. It contains an
Image Acquisition System (IAS), a Digital Signal Processor (DSP), and a three-wire
Serial Peripheral Interface consists of the serial clock (SCLK), the master-in/slave-out
(MISO) and the master-out/slave-in (MOSI). In addition two signals, Motion, is an output
intended to act as an interrupt to the microcontroller whenever the ADNS-3030 senses
motion, and SHTDWN, is an input pin to set the sensor in shutdown mo de. When the
mouse is moved the ADNS-3030 alerts the system controller by activating the Motion
signal. At the same time the ADNS-3030 accumulates the horizontal and vertical displacements (count per inch, or cpi) in its Delta_X and Delta_Y registers respectively.
The ADNS-3030 deactivates the Motion signal as soon as movement stops. The mouse
motion can be also detected by checking if the MOT bit (bit 7 in Motion register) is set.
The SmartSpeed technology automatically optimizes the frame rate by examining the
acquired images of the surface. It also manages the integrated LED driver to coordinate
with the shutter. The system controller reads the motion information and reports it to the
PC to update the cursor position. The advantages of using ADNS-3030 optical sensor
are the efficient power management, high tracking accuracy, and efficient communications with the optical sensor via the full duplex SPI port. To learn more about sensor’s
technical information, please visit the Avago web site at http://www.avagotech.com
Figure 3-2. Sensor interface
3.3 Mouse Buttons Mouse buttons are connected as standard switches. These switches are pulled up by
the pull up resistors inside the m icrocontroller. Wh en the user depr esses a button, the
switch will be closed and the pin will be pulled LOW to GND. A LOW state at the pin is
interpreted as the button being depressed. A HIGH state is interpreted as the button has
been released or the button is not being depressed. In this reference design there are
three switches: left, Z-wheel (middle), and right.
AT89C5131A-M
ATMEL
microcontroller
AVAGO
ADNS-3030
Optical Mouse
Sensor
MOSI
MISO
SCLK
STDW
NCS
MOTION

AT89RFD-11 User Guide -7
7648A–USB–06/06
Figure 3-3. Mouse Buttons
3.4 Z-Wheel The motion of Z-wheel is detected using the quadr ature signal ge nerate d by optical sen-
sors. Two phototransistors are connected in a source-follower configuration forming
Channel A and Channel B. An infrared LED shines, causing the phototransistors to turn
on. In between the phototransistors and LED is a pinwheel that turns on the mouse ball
rollers. The fan of this pinwheel is mechanically de sig ned to block th e infra red light su ch
that the phototransistors are turned on and off in a quadrature output pattern. Every
change in the phototransistor outputs represents a count of mouse movement. Co mparing the last state of the optics to the current state derives directional information. As
shown in the Figure below, rotating the wheel forward p roduces a unique set o f state
transitions, and rotating the wheel backward produces another set of unique state
transitions.
Figure 3-4. Optics Quadrature Signal Generation
Left Button
Middle Button
Right Button
AT89C5131A-M
P1_0
P1_2
P1_1