ARM7-LPC2103中文用户手册

发布时间:2024-10-23

ARM7芯片的使用手册

广州周立功单片机发展有限公司 http://

LPC2101/02/03使用指南

ARM7芯片的使用手册

目录

第1章 概述............................................................................................................................................1

1.1 简介...............................................................................................................................................1

1.2 特性...............................................................................................................................................1

1.3 应用...............................................................................................................................................2

1.4 器件信息.......................................................................................................................................2

1.5 结构概述.......................................................................................................................................2

1.6 ARM7TDMI-S处理器..................................................................................................................2

1.7 片内FLASH存储器系统...............................................................................................................3

1.8 片内静态RAM(SRAM)...............................................................................................................3

1.9 方框图...........................................................................................................................................4

第2章 LPC2101/02/03存储器寻址.....................................................................................................5

2.1 存储器映射...................................................................................................................................5

2.2 LPC2101/02/03存储器重新映射和引导模块..............................................................................8

2.2.1 存储器映射概念和操作模式................................................................................................8

2.2.2 存储器的重新映射................................................................................................................9

2.3 预取指中止和数据中止异常.....................................................................................................10

第3章 系统控制模块..........................................................................................................................12

3.1 系统控制模块功能汇总.............................................................................................................12

3.2 管脚描述.....................................................................................................................................12

3.3 寄存器描述.................................................................................................................................13

3.4 晶体振荡器.................................................................................................................................13

3.5 外部中断输入.............................................................................................................................15

3.5.1 寄存器描述..........................................................................................................................15

3.5.2 外部中断标志寄存器(EXTINT - 0xE01F C140)..........................................................15

3.5.3 中断唤醒寄存器(INTWAKE - 0xE01F C144)..............................................................16

3.5.4 外部中断方式寄存器(EXTMODE – 0xE01F C148)....................................................17

3.5.5 外部中断极性寄存器(EXTPOLAR – 0xE01F C14C)..................................................17

3.6 其它系统控制.............................................................................................................................18

3.6.1 系统控制和状态标志寄存器 (SCS – 0xE01F C1A0).......................................................18

3.7 存储器映射控制.........................................................................................................................19

3.7.1 存储器映射控制寄存器(MEMMAP – 0xE01F C040)..................................................19

3.7.2 存储器映射控制的使用注意事项......................................................................................19

3.8 锁相环(PLL)..........................................................................................................................19

3.8.1 寄存器描述..........................................................................................................................20

3.8.2 PLL控制寄存器(PLLCON – 0xE01F C080).................................................................21

3.8.3 PLL配置寄存器(PLLCFG – 0xE01F C084)..................................................................21

3.8.4 PLL状态寄存器(PLLSTAT - 0xE01F C088).................................................................21

3.8.5 PLL中断...............................................................................................................................22

3.8.6 PLL模式...............................................................................................................................22

3.8.7 PLL馈送寄存器(PLLFEED – 0xE01F C08C)...............................................................22

ARM7芯片的使用手册

3.8.8 PLL和掉电模式...................................................................................................................23

3.8.9 PLL频率计算.......................................................................................................................23

3.8.10 确定PLL设定的过程.......................................................................................................23

3.8.11 PLL配置举例.....................................................................................................................24

3.9 功率控制.....................................................................................................................................24

3.9.1 寄存器描述..........................................................................................................................25

3.9.2 功率控制寄存器(PCON – 0xE01F COCO)...................................................................25

3.9.3 外设功率控制寄存器(PCONP – 0xE01F COC4)..........................................................25

3.9.4 功率控制注意事项..............................................................................................................26

3.10 复位...........................................................................................................................................26

3.10.1 复位源识别寄存器(RSIR – 0xE01F C180).................................................................27

3.11 APB分频器................................................................................................................................28

3.11.1 寄存器描述........................................................................................................................28

3.11.2 APBDIV寄存器(APBDIV - 0xE01F C100).................................................................28

3.12 唤醒定时器...............................................................................................................................29

3.13 代码安全VS.调试.....................................................................................................................29

第4章 存储器加速模块(MAM)....................................................................................................30

4.1 简介.............................................................................................................................................30

4.2 操作.............................................................................................................................................30

4.3 MAM模块...................................................................................................................................30

4.3.1 Flash存储器组.....................................................................................................................31

4.3.2 指令锁存和数据锁存..........................................................................................................31

4.3.3 Flash编程问题.....................................................................................................................31

4.4 MAM的操作模式.......................................................................................................................32

4.5 MAM配置...................................................................................................................................32

4.6 寄存器描述.................................................................................................................................33

4.7 MAM控制寄存器(MAMCR – 0XE01F C000)......................................................................33

4.8 MAM定时寄存器(MAMTIM – 0XE01F C004)....................................................................33

4.9 MAM使用注意事项...................................................................................................................34

第5章 向量中断控制器(VIC).......................................................................................................35

5.1 特性.............................................................................................................................................35

5.2 描述.............................................................................................................................................35

5.3 寄存器描述.................................................................................................................................35

5.4 VIC寄存器..................................................................................................................................37

5.4.1 软件中断寄存器(VICSoftInt - 0xFFFF F018)...............................................................37

5.4.2 软件中断清零寄存器(VICSoftIntClear - 0xFFFF F01C)..............................................38

5.4.3 原始中断状态寄存器(VICRawIntr - 0xFFFF F008).....................................................38

5.4.4 中断使能寄存器(VICIntEnable - 0xFFFF F010)..........................................................39

