2008-03-07 03:49 AM
systick priority
2011-05-17 03:26 AM
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? -- Chris2011-05-17 03:26 AM
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.2011-05-17 03:26 AM
thanks to lanchon and sjo for replies.
I should have used pre-emptive priorities rather than sub-priorities. -- Chris