COM update interrrupt is delayed 1.3us
Hi,
i am trying to figure out, why this interrupt is delayed that much.
The com trigger comes from timer 1, which works as expected. Also the delay here is as expected too (apart from a 50ns deviation). There is a delay of 1.3us, from the time i can observe, that the com trigger has successfully triggered a loading of the registers in timer 8, to the time i can observe, that the com interrupt of timer8 has been fired.
This is my timer 1 interrupt, that preloads the values for CCR2 which causes the com trigger:
void TIM1_CC_IRQHandler(){
GPIOC->BSRR = (uint32_t) GPIO_PIN_3;
TIM1->CNT = 0;
unsigned long captValue = TIM1->CCR1;
lastHallIntervalTics = captValue - lastHallSignalTics; // calc interval
lastHallSignalTics = captValue;
WRITE_REG(TIM1->CCR2, NS_TO_TIM1_CLOCK(500));//lastHallIntervalTics)); // Delay value for PWM change trigger
switchNextState();
}
This is the com interrupt with PC3 beeing the testsignal:
void TIM8_TRG_COM_IRQHandler(){
GPIOC->BRR = (uint32_t) GPIO_PIN_3;
TIM8->SR = ~TIM_SR_COMIF; // DONT send "&=" ReadModifyWrite is bad!
switchNextState();
}
Find attached the picture