5.4.5 中断使能清零寄存器(VICIntEnClear - 0xFFFF F014)................................................40

5.4.6 中断选择寄存器(VICIntSelect - 0xFFFF F00C)...........................................................40

5.4.7 IRQ状态寄存器(VICIRQStatus - 0xFFFF F000)..........................................................41

5.4.8 FIQ状态寄存器(VICFIQStatus - 0xFFFF F004)...........................................................41

5.4.9 向量控制寄存器0-15(VICVectCntl 0-15 - 0xFFFF F200-23C)...................................42

ARM7芯片的使用手册

5.4.10 向量地址寄存器0-15(VICVectAddr0-15 - 0xFFFF F100-13C).................................42

5.4.11 默认向量地址寄存器(VICDefVectAddr - 0xFFFF F034)...........................................43

5.4.12 向量地址寄存器(VICVectAddr - 0xFFFF F030).........................................................43

5.4.13 保护使能寄存器(VICProtection - 0xFFFF F020).......................................................43

5.5 中断源.........................................................................................................................................43

5.6 伪中断.........................................................................................................................................45

5.6.1 伪中断的详述和个案..........................................................................................................46

5.6.2 解决方案..............................................................................................................................47

5.6.3 方案1:在写CPSR来禁止IRQ过程中检测接收到的IRQ...........................................47

5.6.4 方案2:分别使用两条写CPSR的指令来禁能IRQ和FIQ...........................................47

5.6.5 方案3:在IRQ处理程序的开始重新使能FIQ...............................................................47

5.7 VIC使用事项..............................................................................................................................48

第6章 管脚配置..................................................................................................................................49

6.1 LPC2101/2102/2103的管脚配置................................................................................................49

6.2 LPC2101/02/03的管脚描述........................................................................................................51

第7章 管脚连接模块..........................................................................................................................55

7.1 特性.............................................................................................................................................55

7.2 应用.............................................................................................................................................55

7.3 描述.............................................................................................................................................55

7.4 寄存器描述.................................................................................................................................55

7.4.1 管脚功能选择寄存器0(PINSEL0 - 0xE002 C000)......................................................55

7.4.2 管脚功能选择寄存器1(PINSEL1 - 0xE002 C004)......................................................57

7.4.3 管脚功能选择寄存器值......................................................................................................59

第8章 通用输入/输出口(GPIO)........................................................................................................60

8.1 特性.............................................................................................................................................60

8.2 应用.............................................................................................................................................60

8.3 管脚描述.....................................................................................................................................60

8.4 寄存器描述.................................................................................................................................60

8.4.1 GPIO端口0方向寄存器(IODIR, 端口0:IO0DIR - 0xE002 8008;FIODIR, 端口0:

FIO0DIR – 0x3FFF C000)..........................................................................................................62

8.4.2 高速GPIO端口0屏蔽寄存器 (FIOMASK, 端口0:FIO0MASK – 0x3FFF C010)....63

8.4.3 GPIO端口0管脚值寄存器(IOPIN, 端口0:IO0PIN - 0xE002 8000;FIOPIN, 端口0:

FIO0PIN - 0x3FFF C014)...........................................................................................................64

8.4.4 GPIO端口0输出置位寄存器(IOSET,端口0:IO0SET - 0xE002 8004;FIOSET,端口0:

FIO0SET - 0x3FFF C018)...........................................................................................................65

8.4.5 GPIO端口0输出清零寄存器(IOCLR,端口0:IO0CLR – 0xE002 800C;FIOCLR,端口

0:FIO0CLR – 0x3FFF C01C)......................................................................................................66

8.5 GPIO使用注意事项....................................................................................................................67

8.5.1 例1:顺序访问IOSET和IOCLR寄存器对同一个GPIO管脚/位的影响....................67

8.5.2 例2:使GPIO管脚上输出瞬时的0和1.........................................................................67

8.5.3 写IOSET/IOCLR .vs. IOPIN..............................................................................................68

8.5.4 当使用遗留和增强型GPIO寄存器时输出信号频率需要考虑的事项...........................68

ARM7芯片的使用手册

第9章 通用异步接收器/发送器0 (UART0).....................................................................................70

9.1 特性.............................................................................................................................................70

9.2 管脚描述.....................................................................................................................................70

9.3 寄存器描述.................................................................................................................................70

9.3.1 UART0接收器缓存寄存器(U0RBR - 0xE000 C000,DLAB=0,只读)....................71

9.3.2 UART0发送器保持寄存器(U0THR - 0xE000C000,DLAB=0,只写).....................71

9.3.3 UART0除数锁存寄存器(U0DLL - 0xE000 C000和U0DLM - 0xE000 C004,当DLAB=1

时)................................................................................................................................................72

9.3.4 UART0小数分频寄存器(U0FDR – 0xE000 C028).......................................................72

9.3.5 UART0波特率计算.............................................................................................................73

9.3.6 UART0中断使能寄存器(U0IER - 0xE000 C004,DLAB=0)......................................74

9.3.7 UART0中断标识寄存器(U0IIR - 0xE000 C008,只读)..............................................75

9.3.8 UART0 FIFO控制寄存器(U0FCR - 0xE000 C008)......................................................76

9.3.9 UART0线控制寄存器(U0LCR - 0xE000 C00C)...........................................................77

9.3.10 UART0线状态寄存器(U0LSR - 0xE000 C014,只读)..............................................78

9.3.11 UART0高速缓存寄存器(U0SCR – 0xE000 C01C).....................................................79

