cancel
Showing results for 
Search instead for 
Did you mean: 

LSM6DSO interface with MCU : Generation of wakeup/activity/single tap interrupt during double tap. Expected : Only double tap. Actual: wakeup/activity/single tap interrupts also along with double tap interrupt

srao.1
Associate II

Issue Summary:

Generation of wakeup/activity/single tap interrupt during double tap.

Expected : Only double tap.

Actual: wakeup/activity/single tap interrupts also along with double tap interrupt

please find the below Analysis for your reference. 

Register Configurations for wakeup:

Wake-up Configuration Details :

1. Write 60h to CTRL1_XL // Turn on the accelerometer

// ODR_XL = 416 Hz, FS_XL = ±2 g

2. Write 00h to TAP_CFG0 // Disabled latch mode

Write 80h to TAP_CFG2 // Enable interrupt function

3. Write 60h to WAKE_UP_DUR // 3*ODR_time = 3*2.4 ms = 7.2 ms

4. Write 0Fh to WAKE_UP_THS // Set wake-up threshold ---- > 15*fs_xl/64 = 468.75 mg

5. Write 20h to MD1_CFG // Wake-up interrupt driven to INT1 pin

Double Tap Configuration Details :

1. Write 60h to CTRL1_XL // Turn on the accelerometer

// ODR_XL = 416 Hz, FS_XL = ±2 g

2. Write 0Eh to TAP_CFG0 // Enable tap detection on X, Y, Z-axis

3. Write 0Ch to TAP_CFG1 // Set X-axis threshold and axes priority

4. Write 8Ch to TAP_CFG2 // Set Y-axis threshold and enable interrupt

5. Write 0Ch to TAP_THS_6D // Set Z-axis threshold

6. Write 7Fh to INT_DUR2 // Set Duration, Quiet and Shock time windows

7. Write 80h to WAKE_UP_THS // Single-tap and double-tap enabled (SINGLE_DOUBLE_TAP = 1)

8. Write 08h to MD2_CFG // Double-tap interrupt driven to INT2 pin

Test Steps :

power on the board

Double tap on the board on the LSM6DSO board

Expected output :

Interrupt 1 signal should not generated and only Interrupt 2 signal should be generated, during Double tap  

Actual Observation :

Two times Interrupt 1 signal also generated along with single interrupt 2 signal, during double tap (Totally 3 interrupt)

//...............................................................................................................//

Register Configuration for activity event:

Wake-up Configuration Details :

1. Write 60h to CTRL1_XL // Turn on the accelerometer

// ODR_XL = 416 Hz, FS_XL = ±2 g

2. Write 00h to TAP_CFG0 // Disabled latch mode

Write 80h to TAP_CFG2 // Enable interrupt function

3. Write 60h to WAKE_UP_DUR // 3*ODR_time = 3*2.4 ms = 7.2 ms

4. Write 0Fh to WAKE_UP_THS // Set wake-up threshold ---- > 15*fs_xl/64 = 468.75 mg

5. Write 80h to MD1_CFG // Routing of activity/inactivity recognition event on INT1

Double Tap Configuration Details :

1. Write 60h to CTRL1_XL // Turn on the accelerometer

// ODR_XL = 416 Hz, FS_XL = ±2 g

2. Write 0Eh to TAP_CFG0 // Enable tap detection on X, Y, Z-axis

3. Write 0Ch to TAP_CFG1 // Set X-axis threshold and axes priority

4. Write 8Ch to TAP_CFG2 // Set Y-axis threshold and enable interrupt

5. Write 0Ch to TAP_THS_6D // Set Z-axis threshold

6. Write 7Fh to INT_DUR2 // Set Duration, Quiet and Shock time windows

7. Write 80h to WAKE_UP_THS // Single-tap and double-tap enabled (SINGLE_DOUBLE_TAP = 1)

8. Write 08h to MD2_CFG // Double-tap interrupt driven to INT2 pin

Steps Followed:

power on the board

Initially Interrupt 1 signal generated without any touch on LSM6DSO board

Double tap on the LSM6DSO board.

Expected output :

Interrupt 1 signal should not be generated and only Interrupt 2 signal should be generated ,during Double tap  

Actual Observation :

Two Activity(Interrupt 1) signal and one double tap (Interrupt 2) signal, during Double tap (Totally 3 interrupt)

//.................................................................................................................//

Register Configuration for single tap:

1. Write 60h to CTRL1_XL // Turn on the accelerometer

// ODR_XL = 416 Hz, FS_XL = ±2 g

2. Write 0Eh to TAP_CFG0 // Enable tap detection on X, Y, Z-axis

3. Write 0Ch to TAP_CFG1 // Set X-axis threshold and axes priority

4. Write 8Ch to TAP_CFG2 // Set Y-axis threshold and enable interrupt

5. Write 0Ch to TAP_THS_6D // Set Z-axis threshold

6. Write 7Fh to INT_DUR2 // Set Duration, Quiet and Shock time windows

7. Write 40h to MD1_CFG // Routing of single-tap recognition event on INT1

Double Tap Configuration Details :

1. Write 60h to CTRL1_XL // Turn on the accelerometer

// ODR_XL = 416 Hz, FS_XL = ±2 g

2. Write 0Eh to TAP_CFG0 // Enable tap detection on X, Y, Z-axis

3. Write 0Ch to TAP_CFG1 // Set X-axis threshold and axes priority

4. Write 8Ch to TAP_CFG2 // Set Y-axis threshold and enable interrupt

