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.