I am working on a project, trying to connect several LSM6DSOX with Arduino Due. For convenience I used the SPI mode. But I had some problem here: there was no problem with only one LSM6DSOX communicating with Arduino, but there would be problem when two LSM6DSOX connected.
For wiring: I used the SPI-header of the Arduino to connect sensors (SDA, SCL, DO). For CS pins I choose the digital Pin of Arduino.
For coding: I used mainly the example code provided from adafruit. https://learn.adafruit.com/lsm6dsox-and ... mu/arduino
But I did some change as below. (Because the problem occurs here, so I didn't post the code after that)
Code: Select all
for (int i = 0; i++; i < 2){ //For only one sensor, change the number to one
if (!sox[i].begin_SPI(LSM_CS[i], LSM_SCK, LSM_MISO, LSM_MOSI)) {
Serial.print("Failed to find LSM6DSOX chip: ");
Serial.println(i);
while (1) {
delay(10);
}
}
}
I thought it may because of the interference of the second sensor. I tried to set the CS pin of the second one to high at very beginning, but the problem is not solved. Hoping if someone can help me with it. Thanks in advance.