发 帖  
原厂入驻New
张飞软硬开源基于STM32 BLDC直流无刷电机驱动器开发视频套件, 👉戳此立抢👈
[问答] LIS2DH12如何正确配置数据就绪中断?
133 中断 传感器
分享
嗨,


我想要最基本的功能 - 数据就绪中断,但似乎不那么容易出来。这是我的配置:

void lis3dh_init(void)
{
// Inizialize MEMS传感器
lis3dh_reset();
//设置ODR(打开设备)
LIS3DH_SetODR(LIS3DH_ODR_50Hz);
//设置PowerMode
LIS3DH_SetMode(LIS3DH_NORMAL);
//设置Fullscale
LIS3DH_SetFullScale(LIS3DH_FULLSCALE_4);
//设置轴启用
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);
//初始化计步器
IntPedomter();
}

void get_acc_data(void)
{
IF(!g_int_triggered)返回;
AxesRaw_t数据;
LIS3DH_GetAccAxesRaw(& data); / *读取加速度XYZ数据* /
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);
}

我已经将INT1引脚配置为低至高边沿触发引脚。但是,当我使用示波器获取波形时,它是一条直线,我看不出它的任何变化。而且也无法获得任何加速度数据。

所以我的问题是如何正确配置数据就绪中断?谢谢。

以上来自于谷歌翻译


以下为原文




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.
0
2019-5-23 14:15:13   评论 分享淘帖 邀请回答