AnsweredAssumed Answered

STM32F407 TIM1CC

Question asked by carrier.michael on Mar 12, 2017
Latest reply on Mar 13, 2017 by carrier.michael

I can't seem to get TIM1's CC channel 1 ISR to fire.

 

 FanTimerHandle.Instance =TIM1;

  memset(&sConfig, 0, sizeof(sConfig));
  /* Initialize TIMx peripheral as follow:
       + Period = 0xFFFF
       + Prescaler = 0
       + ClockDivision = 0
       + Counter direction = Up
  */
  FanTimerHandle.Init.Period = 0xFFFF;
  FanTimerHandle.Init.Prescaler = 512;
  FanTimerHandle.Init.ClockDivision = 0;
  FanTimerHandle.Init.CounterMode = TIM_COUNTERMODE_UP; 
  FanTimerHandle.Init.RepetitionCounter = 0;
  if(HAL_TIM_IC_Init(&FanTimerHandle) != HAL_OK)
  {
    /* Initialization Error */
    Error_Handler();
  }
 
  /* Configure the Input Capture of channel 1 */
  sConfig.ICPolarity    = TIM_ICPOLARITY_RISING;
  sConfig.ICSelection   = TIM_ICSELECTION_DIRECTTI;
  sConfig.ICPolarity    = TIM_ICPSC_DIV1;
  sConfig.ICFilter      = 0;
  if(HAL_TIM_IC_ConfigChannel(&FanTimerHandle, &sConfig, TIM_CHANNEL_1) != HAL_OK)
  {
    /* Configuration Error */
    Error_Handler();
  }

  /*##-4- Start the Input Capture in interrupt mode ##########################*/
  if(HAL_TIM_IC_Start_IT(&FanTimerHandle, TIM_CHANNEL_1) != HAL_OK)
  {
    /* Starting Error */
    Error_Handler();
  }
 

and GPIO :

__HAL_RCC_TIM1_CLK_ENABLE();
       
      /* Enable GPIO channels Clock */
      FAN_TIMER_CHANNEL_PORT();
     
      /* Configure  (TIMx_Channel) in Alternate function, push-pull and 100MHz speed */
      GPIO_InitStruct.Pin = GPIO_PIN_8;
      GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
      GPIO_InitStruct.Pull = GPIO_PULLUP;
      GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
      GPIO_InitStruct.Alternate = GPIO_AF1_TIM1;
      HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);

      /*##-2- Configure the NVIC for TIMx #########################################*/
      /* Sets the priority grouping field */
      HAL_NVIC_SetPriority(TIM1_CC_IRQn, 1, 1);
     
      /* Enable the TIM4 global Interrupt */
      HAL_NVIC_EnableIRQ(TIM1_cc_IRQn);

Outcomes