cancel
Showing results for 
Search instead for 
Did you mean: 

systick priority

stm32f101
Associate II
Posted on March 07, 2008 at 12:49

systick priority

3 REPLIES 3
stm32f101
Associate II
Posted on May 17, 2011 at 12:26

Hi,

I'm using systick to run my 1mS housekeeping and have a problem with its priority. I want to have an external interrupt (PC7) run at a higher priority but when I look with a scope I'm not getting this. If the ext interrupt occurs during the systick interrupt I get a delayed ext int.

I have set the priorities up as follows.

/* Configure one bit for preemption priority */

NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);

/* Enable the EXTI9_5 Interrupt with Preemption Priority 0 and Sub Priority as 0 */

NVIC_InitStructure.NVIC_IRQChannel = EXTI9_5_IRQChannel;

NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;

NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;

NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

NVIC_Init(&NVIC_InitStructure);

/* Systick with Preemption Priority 0 and Sub Priority as 4 */

NVIC_SystemHandlerPriorityConfig(SystemHandler_SysTick, 0, 4);

What am I missing, any ideas?

--

Chris

lanchon
Associate III
Posted on May 17, 2011 at 12:26

hi,

I haven't studied the NVIC yet, but I think you use subpriorities in order to get exactly the behavior you are getting.

the idea (I think) is that:

-interrupts with a higher preemption priority will preempt (interrupt) the ISRs of interrupts with a lower preemption priority.

-interrupts within a specific preemption priority will not interrupt each other; subpriorities only select which interrupt is acknowledged when more than one interrupt within the preemption priority group is active at the time of selection. (this happens if more than one int becomes active at the same time (more or less the same time; see ''late arriving''), when ints are enabled, when the ISR of a higher preempt priority ends, etc)

it appears you'd have to use different preemption priorities.

stm32f101
Associate II
Posted on May 17, 2011 at 12:26

thanks to lanchon and sjo for replies.

I should have used pre-emptive priorities rather than sub-priorities.

--

Chris