Hi all,
I'm trying to read the data from the ADIS16210 IMU to an Arduino Mega(2560). Connections are as follows:
CS (J1-3) - to digital pin 53 (SS)
SCLK (J1-2) - to digital pin 52 (SCK)
DOUT (J1-4) - to digital pin 50 (MISO)
DIN (J1-6) - to digital pin 51 (MOSI)
VCC (J1-12) - to 5V
GND (J1-9) - to GND
Edit: I forgot to mention that the IMU comes with the ADIS16ACL1/PCBZ breakout board if that's helpful information
Manual can be found here: ADIS16210 (Rev. E) (analog.com)
And my code so far is this:
#include<SPI.h>
#define SS 53
void setup (void)
{
Serial.begin(9600);
SPI.begin();
SPI.beginTransaction(SPISettings(830000,MSBFIRST,SPI_MODE3));
digitalWrite(SS,HIGH);
}
void loop(void)
{
byte r[2];
digitalWrite(SS, LOW);
SPI.transfer(0x04); //0x04 is XACCL_OUT
r[0] = SPI.transfer(0x00);
r[1] = SPI.transfer(0x00); //possibly redundant? Manual says that it returns 16bits and
// byte r; r=SPI.transfer(0x00); still returns 0
Serial.print(r[0]);
Serial.print(" ");
Serial.print(r[1]);
Serial.println(" ");
digitalWrite(SS, HIGH);
delay(500);
}
My issue is that the serial monitor will only display "0 0" each line no matter how I move it. I know I still need to convert the data, but shouldn't that value at least change when I move the IMU.
I'm very new to SPI connections. Any insight would be extremely helpful thank you.