Priority Group Setting for NVIC Cortex-M7

I am working on ARM Cortex M7 Microcontroller. I am currently working with NVIC module.

In my case, Priority Group is not getting set as required. By default __NVIC_PRIO_BITS macro is defined having value 3. This allows 2^3, i.e. 8 priority levels. But as per requirements, I require more priority levels for this I set the macro __NVIC_PRIO_BITS value as 5. I have attached screenshot for this .

Later I set priority group as 4. This assigns 3 bits for preemptive priority and 2 bits for subpriority.

Considering above configuration, when preemptive priority is set as 5 and sub priority as 1, the encoded priority comes out to be 21 which is as expected. But when SetPriority function is called, the priority set is 20. After multiple combinations of assigning different preemptive and sub priorities, it was concluded that only least significant 5 bits are not implemented and only 3 bits are used, i.e. default configuration, 3 bits for priority levels.

Any solution for this would be helpful

Thank You!

  • Atharva,

    I am wondering if this issue was ever resolved for you. Currently I am experiencing an issue with using HAL_Delay() which ends up in an infinite loop which I suspect is due to the SysTick timer not updating because the NVIC Priority won't update. I'm curious if my issue can be resolved through anything you've found out.