AnsweredAssumed Answered

Troubleshooting ADIS16485/Arduino SPI Communication

Question asked by TallDave on May 4, 2013
Latest reply on Feb 17, 2014 by NevadaMark
Branched from an earlier discussion

Hello Jim, went with the Arduino, but thanks for the other information.

 

Hello Nevada Mark, trying to read PROD_ID but getting 0 from ADIS16485.

 

Based on ADIS16485 datasheet Rev A, Figure 27, pg 27 illustration of J1 connectors, I used jumper wires to make the following connections:

 

CS (J1-3) - to digital pin 10 (SS) (brown wire)

SCLK (J1-2) - to digital pin 13 (SCK) (orange wire)

DOUT (J1-4) - to digital pin 12 (MISO) (green wire)

DIN (J1-6) - to digital pin 11 (MOSI) (yellow wire)

VCC (J1-12) - to 3V3 (red wire)

GND (J1-9) - to GND (black wire)

 

The female connections to the PCB are a bit wider than I would like, but they seem to be well connected.

photo.JPG

Based on the documentation Pin 1 of the PCB is marked with a *, correct?

PCB_MarkedPin1.png

Does my wiring look like it could work?

 

Here are the 2 functions used to get the PROD_ID:

 

#define PROD_ID   0x7E // Product identification, adis16485 See Table 9

 

unsigned int adis16485::product_id(){

  // Read 16 bits from the PROD_ID register

  return read(16, PROD_ID);

}

 

unsigned int adis16485::read(unsigned char nbits, unsigned char reg){

  // initialize variables

  unsigned char upper, lower, mask;

 

  // Get upper and lower unsigned chars

  digitalWrite(CS, LOW);

  SPI.transfer(reg);

  SPI.transfer(0x00);

  digitalWrite(CS, HIGH);

  delay_cycle();

  digitalWrite(CS, LOW);

  upper = SPI.transfer(0x00);

  lower = SPI.transfer(0x00);

  digitalWrite(CS, HIGH);

 

  // calculate mask

  mask = 0xFF >> (16 - nbits);

 

  // Combine upper and lower, and return

  return ( ( upper & mask ) << 8 ) | ( lower );

}

 

PROD_ID is on Page 0 which should be the default.

 

Let me know what you think about all of this?

 

Thanks.

 

--TallDave

Outcomes