SPI communication issues between Boron and LIS3DH


I am having trouble getting readings from my Adafruit LIS3DH. I followed the tutorial done by @rickkas7 (GitHub - rickkas7/spi1-reconfiguration: Reconfiguring the pins for SPI1 on a Gen3 Particle device (Argon, Boron, Xenon)), but I am still having issues. I wired up the reconfiguration layout on my boron and ran the 6_SPI1 example in the LIS3DH library. When I run the code on the device I get the incorrect either no sample or -1, -1, -1. From the example I posted above the issue would be my SPI communication. Does anyone have any thoughts on how I could fix this issue?


Is there a reason you need to use SPI1, and more importantly reallocate the pins? You’ve added a lot of variables. At least initially, you should try using it on the standard SPI interface and work from there.

Also a picture and description of your wiring would be helpful.

The LIS3DH supports both SPI and I2C. Unless you are doing high-speed sampling by DMA, it’s almost always easier to use it in I2C mode since you only need SDA and SCL and it’s easier to share the I2C bus than the SPI bus.

Hi @rickkas7. Thank you for your help. I tried rewiring to I2C, but I am still getting no sample. I have attached images of my wiring to this reply. There is also a description below.

VIN to 3V3 - White
GND to GND - Green
SCL to D1 - Yellow
SDA to D0 - Red

What configuration for the LIS3DH library are you using? That should be using the default address of 0x18 with that wiring.

But the first thing to check when having I2C problems is to run I2C scanner firmware which will print out any devices that are connected along with their addresses.