Philips LPC2131, LPC2132, LPC2138 User Guide

INTEGRATED CIRCUITS
LPC2131/2132/2138
User Manual
Preliminary Release
November 22, 2004
Philips Semiconductors
PHILIPS
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Microc ontroller
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Micr ocontroller

Table of Contents

List of Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
List of Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Document Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
General Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Device information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Architectural Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
ARM7TDMI-S Processor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
On-Chip Flash Memory System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
On-Chip Static RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
LPC2131/2132/2138 Memory Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Memory Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
LPC2131/2132/2138 Memory Re-mapping and Boot Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Prefetch Abort and Data Abort Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
System Control Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Summary of System Control Block Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Pin Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Crystal Oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
External Interrupt Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Memory Mapping Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
PLL (Phase Locked Loop) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Power Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
VPB Divider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Wakeup Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Brown-out Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Code Security vs. Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Memory Accelerator Module (MAM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Memory Accelerator Module Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
MAM Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
MAM Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Vectored Interrupt Controller (VIC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
VIC Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Interrupt Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Spurious Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
VIC Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Micr ocontroller
Pin Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
LPC2131/2132/2138 Pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Pin Description for LPC2131/2132/2138 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Pin Connect Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
GPIO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Pin Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
GPIO Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
UART0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Pin Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
UART1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Pin Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
I2C Interfaces I2C0 and I2C1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Pin Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
I2C Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
I2C Implementation and Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Details of I2C Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Software Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
SPI Interface (SPI0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Pin Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
SSP Controller (SPI1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Texas Instruments Synchronous Serial Frame Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
SPI Frame Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Semiconductor Microwire Frame Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Register Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Micr ocontroller
Timer/Counter0 and Timer/Counter1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Pin Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Example Timer Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
Pulse Width Modulator (PWM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Pin Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
A/D Converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Pin DescriptionS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
OPERATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
D/A Converter (LPC2132/2138 only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Pin DescriptionS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
OPERATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Real Time Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
RTC Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Miscellaneous Register Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Consolidated Time Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Time Counter Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Alarm Register Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
RTC Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Reference Clock Divider (Prescaler) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Watchdog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Micr ocontroller
Flash Memory System and Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Flash Boot Loader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Boot process FlowChart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
Sector Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
fLASH cONTENT pROTECTION mECHANISM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
Code Read Protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
IAP Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
JTAG Flash Programming interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
EmbeddedICE Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Pin Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Reset State of Multiplexed Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Embedded Trace Macrocell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Pin Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
Reset State of Multiplexed Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
RealMonitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
How to Enable RealMonitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
RealMonitor build options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Micr ocontroller

List of Figures

Figure 1: LPC2131/2132/2138 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Figure 2: System Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Figure 3: Peripheral Memory Map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Figure 4: AHB Peripheral Map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Figure 5: VPB Peripheral Map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Figure 6: Map of lower memory is showing re-mapped and re-mappable areas
(LPC2138 with 512 kB Flash). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Figure 7: Oscillator modes and models: a) slave mode of operation, b) oscillation mode of operation,
c) external crystal model used for CX1/X2 evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Figure 8: FOSC selection algorithm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Figure 9: External Interrupt Logic. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Figure 10: PLL Block Diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Figure 11: Reset Block Diagram including Wakeup Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Figure 12: VPB Divider Connections. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Figure 13: Simplified Block Diagram of the Memory Accelerator Module . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Figure 14: Block Diagram of the Vectored Interrupt Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Figure 15: LPC2131/2132/2138 64-pin package. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Figure 16: LPC2131/2132/2138 UART0 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Figure 17: UART1 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Figure 18: I2C Bus Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Figure 19: Master Mode Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Figure 20: Format in the master transmitter mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Figure 21: Format of master receiver mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Figure 22: A master receiver switch to master transmitter after sending repeated START. . . . . . . . . . . . 118
Figure 23: Slave Mode Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Figure 24: Format of slave receiver mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Figure 25: Format of slave transmitter mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Figure 26: I2C Bus Serial Interface Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Figure 27: Arbitration Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Figure 28: Serial Clock Synchronization (Figure 14). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Figure 29: (Format and States in the Master Transmitter Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Figure 30: Format and States in the Master Receiver Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Figure 31: Format and States in the Slave Receiver Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Figure 32: Format and States of the Slave Transmitter Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
Figure 33: Simultaneous Repeated START Conditions from 2 Masters . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Figure 34: Forced Access to a Busy I2C Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Figure 35: Recovering from a Bus Obstruction Caused by a Low Level on SDA . . . . . . . . . . . . . . . . . . . 142
Figure 36: SPI Data Transfer Format (CPHA = 0 and CPHA = 1). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Figure 37: SPI Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Figure 38: Texas Instruments synchronous serial frame format:
a) single and b) continuous/back-to-back two frames transfer. . . . . . . . . . . . . . . . . . . . . . . . . 164
Figure 39: SPI frame format with CPOL=0 and CPHA=0 (a) single and b) continuous transfer) . . . . . . . 165
Figure 40: SPI frame format with CPOL=0 and CPHA=1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
Figure 41: SPI frame format with CPOL=1 and CPHA=0 (a) single and b) continuous transfer) . . . . . . . 167
Figure 42: SPI frame format with CPOL=1 and CPHA=1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
Figure 43: Microwire frame format (single transfer). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Figure 44: Microwire frame format (continuos transfers). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Figure 45: Microwire frame format (continuos transfers). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Figure 46: A timer cycle in which PR=2, MRx=6, and both interrupt and reset on match are enabled.. . . 183
Figure 47: A timer cycle in which PR=2, MRx=6, and both interrupt and stop on match are enabled. . . . 183
Figure 48: Timer block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
Figure 49: PWM block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Figure 50: Sample PWM waveforms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Figure 51: RTC block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
Figure 52: RTC Prescaler block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Micr ocontroller
Figure 53: Watchdog Block Diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Figure 54: Map of lower memory after reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
Figure 55: Boot Process flowchart. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
Figure 56: IAP Parameter passing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Figure 57: EmbeddedICE Debug Environment Block Diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Figure 58: ETM Debug Environment Block Diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
Figure 59: RealMonitor components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
Figure 60: RealMonitor as a state machine. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Figure 61: Exception Handlers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Micr ocontroller

List of Tables

