SLAU846A June 2023 – October 2023 MSPM0G1105 , MSPM0G1106 , MSPM0G1107 , MSPM0G1505 , MSPM0G1506 , MSPM0G1507 , MSPM0G3105 , MSPM0G3105-Q1 , MSPM0G3106 , MSPM0G3106-Q1 , MSPM0G3107 , MSPM0G3107-Q1 , MSPM0G3505 , MSPM0G3505-Q1 , MSPM0G3506 , MSPM0G3506-Q1 , MSPM0G3507 , MSPM0G3507-Q1
The nested vectored interrupt controller (NVIC) is an industry-standard Arm component which interfaces peripheral interrupts (which are external to the processor) into the CPU. The NVIC supports connection of up to 32 native peripheral interrupt sources.
The NVIC is configured through memory-mapped registers in the system private peripheral bus (PPB) region. See Table 3-8 for the list of NVIC registers. The software development kit (SDK) provided with the devices supports the standard Arm Cortex Microcontroller Software Interface Standard (CMSIS) register access definitions for the NVIC. Application software must use 32-bit aligned, word-size transactions when accessing any NVIC register.
In addition to interfacing peripheral interrupts to the processor, the NVIC also supports programmable priority for each interrupt.
Peripheral interrupt enables can be read, set, and cleared through the interrupt set-enable (ISER) and interrupt clear-enable (ICER) registers in the NVIC. The 32 interrupts are mapped to the ISER and ICER registers with interrupt zero in the BIT0 position (LSB) and interrupt 31 in the BIT31 position (MSB) of each register. To enable an interrupt, set the corresponding enable bit in the ISER register. Writing a '0' to ISER has no effect. It is possible to read the ISER register to determine which interrupts are enabled. Upon a read, a '1' indicates that an interrupt is enabled; a '0' indicates disabled. To disable an interrupt, set the corresponding enable bit in the ICER register. Writing a '0' to ICER has no effect.
In the event that an interrupt is disabled in the NVIC, if the interrupt is asserted by the corresponding peripheral then the NVIC interrupt will go to a pending state but the processor is not interrupted. If an interrupt is disabled when in an active state (when a handler is running) it will remain active until the exception handler returns or a reset occurs, but no further activations will happen.
Pending interrupt status can be read, set, and cleared through the interrupt set-pending (ISPR) and interrupt clear-pending (ICPR) registers in the NVIC. The 32 interrupts are mapped to the ISPR and ICPR registers with interrupt zero in the BIT0 position (LSB) and interrupt 31 in the BIT31 position (MSB) of each register. To read if an interrupt is pending, read either the ISPR or the ICPR. Upon a read, a '1' indicates that an interrupt is pending; a '0' indicates not pending. To set an interrupt to a pending state through software, set the corresponding bit in the ISPR register. Writing a '0' to ISPR has no effect. To clear an interrupt pending state, set the corresponding bit in the ICPR register. Writing a '0' to ICPR has no effect. Note that if a peripheral interrupt condition is still present, the pending state will be set again by hardware even if it is cleared.
Interrupts on the NVIC have programmable priority. There are four priority levels possible. Priority is set by programming the eight IPRx registers in the NVIC. Each priority field is 8 bits in length, and the priority for 4 interrupts is configured per 32-bit register. The Arm Cortex-M0+ only implements the most significant 2 bits of each 8-bit priority field (giving the 4 priority levels). Lower priority values have higher priority. System exceptions (reset, NMI, hard fault) have fixed priorities of -3, -2, and -1, respectively. As such, these exceptions always have higher priority than peripheral interrupts. Peripheral interrupt priorities are programmable as 0, 64, 128, or 192, with 0 being highest priority and 192 being lowest priority.
If the processor is currently handling an exception, it can only be preempted by a higher priority exception. In the event that there are multiple exceptions in a pending state which all have the same priority level assigned, the exception with the lowest exception number is taken first.
Address | Register | CMSIS | Description |
---|---|---|---|
0xE000.E100 | NVIC_ISER | NVIC->ISER[0] | Interrupt set-enable register |
0xE000.E180 | NVIC_ICER | NVIC->ICER[0] | Interrupt clear-enable register |
0xE000.E200 | NVIC_ISPR | NVIC->ISPR[0] | Interrupt set-pending register |
0xE000.E280 | NVIC_ICPR | NVIC->ICPR[0] | Interrupt clear-pending register |
0xE000.E400 | NVIC_IPR0 | NVIC->IP[0] | Interrupt priority register (0-3) |
0xE000.E404 | NVIC_IPR1 | NVIC->IP[1] | Interrupt priority register (4-7) |
0xE000.E408 | NVIC_IPR2 | NVIC->IP[2] | Interrupt priority register (8-11) |
0xE000.E40C | NVIC_IPR3 | NVIC->IP[3] | Interrupt priority register (12-15) |
0xE000.E410 | NVIC_IPR4 | NVIC->IP[4] | Interrupt priority register (16-19) |
0xE000.E414 | NVIC_IPR5 | NVIC->IP[5] | Interrupt priority register (20-23) |
0xE000.E418 | NVIC_IPR6 | NVIC->IP[6] | Interrupt priority register (24-27) |
0xE000.E41C | NVIC_IPR7 | NVIC->IP[7] | Interrupt priority register (28-31) |