9.3.12 UART0自动波特率控制寄存器(U0ACR – 0xE000 C020)..............................................79

9.3.13 自动波特率........................................................................................................................80

9.3.14 UART0发送使能寄存器(U0TER – 0xE000 C030).....................................................80

9.3.15 自动波特率模式................................................................................................................81

9.4 结构.............................................................................................................................................82

第10章 通用异步接收器/发送器1(UART1)...............................................................................84 10.1 特性...........................................................................................................................................84 10.2 管脚描述...................................................................................................................................84 10.3 寄存器描述...............................................................................................................................85

10.3.1 UART1接收器缓存寄存器(U1RBR - 0xE0010000,DLAB=0,只读)....................86

10.3.2 UART1发送器保持寄存器(U1THR - 0xE0010000,DLAB=0,只写)....................86 10.3.3 UART1除数锁存寄存器0和1(U1DLL - 0xE001 0000和U1DLM - 0xE001 0004,当

DLAB=1时)................................................................................................................................86

10.3.4 UART1小数分频寄存器(U1FDR – 0xE001 0028).....................................................87

10.3.5 UART1波特率计算...........................................................................................................87

10.3.6 UART1中断使能寄存器(U1IER - 0xE001 0004,DLAB=0)....................................88

10.3.7 UART1中断标识寄存器(U1IIR - 0xE001 0008,只读).............................................89

10.3.8 UART1 FIFO控制寄存器(U1FCR - 0xE001 0008).....................................................91

10.3.9 UART1线控制寄存器(U1LCR - 0xE001 000C).........................................................92

10.3.10 UART1 Modem控制寄存器(U1MCR - 0xE001 0010)..............................................93

10.3.11 UART1线状态寄存器(U1LSR – 0xE001 0014,只读)............................................95

10.3.12 UART1 Modem状态寄存器(U1MSR - 0x0E001 0018)............................................96

10.3.13 UART1高速缓存寄存器(U1SCR - 0xE001 001C)....................................................96

10.3.14 UART1自动波特率控制寄存器(U1ACR – 0xE001 0020)............................................97

10.3.15 自动波特率......................................................................................................................97

10.3.16 自动波特率模式..............................................................................................................98

10.3.17 UART1发送使能寄存器(U1TER – 0xE001 0030)....................................................99

ARM7芯片的使用手册

第11章 I2C接口I2C0和I2C1.........................................................................................................102 11.1 特性.........................................................................................................................................102 11.2 应用.........................................................................................................................................102 11.3 描述.........................................................................................................................................102 11.4 管脚描述.................................................................................................................................103 11.5 I2C操作模式............................................................................................................................103 11.5.1 主发送器模式:..............................................................................................................103 11.5.2 主接收器模式..................................................................................................................104 11.5.3 从接收器模式..................................................................................................................105 11.5.4 从发送器模式..................................................................................................................105 11.6 I2C的实现和操作....................................................................................................................106 11.6.1 输入滤波器和输出部分..................................................................................................106 11.6.2 地址寄存器,I2ADDR...................................................................................................107 11.6.3 比较器..............................................................................................................................108 11.6.4 移位寄存器,I2DAT.......................................................................................................108 11.6.5 仲裁和同步逻辑..............................................................................................................108 11.6.6 串行时钟发生器..............................................................................................................109 11.6.7 时序和控制......................................................................................................................109 11.6.8 控制寄存器,I2CONSET和I2CONCLR......................................................................109 11.6.9 状态译码器和状态寄存器..............................................................................................109 11.7 寄存器描述.............................................................................................................................110 11.7.1 I2C控制置位寄存器(I2CONSET:12C0 – I2C0CONSET: 0xE001C000和I2C1-

I2C1CONSET: 0xE005C000)...................................................................................................110 11.7.2 I2C控制清零寄存器(I2CONCLR: I2C0 - I2C0CONCLR: 0xE001C018;

I2C1-I2C1CONCLR:0xE005C018)..........................................................................................112 11.7.3 I2C状态寄存器(I2STAT: I2C0-I2C0STAT: 0xE001C004和I2C1-I2C1STAT:

0xE005C004).............................................................................................................................112 11.7.4 I2C数据寄存器(I2DAT: I2C0-I2C0DAT: 0xE001C008和I2C1-I2C1DAT: 0xE005C008).....................................................................................................................................................113 11.7.5 I2C从地址寄存器(I2ADR:I2C0-I2C0ADR: 0xE001C00C和I2C1-I2C1ADR: 地址0xE005C00C)位描述................................................................................................................113 11.7.6 I2C SCL高电平占空比寄存器(I2SCLH: I2C0-I2C0SCLH: 0xE001 C010和

I2C1-I2C1SCLH: 0xE005 C010)..............................................................................................113 11.7.7 I2C SCL低电平占空比寄存器(I2SCLL: I2C0-I2C0SCLL: 0xE001 C014;

I2C1-I2C1SCLL: 0xE005 C014)...............................................................................................113 11.7.8 选择合适的I2C数据率和占空比...................................................................................114 11.8 I2C操作模式的细节................................................................................................................114 11.8.1 主发送器模式..................................................................................................................115 11.8.2 主接收器模式..................................................................................................................115 11.8.3 从接收器模式..................................................................................................................116 11.8.4 从发送器模式..................................................................................................................120 11.8.5 各种不同的状态..............................................................................................................124 11.8.6 I2STAT= 0xF8:..................................................................................................................124

ARM7芯片的使用手册