Table 1: LPC2131/2132/2138 device information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Table 2: ARM Exception Vector Locations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Table 3: LPC2131/2132/2138 Memory Mapping Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Table 4: Pin summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Table 5: Summary of System Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Table 6: Recommended values for CX1/X2 in oscillation mode
(crystal and external components parameters) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Table 7: External Interrupt Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Table 8: External Interrupt Flag Register (EXTINT - 0xE01FC140). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Table 9: Interrupt Wakeup Register (INTWAKE - 0xE01FC144). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Table 10: External Interrupt Mode Register (EXTMODE - 0xE01FC148) . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Table 11: External Interrupt Polarity Register (EXTPOLAR - 0xE01FC14C). . . . . . . . . . . . . . . . . . . . . . . . 36
Table 12: MEMMAP Register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Table 13: Memory Mapping Control Register (MEMMAP - 0xE01FC040). . . . . . . . . . . . . . . . . . . . . . . . . . 38
Table 14: PLL Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Table 15: PLL Control Register (PLLCON - 0xE01FC080) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Table 16: PLL Configuration Register (PLLCFG - 0xE01FC084) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Table 17: PLL Status Register (PLLSTAT - 0xE01FC088) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Table 18: PLL Control Bit Combinations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Table 19: PLL Feed Register (PLLFEED - 0xE01FC08C). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Table 20: PLL Divider Values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Table 21: PLL Multiplier Values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Table 22: Power Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Table 23: Power Control Register (PCON - 0xE01FC0C0). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Table 24: Power Control for Peripherals Register for LPC2131/2132/2138 (PCONP - 0xE01FC0C4). . . . 46
Table 25: Power Control for Peripherals Register for LPC2131/2132/2138 (PCONP - 0xE01FC0C4). . . . 49
Table 26: VPBDIV Register Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Table 27: VPB Divider Register (VPBDIV - 0xE01FC100). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Table 28: MAM Responses to Program Accesses of Various Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Table 29: MAM Responses to Data and DMA Accesses of Various Types. . . . . . . . . . . . . . . . . . . . . . . . . 57
Table 30: Summary of System Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Table 31: MAM Control Register (MAMCR - 0xE01FC000). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Table 32: MAM Timing Register (MAMTIM - 0xE01FC004) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Table 33: VIC Register Map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Table 34: Software Interrupt Register (VICSoftInt - 0xFFFFF018, Read/Write) . . . . . . . . . . . . . . . . . . . . . 64
Table 35: Software Interrupt Clear Register (VICSoftIntClear - 0xFFFFF01C, Write Only). . . . . . . . . . . . . 64
Table 36: Raw Interrupt Status Register (VICRawIntr - 0xFFFFF008, Read-Only). . . . . . . . . . . . . . . . . . . 64
Table 37: Interrupt Enable Register (VICINtEnable - 0xFFFFF010, Read/Write) . . . . . . . . . . . . . . . . . . . . 65
Table 38: Software Interrupt Clear Register (VICIntEnClear - 0xFFFFF014, Write Only) . . . . . . . . . . . . . . 65
Table 39: Interrupt Select Register (VICIntSelect - 0xFFFFF00C, Read/Write) . . . . . . . . . . . . . . . . . . . . . 65
Table 40: IRQ Status Register (VICIRQStatus - 0xFFFFF000, Read-Only) . . . . . . . . . . . . . . . . . . . . . . . . 65
Table 41: IRQ Status Register (VICFIQStatus - 0xFFFFF004, Read-Only) . . . . . . . . . . . . . . . . . . . . . . . . 66
Table 42: Vector Control Registers (VICVectCntl0-15 - 0xFFFFF200-23C, Read/Write) . . . . . . . . . . . . . . 66
Table 43: Vector Address Registers (VICVectAddr0-15 - 0xFFFFF100-13C, Read/Write). . . . . . . . . . . . . 66
Table 44: Default Vector Address Register (VICDefVectAddr - 0xFFFFF034, Read/Write) . . . . . . . . . . . . 66
Table 45: Vector Address Register (VICVectAddr - 0xFFFFF030, Read/Write). . . . . . . . . . . . . . . . . . . . . 67
Table 46: Protection Enable Register (VICProtection - 0xFFFFF020, Read/Write). . . . . . . . . . . . . . . . . . . 67
Table 47: Connection of Interrupt Sources to the Vectored Interrupt Controller . . . . . . . . . . . . . . . . . . . . . 68
Table 48: Pin description for LPC2131/2132/2138 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Table 49: Pin Connect Block Register Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Table 50: Pin Function Select Register 0 (PINSEL0 - 0xE002C000). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Table 51: Pin Function Select Register 1 (PINSEL1 - 0xE002C004). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Table 52: Pin Function Select Register 2 (PINSEL2 - 0xE002C014). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Table 53: Pin Function Select Register Bits. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Table 54: GPIO Pin Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Micr ocontroller
Table 55: GPIO Register Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Table 56: GPIO Pin Value Register (IO0PIN - 0xE0028000, IO1PIN - 0xE0028010) . . . . . . . . . . . . . . . . . 87
Table 57: GPIO Output Set Register (IO0SET - 0xE0028004, IO1SET - 0xE0028014) . . . . . . . . . . . . . . . 87
Table 58: GPIO Output Clear Register (IO0CLR - 0xE002800C, IO1CLR - 0xE002801C). . . . . . . . . . . . . 87
Table 59: GPIO Direction Register (IO0DIR - 0xE0028008, IO1DIR - 0xE0028018) . . . . . . . . . . . . . . . . . 88
Table 60: UART0 Pin Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Table 61: UART0 Register Map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Table 62: UART0 Receiver Buffer Register (U0RBR - 0xE000C000 when DLAB = 0, Read Only). . . . . . . 91
Table 63: UART0 Transmitter Holding Register (U0THR - 0xE000C000 when DLAB = 0, Write Only) . . . 91
Table 64: UART0 Divisor Latch LSB Register (U0DLL - 0xE000C000 when DLAB = 1). . . . . . . . . . . . . . . 91
Table 65: UART0 Divisor Latch MSB Register (U0DLM - 0xE000C004 when DLAB = 1). . . . . . . . . . . . . . 92
Table 66: UART0 Interrupt Enable Register (U0IER - 0xE000C004 when DLAB = 0) . . . . . . . . . . . . . . . . 92
Table 67: UART0 Interrupt Identification Register (U0IIR - 0xE000C008, Read Only) . . . . . . . . . . . . . . . . 93
Table 68: UART0 Interrupt Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Table 69: UART0 FIFO Control Register (U0FCR - 0xE000C008) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Table 70: UART0 Line Control Register (U0LCR - 0xE000C00C). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Table 71: UART0 Line Status Register (U0LSR - 0xE000C014, Read Only) . . . . . . . . . . . . . . . . . . . . . . . 96
Table 72: UART0 Scratch Pad Register (U0SCR - 0xE000C01C) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Table 73: Baud-rates using 20 MHz peripheral clock (pclk). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Table 74: UART0 Transmit Enable Register (U0TER - 0xE0010030). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Table 75: UART1 Pin Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Table 76: UART1 Register Map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Table 77: UART1 Receiver Buffer Register (U1RBR - 0xE0010000 when DLAB = 0, Read Only). . . . . . 103
Table 78: UART1 Transmitter Holding Register (U1THR - 0xE0010000 when DLAB = 0, Write Only) . . . 103
Table 79: UART1 Divisor Latch LSB Register (U1DLL - 0xE0010000 when DLAB = 1) . . . . . . . . . . . . . . 104
Table 80: UART1 Divisor Latch MSB Register (U1DLM - 0xE0010004 when DLAB = 1). . . . . . . . . . . . . 104
Table 81: UART1 Interrupt Enable Register (U1IER - 0xE0010004 when DLAB = 0). . . . . . . . . . . . . . . . 104
Table 82: UART1 Interrupt Identification Register (U1IIR - 0xE0010008, Read Only) . . . . . . . . . . . . . . . 105
Table 83: UART1 Interrupt Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Table 84: UART1 FIFO Control Register (U1FCR - 0xE0010008) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Table 85: UART1 Line Control Register (U1LCR - 0xE001000C) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Table 86: UART1 Modem Control Register (U1MCR - 0xE0010010) (LPC2138 only) . . . . . . . . . . . . . . . 108
Table 87: UART1 Line Status Register (U1LSR - 0xE0010014, Read Only). . . . . . . . . . . . . . . . . . . . . . . 108
Table 88: UART1 Modem Status Register Bit Descriptions (U1MSR - 0x0xE0010018) (LPC2138 only) . 110
Table 89: UART1 Scratch Pad Register (U1SCR - 0xE001001C). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Table 90: Baud-rates using 20 MHz peripheral clock (pclk). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Table 91: UART1 Transmit Enable Register (U1TER - 0xE0010030). . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Table 92: I2C Pin Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Table 93: I2C Register Map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Table 94: I2C Control Set Register
(I2CONSET: I2C0 - I2C0CONSET: 0xE001C000; I2C1 - I2C1CONSET: 0xE005C000) . . . . . 124
Table 95: I2C Control Clear Register
(I2CONCLR: I2C0 - I2C0CONCLR: 0xE001C018; I2C1 - I2C1CONCLR: 0xE005C018) . . . . . 125
Table 96: I2C Status Register
(I2STAT: I2C0 - I2C0STAT: 0xE001C004; I2C1 - I2C1STAT: 0xE005C004) . . . . . . . . . . . . . . 126
Table 97: I2C Data Register (I2DAT: I2C0 - I2C0DAT: 0xE001C008; I2C1 - I2C1DAT: 0xE005C008) . . 126 Table 98: I2C Slave Address Register
(I2ADR: I2C0 - I2C0DAT: 0xE001C00C; I2C1 - I2C1DAT: 0xE005C00C) . . . . . . . . . . . . . . . . 126
Table 99: I2C SCL High Duty Cycle Register
(I2SCLH: I2C0 - I2C0SCLH: 0xE001C010; I2C1 - I2C1SCLH: 0xE005C010). . . . . . . . . . . . . . 127
Table 100: I2C SCL Low Duty Cycle Register
(I2SCLL: I2C0 - I2C0SCLL: 0xE001C014; I2C1 - I2C1SCLL: 0xE005C014) . . . . . . . . . . . . . . 127
Table 101: Example I2C Clock Rates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Table 102: Master Transmitter Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Table 103: Master Receiver Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Table 104: Slave Receiver Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Table 105: Slave Transmitter Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Micr ocontroller
Table 106: Miscellaneous States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Table 107: SPI Data To Clock Phase Relationship. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Table 108: SPI Pin Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Table 109: SPI Register Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Table 110: SPI Control Register (S0SPCR - 0xE0020000). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Table 111: SPI Status Register (S0SPSR - 0xE0020004) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Table 112: SPI Data Register (S0SPDR - 0xE0020008). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Table 113: SPI Clock Counter Register (S0SPCCR - 0xE002000C) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Table 114: SPI Interrupt Register (S0SPINT - 0xE002001C) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Table 115: SSP Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Table 116: SSP Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Table 117: SSP Control Register 0 (SSPCR0 - 0xE0068000) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Table 118: SSP Control Register 1 (SSPCR1 - 0xE0068004) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
Table 119: SSP Data Register (SSPDR - 0xE0068008). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
Table 120: SSP Status Register (SSPSR - 0xE006800C) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Table 121: SSP Clock Prescale Register (SSPCPSR - 0xE0068010) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Table 122: SSP Interrupt Mask Set/Clear Register (SSPIMSC - 0xE0068014) . . . . . . . . . . . . . . . . . . . . . 173
Table 123: SSP Raw Interrupt Status Register (SSPRIS - 0xE0068018). . . . . . . . . . . . . . . . . . . . . . . . . . 174
Table 124: SSP Masked Interrupt Status Register (SSPMIS - 0xE006801C). . . . . . . . . . . . . . . . . . . . . . . 174
Table 125: SSP Interrupt Clear Register (SSPICR - 0xE0068020). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
Table 126: Pin summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Table 127: TIMER0 and TIMER1 Register Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Table 128: Interrupt Register (IR: TIMER0 - T0IR: 0xE0004000; TIMER1 - T1IR: 0xE0008000). . . . . . . . 178
Table 129: Timer Control Register
(TCR: TIMER0 - T0TCR: 0xE0004004; TIMER1 - T1TCR: 0xE0008004). . . . . . . . . . . . . . . . . 178
Table 130: Count Control Register
(CTCR: TIMER0 - T0CTCR: 0xE0004070; TIMER1 - T1TCR: 0xE0008070) . . . . . . . . . . . . . . 179
Table 131: Match Control Register
(MCR: TIMER0 - T0MCR: 0xE0004014; TIMER1 - T1MCR: 0xE0008014). . . . . . . . . . . . . . . . 180
Table 132: Capture Control Register
(CCR: TIMER0 - T0CCR: 0xE0004028; TIMER1 - T1CCR: 0xE0008028) . . . . . . . . . . . . . . . . 180
Table 133: External Match Register
(EMR: TIMER0 - T0EMR: 0xE000403C; TIMER1 - T1EMR: 0xE000803C) . . . . . . . . . . . . . . . 181
Table 134: External Match Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Table 135: Set and Reset inputs for PWM Flip-Flops. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Table 136: Pin summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Table 137: Pulse Width Modulator Register Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
Table 138: PWM Interrupt Register (PWMIR - 0xE0014000) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
Table 139: PWM Timer Control Register (PWMTCR - 0xE0014004) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Table 140: PWM Match Control Register (PWMMCR - 0xE0014014) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Table 141: PWM Control Register (PWMPCR - 0xE001404C). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Table 142: PWM Latch Enable Register (PWMLER - 0xE0014050). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Table 143: A/D Pin Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
Table 144: A/D Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
Table 145: A/D Control Register (AD0CR - 0xE0034000, AD1CR - 0xE0060000). . . . . . . . . . . . . . . . . . . 199
Table 146: A/D Data Register (AD0DR - 0xE0034004, AD1DR - 0xE0060004). . . . . . . . . . . . . . . . . . . . . 200
Table 147: A/D Global Start Register (ADGSR - 0xE0034008). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
Table 148: D/A Pin Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Table 149: D/A Converter Register (DACR - 0xE006C000) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Table 150: Real Time Clock Register Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Table 151: Miscellaneous Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Table 152: Interrupt Location (ILR - 0xE0024000) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Table 153: Clock Tick Counter (CTC - 0xE0024004) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Table 154: Clock Control Register (CCR - 0xE0024008) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
Table 155: Counter Increment Interrupt Register (CIIR - 0xE002400C). . . . . . . . . . . . . . . . . . . . . . . . . . . 210
Table 156: Alarm Mask Register (AMR - 0xE0024010) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Table 157: Consolidated Time Register 0 (CTIME0 - 0xE0024014). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Micr ocontroller
Table 158: Consolidated Time Register 1 (CTIME1 - 0xE0024018). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Table 159: Consolidated Time Register 2 (CTIME2 - 0xE002401C). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Table 160: Time Counter Relationships and Values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Table 161: Time Counter registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Table 162: Alarm Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Table 163: Reference Clock Divider registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Table 164: Prescaler Integer Register (PREINT - 0xE0024080). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Table 165: Prescaler Fraction Register (PREFRAC - 0xE0024084). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Table 166: Prescaler cases where the Integer Counter reload value is incremented. . . . . . . . . . . . . . . . . 218
Table 167: Watchdog Register Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
Table 168: Watchdog Mode Register (WDMOD - 0xE0000000). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
Table 169: Watchdog Constatnt Register (WDTC - 0xE0000004) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
Table 170: Watchdog Feed Register (WDFEED - 0xE0000008) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Table 171: Watchdog Timer Value Register (WDTV - 0xE000000C) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Table 172: Flash sectors in LPC2131, LPC2132 and LPC2138. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
Table 173: ISP Command Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Table 174: ISP Unlock command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Table 175: ISP Set Baud Rate command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
Table 176: Correlation between possible ISP baudrates and external crystal frequency (in MHz). . . . . . . 232
Table 177: ISP Echo command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
Table 178: ISP Write to RAM command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Table 179: ISP Read Memory command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Table 180: ISP Prepare sector(s) for write operation command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
Table 181: ISP Copy command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
Table 182: ISP Go command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Table 183: ISP Erase sector command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Table 184: ISP Blank check sector command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Table 185: ISP Read Part Identification command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Table 186: ISP Read Boot Code version number command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Table 187: ISP Compare command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Table 188: ISP Return Codes Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Table 189: IAP Command Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Table 190: IAP Prepare sector(s) for write operation command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Table 191: IAP Copy RAM to Flash command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Table 192: IAP Erase Sector(s) command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
Table 193: IAP Blank check sector(s) command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
Table 194: IAP Read Part Identification command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
Table 195: IAP Read Boot Code version number command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Table 196: IAP Compare command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Table 197: Reinvoke ISP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Table 198: IAP Status Codes Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Table 199: EmbeddedICE Pin Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Table 200: EmbeddedICE Logic Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Table 201: ETM Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Table 202: ETM Pin Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
Table 203: ETM Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Table 204: RealMonitor stack requirement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Microcontroller

