2025-09-24 3:11 AM - last edited on 2025-09-24 3:24 AM by Andrew Neil
I want to read acc data by fifo, but int1 can't work. I think there might be something wrong with my setup, but I can't figure out where the problem lies. This is my code.
/* Wait sensor boot time */
platform_delay(BOOT_TIME);
/* Check device ID */
whoamI = 0;
iis2iclx_device_id_get(&dev_ctx, &whoamI);
if ( whoamI != IIS2ICLX_ID )
while (1); /*manage here device not found */
/* Restore default configuration */
iis2iclx_reset_set(&dev_ctx, PROPERTY_ENABLE);
do {
iis2iclx_reset_get(&dev_ctx, &rst);
} while (rst);
/* Set full scale */
iis2iclx_xl_full_scale_set(&dev_ctx, IIS2ICLX_2g);
/* Configure filtering chain(No aux interface)
* Accelerometer - LPF1 + LPF2 path
*/
iis2iclx_xl_hp_path_on_out_set(&dev_ctx, IIS2ICLX_LP_ODR_DIV_100);
iis2iclx_xl_filter_lp2_set(&dev_ctx, PROPERTY_ENABLE);
// iis2iclx_fifo_virtual_sens_odr_chg_set(&dev_ctx, PROPERTY_ENABLE);
iis2iclx_fifo_stop_on_wtm_set(&dev_ctx, PROPERTY_ENABLE);
iis2iclx_fifo_xl_batch_set(&dev_ctx, IIS2ICLX_XL_BATCHED_AT_104Hz);
iis2iclx_fifo_watermark_set(&dev_ctx, 112);
iis2iclx_fifo_mode_set(&dev_ctx, IIS2ICLX_FIFO_MODE);
iis2iclx_fifo_mode_t fifo_mode;
iis2iclx_fifo_mode_get(&dev_ctx, &fifo_mode);
iis2iclx_fifo_temp_batch_set(&dev_ctx, IIS2ICLX_TEMP_NOT_BATCHED);
iis2iclx_fifo_timestamp_decimation_set(&dev_ctx, IIS2ICLX_NO_DECIMATION);
iis2iclx_pin_int1_route_t int1_route;
int1_route.int1_ctrl.int1_fifo_th = 1;
int1_route.int1_ctrl.int1_fifo_ovr = 1;
int1_route.int1_ctrl.int1_fifo_full = 1;
int1_route.int1_ctrl.int1_cnt_bdr = 1;
iis2iclx_pin_int1_route_set(&dev_ctx, &int1_route);
Edited to apply source code formatting - please see How to insert source code for future reference.