research
My mouse has an
optical sensor (pdf) which communicates with the
USB controller? over what a synchronous two wire interface. The circuit board leaves the quadriture outputs NC so the serial port is the only communication between the USB chip and the optical sensor.
typical use
optical sensor
since i need to emulate this sensor it is important to understand how it works.
overview
The output format is two channel
quadrature (X and Y direction)
which emulates encoder photo-
transistors. The current X and Y
information are also available in
registers accessed via a serial port
Write Operation
Write operations, where data is going from the micro-controller to the ADNS-2051, is always initiated by the micro-controller and consists of two bytes. The first byte contains the address (seven bits) and has a “1” as its MSB to indicate data direction. The second byte contains the data. The transfer is synchronized by SCLK. The micro-controller changes SDIO on falling edges of SCLK. The ADNS-2051 reads SDIO on rising edges of SCLK.
Read Operation
A read operation, which means that data is going from the ADNS-2051 to the microcontroller, is always initiated by the micro-controller and consists of two bytes. The first byte
contains the address, is written by the micro-controller, and has a "0" as its MSB to indicate data direction. The second byte contains the data and is driven by the ADNS-2051. The transfer is synchronized by SCLK. SDIO is changed on falling edges of SCLK and read on every rising edge of SCLK. The micro-controller must go to a high Z state after the last address data bit. The ADNS-2051 will go to the high Z state after the last data bit (see detail "B" in Figure 28). One other thing to note during a read operation is that SCLK will need to be delayed after the last address data bit to ensure that the ADNS-2051 has at least 100 µs to prepare the requested data. This is shown in the timing diagrams below.
Start up Sequence
The microprocessor then tries to read from location 0x00, Product_ID, and is expecting a value of 0x02. If it receives this value, it then knows that the communication to
the ADNS-2051 is operational.
Registers
see pg24 of
ADNS-2501 Datasheet.
| Address | Register |
| 0x00 | Product_ID |
| 0x01 | Revision_ID |
| 0x02 | Motion |
| 0x03 | Delta_X |
| 0x04 | Delta_Y |
| 0x05 | SQUAL |
| 0x06 | Average_Pixel |
| 0x07 | Maximum_Pixel |
| 0x08 | Reserved |
| 0x09 | Reserved |
| 0x0a | Configuration_bits |
| 0x0b | Reserved |
| 0x0c | Data_Out_Lower |
| 0x0d | Data_Out_Upper |
| 0x0e | Shutter_Lower |
| 0x0f | Shutter_Upper |
| 0x10 | Frame_Period_Lower |
| 0x11 | Frame_Period_Upper |
- pg38 - startup register values
--
ChristopherPepe - 26 Aug 2006