DOCUMENT REVISION HISTORY

2004 Aug 25:
• Prototype of combined LPC2132/2138 User Manual created from the design specification. 2004 Sep 13:
• Informatoin on counter functionality of the TIMER0/1 added into "Introduction" and "Timer/Counter0 and Timer/Counter1" chapters.
• Reference to the LPC201x in Table 23, “Power Control Register (PCON - 0xE01FC0C0),” ("System Control Block" chapter) replaced with the LPC2132/2138.
• Info on reserved bits in Table 52, “Pin Function Select Register 2 (PINSEL2 - 0xE002C014),” ("Pin Connect Blo ck" chapter) corrected.
• Reference to the PORT2/3 in the " R egi st er D e sc rip tio n" section of the "GPI O" c ha pter rem ov ed . Nu mbe r o f PO RT0 available pins discussed in this section also updated.
2004 Sep 14:
• RTC related information added into the "Reset" and "Wakeup Timer" sections of the "System Control Block" chapter.
• "RTC Usage Notes" section in the "Real Time Clock" chapter updated.
2004 Sep 15:
• Count Control Register description in the "Timer/Counter0 and Timer/Counter1" chapter uptaded.
• All available CAP and MAT pins listed in the Pin Description section of the "Timer/Counter0 and Timer/Counter1" chapter.
• Details on the counter mode added into the Count Control register description in the "Timer/Counter0 and Timer/Counter1" chapter.
2004 Sep 16:
• Typographic errors in the "SSP Controller (SPI1)" chapter corrected.
• Details on Flash erase/write cycles and data retention added into the "Introduction" chapter.
2004 Nov 22:
2
• An updated I
C chapter in cluded in the document.
• Missing chapter on the Memory Accelerator Module (MAM) added to the document.
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Microcontroller
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Microcontroller

