2016-11-13 10:37 PM
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.2016-11-30 05:12 AM
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