Skip to main content
sholojda
Associate III
Jun 5, 2023 5:48 AM UTC
Question

NVIC and Piority Grouping in STM32 after reset

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?

This topic has been closed for replies.

5 replies

Danish1
Lead III
Jun 5, 2023 11:27 AM UTC

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

Tesla DeLorean
Guru
Jun 5, 2023 11:37 AM UTC

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
sholojda
sholojdaAuthor
Associate III
Jun 5, 2023 12:09 PM UTC

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.
Jun 5, 2023 1:00 PM UTC

"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
Principal III
Jun 6, 2023 9:28 PM UTC

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