How to select pwm interrupt rising or falling edge and perform action in Handler
I am trying to achieve gpio pin toggle in TIM_Handler() on pwm interrupt. Currently gpio is toggling after some delay of falling edge of pwm. But I am expecting to toggle gpio at each rising edge of pwm. please help me to achieve it.
My TIM Config for STM32F030R8 - MCU is as follows
>TIM16 Enabled in CubeMx
>Selected PWM Generation CH1 and CH1N
>Pulse Width 50%
>Selected TIM16 global interrupt
>Code Generated by CubeMX
>In main.c
>Added HAL_TIM_PWM_Start_IT(&htim16, TIM_CHANNEL_1);
>Added HAL_TIMEx_PWMN_Start_IT(&htim16, TIM_CHANNEL_1);
>In stm32f0xx_it.c under timer handler what I wrote is
void TIM16_IRQHandler(void)
{
GPIOA->BSRR = (uint32_t)GPIO_PIN_10;
HAL_TIM_IRQHandler(&htim16);
GPIOA->BRR = (uint32_t)GPIO_PIN_10;
}
Yellow is PWM and green is gpio toggle. You can see gpio toggles after PWM rising edge and some delay.

