Great job with the Teensy 3.0.
I'm trying now to integrate an ADIS16480 from Analog Devices with the Teensy 3.0 but no matter what I do, the IMU doesnt answer. I know it works because I can test it in another device and it works perfectly.
I have used some libraries (SDFAT and cmason), mix everything, etc. but still does not work.
Enclosed the teensySPI.c and .h. And my main():
int main(void) {
short count = 0;
char msg[64];
uint8_t buffOut[8];
uint8_t buffIn[8];
int value;
short i;
// Serial Init
serial_begin(9600);
serial_print("Hello World\n");
// SPI Init
pinMode (chipSelect, OUTPUT);
digitalWriteFast(chipSelect, HIGH);
SPIbegin();
SPIinit(SPI_CLOCK_DIV16);
SPIsetDataMode(SPI_MODE3);
// SPI comm
buffOut[0] = 0x80; buffOut[1] = 0x00;
buffOut[2] = 0x00; buffOut[3] = 0x00;
digitalWrite(chipSelect, LOW);
SPIsendMultiple(buffOut, 4);
digitalWrite(chipSelect, HIGH);
while (1) {
// SPI comm
digitalWrite(chipSelect, LOW);
delayMicroseconds(4);
buffOut[0] = 0x80; buffOut[1] = 0x00;
buffOut[2] = 0x00; buffOut[3] = 0x00;
SPIsendMultiple(buffOut, 4);
delayMicroseconds(4);
digitalWrite(chipSelect, HIGH);
delayMicroseconds(25);
digitalWrite(chipSelect, LOW);
delayMicroseconds(4);
buffOut[0] = 0x7E; buffOut[1] = 0x00;
buffOut[2] = 0x00; buffOut[3] = 0x00;
SPIsendMultiple(buffOut, 4);
delayMicroseconds(4);
digitalWrite(chipSelect, HIGH);
delayMicroseconds(25);
digitalWrite(chipSelect, LOW);
delayMicroseconds(4);
buffOut[0] = 0x22; buffOut[1] = 0x00;
buffOut[2] = 0x00; buffOut[3] = 0x00;
SPIsendMultiple(buffOut, 4);
delayMicroseconds(4);
digitalWrite(chipSelect, HIGH);
delayMicroseconds(25);
}
return 0;
}
The specs of the IMU is in this link (http://www.analog.com/static/imported-files/data_sheets/ADIS16480.pdf). The characteristics
- SPI Mode 3
- MSB-First Mode
- 16-bit mode
I have tried to change the configurations of the registers SPI0_MCR and SPI0_CTAR0/1. Without any success.
Has anyone already got an ADIS IMU working with a Teensy 3.0? Could anyone help?
Thanks in advance.
I'm trying now to integrate an ADIS16480 from Analog Devices with the Teensy 3.0 but no matter what I do, the IMU doesnt answer. I know it works because I can test it in another device and it works perfectly.
I have used some libraries (SDFAT and cmason), mix everything, etc. but still does not work.
Enclosed the teensySPI.c and .h. And my main():
int main(void) {
short count = 0;
char msg[64];
uint8_t buffOut[8];
uint8_t buffIn[8];
int value;
short i;
// Serial Init
serial_begin(9600);
serial_print("Hello World\n");
// SPI Init
pinMode (chipSelect, OUTPUT);
digitalWriteFast(chipSelect, HIGH);
SPIbegin();
SPIinit(SPI_CLOCK_DIV16);
SPIsetDataMode(SPI_MODE3);
// SPI comm
buffOut[0] = 0x80; buffOut[1] = 0x00;
buffOut[2] = 0x00; buffOut[3] = 0x00;
digitalWrite(chipSelect, LOW);
SPIsendMultiple(buffOut, 4);
digitalWrite(chipSelect, HIGH);
while (1) {
// SPI comm
digitalWrite(chipSelect, LOW);
delayMicroseconds(4);
buffOut[0] = 0x80; buffOut[1] = 0x00;
buffOut[2] = 0x00; buffOut[3] = 0x00;
SPIsendMultiple(buffOut, 4);
delayMicroseconds(4);
digitalWrite(chipSelect, HIGH);
delayMicroseconds(25);
digitalWrite(chipSelect, LOW);
delayMicroseconds(4);
buffOut[0] = 0x7E; buffOut[1] = 0x00;
buffOut[2] = 0x00; buffOut[3] = 0x00;
SPIsendMultiple(buffOut, 4);
delayMicroseconds(4);
digitalWrite(chipSelect, HIGH);
delayMicroseconds(25);
digitalWrite(chipSelect, LOW);
delayMicroseconds(4);
buffOut[0] = 0x22; buffOut[1] = 0x00;
buffOut[2] = 0x00; buffOut[3] = 0x00;
SPIsendMultiple(buffOut, 4);
delayMicroseconds(4);
digitalWrite(chipSelect, HIGH);
delayMicroseconds(25);
}
return 0;
}
The specs of the IMU is in this link (http://www.analog.com/static/imported-files/data_sheets/ADIS16480.pdf). The characteristics
- SPI Mode 3
- MSB-First Mode
- 16-bit mode
I have tried to change the configurations of the registers SPI0_MCR and SPI0_CTAR0/1. Without any success.
Has anyone already got an ADIS IMU working with a Teensy 3.0? Could anyone help?
Thanks in advance.