cancel
Showing results for 
Search instead for 
Did you mean: 

How to change steval-mki109v3 with lsm6dso unico into magnetometer mode

Sunny.Q
Associate II

I checked the video posted. And I can use most functions of the video said. While I can't find the way to change the mode into magnetometer. In video, it just directly changed to that mode and didn't mention the method.

1 REPLY 1
Eleon BORLINI
ST Employee

​Hi @Sunny.Q​ , are you referring to the possibility for the LSM6DSO to work as sensor hub for an external magnetometer such as LIS2MDL, right? Did you check the paragraph 7.4 of the AN5192 (Sensor hub mode example)? After having physically connected the two sensors, you have to follow this procedure:

Write 40h to CTRL1_XL // Turn on the accelerometer (for trigger signal) at 104 Hz
2. Perform one-shot read with
SLV0_ADD = 3Dh
SLV0_SUBADD = 4Fh
// Check LIS2MDL WHO_AM_I register
// LIS2MDL slave address is 3Ch and rw_0=1
// WHO_AM_I register address is 4Fh
3. Perform one-shot write with
SLV0_ADD = 3Ch
SLV0_SUBADD = 60h
DATAWRITE_SLV0 = 8Ch
// Write LIS2MDL register CFG_REG_A (60h) = 8Ch
// LIS2MDL slave address is 3Ch and rw_0=0
// Enable temperature compensation
// Enable magnetometer at 100 Hz ODR in continuous mode
4. Perform one-shot write with
SLV0_ADD = 3Ch
SLV0_SUBADD = 61h
DATAWRITE_SLV0 = 02h
// Write LIS2MDL register CFG_REG_B (61h) = 02h
// LIS2MDL slave address is 3Ch and rw_0=0
// Enable magnetometer offset-cancellation
5. Perform one-shot write with
SLV0_ADD = 3Ch
SLV0_SUBADD = 62h
DATAWRITE_SLV0 = 10h
// Write LIS2MDL register CFG_REG_B (62h) = 10h
// LIS2MDL slave address is 3Ch and rw_0=0
// Enable magnetometer BDU
6. Setup continuous read with
SLV0_ADD = 3Dh
SLV0_SUBADD = 68h
SLAVE0_CONFIG = 06h
// LIS2MDL slave address is 3Ch and rw_0=1
// Magnetometer output registers start from 68h
// Set up a continuous 6-byte read from I²C master interface

Regards