Hi. Iv used arduino a long time now and i absolutely love it. Made alot of projects but never got real deep into communication protocols and now im trying to interface with ADNS-7550 chip.
i tried reading the datasheet and the reference on this page
But i only get confused :S
if i could get some pointers on how setup and use the correct spi commands to send and receive i would be veary grateful
i havnt used spi alot myselfe, but if i just could get all the values right in the library one time and maybe send a command and receive a command i think i can get the rest by trial and failure
i just blew 1 arduino mega on this and i rather not destroy one more :S
Iv read it and i stil dont understand, i have no experience with spi and how to make read or write. like in the datasheet it says "Write 0x5a to register 0x3a" i havnt got a clue, im sorry
#include "SPI.h"#
int ss = 53;
void setup() {
 Serial.begin(115200);
 pinMode(ss, OUTPUT);
 SPI.begin();
 SPI.setBitOrder(MSBFIRST);
 digitalWrite(ss,HIGH);
 delayMicroseconds(10);
 digitalWrite(ss,LOW);
 delayMicroseconds(10);
 spiWrite(0x5a,0x3a);
 delayMicroseconds(10);
 digitalWrite(ss,HIGH);
 delayMicroseconds(10);
 digitalWrite(ss,LOW);
 spiWrite(0x5a,0x3a);
 int a = SPI.transfer(0x02);
 a = SPI.transfer(0x03);
 a = SPI.transfer(0x04);
 a = SPI.transfer(0x05);
 delayMicroseconds(10);
 spiWrite(0x27,0x3c);
 spiWrite(0x0a,0x22);
 spiWrite(0x01,0x21);
 spiWrite(0x32,0x3c);
 spiWrite(0x20,0x23);
 spiWrite(0x05,0x3c);
 spiWrite(0xb9,0x37);
 delay(1000);
 a = SPI.transfer(0x03);
 Serial.println(a);
 delay(50);
 a = SPI.transfer(0x03);
 Serial.println(a);
 a = SPI.transfer(0x03);
 Serial.println(a);
 a = SPI.transfer(0x03);
 Serial.println(a);
 a = SPI.transfer(0x03);
 Serial.println(a);
Â
Â
Â
Â
Â
}
void loop() {
}
int spiWrite(int address, int value) {
 // take the SS pin low to select the chip:
 digitalWrite(ss,LOW);
 // send in the address and value via SPI:
 SPI.transfer(address);
 SPI.transfer(value);
 // take the SS pin high to de-select the chip:
 digitalWrite(ss,HIGH);
 delayMicroseconds(10);
}