0
\$\begingroup\$

Assuming I set an external GPIO interrupt to highest priority, how many cycles does an STM32F0 MCU take to:

  • start executing the interrupt handler code
  • return from the interrupt

I expect that the answers will be ranges, but I might be wrong.

Will these two figures, plus the time my interrupt handler code takes to execute, equal the number of cycles "stolen" from the main loop?

asked Nov 6, 2018 at 9:20
\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

Look at the exception entry timing diagram on this page. Stacking

Entering the ISR on an Cortex M3 uses 12 clock cycles. For your ARM core and for leaving the ISR, maybe you can find a similar diagram.

The "stolen" cycles should equal all cycles used for entering, executing and leaving your ISR.

Chris Stratton
33.8k3 gold badges45 silver badges92 bronze badges
answered Nov 6, 2018 at 9:27
\$\endgroup\$
2
  • \$\begingroup\$ It this in fact perfectly deterministic? Ie, that no contention for internal data paths or resources could extend this? What about if the ISR or vector table is located in RAM (or merely the required stack operations), and DMA is also trying to access RAM? It may be that it is deterministic, but it's something that needs to be considered when asking this about a modern architecture. \$\endgroup\$ Commented Nov 6, 2018 at 14:32
  • \$\begingroup\$ You are right. These are all parameters which can influence the timing. But I don't think you have designed a robust system if you have to go into such details. \$\endgroup\$ Commented Nov 6, 2018 at 15:26

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.