|
在STM32中用到了Cortex-M3定义的三组寄存器,有关这三组寄存器的说明不在STM32的技术手册中,需要参考ARM公司发布的Cortex-M3 Technical Reference Manual (r2p0)。 在STM32的固件库中定义了三个结构体与这三个寄存器组相对应,这三个结构体与ARM手册中寄存器的对应关系如下: 一、NVIC寄存器组 STM32的固件库中有如下定义: - \& G/ G3 l6 F( q typedef struct; g& o- _! _- `: H% e1 |: c { vu32 ISER[2];* b. X0 @& Q5 ? u32 RESERVED0[30];3 n9 l/ o* x% ?9 D vu32 ICER[2];3 N0 c1 k$ }" @, O$ N) n7 W2 O u32 RSERVED1[30]; vu32 ISPR[2];' y8 K( x I6 E' ], J u32 RESERVED2[30]; vu32 ICPR[2];! ]; r2 j, B+ M. f0 R u32 RESERVED3[30]; vu32 IABR[2];3 \; N/ |3 K! w9 ~ u32 RESERVED4[62];# X( x2 n8 f: d4 C. d* Q/ t% r vu32 IPR[11];7 S* D' g3 Z, B, s; ?8 _ } NVIC_TypeDef; 它们对应ARM手册中的名称为 ISER = Interrupt Set-Enable Registers( c+ W8 \( \4 I6 j: T! W5 N ICER = Interrupt Clear-Enable Registers/ G1 c; J* N: I3 u& e ISPR = Interrupt Set-Pending Register7 g# r( d& z* X( C T$ E3 q ICPR = Interrupt Clear-Pending Register IABR = Active Bit Register" r# O# ~" `" t& l# c. G IPR = Interrupt Priority Registers 8 k; \8 y ~: p4 w! j7 s% n 每个寄存器有240位,以Interrupt Set-Enable Registers说明,ISER[0]对应中断源0~31,ISER[1]对应中断源32~63,STM32只有60个中断源,所以没有ISER[2:7]。 # t$ e$ C: ?+ v6 L6 b! R; ^ 参考STM32技术参考手册中的中断向量表,中断源的位置为: 位置0 - WWDG = Window Watchdog interrupt 位置1 - PVD = PVD through EXTI Line detection interrupt 位置2 - TAMPER = Tamper interrupt7 _# A) h, _; a# V ...... 位置58 - DMA2_Channel3 = DMA2 Channel3 global interrupt 位置59 - DMA2_Channel4_5 = DMA2 Channel4 and DMA2 Channel5 global interrupts : T" b% @- c: C" |" ~1 i 9 U- p9 N8 \4 C+ Y9 }$ }& h% S 二、系统控制寄存器组 STM32的固件库中有如下定义: typedef struct) s( A L( q2 U0 s0 r) w { vuc32 CPUID;$ x4 R5 H! s+ O& |3 H vu32 ICSR;! l: z; q2 p$ ` vu32 VTOR; vu32 AIRCR; vu32 SCR;+ q* G p. `; h+ D vu32 CCR; vu32 SHPR[3]; vu32 SHCSR;( @; ^9 t9 D% G, C/ S j$ Y vu32 CFSR;, w/ v( Y# \% e% W vu32 HFSR; ^8 u# E7 T6 C, x vu32 DFSR;2 F8 {6 \2 M/ g; o; h( E) X4 A. | vu32 MMFAR;6 K0 p( ~; u$ u+ [" ^4 P vu32 BFAR; vu32 AFSR;0 V' K9 ~. u% `7 z" B# A5 P: _ } SCB_TypeDef; /* System Control Block Structure */ 它们对应ARM手册中的名称为 ' x/ g7 n5 G0 t CPUID = CPUID Base Register+ x1 F: g- W0 u! g" @+ m ICSR = Interrupt Control State Register5 p" i. B/ F: H VTOR = Vector Table Offset Register AIRCR = Application Interrupt/Reset Control Register SCR = System Control Register CCR = Configuration Control Register SHPR = System Handlers Priority Register SHCSR = System Handler Control and State Register, N1 L! W3 X* a& _( W' N m CFSR = Configurable Fault Status Registers HFSR = Hard Fault Status Register, i+ Y& e# A, F$ ^ DFSR = Debug Fault Status Register MMFAR = Mem Manage Address Register' l7 }$ l% D9 G' d% H3 I$ c BFAR = Bus Fault Address Register AFSR = Auxiliary Fault Status Register 3 R% l* D1 Q- f: j$ e9 P 三、系统时钟寄存器组 ( T* b. y# J& Z% _0 {9 W STM32的固件库中有如下定义: typedef struct. {. D% l) X) M9 S4 Q- H) G4 m! W { vu32 CTRL;4 {7 c) g$ x3 r7 P4 C3 m1 h' a vu32 LOAD;/ g' |* z+ \1 }9 w* l vu32 VAL;" @' S8 x6 c* t. \/ f9 f2 w, X vuc32 CALIB; } SysTick_TypeDef; 它们对应ARM手册中的名称为 ( e1 r( V- R" g @ CTRL = SysTick Control and Status Register* U/ R* L5 x# I, n LOAD = SysTick Reload Value Register VAL = SysTick Current Value Register+ r v) ]9 v: Q CALIB = SysTick Calibration Value Register |
微信公众号
手机版
RE:STM32中用到的Cortex-M3寄存器说明
RE:STM32中用到的Cortex-M3寄存器说明
RE:STM32中用到的Cortex-M3寄存器说明
RE:STM32中用到的Cortex-M3寄存器说明
RE:STM32中用到的Cortex-M3寄存器说明
回复:STM32中用到的Cortex-M3寄存器说明
回复:STM32中用到的Cortex-M3寄存器说明
RE:STM32中用到的Cortex-M3寄存器说明