2022-05-22 08:04 PM
I tested with NUCLEO-F303ZE (72Mhz clock).
I checked the time when comparator makes interrupt as below
------------------------------------------------------------------------------------
void COMP7_IRQHandler(void)
{
DRV_GPIO_Port->BSRR = (uint32_t)DRV_Pin;
DRV_GPIO_Port->BRR = (uint32_t)DRV_Pin;
HAL_COMP_IRQHandler(&hcomp7);
}
------------------------------------------------------------------------------------
I found that it almost takes 600ns.
Did I have a mistake or Its is normal ?
2022-05-30 04:08 PM
Doesn't sound much out of ordinary. Interrupts in 32-bit mcu have significant overhead. In Cortex-M4 the minimum ISR entry is 12 cycles, plus there is the C function prologue (which may be worsened by FLASH and RAM latency) and any setup needed to perform the GPIO writes.
Have you tried to play with compiler optimizations?
JW