How do I change the interrupt priority so I could pass relevant assertions?

My platform: STM32WB55x series.

I’m calling ISR safe FreeRTOS APIs from TIM2’s ISR. It won’t pass

configASSERT( ( portAIRCR_REG & portPRIORITY_GROUP_MASK ) <= ulMaxPRIGROUPValue );


Now, it is abundantly clear that I’m calling this API from an ISR with a priority higher than configMAX_SYSCALL_INTERRUPT_PRIORITY, and that is problematic (why? I dunno)

the ucCurrentPriority is already at 0x00, given it’s STMicroelectronics, it means that it’s the highest priority, so I need to “downgrade” it by increasing its value.

What I’m trying to find out is that:

  1. Is it a good idea to lower the priority of TIM2, I assumed ucCurrentPriority is its priority.

  2. How do I lower the priority of TIM2?

Please help! Thanks in advance!

I think sooner or later you likely want to adjust the different interrupt priorities.
I’d recommend to read the FreeRTOS docs regarding RTOS for ARM Cortex-M .
Also e.g. Understanding priority levels of ISR and FreeRTOS APIs - #16 by aggarg contains a good and easy to understand explanation.
There are much more posts regarding interrupt priorities in the forum (search: configMAX_SYSCALL_INTERRUPT_PRIORITY)

Usually there a CMSIS API for the NVIC (on Cortex-M) including NVIC_SetPriority().

Hello Hartmut, thank you for your help.

I managed to find the register and set it manually. If direct operation on registers is a bad idea, please inform me.

Thank you once again.