AnsweredAssumed Answered

STM L3GD20 Gyro and STM32F3 Interrupts on DRDY (data ready)

Question asked by adam.at.epsilon on Jun 10, 2015
Latest reply on Jul 28, 2015 by adam.at.epsilon
Hi, I have an STM32F3Discovery board and I can read the gyroscope values over SPI fine. Now I intend to have the gyro running at 96Hz but only read the data values when DRDY is high, but my interrupt handler never gets called.

Setting control registers and reading the set values back also works fine.
    GYRO_CS_GPIO_CLK_ENABLE();
      GPIO_InitStructure.Pin = GYRO_INT2_PIN;<br>
    GPIO_InitStructure.Mode = GPIO_MODE_IT_RISING;<br>
    GPIO_InitStructure.Pull = GPIO_NOPULL;<br>
    GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;<br>
    HAL_GPIO_Init(GYRO_INT_GPIO_PORT, &GPIO_InitStructure);<br><br>
    HAL_NVIC_SetPriority(GYRO_INT2_EXTI_IRQn, 2, 0);<br>
    HAL_NVIC_EnableIRQ(GYRO_INT2_EXTI_IRQn);

And the interrupt is enabled in the MEMS by:
ctrl3 = 0x08; /* page 33 L3GD20 datasheet */
GYRO_IO_Write(&ctrl3, L3GD20_CTRL_REG3_ADDR, 1);



but my interrupt service routine never gets called, I implement it as follows:
void EXTI2_TS_IRQHandler(void)
{
    HAL_GPIO_EXTI_IRQHandler(GYRO_INT2_PIN);
}

although when measuring the PE1 pin with an oscilloscope, it is constantly high.

There also an inconsistency in the documentation, STM32F3 Discovery reference manual says that GPIO pin PE1 is connected to EXTI1 on page 295 Figure 51 section 14.2.6, but the stm32f3_discovery.h file says:

#define GYRO_INT2_EXTI_IRQn                      EXTI2_TSC_IRQn

is there a confusion whether EXTI1 or EXTI2 should be used?

Outcomes