Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
NuMicro@nuvoton.com
Cortex-M0 performance
Interrupts
Peripherals
Supports byte (8-bit), halfword (16-bit) and word (32-bit) data types, each must be accessed with natural alignment.
Exception Model
An exception may be an interrupt or a hardware error Each exception has exception number, priority number and vector address
Vector address Vector table base address is fixed at 0x00000000
Word 0 Word 1 Word 2 Initial value of stack Vector address of exception 1 Vector address of exception 2 0x00000000
Vector Table
Exception
Reset NMI HardFault SVCall PendSV SysTick External Interrupt (0) External Interrupt (31)
Priority level
-3 -2 -1 configured by register SHPR2 configured by register SHPR3 configured by register SHPR3 configured by register NVIC_IPRx configured by register NVIC_IPRx
10
11
Code
Typically ROM or flash memory, WT Typically used for on-chip RAM, WBWA
SRAM
Peripheral
on-chip peripheral, XN
System
Note 1 : Event entry points (vectors), system control, and configuration are defined at physical addresses Note 2 : A multi-word access which crosses a 0.5GB address boundary is UNPREDICTABLE
13
0xE000E000 - 0xE000E00F
0xE000E010 - 0xE000E0FF
0xE000E100 - 0xE000ECFF 0xE000ED00 - 0xE000ED8F 0xE000EDF0 - 0xE000EEFF
15
Name
ACTLR CPUID ICSR VTOR AIRCR SCR CCR SHPR2 SHPR3
Function
Auxiliary Control Register CPUID Register Interrupt Control State Register Vector Table Offset Register Application Interrupt/Reset Control Register System Control Register (optional) Configuration and Control Register System Handler Priority Register 2 System Handler Priority Register 3
Type
R/W RO R/W RO R/W R/W RO R/W R/W
Reset Value
IMPLEMENTATION DEFINED IMPLEMENTATION DEFINED 0x00000000 0x00000000 bits [10:8] = 000 bits [4,2,1] = 000 bits [9,3] = 1 SBZ SBZ
0xE000ED24
0xE000ED30
SHCSR
DFSR
R/W
R/W
0x00000000
0x00000000
16
17
CPU clock
Reference clock
external clock
Reload counter
18
0xE000E014
0xE000E018 0xE000E01C
SYST_RVR
SYST_CVR SYST_CALIB
R/W
R/W RO
UNKNOWN
UNKNOWN IMP DEF
19
20
21
21
The processor state is automatically saved on interrupt entry, and restored on interrupt exit Fewer cycles than a software implementation, significantly enhancing performance in low MHz systems
22
22
NVIC immediately fetches a new vector address to service the pending interrupt Provide deterministic response to these possibilities with support for late arrival and pre-emption
23
23
Traditional MCU
NuMicro
Abandon a stack Pop if an exception arrives and service the new interrupt immediately. Achieve lower latency in a deterministic manner by preempting and switching to the second interrupt without completing the state restore and save
24
24
interrupt 0 : Interrupt 31
Interrupt number
NVIC
Cortex-M0
Exception number
Exception 1 Exception 2
Exception 47
System interrupts
Vector Table 25
NVIC cont.
NVIC registers
Address
0xE000E100 0xE000E180 0xE000E200 0xE000E280 0xE000E400 0xE000E404 0xE000E408 0xE000E40C 0xE000E410 0xE000E414 0xE000E418 0xE000E41C
Name
NVIC_ISER NVIC_ICER NVIC_ISPR NVIC_ICPR NVIC_IPR0 NVIC_IPR1 NVIC_IPR2 NVIC_IPR3 NVIC_IPR4 NVIC_IPR5 NVIC_IPR6 NVIC_IPR7
Function
Irq 0 to 31 Set-Enable Register Irq 0 to 31 Clear-Enable Register Irq 0 to 31 Set-Pending Register Irq 0 to 31 Clear-Pending Register Irq 0 to 3 Priority Register Irq 4 to 7 Priority Register Irq 8 to 11 Priority Register Irq 12 to 15 Priority Register Irq 16 to 19 Priority Register Irq 20 to 23 Priority Register Irq 24 to 27 Priority Register Irq 28 to 31 Priority Register
Type
R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
Reset Value
0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
26
NVIC cont.
Interrupt Set-Enable and Clear-Enable Registers
NVIC_ISER : write 1 to enable interrupt NVIC_ICER : write 1 to disable interrupt
27
Thanks
29