Skip to main content
Associate II
July 4, 2024
Solved

Enable/ disable EXTI interrupts using HAL

  • July 4, 2024
  • 2 replies
  • 1705 views

Hey guys.

I need to enable/disable the line 14 of the EXTI interrupts multiple times, using HAL

Do i just use the HAL_NVIC_DisableIRQ  HAL_NVIC_EnableIRQ  ( and HAL_NVIC_SetPriority whenever i re-enable the line?), providing the correct handle to the api each time?

This topic has been closed for replies.
Best answer by Sarra.S

Hello @AlexandrosAA, 

You only need to set the priority once using HAL_NVIC_SetPriority unless you need to change the priority dynamically.

to enable the interrupt: HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);

to disable the interrupt: HAL_NVIC_DisableIRQ(EXTI15_10_IRQn);

2 replies

Pavel A.
July 4, 2024

To enable/disable EXTI interrupts, you can set and clear raising/falling edge detection bit of the needed line in EXTI registers EXTI_RTSR1 and/or EXTI_FTSR1. Leave the NVIC interrupt enabled.  Not sure if the HAL library has a function for this. If not, do it without the HAL.

Sarra.SBest answer
ST Employee
July 9, 2024

Hello @AlexandrosAA, 

You only need to set the priority once using HAL_NVIC_SetPriority unless you need to change the priority dynamically.

to enable the interrupt: HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);

to disable the interrupt: HAL_NVIC_DisableIRQ(EXTI15_10_IRQn);

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.