Hi, Felix. I checked for shorts on all the SPI lines and !CS to GND. With the assembly unpowered, all are open. When checking to 3.3 V, MOSI and !CS are 10 kΩ to 3.3 V which I assume are pull-ups not to be concerned with.
I was trying this only with the blink.ino code loaded into the M0 (no initialization of SPI). So, with the accelerometer disconnected, I loaded the code I had been using with this accelerometer on an Arduino Pro Mini onto the Moteino M0. With the accelerometer still disconnected, the M0 runs and displays what I would expect on the serial monitor as shown in the attached (I assume the values for theta are from noise occasionally picked up on the open SPI lines). So the sketch is running.
However, when I unplug the M0 USB, connect the accelerometer board, and re-plug the USB, the M0 is no longer seen by the Arduino IDE (as happened with blink.ino).
Here is the beginning of my code to see if it is initializing the SPI port as you suggest:
/*
Test out LIS3DH digital XYZ accelerometer board from Sparkfun. Get
it running on Moteino M0 with output up serial monitor or RF link.
*/
#if defined (MOTEINO_M0) && defined(SERIAL_PORT_USBVIRTUAL)
#define Serial SERIAL_PORT_USBVIRTUAL // Required for Serial on Zero based boards
#endif
#include "SparkFunLIS3DH.h"
#include "SPI.h"
LIS3DH myIMU(SPI_MODE, 10); // constructed with parameters for SPI and cs pin number
#define RUN_CSV (0) // stream data for debug out USB in CSV format
#define CAL (1) // put SW in calibration mode
#define DEV1 (2) // send option 1 development data out USB port
#define DEV2 (3) // send option 2 development data out USB port
#define RUN_BIN (4) // stream data for debug out USB in binary format
unsigned long SerialBaudRate = 115200; // 4800 19200 57600 115200 230400 460800
#define RUN_MODE (RUN_CSV) // RUN_CSV, CAl, DEV1, DEV2 or RUN_BIN
// Calibration values (determined experimentally)
#define X_ACC_OS (363.0) // [count]
#define Y_ACC_OS (351.5) // [count]
#define X_ACC_GAIN (1.0/76.0) // [g/count]
#define Y_ACC_GAIN (1.0/75.0) // [g/count]
// Units
#define U_RAD (1.0)
#define U_REV (U_RAD*2.0*PI)
#define U_DEG (U_REV/360)
#define IU_REV (1.0/U_REV)
#define IU_DEG (1.0/U_DEG)
#define DELTA_THETA_THRESH (2.0*U_DEG) // Angle change required to update data printed (or outout over radio?)
float last_theta = 0.0; // for determing when to output next data point
String PrintStr;
unsigned int X_Acc_Raw_Max = 0;
unsigned int Y_Acc_Raw_Max = 0;
unsigned int X_Acc_Raw_Min = 1024;
unsigned int Y_Acc_Raw_Min = 1024;
unsigned int LoopCnt = 0;
unsigned long StrtTime_ms = 0;
unsigned long DeltaT_ms;
void setup()
{
Serial.begin(SerialBaudRate);
while (!Serial); // wait for serial port to connect. Needed for native USB port only
Serial.println("Serial port has connected.");
myIMU.settings.adcEnabled = 0;
myIMU.settings.tempEnabled = 0;
myIMU.settings.accelSampleRate = 5000; // [Hz], Can be: 0,1,10,25,50,100,200,400,1600,5000 Hz
myIMU.settings.accelRange = 2; // [g], Max acceleration readable. Can be: 2, 4, 8, 16 g
myIMU.settings.xAccelEnabled = 1;
myIMU.settings.yAccelEnabled = 1;
myIMU.settings.zAccelEnabled = 0;
//Call .begin() to configure the IMU
Serial.print("myIMU.begin() returned: ");
Serial.println(myIMU.begin()); // configure IMU and print status returned
Serial.print("Delta theta threahold: ");
Serial.println(DELTA_THETA_THRESH);
}
void loop() {
//float X_Acc_Raw, Y_Acc_Raw; // [g]
int16_t Raw_X, Raw_Y; // [count],
float X, Y; // [g], floating point accelerometer readings
float theta; // [rad], calculated angle
unsigned long Time_ms = millis();
StrtTime_ms = millis();
X = myIMU.readFloatAccelX();
Y = myIMU.readFloatAccelY();
Raw_X = myIMU.readRawAccelX();
Raw_Y = myIMU.readRawAccelY();
DeltaT_ms = millis() - StrtTime_ms;
[snip]
Aren't these lines what is needed to initialize SPI? First this in the global section:
#if defined (MOTEINO_M0) && defined(SERIAL_PORT_USBVIRTUAL)
#define Serial SERIAL_PORT_USBVIRTUAL // Required for Serial on Zero based boards
#endif
#include "SparkFunLIS3DH.h"
#include "SPI.h"
LIS3DH myIMU(SPI_MODE, 10);
and then this in setup():
Serial.println(myIMU.begin()); // configure IMU and print status returned
It seems this code is never even being run.
To ensure my accelerometer board is still working, I took it back over to the Arduino Pro Mini and it runs fine there using the above code.