cancel
Showing results for 
Search instead for 
Did you mean: 

I'm using the ST iis3dwb mems accelerometer and I'm trying to configure it to use the internal FIFO and generate the interrupt lines INT1 or INT2, but they aren't firing. What am I doing wrong?

PJamr.1
Associate

I'm using the STM32-F446RE Nucleo board. I am using PB1 and PB2 to trigger on the iis3dwb interrupts; PB1 and PB2 are setup as GPIO_EXTI1 and GPIO_EXTI2 respectively. These interrupts work as I have a breakpoint in the interrupt handler's and can trigger them by manually touching the respective pins (24 and 21 on CN10 on the Nucleo) with a 3.3v jumper.

I'm trying to setup the iis3DWB to use the internal FIFO to collect only the Z-axis data; ideally, I want to trigger an interrupt on INT1 whenever the FIFO watermark has been reached, however, it doesn't generate an interrupt. I tried to then simply enable all interrupt sources on the iis3dwb sensor to output to INT1 just to see if it ever fires off, and it seems like it doesn't. Not sure if I'm doing something incorrectly in my configuration or if its potentially a hardware issue.

My configuration routine is below -- I'd expect that after the configuration runs, the iis3dwb should start collecting data to the FIFO and generate interrupts. Is my configuration routine correct or am I missing something silly? I'm using the iis3dwb driver provided by ST located in their github repo here:

https://github.com/STMicroelectronics/STMems_Standard_C_drivers/tree/master/iis3dwb_STdC

Configuration code below:

void iis3dwb_configure(void * spi_handle, void * print_handle)
{
  stmdev_ctx_t dev_ctx;
  /* Initialize mems driver interface */
  dev_ctx.write_reg = platform_write;
  dev_ctx.read_reg = platform_read;
  dev_ctx.handle = spi_handle;
 
  iis3dwb_pin_int1_route_t int1_route;
  iis3dwb_pin_int2_route_t int2_route;
 
  /* Wait sensor boot time */
  platform_delay(BOOT_TIME);
  /* Check device ID */
  iis3dwb_device_id_get(&dev_ctx, &whoamI);
 
  if (whoamI != IIS3DWB_ID)
	  while (1);
 
  /* Restore default configuration */
  iis3dwb_reset_set(&dev_ctx, PROPERTY_ENABLE);
 
  do {
    iis3dwb_reset_get(&dev_ctx, &rst);
  } while (rst);
 
  /* Configure sensor to "Power-Down" mode */
  iis3dwb_xl_data_rate_set(&dev_ctx, IIS3DWB_XL_ODR_OFF);
 
  /* set up axis selection */
  iis3dwb_xl_axis_selection_set(&dev_ctx, IIS3DWB_ONLY_Z_ON_ALL_OUT_REG);
 
  /* Set full scale */
  iis3dwb_xl_full_scale_set(&dev_ctx, IIS3DWB_16g);
 
  /* Set Fifo mode */
  iis3dwb_fifo_mode_set(&dev_ctx, IIS3DWB_FIFO_MODE);
 
  /* set watermark at half of the fifo capacity */
  iis3dwb_fifo_watermark_set(&dev_ctx, 256);
 
  /* set interrupt polarity */
  iis3dwb_pin_polarity_set(&dev_ctx, IIS3DWB_ACTIVE_HIGH);
 
  /* stop on wtm set */
  iis3dwb_fifo_stop_on_wtm_set(&dev_ctx, 1);
 
  /* setup the batching rate */
  iis3dwb_fifo_xl_batch_set(&dev_ctx, IIS3DWB_XL_BATCHED_AT_26k7Hz);
 
  iis3dwb_pin_mode_set(&dev_ctx, IIS3DWB_PUSH_PULL);
 
  /* set up block data update */
//  iis3dwb_block_data_update_set(&dev_ctx, 1);
 
  /* route the interrupt 1 configuration */
  int1_route.fifo_th = 1;
  int1_route.fifo_ovr = 1;
  int1_route.fifo_full = 1;
  int1_route.fifo_bdr = 1;
  int1_route.drdy_xl = 1;
 
  iis3dwb_pin_int1_route_set(&dev_ctx, &int1_route);
 
  /* route the interrupt 1 configuration */
  int2_route.fifo_th = 1;
  int2_route.fifo_ovr = 1;
  int2_route.fifo_full = 1;
  int2_route.fifo_bdr = 1;
  int2_route.drdy_xl = 1;
 
  iis3dwb_pin_int2_route_set(&dev_ctx, &int2_route);
  /* turn on data collection */
 
  iis3dwb_xl_data_rate_set(&dev_ctx, IIS3DWB_XL_ODR_26k7Hz);
 
}

0 REPLIES 0