Skip to main content
SA.17
Associate III
September 24, 2020
Question

HAL API sets NVIC priority from 0 to 3 only whereas rM0376 suggests otherwise

  • September 24, 2020
  • 1 reply
  • 872 views

I am using STM32L072

hence referring to reference manual RM0376

Page . 280 Table.53 suggests that priority can be from 0 till 38

but when try  

HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority)

as per help above that function i can set Preemptpriority only from 0-3 , subpriority is of no use for cortex m0+

if i put more than 3 ,it becomes 0

I am confused between reference manual and HAL

Which is correct ?

    This topic has been closed for replies.

    1 reply

    TDK
    September 24, 2020

    If you set the priority of all your interrupts to the same thing, the "priority" listed in the table is the order they'll fire in. These are built-in values which cannot be changed. It's just saying that if multiple interrupts are pending, and if they have the same priority level, the one with the lowest IRQ number will be executed first.

    It could definitely be written better, or at least clarified.

    "If you feel a post has answered your question, please click ""Accept as Solution""."
    SA.17
    SA.17Author
    Associate III
    September 25, 2020

    "If you set the priority of all your interrupts to the same thing, the "priority" listed in the table is the order they'll fire in. "

    Not the case cause i have already tried and uart and systicktimer stuck just because they have same priority.it only works if i change uart priority to a higher number .

    TDK
    September 25, 2020
    Well they aren't going to preempt each other if they have the same priority.
    "If you feel a post has answered your question, please click ""Accept as Solution""."