AnsweredAssumed Answered

why is my interrupt not working???

Question asked by penafiel.joseph on Sep 10, 2015
Latest reply on Sep 10, 2015 by Ian Legg
hello,

I've been trying to blink an led using an overflow interrupt with timer 4 on the sm8l discovery board. So far I haven't made it work. I'm currently using IAR Embedded Workbench with the Std library for stm8l. 
I need help. 


here's what I'm trying to do:

here's the main.c
#include "stm8l15x.h"
 
 
void timer4_init(void){
  TIM4_DeInit();
  CLK_PeripheralClockConfig(CLK_Peripheral_TIM4, ENABLE);
  TIM4_TimeBaseInit(TIM4_Prescaler_8, 100);
  TIM4_ITConfig(TIM4_IT_Update, ENABLE);
}
 
 
int main(void) {
   
  timer4_init();
   
 GPIO_Init(GPIOC, GPIO_Pin_7, GPIO_Mode_Out_PP_High_Fast); 
 enableInterrupts();
  
   
  while(1){
     
   
}
 
}


and the interrupt handler is in the stm8l15x_it.c, I've also included in this file the stm8l15x.h header file.
INTERRUPT_HANDLER(TIM4_UPD_OVF_TRG_IRQHandler,25)
{
    /* In order to detect unexpected events during development,
       it is recommended to set a breakpoint on the following instruction.
    */
   GPIO_ToggleBits(GPIOC, GPIO_Pin_7);
    
   TIM4_ClearITPendingBit(TIM4_IT_Update);
   
}


What am I doing wrong?


thanks in advance

Outcomes