11.8.8 一些特殊的情况:..........................................................................................................124 11.8.9 两个主机同时启动重复起始条件..................................................................................124 11.8.10 仲裁丢失后的数据传输................................................................................................124 11.8.11 强制访问I2C总线.........................................................................................................125 11.8.12 SCL或SDA低电平妨碍I2C总线的操作....................................................................125 11.8.13 总线错误........................................................................................................................125 11.8.14 I2C状态服务程序...........................................................................................................126 11.8.15 初始化............................................................................................................................126 11.8.16 I2C中断服务...................................................................................................................127 11.8.17 状态服务程序................................................................................................................127 11.8.18 实际应用中的状态服务................................................................................................127 11.9 软件举例.................................................................................................................................127 11.9.1 初始化程序......................................................................................................................127 11.9.2 启动主机发送功能..........................................................................................................127 11.9.3 启动主机接收功能..........................................................................................................127 11.9.4 I2C中断程序.....................................................................................................................128 11.9.5 非模式指定的状态..........................................................................................................128 11.9.5.1 状态:0x00...............................................................................................................................128 11.9.5.2 主机状态...................................................................................................................................128 11.9.5.3 状态:0x08...............................................................................................................................128 11.9.5.4 状态:0x10...............................................................................................................................128 11.9.6 主机发送器状态..............................................................................................................129 11.9.6.1 状态:0x18...............................................................................................................................129 11.9.6.2 状态:0x20...............................................................................................................................129 11.9.6.3 状态:0x28...............................................................................................................................129 11.9.6.4 状态:0x30...............................................................................................................................129 11.9.6.5 状态:0x38...............................................................................................................................129 11.9.7 主机接收器状态..............................................................................................................130 11.9.7.1 状态:0x40...............................................................................................................................130 11.9.7.2 状态:0x48...............................................................................................................................130 11.9.7.3 状态:0x50...............................................................................................................................130 11.9.7.4 状态:0x58...............................................................................................................................130 11.9.8 从机接收器状态..............................................................................................................131 11.9.8.1 状态:0x60...............................................................................................................................131 11.9.8.2 状态:0x68...............................................................................................................................131 11.9.8.3 状态:0x70...............................................................................................................................131 11.9.8.4 状态:0x78...............................................................................................................................131 11.9.8.5 状态:0x80...............................................................................................................................132 11.9.8.6 状态:0x88...............................................................................................................................132 11.9.8.7 状态:0x90...............................................................................................................................132 11.9.8.8 状态:0x98...............................................................................................................................132 11.9.8.9 状态:0xA0..............................................................................................................................132 11.9.9 从机发送器状态..............................................................................................................133

ARM7芯片的使用手册

11.9.9.1 状态:0xA8..............................................................................................................................133 11.9.9.2 状态:0xB0..............................................................................................................................133 11.9.9.3 状态:0xB8..............................................................................................................................133 11.9.9.4 状态:0xC0..............................................................................................................................133 11.9.9.5 状态:0xC8..............................................................................................................................133

第12章 SPI接口(SPI0)...............................................................................................................135 12.1 特性.........................................................................................................................................135 12.2 描述.........................................................................................................................................135 12.2.1 SPI概述............................................................................................................................135 12.2.2 SPI数据传输....................................................................................................................135 12.2.3 概述..................................................................................................................................137 12.2.4 主机操作..........................................................................................................................137 12.2.5 从机操作..........................................................................................................................137 12.2.6 异常状况..........................................................................................................................138 12.2.7 读溢出..............................................................................................................................138 12.2.8 写冲突..............................................................................................................................138 12.2.9 模式错误..........................................................................................................................138 12.2.10 从机中止........................................................................................................................138 12.3 管脚描述.................................................................................................................................139 12.4 寄存器描述.............................................................................................................................139 12.4.1 SPI控制寄存器(S0SPCR - 0xE002 0000)..................................................................139 12.4.2 SPI状态寄存器(S0SPSR - 0xE002 0004)..................................................................141 12.4.3 SPI数据寄存器(S0SPDR - 0xE002 0008).................................................................141 12.4.4 SPI时钟计数寄存器(S0SPCCR - 0xE002 000C)......................................................141 12.4.5 SPI中断寄存器(S0SPINT - 0xE002 001C)................................................................142 12.5 结构.........................................................................................................................................142

第13章 SSP控制器(SPI1)...............................................................................................................143 13.1 特性.........................................................................................................................................143 13.2 描述.........................................................................................................................................143 13.3 总线描述.................................................................................................................................144 13.3.1 Texas仪器同步串行(SSI)数据帧格式............................................................................144 13.3.2 SPI帧格式........................................................................................................................144 13.3.3 时钟极性(CPOL)和时钟相位(CPHA)控制.........................................................144 13.3.4 CPOL=0, CPHA=0时的SPI格式...................................................................................145 13.3.5 CPOL=0,CPHA=1时的SPI格式.................................................................................146 13.3.6 CPOL=1, CPHA=0时的SPI格式...................................................................................146 13.3.7 CPOL=1,CPHA=1时的SPI格式.................................................................................147 13.3.8 半导体Microwire帧格式...............................................................................................148 13.3.9 Microwire模式中CS相对SK的建立和保持时间.......................................................150 13.4 寄存器描述.............................................................................................................................150 13.4.1 SSP控制寄存器0 (SSPCR0-0xE006 8000)....................................................................151 13.4.2 SSP控制寄存器1(SSPCR1 – 0xE006 8004).............................................................152 13.4.3 SSP数据寄存器(SSPDR – 0xE006 8008)..................................................................152

