cancel
Showing results for 
Search instead for 
Did you mean: 

LSM6DSL sensor hub with LIS2MDL

priven
Associate II
Posted on January 16, 2018 at 09:17

Hello,

I'm using LSM6DSL in sensor hub mode with LIS2MDL, using the example in IKS01A2 I have managed to activate the LIS2MDL and read data from it.

My current issue is that I can't put the LIS2MDL in low power mode, I tried using 'LSM6DSL_ACC_GYRO_SH0_WriteByte' function but it get stuck in the while loop waiting for 'LSM6DSL_ACC_GYRO_SENS_HUB_END_OP_COMPLETED'

Can you please assist?

Thank you,

Michael

6 REPLIES 6
Miroslav BATEK
ST Employee
Posted on January 17, 2018 at 15:46

Do you think you can share the whole project?

Legacy member
Not applicable
Posted on January 17, 2018 at 16:08

My guess is that there is not a correct I2C connection between the master and slave devices and the function hangs, because it doesn't get an ACK from the slave sensor.

Are you sure that the devices are properly connected, with pull-ups to Vcc? Do you have a possibility to check the logic levels of the I2C communication (using a logic analyzer)? Schematics of your HW could also help with a diagnose.

Also, check whether you use the correct I2C addresses of the sensors.

Posted on January 17, 2018 at 16:13

Koudela.David

‌ I don't think so, because Michael wrote '

I have managed to activate the LIS2MDL and read data from it' so he is able to read data from the magnetometer using LSM6DSL as sensor hub. I don't expect any issue with I2C address or connection. But this feature is quite complex and some operations can be tricky.

Posted on January 17, 2018 at 19:21

Hi,

Unfortunately I can't share the project, but I have use the sensor hub example from 

IKS01A2 SDK without any changes, and for the LIS2MDL idle command i use - 'LSM6DSL_ACC_GYRO_SH0_WriteByte(LSM6DSL_X_0_handle, LIS2MDL_MAG_I2C_ADDRESS, LIS2MDL_MAG_CFG_REG_A, LIS2MDL_MD_IDLE) != MEMS_SUCCESS'

Posted on January 17, 2018 at 19:26

Thank you for replay David,

The sensor hub function is  working for data reading from the LIS2MDL, the issue is when I try to power down the LIS2MDL the command is stuck waiting for the sensor hub register.

I also tried idle 1, idle 2 and single mode of the LIS2MDL but I got same result. I also see that the current consumption doesn't drop down after the idle command.

The circuit is very small and I cant use logic diagnose.

Maybe I need to do more operations before I switch to idle mode

priven
Associate II
Posted on January 18, 2018 at 10:24

Update:

I can enter the LIS2MDL to idle mode, but now I cant restart it