2018-06-27 02:09 AM
With the next configuration, the INT1 don't start.
Base on (
https://github.com/STMicroelectronics/STMems_Standard_C_drivers/tree/master/lsm303agr_STdC
)lsm303agr_xl_operating_mode_set(&dev_ctx_xl, LSM303AGR_XL_POWER_DOWN);
lsm303agr_ctrl_reg3_a_t int1_config;
int1_config.i1_aoi1 = 1;int1_config.i1_aoi2 = 0;int1_config.i1_click = 0;int1_config.i1_drdy1 = 0;int1_config.i1_drdy2 = 0;int1_config.i1_overrun = 0;int1_config.i1_wtm = 0;int1_config.not_used_01 = 0;lsm303agr_xl_pin_int1_config_set(&dev_ctx_xl, &int1_config);
lsm303agr_xl_high_pass_int_conf_set(&dev_ctx_xl, LSM303AGR_DISC_FROM_INT_GENERATOR);lsm303agr_xl_full_scale_set(&dev_ctx_xl, LSM303AGR_2g);lsm303agr_xl_int1_pin_detect_4d_set(&dev_ctx_xl, 0x08);
lsm303agr_ctrl_reg6_a_t int2_config;
int2_config.h_lactive = 1;int2_config.boot_i2 = 0;int2_config.i2_clicken = 0 ;int2_config.i2_int1 = 0;int2_config.i2_int2 = 0;int2_config.not_used_01 = 0;int2_config.not_used_02 = 0;int2_config.p2_act = 0;lsm303agr_xl_pin_int2_config_set(&dev_ctx_xl, &int2_config);lsm303agr_xl_int1_gen_threshold_set(&dev_ctx_xl, 0x04);
lsm303agr_xl_int1_gen_duration_set(&dev_ctx_xl, 0x04);lsm303agr_int1_cfg_a_t int_1_cfg;
int_1_cfg.xlie = 0;int_1_cfg.xhie = 1;int_1_cfg.ylie = 0;int_1_cfg.yhie = 1;int_1_cfg.zlie = 0;int_1_cfg.zhie = 1;int_1_cfg._6d = 0;int_1_cfg.aoi = 0;lsm303agr_xl_int1_gen_conf_set(&dev_ctx_xl, &int_1_cfg);lsm303agr_int1_src_a_t int_source_get;
lsm303agr_xl_int1_gen_source_get(&dev_ctx_xl, &int_source_get
);lsm303agr_xl_data_rate_set(&dev_ctx_xl, LSM303AGR_XL_ODR_50Hz);
WhoamI return correct value.
I work with a NRF52,
For read the pin i
nterrupt
:ret_code_t err_code;
err_code = nrf_drv_gpiote_init();
APP_ERROR_CHECK(err_code);nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_HITOLO(false);
in_config.pull = NRF_GPIO_PIN_PULLUP;err_code = nrf_drv_gpiote_in_init(INT_1, &in_config, in_pin_handler);
APP_ERROR_CHECK(err_code);nrf_drv_gpiote_in_event_enable(
INT_1
, true);The 'in_pin_handler' never called.
#int1 #lsm303agr #interrupt2018-06-27 07:47 AM
With this config work fine:
lsm303agr_xl_block_data_update_set(&dev_ctx_xl, PROPERTY_ENABLE);
lsm303agr_xl_data_rate_set(&dev_ctx_xl, LSM303AGR_XL_ODR_100Hz); lsm303agr_xl_full_scale_set(&dev_ctx_xl, LSM303AGR_2g); lsm303agr_xl_operating_mode_set(&dev_ctx_xl, LSM303AGR_LP_8bit); lsm303agr_xl_high_pass_int_conf_set(&dev_ctx_xl, 0x01); lsm303agr_xl_high_pass_on_outputs_set(&dev_ctx_xl, 0x01);lsm303agr_ctrl_reg3_a_t reg3_confg;
reg3_confg.i1_aoi1 = 1; reg3_confg.i1_aoi2 = 0; reg3_confg.i1_click = 0; reg3_confg.i1_drdy1 = 0; reg3_confg.i1_drdy2 = 0; reg3_confg.i1_overrun = 0; reg3_confg.i1_wtm = 0; reg3_confg.not_used_01 = 0; lsm303agr_xl_pin_int1_config_set(&dev_ctx_xl, ®3_confg);lsm303agr_xl_int1pin_notification_mode_set(&dev_ctx_xl, LSM303AGR_INT1_PULSED);
lsm303agr_xl_int1_gen_threshold_set(&dev_ctx_xl, 0x08); lsm303agr_xl_int1_gen_duration_set(&dev_ctx_xl, 0x00);lsm303agr_xl_high_pass_mode_set(&dev_ctx_xl, LSM303AGR_AUTORST_ON_INT);
lsm303agr_int1_cfg_a_t int1_config;
int1_config.xlie = 0; int1_config.xhie = 1; int1_config.ylie = 0; int1_config.yhie = 1; int1_config.zlie = 0; int1_config.zhie = 1; int1_config._6d = 0; int1_config.aoi = 0; lsm303agr_xl_int1_gen_conf_set(&dev_ctx_xl, &int1_config);