6
\$\begingroup\$

In ARM microcontrollers there is an peripheral called NVIC
(Nested Vectored Interrupt Controller).

What does the "nested" and "vectored" part refer to, or why is it "nested" and "vectored"?

\$\endgroup\$
11
\$\begingroup\$

In the old days, a CPU would have one, or maybe two interrupt lines. Maybe one would be Non Maskable Interrupt for critical things, the other shared for everything.

In this case, either an external peripheral, or just software checking lots of status registers would be used to determine the cause of the interrupt, and look up the location of the relevant handler.

Particularly in a real time system, time to get to the first real instruction of an interrupt handler is important, so Vectored Interrupt Controllers were introduced to provide the right address straight off to the processor, saving a few instructions.

The nested part allows for many interrupts to be enabled and assigned priorities. This automatically ensures that once an interrupt handler starts, it won't be interrupted by a new request, unless that request is even more important. This avoids a lot of the complication around enabling and disabling specific interrupts which could achieve the same thing.

A final feature of the M-class architectures is that since the stack push/pop is handled architecturally rather than in software, back to back exceptions are able to skip a redundant pop/push sequence - but this is nothing to do with the nested or vectored descriptions. Two exceptions at the same preemption level would tail-chain, if you had three at the same time then you would be able to chose the order of starting without needing to worry about one of them actually stopping an already running handler.

| improve this answer | |
\$\endgroup\$
5
\$\begingroup\$

Search the terms "nested interrupt", and "vectored interrupt".

Nested has to do with allowing interrupts to be serviced while other ISRs are executing as described by nxp in AN3496.pdf

2.1 Requirements Of Nested Interrupts

In a nested interrupt system, an interrupt is allowed to [occur] anytime and anywhere, even [when] an ISR is being executed. But, only the highest priority ISR will be executed immediately. The second highest priority ISR will be executed after the highest one is completed. The rules of a nested interrupt system are:

• All interrupts must be prioritized.

• After initialization, any interrupt is allowed to occur anytime and anywhere.

• If a low-priority ISR is interrupted by a high-priority interrupt, the high-priority ISR is executed.

• If a high-priority ISR is interrupted by a low-priority interrupt, the high- priority ISR continues executing.

• The same priority ISRs must be executed by time order.

"Vectored Interrupt" just means there is a pointer to an ISR

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ "Vectored" as opposed to the way ARM used to do interrupts — directly jumping to the interrupt vector, which would then contain a branch instruction. \$\endgroup\$ – Simon Richter Sep 7 '18 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.