How do I set and manage interrupt priorities in FreeRTOS?

@Middleware & OS How do I set and manage interrupt priorities in FreeRTOS? My higher priority interrupts are not preempting lower priority ones. Here's my NVIC configuration:
HAL_NVIC_SetPriority(EXTI0_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(EXTI0_IRQn);
HAL_NVIC_SetPriority(EXTI0_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(EXTI0_IRQn);
What could be causing this issue?
Solution:
Hi @Boss lady , you can try this ```cpp #include "FreeRTOSConfig.h" #include "stm32f4xx_hal.h" ...
Jump to solution
3 Replies
barafael
barafael3w ago
Can you rule out priority inversion? Do you have locks in your system?
Solution
Enthernet Code
Hi @Boss lady , you can try this
#include "FreeRTOSConfig.h"
#include "stm32f4xx_hal.h"

void HAL_NVIC_Setup(void) {
HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);

HAL_NVIC_SetPriority(EXTI0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY + 1, 0);
HAL_NVIC_EnableIRQ(EXTI0_IRQn);
}

void EXTI0_IRQHandler(void) {
BaseType_t xHigherPriorityTaskWoken = pdFALSE;

// Clear the interrupt
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_0);

// Perform your interrupt processing here

// Notify FreeRTOS about the ISR
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}
#include "FreeRTOSConfig.h"
#include "stm32f4xx_hal.h"

void HAL_NVIC_Setup(void) {
HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);

HAL_NVIC_SetPriority(EXTI0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY + 1, 0);
HAL_NVIC_EnableIRQ(EXTI0_IRQn);
}

void EXTI0_IRQHandler(void) {
BaseType_t xHigherPriorityTaskWoken = pdFALSE;

// Clear the interrupt
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_0);

// Perform your interrupt processing here

// Notify FreeRTOS about the ISR
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}
Boss lady
Boss lady2w ago
Yes @barafael
Want results from more Discord servers?
Add your server
More Posts
If I write a Python program with a GUI, can I launch it from the Linux CLI and still get the GUI?I'm expecting the answer to be no, but I want to confirm. If I write a Python program with a GUI, caSeeking open-source project without ST HAL for learning low-level drivers & best practices.@Middleware & OS I'm a Newbie in STM32 dev for few months now. Seeking open-source project without Is it good practice to use MQTT to setdata for an IoT device?Hey guys @IoT Cloud I know MQTT uses publish/subscribe, meaning all clients can pub/sub to any topicI need help on secure communication.Hello all, I need help on secure communication. If any of you happen to know which library for mqtt-What are the benefits of using 64 priority levels in ThreadX with CMSIS-RTOS?Good day everyone, I am trying to use ThreadX with CMSIS RTOS in a project. The `cmsis_os2.c` file sHas anyone here encountered UML being used in your firmware development experience?@Middleware & OS I have found this UML diagrams, sequence diagrams and class diagrams in particular,Simple IP based intercom device voice communication protocolI like to know , which voice communication protocol helps me to setup and make voice communication bSingaporian Researchers developed a flexible battery for smart contact lensesSmart contact lenses could be powered by a flexible battery as thin as a human cornea that stores elFacing a problem in setting up esp-idf in vs codehello everyone i am following the book: INTERNET OF THINGS PROJECT WITH ESP32 BY: AGUS KURNIAWAN I what are different ways to maximize the range of esp32 c3 chip on a custom board ?what are different ways to maximize the range of esp32 c3 chip on a custom board ?