ARM7芯片的使用手册

13.4.4 SSP状态寄存器(SSPSR – 0xE006 800C)..................................................................153 13.4.5 SSP时钟预分频寄存器(SSPCPSR – 0xE006 8010)..................................................153 13.4.6 SSP中断屏蔽设置/清除寄存器(SSPIMSC – 0xE006 8014).....................................153 13.4.7 SSP原始中断状态寄存器(SSPRIS – 0xE006 8018).................................................154 13.4.8 SSP屏蔽中断状态寄存器(SSPMIS – 0xE006 801C)................................................154 13.4.9 SSP中断清除寄存器(SSPICR – 0xE006 8020).........................................................154

第14章 模数转换器(ADC)...............................................................................................................155 14.1 特性.........................................................................................................................................155 14.2 描述.........................................................................................................................................155 14.3 管脚描述.................................................................................................................................155 14.4 寄存器描述.............................................................................................................................156 14.4.1 A/D控制寄存器(AD0CR – 0xE003 4000).................................................................156 14.4.2 A/D全局数据寄存器(AD0GDR–0xE003 4004)........................................................158 14.4.3 A/D状态寄存器(ADSTAT, ADC0: AD0CR-0xE003 4004)............................................158 14.4.4 A/D中断使能寄存器(ADINTEN,ADC0:AD0INTEN-0xE003 400C).........................159 14.4.5 A/D数据寄存器(ADDR0~ADDR7, ADC0: AD0DR0 ~AD0DR7 - 0xE003 4010~

0xE003 402C)..............................................................................................................................159 14.5 操作.........................................................................................................................................160 14.5.1 硬件触发转换..................................................................................................................160 14.5.2 中断..................................................................................................................................160 14.5.3 精度和数字接收器..........................................................................................................160

第15章 定时器/计数器 定时器0和定时器1................................................................................161 15.1 特性.........................................................................................................................................161 15.2 应用.........................................................................................................................................161 15.3 描述.........................................................................................................................................161 15.4 管脚描述.................................................................................................................................162 15.5 寄存器描述.............................................................................................................................162 15.5.1 中断寄存器(IR,定时器0:T0IR-0xE000 4000和定时器1:T1IR-0xE0008000).....................................................................................................................................................164 15.5.2 定时器控制寄存器(TCR,定时器0 – T0TCR:0xE0004004;定时器1 – T1TCR:0xE0008004).............................................................................................................................164 15.5.3 计数控制寄存器(CTCR:定时器0-T0CTCR:0xE0004070和定时器1-T1TCR:

0xE0008070)................................................................................................................................165 15.5.4 定时器计数器(TC: 定时器0 – T0TC:0xE0004008;定时器1 – T1TC:0xE0008008).....................................................................................................................................................165 15.5.5 预分频寄存器(PR: 定时器0 – T0PR:0xE000400C;定时器1 – T1PR:0xE000800C).....................................................................................................................................................165 15.5.6 预分频计数器寄存器(PC: 定时器0 – T0PC:0xE0004010;定时器1 – T1PC:0xE0008010).............................................................................................................................166 15.5.7 匹配寄存器(MR0 - MR3)..........................................................................................166 15.5.8 匹配控制寄存器(MCR: 定时器0 – T0MCR:0xE0004014;定时器1 – T1MCR:0xE0008014).............................................................................................................................166 15.5.9 捕获寄存器(CR0 - CR3)............................................................................................167

ARM7芯片的使用手册

15.5.10 捕获控制寄存器(CCR: 定时器0 – T0CCR:0xE0004028;定时器1 – T1CCR:0xE0008028).............................................................................................................................167 15.5.11 外部匹配寄存器(EMR: 定时器0 – T0EMR:0xE000403C和定时器1 – T1EMR:0xE000803C).............................................................................................................................168 15.5.12 PWM控制寄存器(PWMCON, 定时器0:PWM0CON- 0xE0004074和定时器1:PWM1CON- 0xE0008074)..........................................................................................................169 15.5.13 单边沿控制PWM输出的规则....................................................................................170 15.6 定时器举例操作.....................................................................................................................170 15.7 结构.........................................................................................................................................172

第16章 定时器/计数器 定时器2和定时器3................................................................................173 16.1 特性.........................................................................................................................................173 16.2 应用.........................................................................................................................................173 16.3 描述.........................................................................................................................................173 16.4 管脚描述.................................................................................................................................174 16.5 寄存器描述.............................................................................................................................175 16.5.1 中断寄存器(IR,定时器2:T2IR-0xE007 0000和定时器3:T3IR-0xE0074000).....................................................................................................................................................176 16.5.2 定时器控制寄存器(TCR,定时器2– T2TCR:0xE0070004和定时器3 – T3TCR:0xE0074004).............................................................................................................................176 16.5.3 计数控制寄存器(CTCR:定时器2-T2CTCR:0xE0070070和定时器3-T3TCR:

0xE0074070)................................................................................................................................177 16.5.4 定时器计数器(TC: 定时器2 – T2TC:0xE0070008;定时器3 – T3TC:0xE0074008).....................................................................................................................................................177 16.5.5 预分频寄存器(PR: 定时器2 – T2PR:0xE007000C;定时器3– T3PR:0xE007400C).....................................................................................................................................................177 16.5.6 预分频计数器寄存器(PC: 定时器2 – T2PC:0xE0070010;定时器3 – T3PC:0xE0074010).............................................................................................................................178 16.5.7 匹配寄存器(MR0 - MR3)..........................................................................................178 16.5.8 匹配控制寄存器(MCR: 定时器2 – T2MCR:0xE0070014和定时器3 – T3MCR:0xE0074014).............................................................................................................................178 16.5.9 捕获寄存器(CR0 - CR3)............................................................................................179 16.5.10 捕获控制寄存器(CCR: 定时器2 – T2CCR:0xE0070028;定时器3 – T3CCR:0xE0074028).............................................................................................................................179 16.5.11 外部匹配寄存器(EMR: 定时器2 – T2EMR:0xE007003C和定时器3 – T3EMR:0xE007403C).............................................................................................................................180 16.6 PWM控制寄存器(PWMCON, 定时器2:PWM0CON- 0XE0070074和定时器3:PWM1CON- 0XE0074074)....................................................................................................................................181 16.7 单边沿控制PWM输出的规则..............................................................................................182 16.8 定时器举例操作.....................................................................................................................183 16.9 结构.........................................................................................................................................184

