cancel
Showing results for 
Search instead for 
Did you mean: 

Interrupt priority in STM32F429

gerson74
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

> 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.

 

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

2 REPLIES 2
TDK
Guru

> 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.

 

If you feel a post has answered your question, please click "Accept as Solution".
gerson74
Associate II

I solved it by calling the function

NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);

before initialization!!

Thank you