cancel
Showing results for 
Search instead for 
Did you mean: 

Help Needed with LSM6DSOX + LIS3MDL Sensor Hub Mode Configuration (FIFO)

LHeit.1
Associate II

Hello Community!

I hope you are all doing well. I'm currently working on a project that involves interfacing an LSM6DSOX accelerometer and gyroscope with a LIS3MDL magnetometer. My goal is to set up the LSM6DSOX in Sensor Hub Mode to collect and store data from the LIS3MDL into the LSM6DSOX's FIFO. However, I'm encountering some difficulties in configuring these sensors to work together effectively.

Here's an overview of the problem:

  • Hardware Setup: I have connected the LIS3MDL is connected to the LSM6DSOX via Sensor Hub Mode and LIS3MDL's DRDY is connected to the LSM6DSOX's INT2 pin (see AN5272 p.64).

  • Development Environment: I'm using nRF Connect IDE for VSCode for my firmware development.

  • Individual Configurations: I've successfully configured each sensor individually, but I'm struggling to configure the LSM6DSOX in Sensor Hub Mode to collect and store data from the LIS3MDL into its FIFO.  It works for the Accelerometer and the Gyrometer Data, but no data from the LIS3MDL is stored in the FIFO. I believe my issue is mainly with the register settings and communication between the sensors.

  • Documentation Review: I've reviewed the datasheets and application notes for both the LSM6DSOX and the LIS3MDL, as well as the NRF5340 documentation, but I haven't been able to pinpoint what I'm missing.

I'm seeking guidance and expertise from the community to help me understand the correct register settings and configurations for the LSM6DSOX in Sensor Hub Mode, specifically within the nRF Connect IDE for VSCode environment. Any insights into how to set up the LSM6DSOX to collect data from the LIS3MDL and store it in its FIFO would be greatly appreciated.

Current Configuration:

If it helps, here's a summary of my current configuration settings for the LSM6DSOX and the LIS3MDL:

  • LSM6DSOX
    • CTRL1_XL: 0xA4     (10100100)
    • CTRL2_G: 0xAC      (10101100)
    • FIFO_CTRL1: 0x0A (00001010)
    • FIFO_CTRL2: 0x00 (00000000)
    • FIFO_CTRL3: 0x33 (00110011)
    • FIFO_CTRL4: 0x06 (00000110)
    • SLV0_ADD: 0x08 (00001000)
    • SLV0_CONFIG: 0x08 (00001000)
    • MASTER_CONFIG: 0x14 (00010100)
    • CTRL6_C: 0x08 (00001000)
  • LIS3MDL:
    • CTRL_REG1: 0x02 (00000010)
    • CTRL_REG2: 0x60 (01100000)
    • CTRL_REG3: 0x00 (00000000)

I'm using nRF Connect IDE for VSCode for programming the NRF5340 and sensor communication.

 

Thank you in advance for your help and support. Please feel free to ask if you need more details about my current setup or if you have any questions regarding my configuration.

Looking forward to your responses!

Best regards,

5 REPLIES 5
Federica Bossi
ST Employee

Hi @LHeit.1 ,

Please, take a look at this example on GitHub. It uses LIS2MDL but the idea is very similar, check if at code level is all correct so that we can exclude a FW problem.

Let me know if you solve, otherwise we will check the hardware.

If this helps you, please mark my answer as "Best Answer" by clicking on the "Accept as Solution" button, this can be helpful for Community users to find this solution faster.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
LHeit.1
Associate II

@Federica Bossi Thank you for your assistance; it was incredibly helpful. I've made some adjustments to the driver you provided, allowing me to successfully retrieve data from the LIS3MDL sensor via the FIFO. Additionally, I've achieved the capability to read the Sensor Hub data upon an external trigger from the DRDY signal of the LIS3MDL. However, I have a follow-up question: Is it feasible to synchronize the FIFO batch ODR of both the LIS3MDL and LSM6DSOX for data rates exceeding 104Hz?

Hi @LHeit.1 ,

By setting the START_CONFIG bit of the MASTER_CONFIG register to 0, the FIFO should be triggered by the drdy of the accelerometer/gyroscope, so the data should be synchronized.

If it is not what you are looking for, consider this: the 2 sensors have different ODRs, so it is not possible to have a perfect synchronization between the data.

One workaround would be to keep the magnetometer at a higher ODR, and calculate how much data you should discard in post processing.

The idea is that if you have one ODR that is 1.5 times the other, you discard one sample every three.

If my reply answered your question, please click on Accept as Solution at the bottom of this post. This will help other users with the same issue to find the answer faster :)

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hi @Federica Bossi,

thank you again for your answer.

What if I set DRDY of the Accelerometer or the Gyroscope  at INT1 and then redirect the INT1 signal to INT 2, with the external INT2 Trigger for the sensor hub (START_CONFIG bit of the MASTER_CONFIG register to 1)? Or is this not recommended?

Hi @LHeit.1 ,

You can but you will lose the synchronization.

Another method is to put everything in the FIFO, read also the timestamps and reconstruct the right temporization afterwards.

If my reply answered your question, please click on Accept as Solution at the bottom of this post. This will help other users with the same issue to find the answer faster

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.