LSM6DS3 in SPI mode

I’m using sparkfun’s LSM6DS3 breakout board along with a Microchip pic in SPI mode. I’m able to communicate with the module where I send it the WHO_AM_I (0x8F) and receive the expected 0x69.

I have the module mounted to a stepper motor and am trying to detect motion. After I turn the stepper roughly 20 degrees I’m getting 0x00 when I read the 3 axis gyro registers:

OUTX_H_G

OUTX_L_G

OUTY_H_G

OUTY_L_G

OUTZ_H_G

OUTZ_L_G

I have looked at example code but am not finding what I’m doing wrong. Does the module need to be enabled first?

Thanks

I thought I’d get at least one reply from someone who’s used this module and could verify a setup sequence. A bit disappointing…

Hello,

Sorry for the delay. I would suggest looking at the following SPI example that can be found in the GitHub Repo:

https://github.com/sparkfun/SparkFun_LS … ltiSPI.ino

Please help me understand this module. I have the LSM6DS3 mounted to a stepper motor where the y-axis is parallel with the stepper motor shaft.

If I send a signal and turn the stepper motor 20 degrees can I read from the giro registers a value that would be proportional to the 20 degrees?

Before you read from the registers, did you see any data from the example sketch I sent you earlier?

I’m in the process. I have to track down the headers and source code files and port them to my Microchip pic. I thought I’d ask my previous question before starting that. This will take me a bit.

No worries, we can’t give guarantees on software that we didn’t write. So using the example sketches help us better diagnose where the problem is most likely at. As far as I can tell right now, your assumption about the basic functionality should be correct.

I went through your code and compared it to what I’m doing. Basically you are reading x, y, z gyro output register locations 0x22, 0x24 and 0x26.

I am only reading 0x00s but I suspect it is how I’m doing it with not being sure exactly how the gyro module works. Here is my process:

  1. I have the gyro module mounted to the shaft of a stepper motor with the y-axis parallel to the stepper motor shaft.

  2. I read the OUTX_L_G (0x22), OUTY_L_G (0x24) and OUTZ_L_G (0x26) before any motion and verified they read 0x00.

  3. I turn the stepper motor 20 degrees

  4. I read the OUTX_L_G (0x22), OUTY_L_G (0x24) and OUTZ_L_G (0x26) and they still read 0x00s

Is this because I’m reading after the motion has occurred? Should I setup the fifo to read from there and have motion data go there?

Does the OUTX_L_G (0X22) keep track of what angle the module is in? Because if this outputs the g-force acting on the module I’m not sure how I can send a clock to the stepper and read 0x22 simultaneously.

Here is my design using a Microchip Pic to communicate via SPI (see attached schematic)

I have used 2 different LSM6DS3 modules. Both return 0x69 for the WHO_AM_I command but both give temps of 0x4D08 or around there and not consistent. (please see attached signal analyzer plot).

I tried to upload the schematic as a jpeg but the file is not uploading.

Can this be done?

There is currently a small bug when trying to upload attachments and pictures. I would suggest hosting somewhere else and linking to it with services like Google Drive, Imgur, etc. I apologize for the inconvenience.

This is the link to my schematic:

https://drive.google.com/file/d/1XvByCr … sp=sharing

This is the link to the signal analyzer plot of the spi communication:

https://drive.google.com/file/d/19kus1F … sp=sharing

I would appreciate any suggestions as to why I don’t get the correct temp which might help me figure out why I’m not detecting motion.

I’m unable to draw any conclusions about what needs to be changed. This appears to be code related though. Hopefully a community member might be able to provide some insight.

Here are links to my spi signals for WHO_AM_I and TEMP communication signals:

https://drive.google.com/file/d/1PfY3ct … sp=sharing

https://drive.google.com/file/d/1FzNuS5 … sp=sharing

I can post my c code but it’s to a microchip pic and mostly register manipulation so it may not mean much.

When I read WHO_AM_I I get the correct response but does my reading the temp high and low registers make any sense? Is there an error in the spi communication signals?

Has anyone successfully used this LSM6DS3 module in SPI mode?

I have looked at the SPI example code in the github repo. I have provided SPI logic analyzer signal plots of the simple get temp communication I’m doing.

I have asked if anyone has actually verified that they have de-soldered the SPI short, put the module in SPI mode and verified that these modules do work in SPI mode.

I see a lot of views but no responses. Is this a module that nobody uses in SPI mode? Does anyone have actual logic analyzer signal traces in SPI mode that show this module can run in SPI mode?

At the risk of sounding crass can someone at least tell me to give up on SPI mode?

Respectfully…

So am I to understand that the people at SparkFun have not operated this module in SPI mode successfully?