
在STM32中用到了Cortex-M3定义的三组寄存器,有关这三组寄存器的说明不在STM32的技术手册中,需要参考ARM公司发布的Cortex-M3 Technical Reference Manual (r2p0)。 在STM32的固件库中定义了三个结构体与这三个寄存器组相对应,这三个结构体与ARM手册中寄存器的对应关系如下: * ` g* Z1 o) ~+ x5 T O 一、NVIC寄存器组 STM32的固件库中有如下定义: 5 G, v9 f5 s: C7 h- S7 L typedef struct& C5 L" l4 p' X6 W, C- ^ {/ E, [. b* F+ R! X vu32 ISER[2];9 P4 T6 u, i N! W u32 RESERVED0[30]; vu32 ICER[2]; u32 RSERVED1[30];( Q" ?9 B' I- w: ?9 u7 }+ v vu32 ISPR[2]; u32 RESERVED2[30];) U8 c! b" b# c% ^0 S$ Z vu32 ICPR[2];2 n$ O: u5 U: }! Z; W! u u32 RESERVED3[30]; vu32 IABR[2];& ?6 `# {4 z8 w: B0 [' d- q u32 RESERVED4[62]; vu32 IPR[11]; } NVIC_TypeDef; " u4 B) |* \; H; A$ g 它们对应ARM手册中的名称为8 k: N5 f& h& R$ p ISER = Interrupt Set-Enable Registers8 Q' A v! a" @: Y ICER = Interrupt Clear-Enable Registers ISPR = Interrupt Set-Pending Register8 m/ m# ?- P$ J/ O( x ICPR = Interrupt Clear-Pending Register8 P0 r# B3 F8 ]! g# \% }2 Q2 B: _9 k IABR = Active Bit Register IPR = Interrupt Priority Registers 1 t( X, c+ r$ l! m 每个寄存器有240位,以Interrupt Set-Enable Registers说明,ISER[0]对应中断源0~31,ISER[1]对应中断源32~63,STM32只有60个中断源,所以没有ISER[2:7]。 ) ?/ Z" ?4 i- j 参考STM32技术参考手册中的中断向量表,中断源的位置为: 位置0 - WWDG = Window Watchdog interrupt: M. {$ Q% o/ K5 m Z# c" r% } 位置1 - PVD = PVD through EXTI Line detection interrupt+ Y, ]: r/ f/ L9 j; y& C+ I 位置2 - TAMPER = Tamper interrupt4 W3 b9 D9 E/ P ......1 X2 q! P# M7 V; Y9 h E# O 位置58 - DMA2_Channel3 = DMA2 Channel3 global interrupt 位置59 - DMA2_Channel4_5 = DMA2 Channel4 and DMA2 Channel5 global interrupts 3 b1 v6 ~" y, q, w 二、系统控制寄存器组 0 a; c$ L% O* c/ m6 I; i STM32的固件库中有如下定义: 0 l5 g6 s; J8 O* M0 U# B typedef struct8 z4 M: O ?/ f( t) O { vuc32 CPUID;5 t7 S R4 i4 B8 O0 A! P' k vu32 ICSR; vu32 VTOR; vu32 AIRCR; vu32 SCR;2 L6 _3 y) N7 m6 @ vu32 CCR; vu32 SHPR[3]; i, `5 D' [) l( V5 K1 s' G; J vu32 SHCSR;, Y* e9 d1 d3 k' o. W vu32 CFSR;4 Q2 @6 p! i, i' P& O/ u* s& E. e/ F vu32 HFSR;6 ~6 e J# W: p7 t vu32 DFSR;& i' h, M- A% a3 O, ~- M vu32 MMFAR;+ T- T g( U% ]2 H: I" C vu32 BFAR; vu32 AFSR;; u5 ~2 B/ i: C O } SCB_TypeDef; /* System Control Block Structure */ " b* B$ Z( [/ V: Q0 e 它们对应ARM手册中的名称为 CPUID = CPUID Base Register ICSR = Interrupt Control State Register Z0 j( v* ?* l0 {2 K, m$ [, h VTOR = Vector Table Offset Register AIRCR = Application Interrupt/Reset Control Register SCR = System Control Register CCR = Configuration Control Register; b# |" h9 y2 P1 o7 t/ S SHPR = System Handlers Priority Register; j! A( [( w7 Y: _ SHCSR = System Handler Control and State Register1 ~" c9 J7 I) P# M. T CFSR = Configurable Fault Status Registers HFSR = Hard Fault Status Register E* m' u5 k# U0 j S$ s1 r: \8 d DFSR = Debug Fault Status Register MMFAR = Mem Manage Address Register BFAR = Bus Fault Address Register, J+ T5 X8 Z/ Z5 s# ~ AFSR = Auxiliary Fault Status Register . |$ G3 M2 n0 a1 w. ^" o 三、系统时钟寄存器组 STM32的固件库中有如下定义: typedef struct { vu32 CTRL; vu32 LOAD;1 q3 ^# b8 U# X: G6 ?, c vu32 VAL;4 o; g3 M/ w5 O) P$ _5 E3 @ vuc32 CALIB; } SysTick_TypeDef; 它们对应ARM手册中的名称为 & u) A3 ^4 C: C: h4 i1 Y CTRL = SysTick Control and Status Register( t, l% W* @2 u! c# Z; {4 R7 { LOAD = SysTick Reload Value Register VAL = SysTick Current Value Register0 U, X1 }. \! Y* ] 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寄存器说明