5. Write 0Ch to TAP_THS_6D // Set Z-axis threshold

6. Write 7Fh to INT_DUR2 // Set Duration, Quiet and Shock time windows

7. Write 80h to WAKE_UP_THS // Single-tap and double-tap enabled (SINGLE_DOUBLE_TAP = 1)

8. Write 08h to MD2_CFG // Double-tap interrupt driven to INT2 pin

Steps Followed :

power on the board

enter single tap on the board

Interrupt 1 pin is generating signal with single tap.

Double tap on the board

Interrupt 1 and Interrupt 2 pins are generating one-time signal with double tap.

Expected output :

Interrupt 1 signal should not be generated and only Interrupt 2 signal should generated, during Double tap

Actual Observation :

One single tap (Interrupt 1) signal and one double tap (Interrupt 2) signal, during Double tap (Totally 2 interrupt)

//..................................................................................................................//

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @srao.1​ ,

I don't think you can avoid the wake up interrupt being triggered (stage1) on the first tap of the double tap.

The only way to do this would be to disable the wake up interrupt.

Let me suggest this (maybe it is not feasible for your application, but I'll try):

The idea is that in your wake up ISR you can wait before doing what you need to do.

You wait a time in which the double tap could be triggered.

If the double tap interrupt is triggered, you run the double tap ISR, otherwise you run the wake up ISR.

do you think this can work?

View solution in original post

7 REPLIES 7
niccolò
ST Employee

Hi @srao.1​ ,

with the configurations you programmed, the expected outcome you wrote is not correct.

If you configure both the wake up interrupt on INT1 and the double tap interrupt on INT2, if you tap on the board twice you will trigger twice the wake-up (INT1 rises twice) and once the double tap (INT2 rises once).

The same can be said for the activity-inactivity interrupt along with double tap.

Regarding the third configuration, the sensor detects a single tap, so it triggers the interrupt, and then it detects the second tap, so it detects that that one was a double tap and triggers the double tap interrupt. That is the correct behavior for this sensor.

One problem, you might see is the fact that you expect the interrupt only for higher thresholds.

This is due to the fact that you first write 0Fh in register WAKE_UP_THS, then you write 80h in the same register.

the second writing cancels the first one, so the threshold is reset to 0. you can write just one time 8Fh in that register for your purpose.

In the same way, in the third configuration you mentioned you write twice the same values in different registers, and that is not needed.

Can I ask you what are you trying to achieve? Maybe I can help you.

Hi niccolo.ruffini

Thanks for your quick response.

we have set value 8F into WAKE_UP_THS register.

please provide the clarification about what are the steps we need to follow to get below requirements for my environment.

1) Only "wakeup interrupt" (without any other interrupt) while touch on the LSM6DSO module.

2) Only "Double tap interrupt" (without any other interrupt) while double tap on the LSM6DSO module.

Regards,

Srinivas Rao.

Hi @srao.1​ ,

I'm sorry, but you need to understand that the wake up interrupt is triggered instantly when the board is touched, so if you configure it, it will be triggered when the first of the two double tap occurs.

But even if the interrupt is triggered, you can get the behavior you expect with firmware programming: I would suggest to check, when the interrupt from the wake up is received, if there is a double tap interrupt. If the double tap interrupt is not triggered, the interrupt routine from the wake up should be run, otherwise the interrupt routine for the double tap should be run.

Do you think this can work?

Hi niccolo.ruffini,

Thanks for the suggestion. 

50% is working. 

Checked the double tap interrupt status as well as wakeup interrupt status, 

still we are not able to arrest the run of wakeup during double tap, 

Details below:

during double tap, 

As we are receiving 2 wake up signals and 1 double tap signal , 

two wake up ISR and one double tap ISR executed continuously. 

Unfortunately these ISR count also not consistent.

Execution Stages: 

Stage 1: First wake up isr functionality

wakeup interrupt status = 1, double tap interrupt status = 0; - 

Stage 2: Second wake up isr functionality

wakeup interrupt status = 1, double tap interrupt status = 1; 

Stage 3: double tap isr functionality

wakeup interrupt status = 0,double tap interrupt status = 1; - 

For the Double tap requirement, we need to arrest the stage 1 and stage 2. 

Based on reading the double tap interrupt status and wakeup interrupt status

we are able to arrest stage 2. But not able to arrest stage 1.

It looks like the stopping of isr is not under the control of firmware.

So that we struggled in arresting the stage 1 during double tap. 

Please let us know if any of above points is not clear. 

it will be helpful if we get any other way to arrest the above stage 1.

Hi @srao.1​ ,

I don't think you can avoid the wake up interrupt being triggered (stage1) on the first tap of the double tap.

The only way to do this would be to disable the wake up interrupt.

Let me suggest this (maybe it is not feasible for your application, but I'll try):

The idea is that in your wake up ISR you can wait before doing what you need to do.

You wait a time in which the double tap could be triggered.

If the double tap interrupt is triggered, you run the double tap ISR, otherwise you run the wake up ISR.

do you think this can work?

srao.1
Associate II

Hi niccolo.ruffini,

Thanks for response and idea. it is working with more delay.

As suggested, the steps followed: 

  1. Getting wake up interrupt ,
  2. Wait for some time using delay.
  3. check double tap interrupt signal .
  4. if double tap interrupt is triggered after delay period we are proceeding with double tap, else proceeding with wake up signal

This is not actual fix for my application. but, for time being this is okay.

Hi @srao.1​ ,

I'm glad to hear that, it's working.

I hope you can figure out a way to implement it in your final application.