Skip to main content
GChun.1
Visitor II
May 23, 2022
Question

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

  • May 23, 2022
  • 1 reply
  • 829 views

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 ?

This topic has been closed for replies.

1 reply

waclawek.jan
Super User
May 30, 2022

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​