2023-06-04 10:48 PM
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?
2023-06-05 04:27 AM
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
2023-06-05 04:37 AM
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.
2023-06-05 05:09 AM
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?!
2023-06-05 06:00 AM
"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.
2023-06-06 02:28 PM
The default reset value already makes all 16 levels as group (preemption) priorities. Just do not change it...