SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By randomvibe
#189544
I connected the LSM6DS3 breakout board to my 32-bit Arduino Due in I2C mode. The setup works, except for spurious tics that occasionally appear in the accel and gyro readings. One day the tics are there, other days they are not. I tried changing the LSM6DS3 bandwidth, output-data-rate, filtering, but I still get the tics. I tried a separate LSM6DS3, but no luck.

So I attempted SPI mode to see if this helps, but I can't get SPI to function. Has anyone tried the LSM6DS3 in SPI mode for the Arduino Due? Thanks.
By randomvibe
#189575
I made some progress with the SPI connection. The LSM6DS3 is communicating, but it keeps returning the value 255. Even the WHO_AM_I register (0X0F) returns 255. Does Sparkfun have any recommendations?

The small sketch below demonstrates the problem.
Code: Select all
#define SSX  4   

#include <SPI.h>

void setup() {

    uint8_t  result;
    uint8_t  address = 0X0F;

    Serial.begin(115200);
    
    pinMode(SSX, OUTPUT);
    digitalWrite(SSX, HIGH);

    SPI.begin(SSX);
    SPI.setBitOrder(MSBFIRST);
    SPI.setDataMode(SSX, SPI_MODE3);
    SPI.setClockDivider(SSX,10);        // Due: (pin,divider), divider value: from 1 to 255

    digitalWrite(SSX, LOW);             // Select chip
    result = SPI.transfer(SSX, address);    
    digitalWrite(SSX, HIGH);            // De-select chip

    Serial.println("Who Am I:");
    Serial.println(result);
}

void loop() {
}