第17章 实时时钟..............................................................................................................................185 17.1 特性.........................................................................................................................................185 17.2 描述.........................................................................................................................................185

ARM7芯片的使用手册

17.4 寄存器描述.............................................................................................................................186 17.4.1 RTC中断..........................................................................................................................186 17.4.2 混合寄存器组..................................................................................................................187 17.4.3 中断位置寄存器(ILR - 0xE002 4000).......................................................................187 17.4.4 时钟节拍计数器寄存器(CTCR - 0xE0024004)........................................................187 17.4.5 时钟控制寄存器(CCR - 0xE0024008)......................................................................188 17.4.6 计数器增量中断寄存器(CIIR-0xE002400C)............................................................188 17.4.7 报警屏蔽寄存器(AMR - 0xE0024010).....................................................................188 17.4.8 完整时间寄存器..............................................................................................................189 17.4.9 完整时间寄存器0(CTIME0 - 0xE0024014).............................................................189 17.4.10 完整时间寄存器1(CTIME1 - 0xE0024018)...........................................................189 17.4.11 完整时间寄存器2(CTIME2 - 0xE002401C)..........................................................190 17.4.12 时间计数器组................................................................................................................190 17.4.13 闰年计算........................................................................................................................191 17.4.14 报警寄存器组................................................................................................................191 17.5 RTC使用注意事项..................................................................................................................191 17.6 基准时钟分频器(预分频器)..............................................................................................192 17.6.1 预分频整数寄存器(PREINT - 0xE0024080)............................................................192 17.6.2 预分频小数寄存器(PREFRAC - 0xE0024084).........................................................192 17.6.3 预分频器的使用举例......................................................................................................193 17.6.4 预分频器操作..................................................................................................................193 17.7 RTC外部32KHZ振荡器元件选择.........................................................................................194

第18章 看门狗定时器(WDT).....................................................................................................196 18.1 特性.........................................................................................................................................196 18.2 应用.........................................................................................................................................196 18.3 描述.........................................................................................................................................196 18.4 寄存器描述.............................................................................................................................196 18.4.1 看门狗模式寄存器(WDMOD - 0xE0000000)..........................................................197 18.4.2 看门狗定时器常数寄存器(WDTC - 0xE0000004)...................................................197 18.4.3 看门狗喂狗寄存器(WDFEED - 0xE0000008)..........................................................198 18.4.4 看门狗定时器值寄存器(WDTV - 0xE000000C)......................................................198 18.5 方框图.....................................................................................................................................199

第19章 FLASH存储器系统和编程................................................................................................200 19.1 FLASH BOOT装载程序.........................................................................................................200 19.2 特性.........................................................................................................................................200 19.3 应用.........................................................................................................................................200 19.4 描述.........................................................................................................................................200 19.4.1 复位后的存储器映射......................................................................................................200 19.4.2 有效用户代码的判定标准..............................................................................................201 19.4.3 通信协议..........................................................................................................................202 19.4.4 ISP命令格式....................................................................................................................202 19.4.5 ISP响应格式....................................................................................................................202

ARM7芯片的使用手册

19.4.7 ISP流控制........................................................................................................................202 19.4.8 ISP命令中止....................................................................................................................202 19.4.9 ISP过程中的中断............................................................................................................202 19.4.10 IAP过程中的中断.........................................................................................................202 19.4.11 ISP命令处理器使用的RAM........................................................................................203 19.4.12 IAP命令处理器使用的RAM.......................................................................................203 19.4.13 RealMonitor使用的RAM.............................................................................................203 19.4.14 BOOT处理流程图.........................................................................................................203 19.5 扇区数.....................................................................................................................................204 19.6 FLASH内容保护机制.............................................................................................................204 19.7 代码读保护(CRP)...................................................................................................................205 19.8 ISP命令...................................................................................................................................205 19.8.1 解锁 <解锁代码>...........................................................................................................206 19.8.2 设置波特率 <波特率> <停止位>..................................................................................206 19.8.3 回声 <设定>...................................................................................................................207 19.8.4 写RAM<起始地址> <字节数>......................................................................................207 19.8.5 读存储器 <地址> <字节数>..........................................................................................207 19.8.6 准备写操作的扇区<起始扇区号> <结束扇区号>........................................................208 19.8.7 将RAM内容复制到Flash <Flash地址> <RAM地址> <字节数>.............................209 19.8.8 运行<地址><模式>.........................................................................................................209 19.8.9 擦除扇区<起始扇区号><结束扇区号>.........................................................................210 19.8.10 扇区查空<起始扇区号><结束扇区号>.......................................................................210 19.8.11 读器件标识号................................................................................................................210 19.8.12 读Boot代码版本号......................................................................................................211 19.8.13 比较<地址1><地址2><字节数>................................................................................211 19.8.14 ISP返回代码..................................................................................................................212 19.9 IAP命令...................................................................................................................................212 19.9.1 准备编程扇区..................................................................................................................214 19.9.2 将RAM内容复制到Flash.............................................................................................215 19.9.3 擦除扇区..........................................................................................................................215 19.9.4 扇区查空..........................................................................................................................216 19.9.5 读器件标识号..................................................................................................................216 19.9.6 读Boot代码版本号........................................................................................................216 19.9.7 比较 <地址1><地址2> <字节数>...............................................................................217 19.9.8 重新调用ISP...................................................................................................................217 19.9.9 IAP状态代码...................................................................................................................218 19.10 JTAG FLASH编程接口...........................................................................................................218

