cancel
Showing results for 
Search instead for 
Did you mean: 

Output Compare Interrupt on TIM16 STM32WB55

SWenn.1
Senior III

I am trying to use CubeMX to set up an Output Compare Interrupt on TIM16 of STM32WB55. I do not want anything to go to an output pin I just want to generate an interrupt....Can someone tell me where I set the switch that allows this interrupt as I don't see it anywhere within the module under NVIC??? Secondly do I care about the Output Mode if I am not using an output pin??? (Not sure what Frozen means here if so)

3 REPLIES 3

Well from a HAL perspective if the GPIO doesn't route to the TIM16 AF nothing will be exposed externally.

The TIM16 interrupts with go to TIM1_UP_TIM16_IRQHandler , and then you'd call the HAL's call-in function,which in turn would call your call-back

void TIM1_UP_TIM16_IRQHandler(void)
{
  //HAL_TIM_IRQHandler(&htim1); // If using
  HAL_TIM_IRQHandler(&htim16);
}
void HAL_TIM_OC_MspInit(TIM_HandleTypeDef* htim_oc)
{
  if (htim_oc->Instance==TIM16)
  {
    /* Peripheral clock enable */
    __HAL_RCC_TIM16_CLK_ENABLE();
...
    /* TIM16 interrupt Init */
    HAL_NVIC_SetPriority(TIM1_UP_TIM16_IRQn, 0, 0);
    HAL_NVIC_EnableIRQ(TIM1_UP_TIM16_IRQn);
  }
}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
SWenn.1
Senior III

Thank you for your response but I still don't see the picture

I don't see a mechanism on enabling the IRQ within CubeMx...

.

I have TIM16 go off every one second using HAL_TIM_PeriodElapsedCallback. After this goes off my code does some work (turns some switches on and takes A/Ds).....The issue is when I turn the switches on a current surge creates a dip in voltage and the A/Ds are reading their value prematurely.....What I would like to do is turn the switches on and enable the CCR IRQ to act as a delay until the voltage settles then take the A/Ds. I know the settling time based on an oscilloscope. I don't know how to use the CubeMX Output Compare No Output nor do I see anywhere that I set a switch to enable the CCR IRQ (see pic below)....How do I set this up?

0693W00000NpZquQAF.png

Sorry I'm more of a coder..

Is it being used for the RTOS instead of SysTick?

I'd try with a small test app, prove it works, and if CubeMX is still broken, file a ticket against it.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..