2023-10-26 07:16 AM
Good morning, I have some problems with interrupt priority on the STM32F429.
I set up a serial communication on UART1 with this priority
// USART
NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init ( &NVIC_InitStructure );
I also set a TIM1 timer with this priority.
// TIM1
NVIC_InitStructure.NVIC_IRQChannel = TIM1_UP_TIM10_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init (&NVIC_InitStructure);
Although the serial priority is greater than the timer priority, if I am executing the timer interrupt routine (lasting about 200usec), I have verified that when I receive data via serial at 57600,N,8,1 (and therefore a byte every 156us ) the data is lost because it does not enter the serial interrupt routine.
Why does this happen?
Thank you
Solved! Go to Solution.
2023-10-26 08:13 AM
> NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
The typical configuration has 4 bits for preemption and 0 bits for subpriority, which makes this setting invalid. Have you changed the defaults?
Perhaps show what NVIC_Init does. It's not a standard function as far as I can tell.
2023-10-26 08:13 AM
> NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
The typical configuration has 4 bits for preemption and 0 bits for subpriority, which makes this setting invalid. Have you changed the defaults?
Perhaps show what NVIC_Init does. It's not a standard function as far as I can tell.
2023-10-27 02:18 AM
I solved it by calling the function
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
before initialization!!
Thank you