你好,
我正在使用以下寄存器设置来配置LIS2DH12以在INT1引脚上产生FIFO水印中断,但是INT1引脚始终保持低电平,我不确定我缺少什么。
INT1直接连接到设置为输入的MCU GPIO引脚。
以下是我目前使用的寄存器设置:
//启用BDU,CTRL_REG4 = 0x80
LIS2DH12_SetBDU(LIS2DH12_ENABLE);
//设置为正常功耗模式,10位ACC数据,CTRL_REG1 = 0x00,CTRL_REG4 = 0x80
LIS2DH12_SetMode(LIS2DH12_NORMAL);
//满量程选择,CTRL_REG4 = 0x80
LIS2DH12_SetFullScale(LIS2DH12_FULLSCALE_2);
//启用轴,CTRL_REG1 = 0x07
LIS2DH12_SetAxesEnabled(LIS2DH12_X_ENABLE | LIS2DH12_Y_ENABLE | LIS2DH12_Z_ENABLE);
//将ODR设置为1Hz,
CTRL_REG1 = 0x17
LIS2DH12_SetODR(LIS2DH12_ODR_1Hz);
//将FIFO水印设置为24,FIFO_CTRL_REG = 0x18
LIS2DH12_SetWaterMark(
24
);
//在INT1上设置Fifo水印中断,CTRL_REG3 = 0x04
LIS2DH12_Se
tint1Pin(
LIS2DH12_WTM_ON_INT1_ENABLE
);
//中断1锁存使能,CTRL_REG5 = 0x08
LIS2DH12_Int1LatchEnable(LIS2DH12_ENABLE);
//启用fifo模式,
CTRL_REG5 = 0x48
,FIFO_CTRL_REG = 0x58
LIS2DH12_FIFOModeEnable(LIS2DH12_FIFO_MODE);
几秒钟后,我读取了FIFO_SRC_REG寄存器,FSS [4:0]字段正在计数,
最后是FIFO_SRC_REG = 0xDF的值。因此我认为FIFO工作正常,
但是我无法获得INT1的FIFO水印中断。
一个
关于如何正确配置中断的建议将不胜感激。
谢谢。
#incelegrometer-lis2dh12-configure#lis2dh12 #no-interrupt
以上来自于谷歌翻译
以下为原文
Hello,
I am using following resister setting to config the LIS2DH12 to generate FIFO watermark interrupt on INT1 pin, however the INT1 pin always stays LOW, I am not sure what I am missing.
INT1 is connect directly to the MCU GPIO pin which set to input.
Here are the register settings I'm currently using:
//Enable BDU, CTRL_REG4 = 0x80
LIS2DH12_SetBDU(LIS2DH12_ENABLE );
// Set to normal power mode, 10bit ACC data, CTRL_REG1 = 0x00, CTRL_REG4 = 0x80
LIS2DH12_SetMode(LIS2DH12_NORMAL );
// Full scale selection, CTRL_REG4 = 0x80
LIS2DH12_SetFullScale(LIS2DH12_FULLSCALE_2);
// Enable axes, CTRL_REG1 = 0x07
LIS2DH12_SetAxesEnabled(LIS2DH12_X_ENABLE | LIS2DH12_Y_ENABLE | LIS2DH12_Z_ENABLE);
// set ODR to 1Hz,
CTRL_REG1 = 0x17
LIS2DH12_SetODR(LIS2DH12_ODR_1Hz);
// set FIFO watermark to 24, FIFO_CTRL_REG = 0x18
LIS2DH12_SetWaterMark(
24
);
// set Fifo watermark interrupt on INT1, CTRL_REG3 = 0x04
LIS2DH12_SetInt1Pin(
LIS2DH12_WTM_ON_INT1_ENABLE
);
// Interrupt 1 Latch enable, CTRL_REG5 = 0x08
LIS2DH12_Int1LatchEnable(LIS2DH12_ENABLE);
// enable fifo mode,
CTRL_REG5 = 0x48
, FIFO_CTRL_REG = 0x58
LIS2DH12_FIFOModeEnable(LIS2DH12_FIFO_MODE);
After few seconds, I read the FIFO_SRC_REG register, the FSS[4:0] field is counting up,
and finally the value of FIFO_SRC_REG = 0xDF. Therefore I think FIFO is working,
however I cannot get the FIFO watermark interrupt for INT1.
A
ny suggestion on how to configure the interrupt correctly would be greatly appreciated.
Thank you.
#accelerometer-lis2dh12-configure #lis2dh12 #no-interrupt