[lis2dh12/lis2dw12] INT1 signal too low/no signal output
Hi guys,
I am currently working on a project with lis2dw12 tap and orientation interrupt. I have come across an issue of INT1 output.
I have tested the INT1 output signal with the code below:
#include "lis2dh_reg.h"
void lis2dh_int_test(stmdev_ctx_t dev_ctx)
{
uint8_t buf[2] = {0x00, 0x00};
uint32_t state;
TH_PRINTF("Starting program\r\n");
/* Initialization of sensor */
buf[1] = 0x40;
lis2dh_write_reg(&dev_ctx, 0x22, &buf[1], 1); /* CTRL_REG3 (22h): IA1 interrupt on INT1 pin */
buf[1] = 0x00;
lis2dh_write_reg(&dev_ctx, 0x23, &buf[1], 1); /* CTRL_REG4 (23h): Set Full-scale to +/-2g */
/* 6D orientation enable */
buf[1] = 0x7f;
lis2dh_write_reg(&dev_ctx, 0x30, &buf[1], 1); /* INT1_CFG (30h): INT1 Configuration */
buf[1] = 0x36;
lis2dh_write_reg(&dev_ctx, 0x32, &buf[1], 1); /* INT1_THS (32h): INT1 Threshold set */
buf[1] = 0x06;
lis2dh_write_reg(&dev_ctx, 0x33, &buf[1], 1); /* INT1_DURATION (33h): INT1 Duration set */
/* Start sensor */
buf[1] = 0x3f;
lis2dh_write_reg(&dev_ctx, 0x20, &buf[1], 1); ; /* CTRL_REG1 (20h): Start sensor at ODR 25Hz, Lowpower mode */
/* Settling time 1ms */
nrf_delay_ms(1);
while (1)
{
state = nrf_gpio_pin_read(ACCL_INT1);
if (state) TH_PRINTF("int1 detected \r\n");
}
}
int main(void)
{
uint8_t whoamI,rst;
//lfclk_config();
//timers_init();
twi_init();
stmdev_ctx_t dev_ctx;
dev_ctx.write_reg = platform_write;
dev_ctx.read_reg = platform_read;
dev_ctx.handle = NULL;
nrf_gpio_cfg_input(ACCL_INT1,GPIO_PIN_CNF_PULL_Disabled);
lis2dh_device_id_get(&dev_ctx, &whoamI);
lis2dh_int_test(dev_ctx);
while (true)
{
// Do nothing.
}
},following the application notes dt0097:
Nothing was printed when I rotate the module(with lis2dh12). While when I check the INT1 pin with an oscilloscope, I found that the signal was below 1.5v, which was definitely not able to be recognised as an input.
Could anyone suggest that what the problem would be? Or is it normal to see this phenomena with lis2dh12?
p.s. I am using nrf52840-DK.
