LSM6DSO SPI Example Code

On the Git repository, there is no example code for SPI for the LSM6DSO IMU breakout board.

Can someone attach a very basic example code for the LSM6DSO SPI interface? I am completely new to all of this, but I also need this quite quickly if someone can do that.

https://github.com/sparkfun/SparkFun_Qw … no_Library

If this isn’t the correct spot to post this let me know.

Thanks,

Matt

Move the “//” at the beginning of the code from the SPI line to the “Wire” line to disable i2c and enable SPI

See the guide https://learn.sparkfun.com/tutorials/qw … e-overview for more

I am also struggling with this. How do you define the CS pin? There is a begin() function but also a beginSPI() function in the sparkfun library. I followed the guide for wiring and cutting the i2c address trace but I have had no success with an arduino micro. I struggled with this for several hours yesterday trying to get more samples per second. With i2c, I have only been able to read a little less than 1000 samples per second. I am hoping i2c is the bottleneck and switching to SPI will be faster. Example code will be really helpful. I think there is more to it than just changing from the wire library to the SPI library.

@TS-Russell, it seems there must be more to just cutting the jumper for 0x6B, and commenting out Wire. That’s why I think someone should submit the example code, because like another reply says, we have to set the CS pin and I dont see how we would implement that. Thanks for the help!

Apologies for the incomplete answer - there isn’t an SPI example (you could file an ‘issue’ here in hopes of one being made https://github.com/sparkfun/SparkFun_Qw … n/examples )

Another option in the meantime is to go through the similar examples for a different IMU, and basically use that to scaffold your own code

https://github.com/sparkfun/SparkFun_6D … _basic.ino aligns well with the LSM6 ‘basic readings’

https://github.com/sparkfun/SparkFun_6D … e4_spi.ino the changes used here will be VERY SIMILAR, noting the board modifications needed https://learn.sparkfun.com/tutorials/qw … e-assembly and matching the relevant pin #s