3
Firmware Configurable GPIO
The reference firmware is configured to use the GPIO
pins as shown on the schematic in Appendix A. However,
it may be more optimal to use a different I/O configura-
tion to meet the mechanical constraints of a specific PCB
design. The reference firmware is designed to be easily
configured to another set of pin connections. This is ac-
complished through changes in the I/O definitions at the
beginning of the SPCP826A_A60x0_FS.asm listing. The
following statements are the pin definitions as they exist
today. The firmware will use these definitions to read and
configure the GPIO pins, without any other modifications.
Communications between the Sunplus SPCP826A and the
ADNS-6090 is through the integrated SPI interface. The
serial port cannot be activated while the chip is in pow-
er-down mode (NPD LOW) or reset (RESET HIGH). When
the SPI is enabled through PB0 (NCS), the PB2 (SCLK), PB1
(MISO) and PB3 (MOSI) GPIO pins serve special functions
to enable the SPI interface to talk with external hardware.
During normal operation, the Sunplus SPCP826A SPI is
always configured as a Master to output the serial clock
on PB7. Therefore, the USB microcontroller always initiates
communication. Data sent by the ADNS-6090 optical
sensor is received on the PB1 (MISO), and data is shifted
out to the ADNS-6090 through the PB3 (MOSI). Please see
the schematic in Appendix A.
When writing to the ADNS-6090, the microcontroller drives
both the SCLK and the MOSI lines. When reading from the
ADNS-6090, the microcontroller drives both the SCLK and
MOSI lines initially. After t
SRAD
delay, the ADNS-6090 will
drive the data via MISO. The microcontroller is only driving
the SCLK line. It outputs SCLK for the serial interface.
Mouse Optics
Z-wheel motion is detected using the traditional method
by decoding the quadrature signal generated by the
optics sensor. Two phototransistors are connected in a
source-follower configuration. The 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
designed to block the infrared light such that the photo-
transistors are turned on and off in a quadrature output
pattern. Every change in the phototransistor outputs
represents a count of mouse movement. Comparing the
last state of the optics to the current state derives direction
information.
As shown in Figure 2 traveling along the quadrature signal
to the right produces a unique set of state transitions, and
traveling to the left produces another set of unique state
transitions. In this reference design, only the motion at the
Z-wheel is detected using this method.
Figure 2. Optics Quadrature Signal Generation