第20章 EMBEDDEDICE逻辑.......................................................................................................219 20.1 特性.........................................................................................................................................219 20.2 应用.........................................................................................................................................219 20.3 描述.........................................................................................................................................219 20.4 管脚描述.................................................................................................................................220 20.5 复用管脚的复位状态.............................................................................................................220

ARM7芯片的使用手册

20.7 方框图.....................................................................................................................................221 20.8 DEBUG模式...........................................................................................................................221 20.8.1 使能调试模式..................................................................................................................221 20.8.2 JTAG管脚选择................................................................................................................222

第21章 REALMONITOR...............................................................................................................223 21.1 特性.........................................................................................................................................223 21.2 应用.........................................................................................................................................223 21.3 描述.........................................................................................................................................223 21.3.1 RealMonitor部件.............................................................................................................224 21.3.2 RMHost.............................................................................................................................224 21.3.3 RMTarget..........................................................................................................................224 21.3.4 RealMonitor是如何工作的.............................................................................................224 21.4 如何使能REALMONITOR........................................................................................................225 21.4.1 增加堆栈..........................................................................................................................226 21.4.2 IRQ模式...........................................................................................................................226 21.4.3 未定义模式......................................................................................................................226 21.4.4 SVC模式..........................................................................................................................226 21.4.5 预取指中止模式..............................................................................................................226 21.4.6 数据中止模式..................................................................................................................226 21.4.7 用户/系统模式.................................................................................................................226 21.4.8 FIQ模式...........................................................................................................................226 21.4.9 处理异常..........................................................................................................................226 21.4.10 RealMonitor异常处理...................................................................................................227 21.4.11 RMTarget初始化............................................................................................................227 21.4.12 例程................................................................................................................................227 21.5 REALMONITOR建立选项.........................................................................................................230

第22章 补充信息..............................................................................................................................233 22.1 缩写词.....................................................................................................................................233 附录A 周立功公司相关信息............................................................................................................234

ARM7芯片的使用手册

第1章 概述

1.1 简介

LPC2101/02/03是基于一个支持实时仿真的16/32位ARM7 TDMI-S CPU的微控制器,并带有8kB,16kB或32kB嵌入的高速Flash存储器。128位宽度的存储器接口和独特的加速结构使32位代码能够在最大时钟速率下运行。对中断服务程序和DSP算法中性能要求严格的应用,这增加的性能比在Thumb模式下的性能超出多达30%。对代码规模有严格控制的应用,使用16位Thumb模式将代码规模降低超过30%,而性能的损失却很小。

较小的封装和很低的功耗使LPC2101/02/03特别适用于访问控制和POS机等小型应用中;由于内置了宽范围的串行通信接口(范围从多个UART、SPI和SSP到两条I2C总线)和2kB/4kB/8kB的片内SRAM,它们也非常适合于通信网关和协议转换器。高级性能还使这些器件适合用作数学协处理器。多个32位和16位定时器、1个改良的10位ADC、所有定时器上输出匹配的PWM特性、以及具有多达13个边沿或电平触发的外部中断管脚的32条高速GPIO线,使这些微控制器特别适用于工业控制和医疗系统中。

1.2 特性

z

z 16/32位ARM7 TDMI-S微控制器,超小LQFP48封装。 2kB/4kB/8kB的片内静态RAM和8kB/16kB/32kB的片内Flash程序存储器。128

位宽度接口/加速器可实现高达70 MHz工作频率。

通过片内boot装载程序实现在系统/在应用编程(ISP/IAP)。单个Flash扇区或整片擦除时间为100ms。256字节编程时间为1ms。

嵌入式ICE RT通过片内RealMonitor软件提供实时调试。

10位A/D转换器提供8路模拟输入(每个通道的转换时间低至2.44us),以及特定的结果寄存器来最大限度地减少中断开销。

2个32位定时器/外部事件计数器(带7路捕获和7路比较通道)。

2个16位定时器/外部事件计数器(带3路捕获和7路比较通道)。

低功耗实时时钟(RTC)具有独立的电源和特定的32kHz时钟输入。

多个串行接口,包括2个UART(16C550)、2个高速I2C总线(400 kbit/s)、SPI和具有缓冲作用和数据长度可变功能的SSP。

向量中断控制器(VIC),可配置优先级和向量地址。

多达32个通用I/O口(可承受5V电压)。

多达13个边沿或电平触发的外部中断管脚。

通过一个可编程的片内PLL(100us的设置时间)可实现最大为70MHz的CPU操作频率,其具有10MHz~25MHz的输入频率。

