2015-11-10 06:39 AM
Hi,
I need to disable a EXTI interrupt and then enabling it again later. How can I do that using the hal implementation? I am working on STM32F070.2015-11-11 06:17 AM
You should use the Interrupt & Flag management macros existed in each peripheral .h file .
For example to manage DMA interrupts : __HAL_DMA_ENABLE_IT(__HANDLE__, __INTERRUPT__); __HAL_DMA_EDISABLE_IT(__HANDLE__, __INTERRUPT__); or TIM interrupts: __HAL_TIM_ENABLE_IT(__HANDLE__, __INTERRUPT__); __HAL_TIM_DISABLE_IT(__HANDLE__, __INTERRUPT__); CIAO2015-11-11 07:30 AM
Hi,
The EXTI does not work the same way since it share interrupt handler with other gpio pins. I have no handle to use. See code below. Call stack - EXTI4_15_IRQHandler - HAL_GPIO_EXTI_IRQHandler - HAL_GPIO_EXTI_Callback. I want to disable interrupt on GPIO_PIN_11 for a while, how do I do that? Or should I change the gpio mode? I can't find something like __HAL_GPIO_EXTI_DISABLE_IT(GPIO_Pin).. Gpio_Init(void) { GPIO_InitTypeDef GPIO_InitStruct; ... __GPIOC_CLK_ENABLE(); /*Configure GPIO pin : PC11 */ GPIO_InitStruct.Pin = GPIO_PIN_11; GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_LOW; HAL_GPIO_Init(GPIOC, &GPIO_InitStruct) /* EXTI interrupt init*/ HAL_NVIC_SetPriority(EXTI4_15_IRQn, 0, 0); HAL_NVIC_EnableIRQ(EXTI4_15_IRQn); } stm32f0xx_it.c /** * @brief This function handles EXTI line 4 to 15 interrupts. */ void EXTI4_15_IRQHandler(void) { HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_11); } stm32f0xx_hal_gpio.c /** * @brief Handle EXTI interrupt request. * @param GPIO_Pin: Specifies the port pin connected to corresponding EXTI line. * @retval None */ void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin) { /* EXTI line interrupt detected */ if(__HAL_GPIO_EXTI_GET_IT(GPIO_Pin) != RESET) { __HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin); HAL_GPIO_EXTI_Callback(GPIO_Pin); } } main.c /** * @brief EXTI line detection callbacks * @param GPIO_Pin: Specifies the pins connected EXTI line * @retval None */ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { if (GPIO_Pin == GPIO_PIN_11) { /* OK */ } }2016-02-02 07:19 AM
Hi,
Did you found a solution for that?How about disabling the IRQ with HAL_NVIC_DisableIRQ(EXTI4_15_IRQn) and then enabling it again when ever needed, of course it will disable all EXTI from 4 to 15 but it might help in your case.2023-11-29 11:32 PM
You could use something like, on test port and test pin: