2022-05-08 02:53 PM
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)
2022-05-08 03:37 PM
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);
}
}
2022-05-08 04:48 PM
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?
2022-05-08 07:16 PM
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.