cancel
Showing results for 
Search instead for 
Did you mean: 

Dear Sir. I am using LSM6DSL . Is it possible to configure LSM6DSL for 2 tap,pedometer,6d orientation at the same time ?

EOved.1
Associate II
 
3 REPLIES 3
Eleon BORLINI
ST Employee

Hi @Community member​ ,

Please have a look to the below pseudo-code, that I reported for simplicity from the Application note AN5040. As you can see, the required ODR for the step counted is very different from the one of the Double tap and the 6D, and for this reason I would prefer to try to merge only these two last digital features (moreover, the step counter uses a different register page that the two other activities). You might decide to sent the Double tap interrupt on INT1 pin and the 6D orientation interrupt on the INT2 pin (MD2_CFG (5Fh) register, INT2_6D bit).

Double tap:

1. Write 60h to CTRL1_XL
// Turn on the accelerometer
// ODR_XL = 416 Hz, FS_XL = ±2 g
2. Write 8Eh to TAP_CFG // Enable interrupts and tap detection on X, Y, Z-axis
3. Write 8Ch to TAP_THS_6D // Set tap threshold
4. Write 7Fh to INT_DUR2 // Set Duration, Quiet and Shock time windows
5. Write 80h to WAKE_UP_THS // Single & double-tap enabled (SINGLE_DOUBLE_TAP = 1)
6. Write 08h to MD1_CFG // Double-tap interrupt driven to INT1 pin

Step counter:

1. Write 80h to FUNC_CFG_ACCESS // Enable access to embedded functions registers (bank A)
2. Write 8Eh to CONFIG_****_THS_MIN // ****_FS = ±4 g and configure step counter minimum threshold value
3. Write 00h to FUNC_CFG_ACCESS // Disable access to embedded functions registers (bank A)
4. Write 28h to CTRL1_XL
// Turn on the accelerometer
// ODR_XL = 26 Hz, FS_XL = ±4 g
5. Write 14h to CTRL10_C // Enable embedded functions and step counteralgorithm
6. Write 80h to INT1_CTRL // Step detector interrupt driven to INT1 pin

6D orientation:

1. Write 60h to CTRL1_XL
// Turn on the accelerometer
// ODR_XL = 416 Hz, FS_XL = ±2 g
2. Write 80h to TAP_CFG // Enable interrupts; latched mode disabled
3. Write 40h to TAP_THS_6D // Set 6D threshold (SIXD_THS[1:0] = 10b = 60 degrees)
4. Write 01h to CTRL8_XL // Enable LPF2 filter to 6D functionality
5. Write 04h to MD1_CFG // 6D interrupt driven to INT1 pin

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

-Eleon

Hi.

What if I must have Double Tap and Step Counter at the same time .

Can I use " 28h to CTRL1_XL " for Double Tap and Step Counter ?.

I will use 6D orientation when Double Tap and Step Counter are not necessary .

Please Advise

Hi @Community member​ ,

Since the two features you are interested in (Double Tap and Step Counter) are mapped in different memory register, you can run them together.

The problem is that they work at different ODRs, so you have to choose the lowest one (26Hz) and run the Double Tap at the same frequency (from 416Hz).

You then have to manage the interrupt via registers' reading: note that if you route all the INTs on the same pin you will get the OR of the various interrupts.

-Eleon