Dtynin
Dtynin
DIIDevHeads IoT Integration Server
Created by Marvee Amasi on 5/26/2024 in #code-review
Modifying FreeRTOS Interrupt Priorities After Scheduler Initialization
@Marvee Amasi It seems like you might be encountering a couple of potential issues with how the NVIC priorities are being handled after the FreeRTOS scheduler starts. Here are a few things to consider: Priority Grouping - Ensure that the priority grouping configuration is consistent throughout your application. FreeRTOS typically sets its own priority grouping based on configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY defined in FreeRTOSConfig.h. Verify that your NVIC priority grouping set by HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4) aligns with this configuration. Interrupt Priorities and FreeRTOS - FreeRTOS uses interrupt priorities to manage its critical sections and task switching. Interrupts used within FreeRTOS (or any interrupts calling FreeRTOS APIs) should have priorities lower (numerically higher) than configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY. Ensure that the priority (11 in your case) falls within the acceptable range set by FreeRTOS. Task and Interrupt Context - When you call NVIC_GetPriority(DMA1_Channel4_IRQn) within the task, ensure that the DMA1_Channel4 interrupt is enabled and configured properly. Additionally, check if there are any other parts of your code or other tasks that might be modifying the NVIC priorities or reconfiguring the interrupt. Critical Sections - While using taskENTER_CRITICAL() and taskEXIT_CRITICAL() ensures thread safety, it doesn't necessarily guarantee that the priority of an interrupt won't be modified outside these critical sections by other parts of your application or by the hardware.
4 replies