You are on page 1of 7

NVIC : NESTED

VECTOR INTERRUPTS
CONTROLLER
MUHAMMAD ELZEINY
EXCEPTION ENTRY AND RETURN
• When the processor takes an exception, the
processor pushes the stack frame (eight data
words)
• In parallel the processor performs a vector fetch i.e.
read the exception handler address.
• When stacking is complete the processor starts
executing the exception handler.
• At the same time, the processor writes an
EXC_RETURN value to the LR
• When the exception is complete the EXC_RETURN
loaded into the PC

• The EXC_RETURN lowest five bits provides


information of
• return stack (Process\main)
• processor mode(Handler\Thread).
• EXC_RETURN bits 31:5 are all set.

2
LEVEL-SENSITIVE AND PULSE INTERRUPTS

• Interrupt signal sampled synchronously on the rising edge of


LEVEL-SENSITIVE INTERRUPT the processor clock.
• the NVIC continues to monitor the interrupt signal, and if
this is pulsed the state of the interrupt changes to pending
• Interrupt signal is held asserted until the peripheral and active. In this case, when the processor returns from the
de-asserts the interrupt signal. ISR the state of the interrupt changes to pending, which
might cause the processor to immediately re-enter the ISR.
• Typically this happens because the ISR accesses the
peripheral, causing it to clear the interrupt request. • If the interrupt signal is not pulsed while the processor is in
the ISR, when the processor returns from the ISR the state
• if the signal is not de-asserted before the processor
of the interrupt changes to inactive.
returns from the ISR, the interrupt becomes
pending again, and the processor must re-enter its
ISR again. PULSE INTERRUPT (EDGE-
TRIGGERED )
NOTE: When the processor enters the ISR, it automatically removes
the pending state from the interrupt – The state will become
pending again if the clear-pending register bit is not cleared.

3
FEATURES

• 78 interrupts.
• A programmable priority level of 0-7 for each interrupt.
• Low-latency exception and interrupt handling.
• Level and pulse detection of interrupt signals.
• Grouping of priority values into group priority and subpriority fields.
• Interrupt tail-chaining and late arriving mechanism.
• An external Non-maskable interrupt (NMI).

4
GROUPING OF PRIORITY
• The NVIC can assign each interrupt to
Group and sub-group
• If the pending\active interrupts have
different Group priority → The higher will
serve\preempt first.
• If the pending interrupts have different
sub-Group priority → the higher one will
be served first (but can’t preempt the
active one)
• If the pending interrupts have the same
Group and sub-group priority → the first
ordered in vector table will be served first
(but can’t preempt the active one)

5
GROUP ACTIVITY

• Which registers shall be used to do the followings


1. Enable\Disable NVIC gate for each Interrupt.
2. Assign Group\SubGroup priority for each Interrupt.
• Design generic driver to execute the previous services.

6
#TASK – INTCTR DRIVER

• API: Types • Configuration


• IntCtr_InterruptType • InterruptPripheralGates
• Interrupt Group Priority
• API: Functions
• Interrupt Sub-Group Priority
void IntCtr_init(void)

You might also like