1. INTRODUCTION

GENERAL DESCRIPTION

The LPC2131/2132/213 8 microcontrollers are b ased on a 32/16 bit ARM 7TDMI-S™ CPU with real-time em ulation and embedded trace support, that combines the microcontroller with 32 kB, 64 kB and 512 kB of embedded high speed Flash memory. A 128­bit wide memory interface a nd a unique acce lerator architecture enable 32-bit co de execution at maximum clock rate. For critical code size applica tions , the al ternati ve 16-b it Thum b
Due to their tiny siz e and low p ower consu mption, th ese micr ocontroll ers are ideal f or applica tions where miniat urization is a key requirement, such as acces s control and point-of-sal e. With a wide range of serial co mmunications inte rfaces and on-chip SRAM options of 8/16/32 kB, they are very well suited for communication gateways and protocol converters, soft modems, voice recognition and low en d imaging, provid ing both large buffer si ze and high processi ng power. Various 32-bi t timers, single or dual 10-bit 8 channel ADC(s), 10-bit DAC, PWM channel s and 47 GPIO lines with up to ni ne edge or leve l sensitiv e external interrupt pins make these microcontrollers particularly suitable for industrial control and medical systems.

FEATURES

• 16/32-bit ARM7TDMI-S microcontroller in a tiny LQFP64 package.
• 8/16/32 kB of on-chip static RAM and 32/64/512 kB of on-chip Flash program memory. 128 bit wide interface/accelerator enables high speed 60 MHz operation.
• In-System/In-Applicati on Programming (ISP/IAP) via on-chi p boot-loader softw are. Single Flash sector or ful l chip erase in 400 ms and programming of 256 bytes in 1 ms.
• EmbeddedICE® RT and Embedded Trace interfaces offer real-time debugging with the on-chip RealMonitor™ software and high speed tracing of instruction execution.
• One (LPC2131/2132) or two (LPC2138) 8 channel 10-bit A/D converters provide a total of up to 16 analog inputs, with conversion times as low as 2.44 s per chann el.
• Single 10-bit D/A converter provides variable analog output. (LPC2132/2138 only)
• Two 32-bit timers/counters (with four capture and four compare channels each), PWM unit (six outputs) and watchdog.
• Real-time clock equipped with independent power and clock supply permitting extremely low power consumption in power­save modes.
• Multiple serial inte rfaces inc ludin g two UA RTs (16C 550), two Fast I2 C (400 kb it/s), SPI data length capabilitie s.
• Vectored interrupt controller with configurable priorities and vector addresses.
• Up to 47 of 5 V tolerant general purpose I/O pins in tiny LQFP64 package.
• Up to nine edge or level sensitive external interrupt pins available.
• 60 MHz maximum CPU clock available from programmable on-chip Phase-Locked Loop (PLL) with settling time of 100 microseconds.
• On-chip crystal oscillator with an operating range of 1 MHz to 30 MHz.
• Power saving modes include Idle and Power-down.
• Individual enable/disable of peripheral functions as well as peripheral clock scaling down for additional power optimization.
• Processor wake-up from Power-down mode via external interrupt.
• Single power supply chip with Power-On Reset (POR) and Brown-Out Detection (BOD) circuits:
- CPU operating voltage range of 3.0 V to 3.6 V (3.3 V 10 %) with 5 V tolerant I/O pads.
®
Mode reduces code by more t han 30 % wi th min imal perf ormanc e pena lty.
and SSP with buffering and vari able
Introduction 15 November 22, 2004
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Microcontroller

