cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 Unusual interrupt behaviour

AlexSmart
Senior
Posted on September 12, 2013 at 10:44

So, here the situation.

There is high priority asynchronous external interrupt and low priority systick interrupt. In EXTI handler I disable all interrupts and make pulse on test output 1 In SysTick - pulse on test output 0. And the weird part - on the logic analyser (drawing below).

0690X00000602poQAA.jpg

So in EXTI handler, with no interrupt enabled(!) Systick interrupt appears...

Piece of init code:

#define LOWPRIO 0xF0
#define HIGHESTPRIO 0x00
...
NVIC_SetPriorityGrouping(NVIC_PriorityGroup_2);
NVIC_SetPriority (SysTick_IRQn, LOWPRIO);
NVIC_SetPriority (EXTI3_IRQn, HIGHESTPRIO);
...

Asynchronous

external interrupt

void
EXTI3_IRQHandler(
void
)
{
__disable_fiq();
__disable_irq();
OUT1_PORT->ODR|=OUT1_PIN; 
// set test output 1
delay_ctr = 100;
while
(delay_ctr--);
ACK_VSYNC_EXTI;
OUT1_PORT->ODR&=~OUT1_PIN; 
// clear test output 1
__enable_fiq();
__enable_irq();
}

SysTick and RTX OS tick handlers

/*-------------------------- SysTick_Handler --------------------------------*/
__asm 
void
SysTick_Handler (
void
) {
PRESERVE8
#ifdef IFX_XMC4XXX
EXPORT SysTick_Handler_Veneer
SysTick_Handler_Veneer 
#endif
PUSH {R4,LR} ; Save EXC_RETURN
BL __cpp(rt_systick)
B Sys_Switch
ALIGN
}
/*--------------------------- rt_systick ------------------------------------*/
...
void
rt_systick (
void
) {
/* Check for system clock update, suspend running task. */
P_TCB next;
*((
volatile
unsigned 
int
*)0x40020C14) |= 0x0020; 
// set test output 0
os_tsk.run->state = READY;
rt_put_rdy_first (os_tsk.run);
/* Check Round Robin timeout. */
rt_chk_robin ();
/* Update delays. */
os_time++;
rt_dec_dly ();
/* Check the user timers. */
rt_tmr_tick ();
/* Switch back to highest ready task */
next = rt_get_first (&os_rdy);
rt_switch_req (next);
*((
volatile
unsigned 
int
*)0x40020C14) &= ~0x0020; 
// clear test output 0
}

#priority #stm32f4 #interrupts
1 REPLY 1
AlexSmart
Senior
Posted on September 17, 2013 at 14:41

It's obviously something wrong. All priorities in NVIC->IP and SCP->SHP are ok, but still I'm getting this wierd behaviour. And not only by SysTick. CAN interrupts causes same stuff...