How to read accelerometer data via SPI

Hi, I have a Seeed Studio xiao nrf52840 sense board (with lsm6ds3 imu) and want to read the IMU data via SPI. I2C woks fine but but cannot get SPI to work and can not find any examples either. Using the Seed Arduino LSM6DS library with Arduino ide. Could somebody help with some examples or a piece of code? Thx.

ummm… you talking about the built in sensor?.. its only wired one way…

Yes, the sensor is built-in. Do you mean, with It is wired one way, that only I2C can be used?
According to the lsm6ds3 datasheet both i2c and spi goes to the same pins: The serial interfaces are mapped onto the same pins. ST_LSM6DS3TR_Datasheet.pdf, side 38.

i am not an expert, but i think the chip can only be wired one or the other way and there is no way to switch between the two modes in software, but lets say if you had an external module, you could wire it up a different way… if you find out otherwise please let us know

Hi there,
NO… It’s connected internally Get a BLE XIAO and add an external IMU breakout if you need that.
I smell a speed issue? is that why? Are you using it correctly? It does support a fifo and DMA and that used properly with interrupts significantly increases the throughput exchange of data, btw.
GL :slight_smile: PJ

1 Like

Hi buri,
Check the schematic diagram.
All signals required to configure SPI are not wired.

1 Like

Hi, yes, I had speed issue. I already using FIFO but still needed more speed. I solved that with increasing the clock speed for I2C. Just added to the beginCore() in the lib:


I2C_CLOCK_SPEED is set to 400000 and it works fine.

Thank you for trying to help me :slight_smile: