
在STM32中用到了Cortex-M3定义的三组寄存器,有关这三组寄存器的说明不在STM32的技术手册中,需要参考ARM公司发布的Cortex-M3 Technical Reference Manual (r2p0)。 , U5 t; t/ l# L4 Z) r 在STM32的固件库中定义了三个结构体与这三个寄存器组相对应,这三个结构体与ARM手册中寄存器的对应关系如下: % f& N8 C) k- y, V+ t/ H S ) M& g" d" o7 a1 b3 W4 ?* G 一、NVIC寄存器组 STM32的固件库中有如下定义: typedef struct { vu32 ISER[2];0 h* c4 P9 o) |5 D5 H" Z6 I7 | u32 RESERVED0[30]; vu32 ICER[2];; H( m, q ~3 K3 y" M' m+ q5 E u32 RSERVED1[30]; vu32 ISPR[2]; u32 RESERVED2[30]; vu32 ICPR[2]; u32 RESERVED3[30];" K Q9 }5 O5 l; t) q vu32 IABR[2];/ ]# P/ h( D1 G1 Q8 s" e% S u32 RESERVED4[62]; vu32 IPR[11]; } NVIC_TypeDef; ( B- z1 f& c. A# [5 [+ K 它们对应ARM手册中的名称为 ISER = Interrupt Set-Enable Registers ICER = Interrupt Clear-Enable Registers9 j, ?, m" O& c* ^ ISPR = Interrupt Set-Pending Register6 j( Z; K) m% r3 n/ {1 p4 p ICPR = Interrupt Clear-Pending Register1 ~( x' d( k) v$ O IABR = Active Bit Register" h) C1 E+ Q& X5 C IPR = Interrupt Priority Registers 8 L% {: z4 E( { 每个寄存器有240位,以Interrupt Set-Enable Registers说明,ISER[0]对应中断源0~31,ISER[1]对应中断源32~63,STM32只有60个中断源,所以没有ISER[2:7]。 + {, t. {8 t: b9 W( m 参考STM32技术参考手册中的中断向量表,中断源的位置为:! B1 @" U3 r W+ q: ~: z 位置0 - WWDG = Window Watchdog interrupt 位置1 - PVD = PVD through EXTI Line detection interrupt 位置2 - TAMPER = Tamper interrupt! m$ |5 g' w9 n6 x% [, c! O ......0 B1 W0 s6 V: ^ [ 位置58 - DMA2_Channel3 = DMA2 Channel3 global interrupt 位置59 - DMA2_Channel4_5 = DMA2 Channel4 and DMA2 Channel5 global interrupts 4 p6 x! R) i0 F% m 二、系统控制寄存器组 4 r) R$ W6 [% ^9 `% s2 W STM32的固件库中有如下定义: typedef struct {* O+ t( V" ^$ ]+ w# k* x% k vuc32 CPUID; vu32 ICSR; vu32 VTOR; vu32 AIRCR;3 N8 n6 m+ y# [/ H vu32 SCR; vu32 CCR;7 R/ B5 T4 N7 `7 P. f, `0 P vu32 SHPR[3];! W+ M7 C) ~. q+ n3 q/ k vu32 SHCSR; vu32 CFSR;" s A! [0 e; t. u) Y* q. [ vu32 HFSR; vu32 DFSR; {/ D7 T. m# a* `+ e. V6 m& S vu32 MMFAR; vu32 BFAR; vu32 AFSR; } SCB_TypeDef; /* System Control Block Structure */ 2 w0 W: W" A: L2 V8 a 它们对应ARM手册中的名称为 CPUID = CPUID Base Register8 n- y" d1 ]/ r9 ?& i% N( _ ICSR = Interrupt Control State Register VTOR = Vector Table Offset Register: R. B4 H$ K4 y! r6 ?, w: Q2 w AIRCR = Application Interrupt/Reset Control Register F* z, p0 a/ U2 f SCR = System Control Register) p0 L4 x# D8 B, o9 N5 x CCR = Configuration Control Register SHPR = System Handlers Priority Register8 t) [, [" X2 Q SHCSR = System Handler Control and State Register0 [* R7 d+ `% c' a, L0 B CFSR = Configurable Fault Status Registers) E5 P* D0 Z( ?& F( ] HFSR = Hard Fault Status Register6 k2 ?9 j% s; o5 [8 H DFSR = Debug Fault Status Register MMFAR = Mem Manage Address Register% s0 a2 ?8 m* @* S( q! ~ BFAR = Bus Fault Address Register" q. m3 I( _; Q5 [( ^ AFSR = Auxiliary Fault Status Register 三、系统时钟寄存器组 0 M+ [ B3 c2 U& v% J2 G1 j STM32的固件库中有如下定义: typedef struct+ [; \2 V- b& q! O. b3 x4 A { vu32 CTRL; vu32 LOAD;- y* k0 N) I L/ C; `& v+ J# } vu32 VAL;4 a. F7 D5 c- q0 S1 x6 D vuc32 CALIB;, ~7 E/ F1 @: \. o } SysTick_TypeDef; , h+ u9 I7 E/ L, @4 ^ 它们对应ARM手册中的名称为 CTRL = SysTick Control and Status Register9 E5 L5 i/ v. W! n LOAD = SysTick Reload Value Register VAL = SysTick Current Value Register CALIB = SysTick Calibration Value Register ) N$ D& m4 Z0 C( }% Z( O9 A |
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寄存器说明