STM L3GD20 Gyro and STM32F3 Interrupts on DRDY (data ready)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-06-10 2:44 AM
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 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?
#interrupts #bug #stm32f3 #stm32cube #l3gd20
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-06-10 5:54 AM
After some testing with the assistance of a colleague it was verified that the reference manual is right and the stm32f3_discovery.h header file definitions are wrong: EXTI1 and GPIO_PIN_1 on GPIOE are the correct settings.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-07-03 5:24 AM
Hello Adam,
Thanks for reporting this issue. It will be fixed in coming releases of STM32CubeF3 packages.Regards-Mayla-To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-07-28 2:42 AM
Hi Mayla,
there's another typo instm32f3_discovery.h
<
br
>#define ACCELERO_DRDY_EXTI_IRQn EXTI2_TSC_IRQn
where the word to the right shuold say
EXTI2_TS_IRQn.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-07-28 5:36 AM
Hiadam.at.epsilon,
EXTI2_TS_IRQn is the wrong one (check the definition in the startup file). With the initial fix you suggested, ''EXTI2_TS_IRQn'' will not be used in the file stm32f3_discovery.h'' as#define GYRO_INT1_PIN GPIO_PIN_1 /* PE.00 */
#define GYRO_INT1_EXTI_IRQn EXTI1_IRQn
#define GYRO_INT2_PIN GPIO_PIN_2 /* PE.01 */
#define GYRO_INT2_EXTI_IRQn EXTI2_TS_IRQn
will be replaced by
#define GYRO_INT1_PIN GPIO_PIN_0 /* PE.00 */
#define GYRO_INT1_EXTI_IRQn EXTI0_IRQn
#define GYRO_INT2_PIN GPIO_PIN_1 /* PE.01 */
#define GYRO_INT2_EXTI_IRQn EXTI1_IRQn
-Mayla-
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-07-28 6:18 AM
Hi,
yes you are right, the TSC is the correct one Your suggestion for a correction looks fine. Kind regards, Adam Edited to remove part of answer which was also incorrect on my part.