cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure state machine of LIS3DSH

xiagaoyang2013
Associate
Posted on April 15, 2014 at 03:56

hi,

   I can't get the interrupt after configuring the state machine of LIS3DSH. Could you give me some examples. My code as following:

LIS3DSH_Write_Byte(CTRL_REG1, (u8)0x01);//enable SM1, SM1 interrupt routed to INT1

LIS3DSH_Write_Byte(CTRL_REG3, (u8)0x48);//Interrupt signal active HIGH, Interrupt locked, INT1 signal enabled

LIS3DSH_Write_Byte(CTRL_REG4, (u8)0x57);//X, Y, Z enabled, ODR = 50 Hz.

LIS3DSH_Write_Byte(CTRL_REG5, (u8)0x00);//filter bandwidth 800 Hz, +/-2g, Self-test Disabled

LIS3DSH_Write_Byte(TIM3_1, (u8)20);//Timer3 1000ms

LIS3DSH_Write_Byte(ST1_0, TI3);//SM1 state 1

LIS3DSH_Write_Byte(ST1_1, CONT);//SM1 state 2

#tech
1 REPLY 1
dmg0048
Associate II
Posted on April 25, 2014 at 21:01

I don't remember if the timer caused an interrupt, I don't think so. I recall this accelerometer had a setting, by default disabled, that caused an interrupt when reaching an stop or continue state, maybe you could enable this and see if the interrupt pops when it reaches that state. Looked it for you:

AN3393 4.34

Also, you could check that the interrupt actually works by setting the Data Ready interrupt and Fifo to stream mode, or any other interrupt (fifo full, etc). I've personally had some problems with broken traces and interrupts not being received but the accelerometer was working ok.