AnsweredAssumed Answered

LIS302DL Interrupt Capture

Question asked by avon.giuseppe on Oct 24, 2013
Latest reply on Dec 27, 2013 by Ben K
I'm using STM32F4 Discovery which includes LIS302DL among other peripherals. LIS302DL is connected via SPI and Interrupt Pin 1 and 2 are respectively connected to PE0 and PE1 pin (internally hardwired, not manually connected).

GPIO Pin E0 and E1 are configured as Input NOPULL

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOE, ENABLE);
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = LIS302DL_SPI_INT1_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_PuPd  = GPIO_PuPd_NOPULL ;
GPIO_Init(LIS302DL_SPI_INT1_GPIO_PORT, &GPIO_InitStructure);

GPIO_InitStructure.GPIO_Pin = LIS302DL_SPI_INT2_PIN;
GPIO_Init(LIS302DL_SPI_INT2_GPIO_PORT, &GPIO_InitStructure);

Accelerometer is configured as Interrupt Active High, PushPull and Interrupt generation on Data Ready (0x04 in CTRL_REG1)

While data reading in main program loop works correctly, i need to read accelerometer when data ready interrupt is triggered in order to achieve a regular sample rate (i've also tried using a timer and it works correctly but i prefer drdy interrupt).

Interrupt is only triggered (not always) at program startup, code works because if i connect pin to vdd, interrupt is triggered. I've not forgotten the clear pending bit line in interrupt handler.

EXTI_ClearITPendingBit(EXTI_Line0);
in void EXTI0_IRQHandler(void)

If i touch the pin with an hand or a metallic object the interrupt is triggered (once) so i suspect this two things:
- Accelerometer is not generating interrupts on data ready
- Pin out (accelerometer) and In (PE0) are not correctly configured (PULLUP / DOWN / Open Drain etc)

Also another thing: LIS302DL needs interrupt clearing? Have I to rewrite CTRL_REG3 back to 0x04 to re-enable interrupts? Does interrupts remain enabled?

Thanks in advance

Outcomes