APPLICATIONS

• Industrial control
• Medical systems
• Access control
•Point-of-sale
• Communication gatew ay
• Embedded soft modem
• General purpose applications

DEVICE INFORMATION

Table 1: LPC2131/2132/2138 device information
Device No. of pins On-chip RAM
LPC2131 64 8 kB 32 8 - ­LPC2132 64 16 kB 64 8 - ­LPC2138 64 32 kB 512 16 1 -
On-chip
FLASH
No. of 10-bit
AD Channels
No. of 10-bit
DA Channels
Note
Introduction 16 November 22, 2004
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Microcontroller

ARCHITECTURAL OVERVIEW

The LPC2131/2132/2138 consists of an ARM7TDM I-S CPU with emulatio n support, the ARM7 Lo cal Bus for interface to on -chip memory controllers, the AMBA Advanced High-performance Bus (AHB) for interface to the interrupt controller, and the VLSI Peripheral Bus (VPB, a compatible superset of ARM’s AMBA Advanced Peripheral Bus) for connection to on-chip peripheral functions. The LPC2131/2132/2138 configures the ARM7TDMI-S processor in little-endian byte order.
AHB peripherals are allocated a 2 megabyte range of addresses at the very top of the 4 gigabyte ARM memory space. Each AHB peripheral is allocate d a 16 kilobyte address space within the AHB addres s space. LPC2131/2132 /2138 peripheral funct ions (other than the interrupt controller) are connected to the VPB bus. The AHB to VPB bridge interfaces the VPB bus to the AHB bus. VPB peripherals are also allocated a 2 megabyte range of addresses, beginning at the 3.5 gigabyte address point. Each VPB peripheral is allocated a 16 kilobyte address space within the VPB address space.
The connection of on -ch ip pe rip hera ls to dev ic e pi ns is c ont roll ed b y a Pin C onn ec t Bloc k. T his mu st be con fig ure d by soft w are to fit specific application requirements for the use of peripheral functions and pins.

ARM7TDMI-S PROCESSOR

The ARM7TDMI-S is a general purpose 32-bit microproce ssor, which offers high perfo rmance and very low pow er consumption . The ARM architecture is based on Reduced Instruction Set Computer (RISC) principles, and the instruction set and related decode mechanism are much simpler than those of microprogrammed Complex Instruction Set Computers. This simplicity results in a high instruction throughput and impressive real-time interrupt response from a small and cost-effective processor core.
Pipeline techniques are em plo ye d so tha t all parts of the processing and memo ry systems can operate continuou sl y. Ty pic al ly, while one instruction is being executed, its successor is being decoded, and a third instruction is being fetched from memory.
The ARM7TDMI-S processor also employs a unique architectural strategy known as THUMB, which makes it ideally suited to high-volume applications with memory restrictions, or applications where code density is an issue.
The key idea behind THUMB is that of a super-reduced instruction set. Essentially, the ARM7TDMI-S processor has two instruction sets:
• The standard 32-bit ARM instruction set.
• A 16-bit THUMB instruction set.
The THUMB set’s 16-bit ins truc tion length allows it to ap proa ch tw ice the density of standard ARM c ode w hil e re tain in g m ost of the ARM’s performance advantage over a traditional 16-bit processor using 16-bit registers. This is possible because THUMB code operates on the same 32-bit register set as ARM code.
THUMB code is able to provide up to 65% of the code size of ARM, and 160% of the performance of an equivalent ARM processor connected to a 16-bit memory system.
The ARM7TDMI-S processor is described in detail in the ARM7TDMI-S Datasheet that can be found on official ARM website.

ON-CHIP FLASH MEMORY SYSTEM

The LPC2131/2132/213 8 inco rporate a 32 k B, 64 kB and 512 kB Flash m emory syste m respecti vely. Thi s memory ma y be used for both code and data storage. Programming of the Flash memory may be accomplished in several ways: over the serial built­in JTAG interface, using In System Programming (ISP) and UART0, or by means of In Application Programming (IAP) capabilities. The app lication program, us ing the In App lication Pro gramming (IAP) function s, may also e rase and/or p rogram the Flash while the application is running, allowing a great degree of flexibility for data storage field firmware upgrades, etc. When the LPC2131/2132/2138 on-chip bootloader is used, 32/64/500 kB of Flash memory is available for user code.
Introduction 17 November 22, 2004
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Microcontroller
The LPC2131/2132/2138 Flash memory provides minimum of 10,000 erase/write cycles and 10 years of data-retention.