片内集成振荡器与外部晶体的操作频率范围为1~25MHz。

低功耗模式包括空闲模式、掉电模式和带有效RTC的掉电模式。 z z z z z z z z z z z z z

ARM7芯片的使用手册

z

z 可通过个别使能/禁止外围功能和外围时钟分频来优化额外功耗。 通过外部中断或RTC将处理器从掉电模式中唤醒。

1.3 应用

z

z

z

z

z

z

z 工业控制 医疗系统 访问控制 POS机 通信网关 嵌入式软modem 一般性应用

1.4 器件信息

表1 LPC2101/02/03器件信息 器件 管脚数 片内SRAM

4 kB

8 kB 片内FLASH8kB 16 kB 32 kB ADC通道8输入 8输入 8输入 注释 - - 带完整modem接口的UART1 LPC2102 LPC2103 48 48

1.5 结构概述

LPC2101/02/03包含一个支持仿真的ARM7TDMI-S CPU,片内存储器控制器接口的ARM7局部总线,中断控制器接口的AMBA先进高性能总线(AHB)和连接片内外设功能的ARM外设总线(APB,ARM AMBA先进外设总线的兼容超集)。LPC2101/02/03将ARM7 TDMI-S处理器配置为小端字节顺序。

AHB外设分配了2M字节的地址范围,它位于4G字节ARM存储器空间的最顶端。每个AHB外设都在AHB地址空间内分配了16k字节的地址空间。LPC2101/02/03的外设功能(中断控制器除外)都连接到APB总线。AHB到APB的桥将APB总线与AHB总线相连。APB外设也分配了2M字节的地址范围,从3.5G字节地址点开始。每个APB外设在APB地址空间内都分配了16k字节地址空间。

片内外设与器件管脚的连接由管脚连接模块控制(见7.4节)。该模块必须由软件进行配置以符合外设功能与管脚在特定应用中的需求。

1.6 ARM7TDMI-S处理器

ARM7TDMI-S是通用的32位微处理器,它具有高性能和低功耗的特性。ARM结构是基于精简指令集计算机(RISC)原理而设计的,指令集和相关的译码机制比微程序的复杂指令集计算机要简单得多。这样使用一个小的、廉价的处理器核,就可实现很高的指令吞吐量和

ARM7芯片的使用手册

实时的中断响应。

由于使用了流水线技术,处理和存储系统的所有部分都可连续工作。通常,在执行一条指令的同时对下一条指令进行译码,并将第三条指令从存储器中取出。

ARM7TDMI-S处理器也使用了一个被称为THUMB的独特结构化策略,它非常适用于那些对存储器有限制或者需要较高代码密度的大批量产品的应用。

在THUMB后面一个关键的概念是“超精简指令集”。基本上,ARM7TDMI-S处理器具有两个指令集:

z

z 标准32位ARM指令集 16位THUMB指令集

THUMB指令集的16位指令长度使其可以达到标准ARM代码两倍的密度,却仍然保持ARM的大多数性能上的优势,这些优势是使用16位寄存器的传统16位处理器所不具备的。因为THUMB代码和ARM代码一样,在相同的32位寄存器集上进行操作。

THUMB代码仅为ARM代码规模的65%,但其性能却相当于连接到16位存储器系统的相同ARM处理器性能的160%。

关于ARM7TDMI-S处理器的详细内容请参阅ARM官方网站上的ARM7TDMI-S数据手册。

1.7 片内Flash存储器系统

LPC2101/02/03分别含有8kB、16kB和32kB Flash存储器系统。该存储器可用作代码和数据的存储。对FLASH存储器的编程可通过几种方法来实现:

z

z

z 使用内置的串行JTAG接口 使用在系统编程(ISP)和UART 使用在应用编程(IAP)功能

使用IAP功能的应用程序也可以在应用程序运行时对Flash进行擦除和/或编程,这样为数据存储和现场固件升级等都带来了极大的灵活性。整个Flash存储器都可用来存放用户代码,因为引导装载程序位于一个独立的存储器单元中。

LPC2101/02/03的Flash存储器至少可擦除/编程100,000次,保存数据的时间长达20年。

1.8 片内静态RAM(SRAM)

片内静态RAM(SRAM)可用作代码和/或数据的存储,它支持8位、16位和32位的访问。LPC2101/02/03分别含有2/4/8kB的静态RAM。

LPC2101/02/03 SRAM可作为一个字节寻址的存储器访问。对存储器进行字和半字访问时将忽略地址对准,并访问被寻址的自然对准值(因此,对存储器进行字访问时将忽略地址位0和1,半字访问时将忽略地址位0)。因此,有效的读写操作要求半字数据访问的地址线0为0(地址以0、2、4、6、8、A、C和E结尾),字数据访问的地址线0和1都为0(地址以0、4、8和C结尾)。该原则同样用于片外和片内存储器。

SRAM控制器包含一个回写缓冲区,它用于防止CPU在连续的写操作时停止运行。回写缓冲区总是保存着软件发送到SRAM的最后一个字节。该数据只有在软件请求下一次写

ARM7-LPC2103中文用户手册.doc 将本文的Word文档下载到电脑

    精彩图片

    热门精选

    大家正在看

    × 游客快捷下载通道(下载后可以自由复制和排版)

    限时特价:7 元/份 原价:20元

    支付方式:

    开通VIP包月会员 特价:29元/月

    注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
    微信:fanwen365 QQ:370150219