AnsweredAssumed Answered

Iterrupt handlers don't compile

Question asked by APod on Jul 9, 2016
Latest reply on Jul 10, 2016 by Clive One
I'm writing code for STM32F4.
I'm trying to set interrupt handler for TIM1 which is configured as PWM1 output.
The timer itself works, but I'm unable to configure the interrupt handler
static void initTimer(void){
     TIM_TimeBaseInitTypeDef TIM_BaseStruct;


     TIM_BaseStruct.TIM_Prescaler = (APBx_FREQ/CNT_FREQ) - 1;
    TIM_BaseStruct.TIM_CounterMode = TIM_CounterMode_Up;
    TIM_BaseStruct.TIM_ClockDivision = TIM_CKD_DIV1;
    TIM_BaseStruct.TIM_RepetitionCounter = 0;

    TIM_TimeBaseInit(MOTOR_TIM, &TIM_BaseStruct);


static void initPWM(void)
    TIM_OCInitTypeDef TIM_OCStruct;

    /* PWM mode 1 = Set on compare match */
    TIM_OCStruct.TIM_OCMode = TIM_OCMode_PWM1;
    TIM_OCStruct.TIM_OutputState = TIM_OutputState_Enable;
    TIM_OCStruct.TIM_OutputNState = TIM_OutputNState_Enable;
    TIM_OCStruct.TIM_OCPolarity = TIM_OCPolarity_High;
    TIM_OCStruct.TIM_OCNPolarity = TIM_OCNPolarity_Low;
    TIM_OCStruct.TIM_OCIdleState = TIM_OCIdleState_Set;
    TIM_OCStruct.TIM_OCNIdleState = TIM_OCNIdleState_Reset;



static void initInterrupt(void){
    NVIC_InitTypeDef nvic_init;


    nvic_init.NVIC_IRQChannel                   = TIM1_UP_TIM10_IRQn;
    nvic_init.NVIC_IRQChannelPreemptionPriority = 0;
    nvic_init.NVIC_IRQChannelSubPriority        = 1;
    nvic_init.NVIC_IRQChannelCmd                = ENABLE;
    NVIC_Init(&nvic_init);/* enables the device and sets interrupt priority */

    TIM_ClearITPendingBit(MOTOR_TIM, TIM_IT_Update);



void MotorDriver_Init(void){
     RCC_ClocksTypeDef rccClocks;

     APBx_FREQ = rccClocks.PCLK2_Frequency * 2;


void MotorDriver_Isr(void)
    if (TIM_GetITStatus(MOTOR_TIM, TIM_IT_Update) != RESET)  {

          if (number_of_steps > 0) {
               if(number_of_steps == 0){
                    TIM_ITConfig(MOTOR_TIM,TIM_IT_Update, DISABLE);
          TIM_ClearITPendingBit(MOTOR_TIM, TIM_IT_Update);


void TIM1_UP_TIM10_IRQHandler(void)

When I run the code it executes without any errors/warnings, but I'm unable to set breakpoints in the handler or Driver_Isr. After all the configurations it jumps to the HardFault handler. If I disable the interrupt configuration, everything else works fine. It seems to me like the firmware is just unable to jump to the handler code.
I also cannot see anything about the handler in the map file. I re verified that the vector address and handler definitions are correct in the startup and stm32f4xx.h files.
The systick interrupt seems to be working fine. Any other handler I tried to configure introduced similar behavior 

What am I doing wrong/missing?