ST意法半导体
直播中

刘芳

7年用户 1263经验值
私信 关注
[问答]

LIS2DH12 FIFO水印中断配置

你好,
我正在使用以下寄存器设置来配置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_Setint1Pin(
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

回帖(2)

刘芳

2019-4-23 10:12:08
你好,
有谁可以帮我看看上面的注册设置?
我想在INT1上配置fifo水印中断。

INT1引脚始终保持低电平。
非常感谢你。

以上来自于谷歌翻译


以下为原文




Hello,
Could anyone please help me to take a look the above register setting?
I want to config the fifo watermark interrupt on INT1.
but
the INT1 pin always stays LOW.
Thank you very much.
举报

刘芳

2019-4-23 10:32:49
米罗斯拉夫,
是的,我用范围检查了INT1上的级别,它始终保持低位。
由于寄存器配置正确(通过回读确认),所以我认为问题可能是由于PCB或MCU造成的。
非常感谢您的帮助。

以上来自于谷歌翻译


以下为原文





Miroslav,

Yes, I checked the level on INT1 with scope, it always stays low.

Since the register configuration is correct (confirmed by read back) , so I think the problem may due to the PCB or MCU.

Thank you very much for your help.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分