2019-06-30 01:12 AM
i have enable three usarts, USART1 AND usart2 enabled tx rx idle. usart3 is just output log
if i set SCB_AIRCR = (0x05FA0000 | 0x500); // group 2 ,
(*(volatile uint8_t*)0xE000E425) = 0x00; // usart1 IPR
// set a low priority
// NVIC_IPR9 usart2
(*(volatile uint8_t*)0xE000E426) = 0xe0; // 38
Q1: is it ok?
Q2: just need set group priority one time within one program?
2019-06-30 01:33 AM
As priority grouping configures interrupt processing, normally it is set once before any interrupts are enabled.
Why don't You use NVIC_SetPriorityGrouping(), NVIC_SetPriority() and other NVIC_***() functions provided by ARM in CMSIS?
2019-06-30 08:59 AM
I think the NVIC is well covered in CM4 TRM and supporting materials.
The problems are generally of constant re-entry if the source is not cleared or disabled. And re-entry due to late clearing of the source.
Routines need to do very little and leave. If you are doing complex processing in this or other interrupts, or by proxy the callback functions of HAL, it is very easy to lose interrupts/data.
The NVIC will schedule interrupts sharing a common pre-emption level at the tail-chaining point.
Interrupts that are important need to preempt.
Group setting is typically done once, and globally.
2019-07-01 05:32 PM
im in RTEMS OS
2019-07-01 05:46 PM
thanks! group 2 is a common value?
2019-07-03 01:11 AM
That doesn't forbid using CMSIS-Core headers.
2019-07-03 01:26 AM
The most common value is the one after reset (0b000), which sets all priorities to preemption and no subpriorities.