Hi, I've been searching for two days now without any result so I post this message and hope that someone could help me.
I'm writing a program using ISR on the timer 0 and a button, on a processor ARM9 from ST with their libraries.
The problem is that, on one or other interupt, the ISR is accessed only once. If I jump to the TIM0 interupt it does not jump anymore to the TIM0 handler but neither to the EXTIT0 handler and vice versa.
here is my source code for the VIC configuration :
void Int_Configuration(void) { WIU_InitTypeDef WIU_InitStruct; /*Reset all Interupt module */ VIC_DeInit(); WIU_DeInit(); VIC_InitDefaultVectors(); /* Init interupt on port 3.5 */ WIU_InitStruct.WIU_Line = WIU_Line5; WIU_InitStruct.WIU_TriggerEdge = WIU_FallingEdge; WIU_Init(&WIU_InitStruct); /*Select line VIC 1.10 interrupt*/ VIC_Config(EXTIT0_ITLine,VIC_IRQ,1); /*select line EXINT5 (port3.5, push button S2)*/ SCU_WakeUpLineConfig(0x05); /* Init interupt on timer 0 */ /*Select line TIMER 0 interrupt*/ VIC_Config(TIM0_ITLine,VIC_IRQ,0); /*Enable interupts on line VIC 1.10 and timer 0*/ VIC_ITCmd(EXTIT0_ITLine, ENABLE); VIC_ITCmd(TIM0_ITLine, ENABLE); }
before this I have the timer0 configuration which execute this code :
void TMR_Configuration() { TIM_InitTypeDef TIM_InitStructure; /* Reset the timer */ TIM_DeInit(TIM0); /* Set all parameters */ TIM_InitStructure.TIM_Mode = TIM_OCM_CHANNEL_1; TIM_InitStructure.TIM_OC1_Modes = TIM_TIMING; TIM_InitStructure.TIM_Clock_Source = TIM_CLK_APB; TIM_InitStructure.TIM_Prescaler = 0xF3; /* one tic is 1/(48MHz / (243 + 1)) = 5,083333 µs */ TIM_InitStructure.TIM_Pulse_Length_1 = 0xFFFB; /* counter until 65535, interupt each 0,33313625 s */ /* Init the timer*/ TIM_Init (TIM0, &TIM_InitStructure); /*Enable TIM1 Output Compare1 interrupt*/ TIM_ITConfig(TIM0, TIM_IT_OC1, ENABLE); }
and here are those two handlers : - TIM0 one :
void TIM0_IRQHandler(void) { static u8 counter = 0; static u8 counter2 = 0; TIM_CounterCmd(TIM0, TIM_STOP); /* Reset TIM0 Counter*/ TIM_CounterCmd(TIM0, TIM_CLEAR); counter ++; if(counter == 3) /* one seconde reached */ { counter2++; counter = 0; if(counter2 == CAL_DFLT_TIMEOUT) /* Timeout reached */ { counter2 = 0; CAL_SET_EVENT(CAL_TIMEOUT_FLAG); } } /* clear Output Compare 1 flag*/ TIM_ClearFlag(TIM0, (TIM_FLAG_OC1 | TIM_FLAG_OC2 | TIM_FLAG_TO)); /* Restart TIM0 Counter*/ TIM_CounterCmd(TIM0, TIM_START); VIC0->VAR = 0; /* Update priority hardware */ VIC1->VAR = 0; }
- EXTINT0 one :
void EXTIT0_IRQHandler(void) { lcd_clear(); lcd_print("button Interupt"); CAL_SET_EVENT(CAL_BUTTON_FLAG); /* Put the button flag */ WIU_ClearFlag(WIU_Line5); /* Clear the Interupt flag */ VIC0->VAR = 0x00; /* Update priority hardware */ VIC1->VAR = 0x00; }
I've checked the registers and each time the flags are well cleared and set on the second interupt but the program does not jump to the ISR.
Thank you for your help.