ON-CHIP STATIC RAM

On-Chip static RAM (SRAM ) may b e used for code and/or d ata sto rage. The SRAM may be acc essed as 8-bits, 16 -bit s, and 3 2­bits. The LPC2131/2132/2138 provide 8/16/32 kB of static RAM respectively.
The LPC2131/LPC2132/ 2138 SRAM is des igned to be acce ssed as a by te-address ed memory. Word an d halfword acc esses to the memory ignore the al ignme nt of the add ress an d access the natural ly-ali gned va lue t hat is add ressed (so a memory access ignores address bits 0 and 1 for word acces ses, and ignores bit 0 for halfword acc esses). Therefore valid reads and w rites require data accessed as halfwords to originate from addresses with address line 0 being 0 (addresses ending with 0, 2, 4, 6, 8, A, C, adnd E) and data a ccessed as wo rds to origina te from adres ses with add ress l ines 0 and 1 bein g 0 (a ddress es endin g wi th 0, 4 , 8, and C). This rule applies to both off and on-chip memory usage.
The SRAM controller inc orpo rate s a wri te-b ac k bu ffer i n ord er to p rev ent CPU stalls during back -to- bac k wr i tes . The write-b ac k buffer always holds the last data sent by software to the SRAM. This data is only written to the SRAM when another write is requested by software (the data is only written to the SRAM when software does another write). If a chip reset occurs, actual SRAM contents will not reflect the most recent write request (i.e. after a "warm" chip reset, the SRAM does not reflect the last write operation). Any software that checks SRAM contents after reset must take this into account. Two identical writes to a location guarantee that the data will be present after a Reset. Alternatively, a dummy write operation before entering idle or power-down mode will similarly guarantee that the last data written will be present in SRAM after a subsequent Reset.
Introduction 18 November 22, 2004
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Microcontroller

BLOCK DIAGRAM

ARM7 Local Bus
Internal SRAM
Controller
8/16/32 kB
SRAM
EINT3:0
8 x CAP0
8 x MAT
AD0.7:0
2
AD1.7:0
3
A
out
Internal Flash
Controller
32/64/512 kB
FLASH
External
Interrupts
Capture / Compare
(w/ external clock)
TIMER 0 & 1
A/D Converters
0 and 1
D/A Converter
2
2
1
1
TMS
TRST
Test/Debug Interface
1
1
1
TDI
TCK
TDO
ARM7TDMI-S
AHB Bridge
AHB to VPB
Bridge
VPB (VLSI Peripheral Bus)
PLL
System
Module
Emulation Trace
(Advanced High-performance Bus)
Clock
AMBA AHB
VPB
Divider
I2C Serial
Interfaces 0 and 1
SPI and SSP
Serial Interfaces
UART 0 & 1
Real Time
Clock
Xtal2
Xtal1
RESET
System
Functions
Vectored Interrupt
Controller
AHB
Decoder
SCL0,1 SDA0,1
SCK0,1 MOSI0,1 MISO0,1 SSEL0,1
TxD0,1
RxD0,1
DSR12,CTS12,RTS1
DTR12, DCD12,RI1
RTXC1 RTXC2
V
bat
2
2
P0.31:0
P1.31:16, 1:0
PWM6:1
1
Shared with GPIO.
2
LPC2138 only.
3
LPC2132/2138 only.
2
General
Purpose I/O
PWM0
Watchdog
Timer
System Control
Figure 1: LPC2131/2132/2138 Block Diagram
Introduction 19 November 22, 2004
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Microcontroller
Introduction 20 November 22, 2004
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Microcontroller

2. LPC2131/2132/2138 MEMORY ADDRESSING

MEMORY MAPS

