cancel
Showing results for 
Search instead for 
Did you mean: 

How long does it take to call the interrupt function of comparator?

GChun.1
Associate

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 ?

1 REPLY 1

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​