AnsweredAssumed Answered

Using a timer interrupt on the F7 discovery

Question asked by te_winkel.rik on Oct 16, 2015
Hello,

A bit of a beginner question here.
I want to have a timer interrupt to trigger every x mS.
This is the code I've made so far but it's not triggering any interrupt.

int uwPrescalerValue = (uint32_t) ((SystemCoreClock /2) / 10000) - 1;
    htim3.Instance = TIM3;
    htim3.Init.Prescaler = uwPrescalerValue;
    htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
    htim3.Init.Period = 100;
    htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
    if(HAL_TIM_Base_Init(&htim3) != HAL_OK)
      {
        while(1)
        {
        }
      }

    if(HAL_TIM_Base_Start_IT(&htim3) != HAL_OK)
      {
        while(1)
        {
        }
      }

    __HAL_RCC_TIM3_CLK_ENABLE();

      /* Set the TIMx priority */
      HAL_NVIC_SetPriority(TIM3_IRQn, 0, 1);

      /* Enable the TIMx global Interrupt */
      HAL_NVIC_EnableIRQ(TIM3_IRQn);

Am I missing something to enable the timer interrupt here?

Best regards,

Rik

Outcomes