cancel
Showing results for 
Search instead for 
Did you mean: 

LIS2DH12 data ready interrupt

frank239955_st
Associate
Posted on November 14, 2016 at 07:37

Hi,

I want the most basic function -- data ready interrupt, but it seems not so easy to come out. Here are my configurations:

void lis3dh_init(void)

{

  //Inizialize MEMS Sensor

lis3dh_reset();

  //set ODR (turn ON device)

  LIS3DH_SetODR(LIS3DH_ODR_50Hz);

  //set PowerMode 

  LIS3DH_SetMode(LIS3DH_NORMAL);

  //set Fullscale

  LIS3DH_SetFullScale(LIS3DH_FULLSCALE_4);

  //set axis Enable

  LIS3DH_SetAxis(LIS3DH_X_ENABLE | LIS3DH_Y_ENABLE | LIS3DH_Z_ENABLE);

LIS3DH_SetInt1Pin(LIS3DH_CLICK_ON_PIN_INT1_DISABLE | LIS3DH_I1_INT1_ON_PIN_INT1_DISABLE |

LIS3DH_I1_INT2_ON_PIN_INT1_DISABLE | LIS3DH_I1_DRDY1_ON_INT1_ENABLE | LIS3DH_I1_DRDY2_ON_INT1_DISABLE |

LIS3DH_WTM_ON_INT1_DISABLE | LIS3DH_INT1_OVERRUN_DISABLE   );

//initialize the pedometer 

IntPedomter();

}

void get_acc_data(void)

{

if(!g_int_triggered) return;

AxesRaw_t data;

LIS3DH_GetAccAxesRaw(&data);/* Read the accel XYZ data*/

PEDO_SampWrite(((data.AXIS_X)>>6)<<3, ((data.AXIS_Y)>>6)<<3, ((data.AXIS_Z)>>6)<<3);

// PRINTF(''%d\t%d\t%d\n'', (data.AXIS_X)/8, (data.AXIS_Y)/8, (data.AXIS_Z)/8);

}

And I've already configure the INT1 pin as a low-to-high edge triggered pin. But when I use the oscilloscope to get the waveforms, it is a straight line, I cannot see any change from it. And also cannot get any acceleration data.

So my question is how to configure the data ready interrupt correctly? Thank you.
1 REPLY 1
Miroslav BATEK
ST Employee
Posted on November 30, 2016 at 14:12

I think the sensor is not running (it is in power down mode), because you don

’

t get any data.

In consequence data ready interrupt can not occur.

In principle you configuration is correct, but I don

’t know what is going on in your functions LIS3DH_SetXxxx(…)

.

To enable data ready interrupt on INT1 pin, you have to set bit I1_DRDY1 in CTRL_REG3(0x22h).

Best regards

Miroslav