cancel
Showing results for 
Search instead for 
Did you mean: 

NVIC and Piority Grouping in STM32 after reset

sholojda
Associate III

Hi.

I have in my hand Nucleo with STM32F103 (old uC but to understand grouping newer is not needed).

In Programming Manual PM0056 on page 134 and 135 I can see a SC_AIRCR register which on PRIGROUP field at reset are all zeros, but on next page in table 45 Piority grouping PRIGROUP [2:0] walues that can be written into this filds are only b011, b100, b101, b110 and b111.

How to undestand this?

5 REPLIES 5
Danish1
Lead II

My guess is that this error in documentation was only spotted (and fixed) on more modern versions of the manual. For example PM0214 Rev 8 (stm32f4) shows 0b0xx gives group priority bits 7:4, not just 0b011

Check ARM TRM or simply print them out to confirm.

Expect they reset to zero, but shouldn't be hard to determine or to set to what you actually want / need.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
sholojda
Associate III

I have read ARM TRM and according to that if PRIGROUP is b000 number of pre-emptition piorities should be 128 and 2 subprorities but STM32 has only 16 levels so there is something wrong?!

Pavel A.
Evangelist III

"Implementations having fewer than 8-bits of interrupt priority treat the least significant bits as zero."

STM32's have 4 bits of interrupt priority which gives at most 16 preemption levels, 0-15 and no sub-priorities. This is the default mode of ST HAL library.

You can select less than 4 bits of preemption then remaining bits will be used for sub-priority.

Many ST examples use priority value 0 or (0, 0) - it will work with any PRIGROUP value, valid or not, even all zeros.

Piranha
Chief II

The default reset value already makes all 16 levels as group (preemption) priorities. Just do not change it...