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

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

Cookies are required to use this site. You must accept them to continue using the site. Learn more…