The LPC2131/2132 /2138 incorporates several distinct memory r egions, shown in t he following figures. Figure 2 shows the overall map of the entire addr ess sp ace fro m the user p rogra m view point fo llow ing reset. Th e interr upt vec tor area s upport s address re­mapping, which is described later in this section.
4.0 GB
3.75 GB
3.5 GB
3.0 GB
2.0 GB
1.0 GB
AHB Peripherals
VPB Peripherals
Reserved Address
Space
Boot Block
(re-mapped from On-Chip Flash memory)
Reserved Address Space
32 kB On-Chip Static RAM (LPC2138) 16 kB On-Chip Static RAM (LPC2132)
8 kB On-Chip Static RAM (LPC2131)
0xFFFF FFFF 0xF000 0000
0xE000 0000
0xC000 0000
0x8000 0000
0x4000 8000 0x4000 7FFF
0x4000 4000 0x4000 3FFF
0x4000 2000 0x4000 1FFF
0x4000 0000
Reserved Address Space
0x0008 0000
512 kB On-Chip No n-Volatile Memo ry (LPC2138) 64 kB On-Chip Non-Volatile Memory (LPC21 32) 32 kB On-Chip Non-Volatile Memory (LPC2131)
0.0 GB
Figure 2: System Memory Map
LPC2131/2132/2138 Memory Addressing 21 November 22, 2004
0x0007 FFFF 0x0001 0000
0x0000 FFFF
0x0000 8000
0x0000 7FFF 0x0000 0000
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Microcontroller
Notes:
- AHB section is 128 x 16 kB blocks (totaling 2 MB).
- VPB section is 128 x 16 kB blocks (totaling 2 MB).
4.0 GB
4.0 GB - 2 MB
3.75 GB
AHB Peripherals
0xFFFF FFFF 0xFFE0 0000
0xFFDF FFFF
Reserved
0xF000 0000 0xEFFF FFFF
Reserved
3.5 GB + 2 MB
0xE020 0000 0xE01F FFFF
VPB Peripherals
3.5 GB
0xE000 0000
Figure 3: Peripheral Memory Map
Figures 3 through 5 show different views of the peripheral address space. Both the AHB and VPB peripheral areas are 2 megabyte spaces whic h are divided up into 128 periph erals. Each peripheral space is 16 kilobytes in size . This allows simplifyi ng the address decod ing for ea ch perip heral. All periphera l registe r addresses are wor d aligned (to 32-bit b oundar ies) regard less of their size. This eliminate s th e nee d for byte lane mapping hardwa re tha t w oul d be requi red to all ow by te (8-bit) or half-word (16­bit) accesses to occur at smaller boundaries. An implication of this is that word and half-word registers must be accessed all at once. For example, it is not possible to read or write the upper byte of a word register separately.
LPC2131/2132/2138 Memory Addressing 22 November 22, 2004
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Microcontroller
Vectored Interrupt Controller
(AHB peripheral #126)
(AHB peripheral #125)
(AHB peripheral #124)
(AHB peripheral #3)
(AHB peripheral #2)
0xFFFF F000 (4G - 4K)
0xFFFF C000
0xFFFF 8000
0xFFFF 4000
0xFFFF 0000
0xFFE1 000 0
0xFFE0 C000
(AHB peripheral #1)
(AHB peripheral #0)
Figure 4: AHB Peripheral Map
0xFFE0 800 0
0xFFE0 400 0
0xFFE0 000 0
LPC2131/2132/2138 Memory Addressing 23 November 22, 2004
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Microcontroller
System Control Block
(VPB peripheral #127)
(VPB peripherals #28- 126)
not used
DAC
(VPB peripheral #27)
SSP
(VPB peripheral #26)
not used
(VPB peripheral #25)
10 bit AD1 (LPC2138)
(VPB peripheral #24)
2
I
C1
(VPB peripheral #23)
not used
(VPB peripheral #14-22)
10 bit AD0
(VPB peripheral #13)
not used
(VPB peripheral #12)
Pin Connect Block
(VPB peripheral #11)
GPIO
(VPB peripheral #10)
RTC
(VPB peripheral #9)
SPI0
(VPB peripheral #8)
2
C0
I
(VPB peripheral #7)
not used
(VPB peripheral #6)
PWM
(VPB peripheral #5)
UART1
(VPB peripheral #4)
UART0
(VPB peripheral #3)
TIMER1
(VPB peripheral #2)
TIMER0
(VPB peripheral #1)
Watchdog Timer
(VPB peripheral #0)
0xE01F FFFF 0xE01F C000
0xE007 0000
0xE006 C000
0xE006 8000
0xE006 4000
0xE006 0000
0xE005 C000
0xE003 8000
0xE003 4000
0xE003 0000
0xE002 C000
0xE002 8000
0xE002 4000
0xE002 0000
0xE001 C000
0xE001 8000
0xE001 4000
0xE001 0000
0xE000 C000
0xE000 8000
0xE000 4000
0xE000 0000
Figure 5: VPB Peripheral Map
LPC2131/2132/2138 Memory Addressing 24 November 22, 2004
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Microcontroller

LPC2131/2132/2138 MEMORY RE-MAPPING AND BOOT BLOCK

Memory Map Concepts and Operating Modes

The basic concept on the LPC21 31/2132/2138 is that each mem ory area has a " natural " location i n the memo ry map. Thi s is the address range for which code residing in that area is written. The bulk of each memory space remains permanently fixed in the same location, eliminating the need to have portions of the code designed to run in different address ranges.
Because of the location of the interrupt vectors on the ARM7 processor (at addresses 0x0000 0000 through 0x0000 001C, as shown in Table 2 below), a sma ll portion of the Boot Blo ck and SRAM spa ces need to be re-ma pped in order to al low alternati ve uses of interrupts in the different operating modes described in Table 3. Re-mapping of the interrupts is accomplished via the Memory Mapping Control feature described in the System Control Block section.
Table 2: ARM Exception Vector Locations
Address Exception 0x0000 0000 Reset 0x0000 0004 Undefined Instruction 0x0000 0008 Software Interrupt
0x0000 000C Prefetch Abort (instruction fetch memory fault)
0x0000 0010 Data Abort (data access memory fault) 0x0000 0014 Reserved * 0x0000 0018 IRQ
0x0000 001C FIQ
*: Identified as reserved in ARM do cumen tation , this loca tion is us ed by the Boot Loader as the Valid User Progra m key. Thi s is descibed in detail in Flash Memory System and Programming on page 225.
Table 3: LPC2131/2132/2138 Memory Mapping Modes
Mode Activation Usage
Boot Loader
mode
User Flash
mode
User RAM
mode
Hardware activation
by any Reset
Software activation
by Boot code
Software activation
by User program
The Boot Loader always mapped to the bottom of memory to allow handling exceptions and using interrupts during the Boot Loading process.
Activated by Boot Loader whe n a valid User Program Si gnature is recogni zed in memory and Boot Loader operation is not forced. Interrupt vectors are not re-mapped and are found in the bottom of the Flash memory.
Activated by a User Program as de sir ed. In terru pt ve ctors are re-mapped to the bottom of the Static RAM.
executes after any reset. The Boot Block interrupt vectors are
LPC2131/2132/2138 Memory Addressing 25 November 22, 2004
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Microcontroller

Memory Re-Mapping

In order to allo w for com patibili ty with future der ivatives , the en tire Boot Block i s mapped to the top of t he on -chip mem ory space. In this manner, the use of larger or smaller flash modules will not require changing the location of the Boot Block (which would require changing the Boot Loader code itself ) or changing the mappin g of the Boot Block interru pt vectors. Memo ry spaces other than the interrupt vectors remain in fixed locations. Figure 6 shows the on-chip memory mapping in the modes defined above.
The portion of memory that is re-mapped to allow interrupt processing in different modes includes the interrupt vector area (32 bytes) and an additional 32 bytes, for a total of 64 bytes. The re-mapped code locations ove rlay addresses 0x0000 0000 throu gh 0x0000 003F. A typical u ser progra m in th e Flash memory c an place the entir e FIQ h andler at addre ss 0x0000 001C w ithout a ny need to consider memory boundaries. The vector contained in the SRAM, external memory, and Boot Block must contain branches to the actual interrupt handlers, or to other instructions that accomplish the branch to the interrupt handlers.
There are three reasons this configuration was chosen:
1. To give the FIQ handler in the Flash memory the advantage of not having to take a memory boundary caused by the re­mapping into account.
2. Minimize the need to for th e SRAM and Bo ot Blo ck vec to rs to deal with arbitrary boun dari es in th e mi ddl e of cod e sp ac e.
3. To provide space to store constants for jumping beyond the range of single word branch instructions.
Re-mapped memory are as, includin g the Boot Block and interr upt vectors, con tinue to appear in their original loc ation in additi on to the re-mapped address.
Details on re-mapping and examples can be found in System Control Block on page 29.
LPC2131/2132/2138 Memory Addressing 26 November 22, 2004
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Microcontroller
0x8000 0000
2.0 GB
2.0 GB - 8K
12K byte Boot Block
(re-mapped from top of Flash memory)
(Boot Block interrupt vectors)
Reserved Addressing Space
0x7FFF FFFF
1.0 GB
32 kB On-Chip SRAM
(SRAM interrupt vectors)
Reserved Addressing Space
(12k byte Boot Block re-Mapped to higher address range)
512K byte Flash Memory
0x4000 8000 0x4000 7FFF
0x4000 0000 0x3FFF FFFF
0x0008 0000 0x0007 FFFF
0.0 GB
Note: memory regions are not drawn to scale.
Active interrupt vectors (from Flash, SRAM, or Boot Block)
0x0000 0000
Figure 6: Map of lower memory is showing re-mapped and re-mappable areas (LPC2138 with 512 kB Flash).
LPC2131/2132/2138 Memory Addressing 27 November 22, 2004
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Microcontroller

PREFETCH ABORT AND DATA ABORT EXCEPTIONS

The LPC2131/2132/2138 ge nerates the ap propriate bus cycle abort exce ption if an acc ess is attempte d for an address tha t is in a reserved or unassigned address region. The regions are:
• Areas of the memory map that are not implemented for a specific ARM derivative. For the LPC2131/2132/2138, this is:
- Address space between On-Chip Non-Volatile Memory and On-Chip SRAM, labelled "Reserved Addressing Space" in Figure 2 and Figure 6. For 32 kB Flash device this is memory address range from 0x0000 8000 to 0x3FFF FFFF, for 64 kB Flash device this is memory address range from 0x0001 0000 to 0x3FFF FFFF, while for 512 kB Flash device this range is from 0x0008 0000 to 0x3FFF FFFF.
- Address space between On-Chi p S ta tic RAM and Ex ternal Me mory. Labell ed "Rese rved Ad dressing Space" in Figure 2. For 8 kB SRAM device this is memory address range from 0x4000 1FFF to 0x7FFF DFFFF, for 16 kB SRAM device this is memory address range from 0x4000 3FFF to 0x7FFF DFFF, while for 32 kB SRAM device this range is from 0x4000 7FFF to 0x7FFF D000. This is an address range from 0x4000 3FFF to 0x7FFF D000.
- Reserved regions of the AHB and VPB spaces. See Figure 3.
• Unassigned AHB peripheral spaces. See Figure 4.
• Unassigned VPB peripheral spaces. See Figure 5. For these areas, both atte mpted data acc ess and instruc tion fetch gen erate an excep tion. In additi on, a Prefetch Abort exceptio n
is generated for any instruction fetch that maps to an AHB or VPB peripheral address. Within the addres s spa ce of an ex is tin g VPB peri phe ral, a data abort exception is not genera ted in res po ns e to an ac ce ss to an
undefined address. Address decoding within eac h peri phe ral is li mit ed to that ne ede d to di stinguish defined regist ers wi thin the peripheral itself. Fo r example, an access to address 0xE0 00D000 (an un defined add ress wit hin the UART0 space) may result in an access to the register defined at address 0xE000C000. Details of such address aliasing within a peripheral space are not defined in the LPC2131/2132/2138 documentation and are not a supported feature.
Note that the ARM core stores the Prefetch Abort flag along with the associated instruction (which will be meaningless) in the pipeline and processes the abort only if an attempt is made to execute the instruction fetched from the illegal address. This prevents acciden tal abort s that co uld be ca used by prefetc hes tha t occur w hen co de is ex ecute d very ne ar a memo ry boun dary.
LPC2131/2132/2138 Memory Addressing 28 November 22, 2004
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Microcontroller

3. SYSTEM CONTROL BLOCK

SUMMARY OF SYSTEM CONTROL BLOCK FUNCTIONS

The System Control Block includes several system features and control registers for a number of functions that are not related to specific peripheral devices. These include:
• Crystal Oscillator.
• External Interrupt Inputs.
• Memory Mapping Control.
•PLL.
• Power Control.
•Reset.
• VPB Divider.
• Wakeup Timer. Each type of fu nction has it s own reg ister(s) if any are required and unnee ded bits a re defined as reserved i n order to allow future
expansion. Unrelated functions n ever share the same register addresses.

PIN DESCRIPTION

Table 4 shows pins that are associated with System Control block functions.
Table 4: Pin summary
Pin name Pin direction Pin Description
X1 Input Crystal Oscillator Input- Input to the oscillator and internal clock generator circuits. X2 Output Crystal Oscillator Output- Output from the oscillator amplifier.
External Interrupt Input 0- An ac tive low general p urpose interru pt input. This pin may be
EINT0 Input
EINT1 Input
EINT2 Input
used to wake up the processor from Idle or Power down modes. Pins P0.1 and P0.16 can be selected to perform EINT0 function.
External Interrupt Input 1- See the EINT0 description above. Pins P0.3 and P0.14 can be selected to perform EINT1 function. LOW level on pin P0.14 immediately after reset is considered as an external hardware
request to start the ISP c ommand handler. M ore details on I SP and Serial Boot Load er can be found in "Flash Memory System and Programming" chapter.
External Interrupt Input 2- See the EINT0 description above. Pins P0.7 and P0.15 can be selected to perform EINT2 function.
External Interrupt Input 3- See the EINT0 description above.
EINT3 Input
Pins P0.9, P0.20 and P0.30 can be selected to perform EINT3 function.
R
ESET Input
System Control Block 29 November 22, 2004
External Reset input- A low on this pin resets the chi p, causing I/O ports and periphe rals to take on their default states, and the processor to begin execution at address 0.
P
hilips Semiconductors Preliminary User Manu
al
LPC2131/2132/2138ARM-based Microcontroller

REGISTER DESCRIPTION

All registers, regardless of size, are on word address boundaries. Details of the registers appear in the description of each function.
Table 5: Summary of System Control Registers
Name Description Access
External Interrupts
EXTINT External Interrupt Flag Register. R/W 0 0xE01FC140 EXTWAKE External Interrupt Wakeup Register. R/W 0 0xE01FC144 EXTMODE External Interrupt Flag Register. R/W 0 0xE01FC148
EXTPOLAR External Interrupt Wakeup Register. R/W 0 0xE01FC14C
Memory Mapping Control
MEMMAP Memory Mapping Control. R/W 0 0xE01FC040
Phase Locked Loop
PLLCON PLL Control Register. R/W 0 0xE01FC080
PLLCFG PLL Configuration Register. R/W 0 0xE01FC084 PLLSTAT PLL Status Register. RO 0 0xE01FC088 PLLFEED PLL Feed Register. WO NA 0xE01FC08C
Power Control
PCON Power Con trol Register. R/W 0 0xE01FC0C0
PCONP Power Control for Peripherals. R/W 0x3BE 0xE01FC0C4
VPB Divider
VPBDIV VPB Divider Control. R/W 0 0xE01FC100
Reset
Value*
Address
Reset
RSID Reset Source Identification Register R/W 0 0xE01FC180
Code Security/Debugging
CSPR Code Security Protection Register RO 0 0xE01FC184
*Reset Value refers to the data stored in used bits only. It does not include reserved bits content.
System Control Block 30 November 22, 2004
Loading...
+ 234 hidden pages