ADXL374 SPI Connection does not work as suspected

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
jodu
 
Posts: 9
Joined: Mon Mar 13, 2023 10:05 am

ADXL374 SPI Connection does not work as suspected

Post by jodu »

Hello,
I want to connect an ADXL374 sensor to an Arduino via SPI. But there are connection problems. The sensor works via I2C and I also tried with another ADXL374 and that also does not work. There is a problem with the item "Failed to find ADXL375 chip" in the code below.
I also use a LSM6DSOX in SetUp which works fine via SPI.

Here is the code I am using:

Code: Select all

#include <Adafruit_Sensor.h>
#include <Adafruit_LSM6DSOX.h>
#include <Adafruit_ADXL375.h>
#include <SPI.h>

#define LSM_CS 0 //cs
#define LSM_SCK 32 //SCL
#define LSM_MISO 33 //DO
#define LSM_MOSI 26 //SDA

Adafruit_LSM6DSOX lsm1;
Adafruit_ADXL375 adxl = Adafruit_ADXL375(LSM_SCK, LSM_MISO, LSM_MOSI, LSM_CS);

void setup() {
  delay(1000);
  Serial.begin(115200);//115200
  while (!Serial)
    delay(10);
  Serial.println("Start!");

  
  if(!adxl.begin()) {
    /* There was a problem detecting the ADXL375 ... check your connections */
    Serial.println("Failed to find ADXL375 chip");
    while(1);
  }

  if (!lsm1.begin_SPI(LSM_CS, LSM_SCK, LSM_MISO, LSM_MOSI)) {
    Serial.println("Failed to find LSM6DSOX chip");
    while (1) {
      delay(10); }
  }
}

void loop() {
  sensors_event_t accel, gyro, temp;
  lsm1.getEvent(&accel, &gyro, &temp);

  sensors_event_t accel1;
  adxl.getEvent(&accel1);
}
Can you help me to solve the problem?

Thanks a lot

User avatar
jodu
 
Posts: 9
Joined: Mon Mar 13, 2023 10:05 am

Re: ADXL374 SPI Connection does not work as suspected

Post by jodu »

Of course I mean the ADXL375 +-200g sensor and not ADXL374

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: ADXL374 SPI Connection does not work as suspected

Post by adafruit_support_carter »

SPI pin connections are here for reference:
https://learn.adafruit.com/adafruit-adx ... ns-3110504

Please post a photo of your setup showing how everything is connected.

User avatar
jodu
 
Posts: 9
Joined: Mon Mar 13, 2023 10:05 am

Re: ADXL374 SPI Connection does not work as suspected

Post by jodu »

Hallo Carter,
here is my setup. But only with the ADXL375.
But that shouldn't be a problem, as I used the exact same setup for the LSM6DSOX and it works.
IMG_7619 2.jpg
IMG_7619 2.jpg (183.27 KiB) Viewed 218 times
IMG_7617 2.jpg
IMG_7617 2.jpg (149.92 KiB) Viewed 218 times

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: ADXL374 SPI Connection does not work as suspected

Post by adafruit_support_carter »

Try connecting power to Vin:
https://learn.adafruit.com/adafruit-adx ... ns-3110500

You are applying power to an output pin.

User avatar
jodu
 
Posts: 9
Joined: Mon Mar 13, 2023 10:05 am

Re: ADXL374 SPI Connection does not work as suspected

Post by jodu »

Hello,
first of all, thank you, I have adapted the set-up.
However, the picture is the same, the LSM6DSOX works and the ADXL375 does not work with SPI.
Furthermore, the ADXL375 with I2C also worked under the old setup.

What else could be the problem?

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: ADXL374 SPI Connection does not work as suspected

Post by adafruit_support_bill »

Post a photo or two from about a 45 degree angle instead of straight down, so we can better see the shape of your solder joints. I see at least one that appears suspect.

User avatar
jodu
 
Posts: 9
Joined: Mon Mar 13, 2023 10:05 am

Re: ADXL374 SPI Connection does not work as suspected

Post by jodu »

Here are the photos of the solder joints.
I have also tried with another ADXL375.
IMG_7628.JPG
IMG_7628.JPG (158.58 KiB) Viewed 207 times
IMG_7623.JPG
IMG_7623.JPG (122.18 KiB) Viewed 207 times

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: ADXL374 SPI Connection does not work as suspected

Post by adafruit_support_bill »

The I2 pin does not appear to have wetted the solder pad surrounding the pin. The SDO and CS pins next to it also look suspect, although the pads are obscured by flux. The joints on the other side of the board all look OK.

The ideal joint will have a cross-section as in the diagram below. This guide has some tips on identifying and fixing common soldering issues. https://learn.adafruit.com/adafruit-gui ... n-problems

Image

User avatar
jodu
 
Posts: 9
Joined: Mon Mar 13, 2023 10:05 am

Re: ADXL374 SPI Connection does not work as suspected

Post by jodu »

I have now cleaned the pins and they look almost perfect to me. I don't think there is a problem with the connection. Otherwise I would have made the same mistake only when soldering the SDO and CS pin on both ADXL375. Because both run with I2C via the pins.

Is there perhaps a problem with the Liberty and its use?
IMG_7642.JPG
IMG_7642.JPG (71.18 KiB) Viewed 195 times

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: ADXL374 SPI Connection does not work as suspected

Post by adafruit_support_bill »

Those solder joints look good now.

I'm not familiar with the interface device you are using. But SPI is not quite as standardized as i2c. Motorola specifies four different clocking modes. And some other manufacturer's have their own variants as well.

User avatar
jodu
 
Posts: 9
Joined: Mon Mar 13, 2023 10:05 am

Re: ADXL374 SPI Connection does not work as suspected

Post by jodu »

Ok, I understand. However, it works with the LSM6DSOX sensor. Do you use different SPI standards for the LSM6DSOX and ADXL375 sensor?
Furthermore, I had already used a Feather m0 adalogger, which showed the same situation.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: ADXL374 SPI Connection does not work as suspected

Post by adafruit_support_bill »

The LSM6DS0X uses Mode 0 and the ADXL375 uses Mode 3. It looks like you are using the software SPI "bit-bang" implementation, so the clock phase and polarity are under complete control of the library.

Have you tried the hardware SPI option?

User avatar
jodu
 
Posts: 9
Joined: Mon Mar 13, 2023 10:05 am

Re: ADXL374 SPI Connection does not work as suspected

Post by jodu »

No, I haven't yet. But how can I put the Mosi, Miso, SCK on the desired pins at hardware SPI?

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: ADXL374 SPI Connection does not work as suspected

Post by adafruit_support_bill »

That depends on the processor you are using. Most boards have a default hardware SPI configuration. Some processors such as the ARM-based processors can be reconfigured to create hardware SPI ports on some subset of their GPIO pins.
https://learn.adafruit.com/using-atsamd ... -a-new-spi

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”