Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Interfacing ADNS 3090 to dsPIC33FJMC802

Status
Not open for further replies.

swetha84

Newbie level 2
Joined
Jan 4, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,296
Hi,


I am new to PIC micro controller programming ,trying to interface ADNS 3090 optical mouse sensor with dsPIC33FJ64MC802.I want to implement SPI protocol to get the two dimensional X & Y values .Also I want to perform frame capture in burst mode.

In addition to this there is a srom file who i have to send The firmware file is an ASCII text file with each 2-character byte (hexadecimal representation) on a single line.The serial port is also used to load SROM
data into the ADNS-3090.

The lines which comprise the SPI port are:
SCLK: Clock input. It is always generated by the master
(the micro- controller).
MOSI: Input data (Master Out/Slave In).
MISO: Output data (Master In/Slave Out).
NCS: Chip select input (active low).

Any code / suggestions is highly appreciated.
 

I've been struggling with dsPIC33FJ128MC804 for some time so I think I can help. First of all: don't use inbuilt Microchip libraries for peripherals, they **** and have errors/bugs (at least the ones that come with C30).

If you have firmware for sensor as a text file and it fits into microcontroller program memory then you can simply put it there as an array. Such array which is stored in program memory you can declare as following

const __attribute__((space(auto_psv))) char FirmWare[]={__copy text here, mind the interpunction__};

Then you configure SPI port (frequency, clock polarity, etc) and configure physical pins as respective inputs/outputs and map them to spi peripheral using PPS. Remember about setting pins as digital if the ones you are using for spi can be multiplexed with analog peripherals.

Then you can issue chip select low, issue command for firmware write by copying as in datasheet
DATASHEET said:
This function is used to load the Avago Technologiessupplied
firmware file contents into the ADNS-3090. The
firmware file is an ASCII text file with each 2-character
byte (hexadecimal representation) on a single line.
This mode is activated by the following steps:
1. Perform hardware reset by toggling the RESET pin
2. Write 0x44 to register 0x20
3. Write 0x07 to register 0x23
4. Write 0x88 to register 0x24
5. Wait at least 1 frame period
6. Write 0x18 to register 0x14 (SROM_Enable register)
7. Begin burst mode write of data file to register 0x60
(SROM_Load register)

Then you can get some pointer like

unsigned int index=0;
unsigned int dummy=0;
char *ptr=FirmWare;
while(i<1986)
{
SPI1BUF=*ptr++;
While(!SPI1STATbits.SPIRBF);
dummy=SPI1BUF
i++;
}

At leas that's the outline, you may of course go for interrupt driven operation because SROM write is very slow in the sensor and MCU can do other things while not sending data.
 
I bought some ADNS-3090 chips! but I can not find the SROM file. Is it possible to e-mail it (zavata.afnan@gmail.com). I am glad hearing from you.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top