• Prototype LPC2106/2105/2104 User Manual created from the design specification.
July, 2003:
• Flash Programming chapter added.
• Memory Accelerator Module chapter added.
• Register names in UARTs and timers updated.
• List of all registers added in the Introduction chapter.
• Pin Configuration chapter added.
August, 2003:
• MAM, VIC, GPIO, and RTC Usage Notes added.
• EmbeddedICE chapter updated.
September, 2003:
• Details on JTAG ports added in the EmbeddedICE chapter.
• Details on crystal oscillator added in the System Control Block chapter.
• List of possible baudrates when ISP is used added in the Flash Memory System and Programming chapter.
• Details on reset timing requirem en ts add ed in the Sys tem Control Block, Reset chapter.
October, 2003:
• Number of Flash erase and write cycel is added in the Introduction chapter.
13October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
14October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
1. INTRODUCTION
FEATURES
• ARM7TDMI-S processor.
• 128 kilobyte on-chip Flash Program Memory with In-System Programming (ISP) and In-Application Programming (IAP)
capability. Flash programming time is 1 ms for up to a 512 byte line. 10,000 erase and write cycles are guaranteed per 512
byte line. Single sector erase (8 kB) or the whole chip erase is done in 400 ms.
• Standard ARM Test/Debug interface for compatibility with existing tools.
2
• Very small package LQFP48 (7x7mm
• Two UARTs, one with full modem interface.
•I2C serial interface.
• SPI serial interface.
• Two timers, each with 4 capture/compare channels.
• PWM unit with up to 6 PWM outputs.
• Real Time C lock.
• Watchdog Timer.
• General purpose I/O pins.
• CPU operating range up to 60 MHz.
• Dual power supply.
- CPU operating voltage range of 1.65V to 1.95V (1.8V +/- 8.3%).
- I/O power supply range of 3.0V to 3.6V (3.3V +/- 10%).
).
• Two low power modes, Idle and Power Down.
• Processor wakeup from Power Down mode via external interrupt.
• Individual enable/disable of peripheral functions for power optimization.
• On-chip crystal oscillator with an operating range of 10 MHz to 25 MHz.
• On-chip PLL allows CPU operation up to the maximum CPU rate. May be used over the entire crystal operating range.
APPLICATIONS
• Internet gateway.
• Serial communications protocol converter.
• Access control.
• Industrial Control.
• Medical equipment.
Introduction15October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
ARCHITECTURAL OVERVIEW
The LPC2106/2105/2104 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 LPC2106/2105/2104 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 allocated a 16 kilobyte address space within the AHB address space. LPC2106/05/04 peripheral functions
(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-chip pe ripherals to d evice pins i s controlled by a Pin Conne ction Block. This must be configured by software
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 memory systems can operat e con tinuously. Typically,
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 TH UMB instruction set.
The THUMB set’s 16-bit ins truc tion length allows it to approach twic e th e de ns ity of s tan dard ARM code while retaining most 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 LPC2106/2105/2104 incorporates a 128K byte Flash memory system. This memory may be used for both code and data
storage. Programming o f the Fl ash m emory ma y be a ccom plish ed in sev eral w ays: over t he seri al bui lt-in JT AG interfa ce, us ing
In System Programming (ISP) and UART0, or by means of In Application Programming (IAP) capabilities. The application
program, using the In Application Programming (IAP) functions, may also erase and/or program the Flash while the application
is running, allowing a great degree of flexibility for data storage field firmware upgrades, etc.
Introduction16October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
ON-CHIP STATIC RAM
The LPC2106, LPC210 5 and LPC 2104 prov ide a 64K byte, 32K b yte and 16 K byte sta tic RAM me mory r espectivel y that may be
used for code and/or data storage. The SRAM supports 8-bit, 16-bit, and 32-bit accesses.
The SRAM controller incorpo r ate s a wri te-b ac k bu ffer i n ord er to p rev ent CPU s tal ls d urin g ba ck -to-back writes. The write-back
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. If a ch ip res et occurs , actu al SRAM cont ent s w ill not refl ec t the mo st recen t wr ite req ue st. Any sof tw are
that checks SRAM contents after reset must take this into account. A dummy write to an unused location may be appended to
any operation in order to guarantee that all data has really been written into the SRAM.
Introduction17October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
BLOCK DIAGRAM
Internal SRAM
Controller
64/32/16 kB
SRAM
EINT0 *
EINT1 *
EINT2 *
CAP0..2 *
MAT0..2 *
ARM7 Local Bus
Internal Flash
External
Interrupts
Capture /
Compare
Timer 0
Controller
128 kB
FLASH
1
1
TMS
TRST
Test/Debug Interface
1
1
1
TDI
TCK
TDO
ARM7TDMI-S
AHB Bridg e
AHB to VPB
Bridge
VPB (VLSI
Peripheral Bus)
PLL
System
Module
Emulation Trace
(Advanced High-performance Bus)
Clock
AMBA AHB
VPB
Divider
I2C Serial
Interface
SPI Serial
Interface
Vss
Vdd
RST
Xtal2
Xtal1
System
Functions
Vectored Interrupt
Controller
AHB
Decoder
SCL *
SDA *
SCK *
MOSI *
MISO *
SSEL *
CAP0..3 *
MAT0..3 *
GPIO (22 pins)
Capture /
Compare
Timer 1
General
GPIO (10 pins)
PWM1..6 *
Purpose I/O
PWM0
Real Time
Clock
* Shared with GPIO
1
When Test/Debug Interface is used, GPIO/other functions sharing these pins are not available
Figure 1: LPC2106/2105/2104 Block Diagram
UART0
UART1
Watchdog
Timer
System
Control
TxD *
RxD *
TxD *
RxD *
Modem Control
(6 pins) *
Introduction18October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
LPC2106/2105/2104 REGISTERS
Accesses to registers in LPC2106/2105/2104 is restricted in the following ways:
1) user must NOT attempt to access any register locations not defined.
2) Access to any defined register locations must be stri ctly for the functions for the registers.
3) Register bits labeled ’-’, ’0’ or ’1’ can ONLY be written and read as follows:
- ’-’ MUST be written with ’0’, but can return any value when read (even if it was written with ’0’). It is a reserved bit and may
be used in future derivatives.
- ’0’ MUST be written with ’0’, and will return a ’0’ when read.
- ’1’ MUST be written with ’1’, and will return a ’1’ when read.
The following table shows all registers available in LPC2106/2105/2104 microcontroller sorted according to the address.
Access to the specific one can be categorized as either read/write, read only or write only (R/W, RO and WO respectively).
"Reset Value" field refe rs to the data stored in us ed/accessible bit s only. It does not inc lude reserved bits cont ent. Some registers
may contain undeterm ined data up on reset. In thi s case, reset value is ca tegorized as "un defined". Classificati on as "NA" is u sed
in case reset value is not applicable. Some registers in RTC are not affected by the chip reset. Their reset value is marked as *
and these registers must be initialized by software if the RTC is enabled.
Registers in LPC210 6/2105/2104 are 8, 16 or 3 2 bits wi de. For 8 bit registers show n in Table 1, bit resi ding in the MSB (The Most
Significant Bit) col umn corresponds to the bit 7 o f that register, while bit in t he LSB (The Leas t Significant B it) column corr esponds
to the bit 0 of the same register.
If a register is 1 6/3 2 bit wide, the b it res iding in t he top left corne r of i ts d escrip tion, is th e bit corre spond ing to the bit 1 5/31 o f the
register, while the bit in the bottom right corner corresponds to bit 0 of this register.
Examples: bit "EN A6" in PWM P CR reg ist er ( add res s 0 xE0 014 04 C) rep res ents t he bit at pos iti on 14 in this register; bits 15, 8, 7
and 0 in the same register are reserved. Bit "Stop on MR6" in PWMMCR register (0xE001 4014) corresponds to the bit at positi on
20; bits 31 to 21 of the same register are reserved.
Unused (reserved) bits are marked with "-" and represented as gray fields. Access to them is restricted as already described.
Table 1: LPC2106/2105/2104 Registers
Address
Offset
WD
0xE0000000
0xE0000004WDTC
NameDescriptionMSBLSBAccess
WD
MOD
Watchdog
mode register
Watchdog
timer
constant
register
----
WD
INTWDTOF
32 bit dataR/W0xFF
WDRE
SET
WDENR/W0
Reset
Value
Watchdog
WD
0xE0000008
FEED
feed
sequence
register
8 bit data (0xAA fallowed by 0x55)WONA
Introduction19October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
Table 1: LPC2106/2105/2104 Registers
Address
Offset
0xE000000CWDTV
Timer 0
0xE0004000T0IR
0xE0004004 T0TCR
0xE0004008T0TCT0 Counter32 bit dataRW0
0xE000400CT0PR
0xE0004010T0PC
0xE0004014 T0MCR
NameDescriptionMSBLSBAccess
Watchdog
timer value
register
T0 Interrupt
Register
T0 Control
Register
T0 Prescale
Register
T0 Prescale
Counter
T0 Match
Control
Register
CR2
Int.
------
4 reserved (-) bits
Reset
MR2
on
Int. on
MR2
CR1
Int.
Stop
on
MR1
32 bit dataRO0xFF
CR0
Int.
Reset
MR1
MR3
Int.
32 bit dataR/W0
32 bit dataR/W0
Stop
on
MR3
Int. on
on
MR1
MR2
Int.
Reset
on
MR3
Stop
on
MR0
MR1
Int.
CTR
Enable
Int. on
MR3
Reset
on
MR0
MR0
Int.
CTR
Reset
Stop
on
MR2
Int. on
MR0
R/W0
R/W0
R/W0
Reset
Value
0xE0004018 T0MR0
0xE000401C T0MR1
0xE0004020 T0MR2
0xE0004024 T0MR3
0xE0004028 T0CCR
0xE000402C T0CR0
0xE0004030 T0CR1
0xE0004034 T0CR2
T0 Match
Register 0
T0 Match
Register 1
T0 Match
Register 2
T0 Match
Register 3
T0 Capture
Control
Register
T0 Capture
Register 0
T0 Capture
Register 1
T0 Capture
Register 2
Int. on
Cpt.2
falling
Int. on
Cpt.2
rising
32 bit dataR/W0
32 bit dataR/W0
32 bit dataR/W0
32 bit dataR/W0
7 reserved (-) bits
Int. on
Cpt.1
Int. on
Cpt.1
falling
32 bit dataRO0
32 bit dataRO0
32 bit dataRO0
Int. on
Cpt.1
rising
Int. on
Cpt.0
Int. on
Cpt.0
falling
Int. on
Cpt.2
Int. on
Cpt.0
rising
R/W0
Introduction20October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
Table 1: LPC2106/2105/2104 Registers
Address
Offset
0xE000403C T0EMR
Timer 1
0xE0008000T1IR
0xE0008004 T1TCR
0xE0008008T1TCT1 Counter32 bit dataRW0
0xE000800CT1PR
0xE0008010T1PC
0xE0008014 T1MCR
NameDescriptionMSBLSBAccess
Ext.
Int.
on
on
External Match
Control 2
Ext.
Mtch.1
MR1
Int.
CTR
Enable
Int. on
MR3
Reset
on
MR0
Ext.
Mtch.0
MR0
Int.
CTR
Reset
Stop
on
MR2
Int. on
MR0
R/W0
R/W0
R/W0
R/W0
T0 External
Match
Register
T1 Interrupt
Register
T1 Control
Register
T1 Prescale
Register
T1 Prescale
Counter
T1 Match
Control
Register
6 reserved (-) bits
External Match
Control 1
CR3
Int.
Reset
on
MR2
CR2
------
4 reserved (-) bits
Int. on
MR2
Int.
External Match
Control 0
CR1
Int.
Stop
on
MR1
CR0
Int.
32 bit dataR/W0
32 bit dataR/W0
Reset
on
MR1
-
MR3
Int.
Stop
on
MR3
Int. on
MR1
Mtch2.
MR2
Reset
MR3
Stop
MR0
Reset
Value
0xE0008018 T1MR0
0xE000801C T1MR1
0xE0008020 T1MR2
0xE0008024 T1MR3
0xE0008028 T1CCR
0xE000802C T1CR0
0xE0008030 T1CR1
0xE0008034 T1CR2
T1 Match
Register 0
T1 Match
Register 1
T1 Match
Register 2
T1 Match
Register 3
T1 Capture
Control
Register
T1 Capture
Register 0
T1 Capture
Register 1
T1 Capture
Register 2
4 reserved (-) bits
Int. on
Cpt.2
falling
Int. on
Cpt.2
rising
Int. on
Cpt.1
32 bit dataR/W0
32 bit dataR/W0
32 bit dataR/W0
32 bit dataR/W0
Int. on
Cpt.3
Int. on
Cpt.1
falling
Int. on
Cpt.1
rising
32 bit dataRO0
32 bit dataRO0
32 bit dataRO0
Int. on
Cpt.3
falling
Int. on
Cpt.0
Int. on
Cpt.3
rising
Int. on
Cpt.0
falling
Int. on
Cpt.2
R/W0
Int. on
Cpt.0
rising
Introduction21October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
Table 1: LPC2106/2105/2104 Registers
Address
Offset
NameDescriptionMSBLSBAccess
0xE0008038 T1CR3
0xE000803C T1EMR
UART 0
U0RBR
(DLAB=0)
0xE000C000
U0THR
(DLAB=0)
U0DLL
(DLAB=1)
U0IER
0xE000C004
(DLAB=0)
T1 Capture
Register 3
T1 External
Match
Register
U0 Receiver
Buffer
Register
U0 Transmit
Holding
Register
U0 Divisor
Latch LSB
U0 Interrupt
Enable
Register
32 bit dataRO0
4 reserved (-) bits
External Match
Control 1
External Match
Control 0
External Match
Control 3
Ext.
Mtch.3
8 bit dataRO
8 bit dataWONA
8 bit dataR/W0x01
00000
Ext.
Mtch2.
En. Rx
Line
Status
Int.
External Match
Control 2
Ext.
Mtch.1
Enable
THRE
Int.
Ext.
Mtch.0
En. Rx
Data
Av.Int.
Reset
Value
R/W0
un-
defined
R/W0
U0DLM
(DLAB=1)
U0IIR
0xE000C008
U0FCR
0xE000C00C U0LCR
0xE000C014 U0LSR
0xE000C01C U0SCR
UART 1
U0 Divisor
Latch MSB
U0 Interrupt
ID Register
U0 FIFO
Control
Register
U0 Line
Control
Register
U0 Line
Status
Register
U0 Scratch
Pad Register
8 bit dataR/W0
FIFOs Enabled00IIR3IIR2IIR1IIR0RO0x01
Rx Trigger
DLAB
Set
Break
---
Stick
Parity
Even
Parity
Select
Parity
Enable
U0 Tx
FIFO
Reset
Nm. of
Stop
Bits
U0 Rx
FIFO
Reset
U0
FIFO
Enable
Word Length
Select
WO0
R/W0
Rx
FIFO
TEMT THREBIFEPEOEDRRO0x60
Error
8 bit dataR/W0
Introduction22October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
Table 1: LPC2106/2105/2104 Registers
Address
Offset
NameDescriptionMSBLSBAccess
U1RBR
(DLAB=0)
0xE0010000
U1THR
(DLAB=0)
U1DLL
(DLAB=1)
U1IER
0xE0010004
(DLAB=0)
U1DLM
(DLAB=1)
U1IIR
0xE0010008
U1FCR
0xE001000C U1LCR
0xE0010010
U1
MCR
0xE0010014 U1LSR
U1 Receiver
Buffer
Register
U1 Transmit
Holding
Register
U1 Divisor
Latch LSB
U1 Interrupt
Enable
Register
U1 Divisor
Latch MSB
U1 Interrupt
ID Register
U1 FIFO
Control
Register
U1 Line
Control
Register
U1 Modem
Control
Register
U1 Line
Status
Register
Reset
Value
8 bit dataRO
un-
defined
8 bit dataWONA
8 bit dataR/W0x01
En.
0000
Mdem
Satus
En. Rx
Status
Int.
Line
Int.
Enable
THRE
Int.
En. Rx
Data
Av.Int.
R/W0
8 bit dataR/W0
FIFOs Enabled00IIR3IIR2IIR1IIR0RO0x01
Rx Trigger
DLAB
Set
Break
---
Stick
Parity
000
Even
Parity
Select
Loop
Back
U0 Tx
FIFO
Reset
Parity
Enable
Nm. of
Stop
00RTSDTRR/W0
Bits
U0 Rx
FIFO
Reset
U0
FIFO
Enable
Word Length
Select
WO0
R/W0
Rx
FIFO
TEMT THREBIFEPEOEDRRO0x60
Error
U1
U1 Scratch
Pad Register
U1 Modem
Status
Register
8 bit dataR/W0
DCDRIDSRCTS
Delta
DCD
Trailing
Edge
RI
Delta
DSR
Delta
CTS
RO0
0xE001001C U1SCR
0xE0010018
MSR
PWM
0xE0014000
0xE0014004
0xE0014008
IR
PWM
Interrupt
Register
PWM Timer
Control
Register
PWM
PWM
TCR
PWMTCPWM Timer
Counter
-----
----
----
MR3
PWM
Enable
32 bit dataRW0
Int.
MR6
Int.
MR2
Int.
MR5
Int.
MR4
Int.
R/W0
MR1
Int.
CTR
Reset
MR0
Int.
CTR
Enable
R/W0
Introduction23October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
Table 1: LPC2106/2105/2104 Registers
Address
Offset
0xE001400C
0xE0014010
0xE0014014
0xE0014018
0xE001401C
0xE0014020
NameDescriptionMSBLSBAccess
PR
PC
PWM
Prescale
Register
PWM
Prescale
Counter
PWM Match
Control
Register
PWM Match
Register 0
PWM Match
Register 1
PWM Match
Register 2
11 reserved (-) bits
Int. on
MR5
Reset
on
MR2
Stop
on
MR4
Int. on
MR2
Reset
on
MR4
Stop
on
MR1
32 bit dataR/W0
32 bit dataR/W0
Stop
MR6
Int. on
MR4
Reset
MR1
on
on
Reset
on
MR6
Stop
on
MR3
Int. on
MR1
Int. on
MR6
Reset
on
MR3
Stop
on
MR0
Stop
on
MR5
Int. on
MR3
Reset
on
MR0
Reset
on
MR5
Stop
on
MR2
Int. on
MR0
R/W0
32 bit dataR/W0
32 bit dataR/W0
32 bit dataR/W0
PWM
PWM
PWM
MCR
PWM
MR0
PWM
MR1
PWM
MR2
Reset
Value
0xE0014024
0xE0014040
0xE0014044
0xE0014048
0xE001404C
0xE0014050
2
C
I
0xE001C000
PWM
MR3
PWM
MR4
PWM
MR5
PWM
MR6
PWM
PCR
PWM
LER
I2CON
SET
0xE001C004 I2STAT
0xE001C008I2DAT
PWM Match
Register 3
PWM Match
Register 4
PWM Match
Register 5
PWM Match
Register 6
PWM Control
Register
PWM Latch
Enable
Register
2
C Control
I
Set Register
2
C Status
I
Register
2
C Data
I
Register
32 bit dataR/W0
32 bit dataR/W0
32 bit dataR/W0
32 bit dataR/W0
-ENA6ENA5ENA4ENA3ENA2ENA1R/W0
-SEL6SEL5SEL4SEL3SEL2SEL1-
Ena.
PWM
-
M6
Latch
Ena.
PWM
M5
Latch
Ena.
PWM
M4
Latch
Ena.
PWM
M3
Latch
Ena.
PWM
M2
Latch
Ena.
PWM
M1
Latch
Ena.
PWM
M0
Latch
R/W0
-I2ENSTASTOSIAA --R/W0
5 bit Status000RO0xF8
8 bit dataR/W0
Introduction24October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
Table 1: LPC2106/2105/2104 Registers
Address
Offset
0xE001C00C
0xE001C010
0xE001C014
0xE001C018
NameDescriptionMSBLSBAccess
I2
ADR
I2
SCLH
I2
SCLL
I2CON
CLR
SPI
0xE0020000SPCR
0xE0020004SPSR
0xE0020008SPDR
0xE002000C
SP
CCR
0xE002001C SPINT
2
C Slave
I
Address
Register
SCL Duty
Cycle
Register High
Half Word
SCL Duty
Cycle
Register Low
Half Word
2
C Control
I
Clear
Register
SPI Control
Register
SPI Status
Register
SPI Data
Register
SPI Clock
Counter
Register
SPI Interrupt
Flag
Reset
Value
7 bit dataGCR/W0
16 bit dataR/W0x04
16 bit dataR/W0x04
-I2ENC STAC-SICAAC--WONA
SPIELSBFMSTR CPOL CPHA
SPIFWCOL ROVR MODF ABRT
---R/W0
---RO0
8 bit dataR/W0
8 bit dataR/W0
-------
SPI
Int.
R/W0
RTC
0xE0024000ILR
0xE0024004CTC
0xE0024008CCR
Interrupt
Location
Register
Clock Tick
Counter
Clock Control
Register
------
15 bit data
----CTTEST
RTC
ALF
CTC
RST
RTC
CIF
R/W*
-RO*
CLK
EN
R/W*
Counter
0xE002400CCIIR
Increment
Interrupt
IM
YEARIMMONIMDOYIMDOWIMDOMIMHOURIMMINIMSEC
R/W*
Register
0xE0024010AMR
Alarm Mask
Register
AMR
YEAR
AMR
MON
AMR
DOY
AMR
DOW
AMR
DOM
AMR
HOUR
AMR
MIN
AMR
SEC
R/W*
Introduction25October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
Table 1: LPC2106/2105/2104 Registers
Address
Offset
0xE0024014
0xE0024018
0xE002401C
NameDescriptionMSBLSBAccess
CTIME0
CTIME1
CTIME2
0xE0024020SEC
0xE0024024MIN
0xE0024028HOUR
0xE002402CDOM
0xE0024030DOW
Consolidated
Time
Register 0
Consolidated
Time
Register 1
Consolidated
Time
Register 2
Seconds
Register
Minutes
Register
Hours
Register
Day of Month
Register
Day of Week
Register
Reset
Value
-----3 bit Day of Week
---5 bit Hours
RO*
--6 bit Minutes
--6 bit Seconds
----
12 bit Year
RO*
----4 bit Month
---5 bit Day of Month
reserved (-) 20 bits12 bit Day of YearRO*
--6 bit dataR/W*
--6 bit dataR/W*
---5 bit dataR/W*
---5 bit dataR/W*
-----3 bit dataR/W*
0xE0024034DOY
0xE0024038
MONTH
Day of Year
Register
Months
Register
0xE002403CYEARYear Register
AL
AL
AL
AL
AL
Alarm value
for Seconds
Alarm value
for Minutes
Alarm value
for Hours
Alarm value
for Day of
Month
Alarm value
for Day of
Week
0xE0024060
0xE0024064
0xE0024068
0xE002406C
0xE0024070
SEC
MIN
HOUR
DOM
DOW
reserved (-) 7 bits9 bit dataR/W*
----4 bit dataR/W*
reserved (-) 4 bits12 bit dataR/W*
--6 bit dataR/W*
--6 bit dataR/W*
---5 bit dataR/W*
---5 bit dataR/W*
-----3 bit dataR/W*
Introduction26October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
Table 1: LPC2106/2105/2104 Registers
Address
Offset
0xE0024074
0xE0024078
0xE002407C
0xE0024080
0xE0024084
GPIO
0xE0028000IOPIN
0xE0028004IOSET
NameDescriptionMSBLSBAccess
AL
DOY
AL
MON
AL
YEAR
PRE
INT
PRE
FRAC
Alarm value
for Day of
Year
Alarm value
for Months
Alarm value
for Year
Prescale
value, integer
portion
Prescale
value,
fractional
portion
GPIO Pin
value regi ster
GPIO 0
Output set
register
Reset
Value
reserved (-) 7 bits9 bit dataR/W*
----4 bit dataR/W*
reserved
(-) 4 bits
reserved
(-) 3 bits
-15 bit dataR/W0
32 bit dataRONA
32 bit dataR/W0
12 bit dataR/W*
13 bit dataR/W0
0xE0028008IODIR
0xE002800C IOCLR
Pin Connet Block
0xE002C000
0xE002C004
System Control Block
0xE01FC000
0xE01FC004
PIN
SEL0
PIN
SEL1
MAMCRMAM control
MAM
TIM
GPIO 0
Direction
control
register
GPIO 0
Output clear
register
Pin funct i on
select
register 0
Pin funct i on
select
register 1
register
MAM timing
control
32 bit dataR/W0
32 bit dataWO0
32 bit dataR/W0
32 bit dataR/W0
------2 bit dataR/W0
-----3 bit dataR/W0x07
Introduction27October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
Table 1: LPC2106/2105/2104 Registers
Address
Offset
0xE01FC040
0xE01FC080
0xE01FC084
0xE01FC088
0xE01FC08C
0xE01FC0C0 PCON
0xE01FC0C4 PCONP
0xE01FC100
NameDescriptionMSBLSBAccess
MEM
MAP
PLL
CON
PLL
CFG
PLL
STAT
PLL
FEED
VPB
DIV
Memory
mapping
control
PLL control
register
PLL
configuration
register
PLL status
register
PLL feed
register
Power control
register
Power control
for
peripherals
VPB divider
control
------2 bit dataR/W0
------PLLCPLLER/W0
-2bit data PSEL5 bit data MSELR/W0
-----
-2bit data PSEL5 bit data MSEL
8 bit dataWONA
------PDIDLR/W0
reserved (-) 22 bits
PC
I2C
------2 bit dataR/W0
PC
PWM0PCURT1PCURT0PCTIM1PCTIM0
PLOCK
PLLCPLLE
RO0
PC
RTCPCSPI
R/W0x3BE
-
Reset
Value
0xE01FC140
0xE01FC144
EXT
INT
EXT
WAKE
External
interrupt flag
register
External
interrupt
wakeup
register
-----EINT2 EINT1 EINT0R/W0
-----
EXT
WAKE
EXT
WAKE
2
EXT
WAKE0R/W0
1
Introduction28October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
2. LPC2106/2105/2104 MEMORY ADDRESSING
MEMORY MAPS
The LPC2106/2105 /2104 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 from th e user p rogram v iewpoi nt follo wing res et. The i nterrupt v ector a rea sup ports ad dress remapping, which is described later in this section.
- 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
VPB Peripherals
3.5 GB
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 simplify ing
the address decod ing for ea ch perip heral. All periphera l registe r addresses are wor d aligned (to 32-bi t boundar ies) regard less of
their size. This eliminates the need for byte lane mapping hardwa re tha t w oul d be requi red to all ow by te (8-bit) or half-word (16bit) 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.
LPC2106/2105/2104 MEMORY RE-MAPPING AND BOOT BLOCK
Memory Map Concepts and Operating Modes
The basic concept on the LPC21 06/2105/2 104 is t hat each mem ory area ha s a "natural " locatio n in the me mory map . This is th e
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 Block 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.
*: Identified as reserved in ARM documentation, this location is used by the Boot Loader as the Valid User Program key.
Table 3: LPC2106/2105/2104 Memory Mapping Modes
ModeActivationUsage
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 w hen a valid User Progra m Signature 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 vectors are re-mapped to the bottom
of the Static RAM.
executes after any reset. The Boot Block interrupt vectors are
In order to allo w for com patibili ty with future der ivativ es, the en tire Boot Block i s mapped to the top o f the 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 addition al 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 plac e the e ntire FIQ handler at addre ss 0x0000 001C without 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 remapping into account.
2. Minimize the need to for the SRAM and Bo ot Blo ck vec tors to deal with arbitrary boundaries in th e mi ddl e of code space.
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 addition
to the re-mapped address.
The LPC2106/2105/2104 generates the ap propria te bus cycle abort exception if an access 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 LPC2106/2105/2104, this is:
- Address space betwee n On-Chip N on-V ol atile Memory and the Spec ial regist ers. Labelled "Reserved for On-Chip M emory"
in Figure 2 and Figure 6.
- Address space between On-Chip Static RAM and External Memory. Labelled "Reserved for On-Chip Memory" in Figure 2.
- External Memory (since no external bus interface is implemented on the LPC2106/2105/2104).
- 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 inst ruction 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 pheral, a data abort exception is not ge nera t ed in res po ns e to an ac ce ss to an
undefined address. Address decoding within each peripheral is li mit ed to that needed to distinguish defined regist ers within the
peripheral itself. Fo r example, an access to address 0xE0 00D000 (a n undefine d address 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 LPC2106/2105/2104 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 whe n co de is exec uted ve ry near a me mo ry boun dary.
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 define d as reserved i n order to allow future
expansion. Unrelated f unctions never share the same register addresses.
PIN DESCRIPTION
Table 4 shows pins that are associated with System Control block functions.
Table 4: Pin summary
Pin namePin directionPin Description
X1InputCrystal Oscillator Input- Input to the oscillator and internal clock generator circuits.
X2OutputCrystal Oscillator Output- Output from the oscillator amplifier.
External Interrupt Input 0- An ac tive low gene ral purpose interru pt input. This pin may be
used to wake up the processor from Idle or Power down modes.
EINT0Input
EINT1
EINT2InputExternal Interrupt Input 2- See the EINT0 description above.
RST
InputExternal Interrupt Input 1- See the EINT0 description above.
Input
LOW level on this pin immediately after reset is considered as an external hardware
request to start the ISP command ha ndler. More de tails on ISP and Flash memory can be
found in "Flash Memory System and Programming" chapter.
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.
System Control Block37October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-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
AddressNameDescriptionAccess
External Interrupts
0xE01FC140EXTINTExternal interrupt flag register.R/W0
0xE01FC144EXTWAKE External interrupt wakeup register.R/W0
Memory Mapping Control
0xE01FC040MEMMAPMemory mappi ng con trol .R/W0
Phase Locked Loop
0xE01FC080PLLCONPLL control register.R/W0
0xE01FC084PLLCFGPLL configuration register.R/W0
0xE01FC088PLLSTATPLL status register.RO0
0xE01FC08CPLLFEEDPLL feed register.WONA
Power Control
0xE01FC0C0PCONPower control register.R/W0
0xE01FC0C4PCONPPower control for peripherals.R/W0x3BE
VPB Divider
0xE01FC100VPBDIVVPB divider control.R/W0
Reset
Value*
*Reset Value refers to the data stored in used bits only. It does not include reserved bits content.
System Control Block38October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
CRYSTAL OSCILLATOR
The oscillator supports crystals in the range of 10 MHz to 25 MHz. The oscillator output frequency is called F
processor clock frequency is referred to as cclk for purposes of rate equations, etc. elsewhere in this document. F
and the ARM
osc
and cclk
osc
are the same value unless the PLL is running and connected. Refer to the PLL description in this chapter for details.
Onboard oscillator in LPC2106/2105/2104 can operate in one of two modes: slave mode and oscillation mode.
In slave mode the input clock signal should be coupled by means of a capacitor of 100 pF (Cc in Figure 7, drawing a), with an
amplitude of at least 200 mVrms. X2 pin in this configuration can be left not connected.
External components and models used in oscillation mode are shown in Figure 7, drawings b and c, and in Table 6. Since the
feedback resistance is integrated on chip, only a crystal and the capacitances C
case of fundamental mode oscillati on (the fun damen tal freque ncy is repres ented by L, C
drawing c, represents the par all el pa ck age capacitance and should not be larger than 7 pF. Para me ters F
and CX2 need to be connected externally in
X1
and RS). Capacitance Cp in Figure 7,
L
, CL, RS and CP are
C
supplied by the crystal manufa ctu rer.
LPC2106/2105/2104
X1X2
C
C
Clock
LPC2106/2105/2104
X1X2
C
X1
Xtal
L
<=>
C
L
R
C
X2
S
C
P
a)b)c)
Figure 7: Oscillator modes and models: a) slave mode of operation, b) oscillation mode of operation,
The LPC2106/2105/2104 includes three External Interrupt Inputs as selectable pin functions. The External Interrupt Inputs can
optionally be used to wake up the processor from Power Down mode.
Register Description
The external interrupt function has two registers associated with it. The EXTINT register contains the interrupt flags, and the
EXTWAKEUP register contains bits that enable individual external interrupts to wake up the LPC2106/2105/2104 from Power
Down mode.
Table 7: External Interrupt Registers
AddressNameDescriptionAccess
0xE01FC140EXTINT
0xE01FC144EXTWAKE
The External Interrupt Flag reg ister contains interrupt fl ags for EINT0, EINT1, and
EINT2. Se e Table 8.
The External Interrupt Wakeup register contains three enable bits that control
whether each external inte rrupt will cause the processor to wake u p fro m Powe r
Down mode. See Table 9.
R/W
R/W
EXTINT Register (EXTINT - 0xE01FC140)
When an external inte rrupt is mapped to its re lated pin, the prese nce of a logic zero on th at pin will set the co rresponding interrupt
flag in the EXTINT register. This will cause the VIC to respond appropriately if that interrupt is enabled. Once the logic level on
external interrupt pin(s) is set to 1, software may clear the flag(s) by writing a 1 to the corresponding bit(s) in EXTINT. Every
attempt to reset EINT bit is futile as long as signal level on associated pin is 0.
Table 8: External Interrupt Flag Register (EXTINT - 0xE01FC140)
EXTINTFunctionDescription
0EINT0
1EINT1
2EINT2
Set when external the EINT0 pin goes low and EINT0 is mapped to its related pin.
Can be cleared by writing a 1 to this bi t after the log ic 1 appe ars on the relate d pin.
Set when external the EINT1 pin goes low and EINT1 is mapped to its related pin.
Can be cleared by writing a 1 to this bi t after the log ic 1 appe ars on the relate d pin.
Set when external the EINT2 pin goes low and EINT2 is mapped to its related pin.
Can be cleared by writing a 1 to this bi t after the log ic 1 appe ars on the relate d pin.
Reset
Value
0
0
0
7:3Reserved
Reserved, user software should not write ones to reserved bits. The value read
from a reserved bit is not defined.
NA
EXTWAKE Register (EXTWAKE - 0xE01FC144)
Enable bits in the EXTWAKE register allow the external interrupts to wake up the processor if it is in Power Down mode. The
related EINTn function must be mapped to the pin in order for the wakeup process to take place. It is not necessary for the
interrupt to be enabled in the Vectored Interrupt Controller for a wakeup to take place. This arrangement allows additional
capabilities, such as having an external interrupt input wake up the processor from Power Down mode without causing an
interrupt (simply resuming operation), or allowing an interrupt to be enabled during Power Down without waking the processor
up if it is asserted (eliminating the need to disable the interrupt if the wakeup feature is not desirable in the application).
0EXTWAKE0When one, assertion of EI NT0
1EXTWAKE1When one, assertion of EI NT1
2EXTWAKE2When one, assertion of EI NT2
7:3Reserved
VPB Bus Data
EINTi
Reset
Write "1" fr om
VPB Bus Interface
Reserved, user software should not write ones to reserved bits. The value read
from a reserved bit is not defined.
Wakeup Enable
(one bit of EXTWAKE)
QD
pclk
S
Q
R
will wake up the processor from Power Down mode.0
will wake up the processor from Power Down mode.0
will wake up the processor from Power Down mode.0
VPB Read
of EXTWAKE
Wakeup Timer
S
Q
R
pclkpclk
EINTi to
(Figure 10)
Interrupt Flag
(one bit of EXTINT)
S
Q
R
Reset
Value
NA
to VIC
VPB Read
of EXTINT
Figure 8: External Interrupt Logic
System Control Block41October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
MEMORY MAPPING CONTROL
The Memory Mapping Control alters the mapping of the interrupt vectors that appear beginning at address 0x00000000. This
allows code running in different memory spaces to have control of the interrupts.
Memory Mapping Control Register (MEMMAP - 0xE01FC040)
Table 10: MEMMAP Register
AddressNameDescriptionAccess
0xE01FC040MEMMAP
Table 11: Memory Mapping Control Register (MEMMAP - 0xE01FC040)
MEMMAPFunctionDescription
1:0MAP1:0
7:2Reserved
*: The hardware reset value of the MAP bits is 00 for LPC2106/2105/2104 parts. The ap parent reset va lue that the user will see
will be altered by the Boot Loader code, which always runs initially at reset. User documentation will reflect this difference.
Memory mapping control. Selects whether the ARM interrupt vectors are read
from the Flash Boot Block, User Flash or RAM.
00: Boot Loader Mode. Interrupt vectors are re-mapped to Boot Block.
01: User Flash Mode. Interrupt vectors are not re-mapped and reside in Flash.
10: User RAM Mode. Interrupt vectors are re-mapped to Static RAM.
11: Reserved. Should not be used.
Warning: Improper set tin g of t his v alue may result in inco rrect o perati on of the devi ce.
Reserved, user software shou ld not write ones to reserved b its. The value rea d from a
reserved bit is not defined.
R/W
Reset
Value*
0
NA
System Control Block42October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
PLL (PHASE LOCKED LOOP)
The PLL accepts a n inpu t clock frequen cy in the ran ge of 1 0 MH z to 2 5 MHz. The in put freq uen cy is m ultipl ied up into th e rang e
of 10 MHz to 60 MHz with a Current Controlled Oscillator (CCO). The multiplier can be an integer value from 1 to 32 (in practice,
the multiplier val ue c ann ot be higher than 6 on the LPC 21 06/ 2105/2104 due to the upper fr equ enc y li mi t o f t he C PU ). T he C CO
operates in the range of 156 MH z to 320 MHz, s o the re is an add iti onal divider in the loop to keep the CCO within its frequ enc y
range while the PLL is pro viding the de sired output freq uency. The ou tput divider ma y be set to divi de by 2, 4, 8, or 16 t o produce
the output clock. Since the minimum output divider value is 2, it is insured that the PLL output has a 50% duty cycle. A block
diagram of the PLL is shown in Figure 9.
PLL activation is con trolled via the PLLC ON register. The PLL mu ltiplier and divider v alues are controlle d by the PLLCFG register.
These two registers are protected in order to prevent accidental alteration of PLL parameters or deactivation of the PLL. Since
all chip operations, including the Watchdog Timer, are dependent on the PLL when it is providing the chip clock, accidental
changes to the PLL setup could result in unexpected behavior of the microcontroller. The protection is accomplished by a feed
sequence similar to that of the Watchdog Timer. Details are provided in the description of the PLLFEED register.
The PLL is turned off and bypassed fol lowing a chip Reset and when by entering pow er Down mode. PLL is enabled by software
only. The program must configure and activate the PLL, wait for the PLL to Lock, then connect to the PLL as a clock source.
Register Description
The PLL is controlled by the registers shown in Table 12. More detailed descriptions follow.
Warning: Improper setting of PLL values may result in incorrect operation of the device.
Table 12: PLL Registers
AddressNameDescriptionAccess
0xE01FC080PLLCON
0xE01FC084PLLCFG
0xE01FC088PLLSTAT
0xE01FC08CPLLFEED
Holding register for updati ng PLL control bits. Val ues written to this register d o not
take effect until a valid PLL feed sequence has taken place.
Holding register for updating PLL configuration values. Values written to this
register do not take effect until a valid PLL feed sequence has taken place.
Read-back register for PLL control and configuration information. If PLLCON or
PLLCFG have been written to, but a PLL feed sequence has not yet occurred,
they will not reflect th e current PLL state. Readi ng this register provides the actual
values controlling the PLL, as well as the status of the PLL.
This register enables loading of the PLL control and configuration information
from the PLLCON and PLLCFG registers into the shadow registers that actuall y
affect PLL operation.
R/W
R/W
RO
WO
System Control Block43October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
PLLC
PLLE
F
OSC
PSEL[1:0]
PLOCK
MSEL[4:0]
0
0
Direct
pd
Bypass
Phase-
Frequency
Detector
fout
CCO
cd
Div-by-M
msel<4:0>
Clock
Synchronization
pd
F
CCO
pd
1
0
cd
/2P
0
1
0
cclk
1
Figure 9: PLL Block Diagram
PLLCON Register (PLLCON - 0xE01FC080)
The PLLCON register contains the bits that enable and connect the PLL. Enabling the PLL allows it to attempt to lock to the
current settings of th e m ul tipl ier and divider values. Conn ect ing the PLL ca us es the processor and all chip functions to run from
the PLL output clock. Changes to the PLLCO N register d o not take effect until a co rrect PLL fee d sequen ce has be en given (se e
PLLFEED Register (PLLFEED - 0xE01FC08C) description).
System Control Block44October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
Table 13: PLL Control Register (PLLCON - 0xE01FC080)
PLLCONFunctionDescription
0PLLE
1PLLC
7:2Reserved
The PLL must be set up, enabled, and Lock established before it may be used as a clock source. When switching from the
oscillator clock to the PLL output or vice versa, internal circuitry synchronizes the operation in order to ensure that glitches are
not generated. Hardw are does not insu re that the PLL is lo cked bef ore it is c onnected or autom atically di sconnec t the PLL i f lock
is lost during opera tion. In the event of l oss of PLL lock, it i s likely that the o scillator clock has become uns table and disconnecting
the PLL will not remedy the situation.
PLL Enable. When one, and after a valid PLL feed, this bit will activate the PLL and
allow it to lock to the requested frequency. See PLLSTAT register, Table 15.
PLL Connect. When PLLC and PLLE are both set to one, and after a valid PLL feed,
connects the PLL as the clock source for the LPC2106/2105/2104. Otherwise, the
oscillator clock is used directly by the LPC2106/2105/2104. See PLLSTAT register,
Table 15.
Reserved, user software shou ld not write ones to reserved b its. The value rea d from a
reserved bit is not defined.
Reset
Value
0
0
NA
PLLCFG Register (PLLCFG - 0xE01FC084)
The PLLCFG register contains the PLL multiplier and divider values. Changes to the PLLCFG register do not take effect until a
correct PLL feed sequence ha s been given (see PLLFEED Reg ister (PLLFEED - 0xE01FC08C) de scription). Calculati ons for the
PLL frequency, and multiplier and divider values are found in the PLL Frequency Calculation section.
4:0MSEL4:0PLL Multiplier value. Supplies the value "M" in the PLL frequency calculations.0
6:5PSEL1:0PLL Divider value. Supplies the value "P" in the PLL frequency calculations.0
7Reserved
Reserved, user software shou ld not write ones to reserved b its. The value rea d from a
reserved bit is not defined.
Reset
Value
NA
PLLSTAT Register (PLLSTAT - 0xE01FC088)
The read-only PLLSTAT register provides the actual PLL parameters that are in effect at the time it is read, as well as the PLL
status. PLLSTAT may disa gree with values foun d in PLLCON and PLLCFG beca use changes to those re gisters do not take effe ct
until a proper PLL feed has occurred (see PLLFEED Register (PLLFEED - 0xE01FC08C) description).
System Control Block45October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
Table 15: PLL Status Register (PLLSTAT - 0xE01FC088)
PLLSTATFunctionDescription
4:0MSEL4:0Read-back for the PLL Multiplier value. This is the value currently used by the PLL.0
6:5PSEL1:0Read-back for the PLL Divider value. This is the value currently used by the PLL.0
7Reserved
8PLLE
9PLLC
10PLOCK
15:11Reserved
PLL Interrupt
The PLOCK bit in the PLLSTAT register is connected to the interrupt controller. This allows for software to turn on the PLL and
continue with other fun ctions without having to wait for the PLL to ach ieve lock. Wh en the interru pt occurs (PLOCK = 1), the PLL
may be connected, and the interrupt disabled.
Reserved, user software shou ld not write ones to reserved bits. The value rea d from
a reserved bit is not defined.
Read-back for the PLL Enable bit. When one, the PLL is currently activated. When
zero, the PLL is turne d off. This bit is aut omatically cleared w hen Power Do wn mode
is activated.
Read-back for the PLL Conne ct bit. W hen PLLC an d PLL E are b oth one , the PLL is
connected as the clock source for the LPC2106/2105/2104. When zero, the PLL is
bypassed and the oscillator clock is used directly by the LPC2106/2105/2104. This
bit is automatically cleared when Power Down mode is activated.
Reflects the PLL Lock status . When zero , the PLL is no t locked. Wh en one, the PLL
is locked onto the requested frequency.
Reserved, user software shou ld not write ones to reserved bits. The value rea d from
a reserved bit is not defined.
Reset
Value
NA
0
0
0
NA
PLL Modes
The combinations of PLLE and PLLC are shown in Table 16.
Table 16: PLL Control Bit Combinations
PLLCPLLEPLL Function
00PLL is turned off and disconnected. The system runs from the unmodified clock input.
01The PLL is active, but not yet connected. The PLL can be connected after PLOCK is asserted.
10
11The PLL is active and has been connected as the system clock source.
Same as 0 0 combination. This preven ts the possibility of the PLL bei ng connected without als o being
enabled.
PLLFEED Register (PLLFEED - 0xE01FC08C)
A correct feed sequence mus t be written to the PLLFEED regi ster in o rder for chang es to the PLLCO N and PLLCFG reg isters to
take effect. The feed sequence is:
1. Write the value 0xAA to PLLF EED
2. Write the value 0x55 to PLLFEED.
System Control Block46October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
The two writes must be in the correct sequence, and must be consecutive VPB bus cycles. The latter requirement implies that
interrupts must be disabled for the duration of the PLL feed operation. If either of the feed values is incorrect, or one of the
previously mentioned conditions is not met, any changes to the PLLCON or PLLCFG register will not become effective.
The PLL feed sequence must be written to this register in order for PLL
configuration and control register changes to take effect.
Reset
Value
undefined
PLL and Power Down Mode
Power Down mode automatically turns off and disconnects the PLL. Wakeup from Power Down mode does not automatically
restore the PLL settings, this must be done in software. Typically, a routine to activate the PLL, wait for lock, and then connect
the PLL can be called at the begin nin g of any i nterrupt service ro utin e that migh t be cal led due to the w akeup . It is import ant not
to attempt to restart the PLL by simply feeding it when execution resumes after a wakeup from Power Down mode. This would
enable and connect the PLL at the same time, before PLL lock is established.
PLL Frequency Calculation
The PLL equations use the following parameters:
F
OSC
F
CCO
cclkthe PLL output frequency (also the processor clock frequency)
MPLL Multiplier value from the MSEL bits in the PLLCFG register
PPLL Divider value from the PSEL bits in the PLLCFG register
the frequency from the crystal oscillator
the frequency of the PLL current controlled oscillator
The PLL output frequency (when the PLL is both active and connected) is given by:
F
cclk = M * F
or cclk = ———
osc
cco
2 * P
The CCO frequency can be computed as:
F
= cclk * 2 * P or F
cco
cco
= F
* M * 2 * P
osc
The PLL inputs and settings must meet the following:
•F
is in the range of 10 MHz to 25 MHz.
osc
• cclk is in the range of 10 MHz to F
is in the range of 156 MHz to 320 MHz.
•F
cco
(the maximum allowed frequency for the LPC2106/2105/2104).
max
System Control Block47October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
Procedure for Determining PLL Settings
If a particular application uses the PLL, its configuration may be determined as follows:
1. Choose the desired processor operating frequency (cclk). This may be based on processor throughput requirements,
need to support a spec ific set o f UART baud rates, etc. Be ar i n mind that periph eral d evices ma y be runnin g from a low er
clock than the processor (see the VPB Divider description in this chapter).
2. Choose an oscillator frequency (F
3. Calculate the value of M to configure the MSEL bits. M = cclk / F
to the MSEL bits in PLLCFG is M - 1 (see Table 19).
4. Find a value for P to config ure the PSEL b its , suc h t hat F
the equation given abov e. P must have on e of the valu es 1, 2, 4, or 8. Th e value writt en to the PSEL bits in PL LCFG is 00
). cclk must be an even multiple of F
osc
osc
is within its defined frequency lim its. F
cco
. M must be in the rang e of 1 to 32 . Th e va lue w ritte n
for P = 1; 01 for P = 2; 10 for P = 4; 11 for P = 8 (see Table 18).
Table 18: PLL Divider Values
osc
.
is calculated us ing
cco
PSEL Bits
(PLLCFG bits 6:5)
001
012
104
118
Table 19: PLL Multiplier Values
MSEL Bits
(PLLCFG bits 4:0)
000001
000012
000103
000114
......
1111031
1111132
Value of P
Value of M
System Control Block48October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
POWER CONTROL
The LPC2106/2105/2104 supports two reduced power modes: Idle mode and Power Down mode. In Idle mode, execution of
instructions is suspended until either a Reset or interrupt occurs. Peripheral functions continue operation during Idle mode and
may generate interrupts to cause the processor to resume execution. Idle mode eliminates power used by the processor itself,
memory systems and related controllers, and internal buses.
In Power Down mode, the oscillator is shut down and the chip receives no internal clocks. The processor state and registers,
peripheral registers, and internal SRAM values are preserved throughout Power Down mode and the logic levels of chip pins
remain static. The Power Down mode can be terminated and normal operation resumed by either a Reset or certain specific
interrupts that are able to function without clocks. Since all dynamic operation of the chip is suspended, Power Down mode
reduces chip power consumption to nearly zero.
Wakeup from Power Down or I dle modes via an interru pt re sumes pr ogram execu tion in suc h a way that no instruc tions are l ost,
incomplete, or repeated. Wake up from Power Down mode is discussed further in the description of the Wakeup Timer later in
this chapter.
A Power Control for Peripherals feature allows individual peripherals to be turned off if they are not needed in the application,
resulting in additional power savings.
Register Description
The Power Control function contains two registers, as shown in Table 20. More detailed descriptions follow.
Table 20: Power Control Registers
AddressNameDescriptionAccess
0xE01FC0C0PCON
0xE01FC0C4PCONP
Power Control Register. This register contains control bits that enable the two
reduced power operating modes of the LPC2106/2105/2104. See Table 21.
Power Control for Peripherals Register. This register contains control bits that
enable and disable indiv idual pe riphera l functi ons, Allo wing elim inati on of pow er
consumption by peripherals that are not needed. See Table 22.
R/W
R/W
PCON Register (PCON - 0xE01FC0C0)
The PCON register contai ns two bits. Writin g a one to the corres ponding bit ca uses entry to eithe r the Power Down or Idle mode.
If both bits are set, Power Down mode is entered.
Table 21: Power Control Register (PCON - 0xE01FC0C0)
PCONFunctionDescription
Idle mode - when set, this bit causes the processor clock to be stopped, while on-chip
0IDL
peripherals remain activ e. Any enabled interrupt from a peripheral or an ex ternal interrupt
source will cause the processor to resume execution.
Reset
Value
0
Power Down mode - when set, th is bit c au ses the osc il lat or an d al l on-chip clocks to be
1PD
7:2Reserved
stopped. A wakeup condition from an external interrupt can cause the oscillator to restart, the PD bit to be cleared, and the processor to resume execution.
Reserved, user software should not write ones to reserved bits. The value read from a
reserved bit is not defined.
0
NA
System Control Block49October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
Power Control for Peripherals Register (PCONP - 0xE01FC0C4)
The PCONP register all ows turn ing off selec ted pe riphera l func tions for the p urpose of sa ving pow er. A few p eriphe ral fun ctions
cannot be turned off (i.e. the Watchdog timer, GPI O, the Pin Connect block, and the System Control block). Each bit in PCO NP
controls one periphe ral as shown in Ta ble 22. The b it numbers corre spond to the rela ted peripheral number as shown in the VPB
peripheral map in the LPC2106/2105/2104 Memory Addressing section.
Table 22: Power Control for Peripherals Register (PCONP - 0xE01FC0C4)
PCONPFunctionDescription
0Reserved
1PCTIM0When 1, Timer 0 is enabled. When 0, Timer 0 is disabled to conserve power.1
2PCTIM1When 1, Timer 1 is enabled. When 0, Timer 1 is disabled to conserve power.1
3PCURT0When 1, UART 0 is enabled. When 0, UART 0 is disabled to conserve power.1
4PCURT1When 1, UART 1 is enabled. When 0, UART 1 is disabled to conserve power.1
5PCPWM0When 1, PWM 0 is enabled. When 0, PWM 0 is disabled to conserve power.1
6Reserved
7PCI2C
8PCSPI
9PCRTCWhen 1, the RTC is enabled. When 0, the RTC is disabled to conserve power.1
31:10Reserved
Reserved, user software shou ld not write ones to reserved b its. The value rea d from a
reserved bit is not defined.
User software should not write ones to reserved bits. The value read from a reserved
bit is not defined.
2
When 1, the I
power.
When 1, the SPI int erface is enabled . When 0, the SP I interface is disabled to cons erve
power.
Reserved, user software shou ld not write ones to reserved b its. The value rea d from a
reserved bit is not defined.
C interface is enable d. When 0, the I2C interface is disabl ed to conserve
Reset
Value
NA
NA
1
1
NA
System Control Block50October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
RESET
Reset has t wo sourc es on the LP C2106/2105 /2104: t he RS T pin and Wat chdog Reset. The RST pin is a Schmitt trigger input pin
with an additional glitch filter. Assertion of chip Reset by any source starts the Wakeup Timer (see Wakeup Timer description
later in this chapter), causing reset to remain asserted until the external Reset is de-asserted, the oscillator is running, a fixed
number of clocks have passed, and the Flash controller has completed its initialization. The relationship between Reset, the
oscillator, and the Wakeup Timer are shown in Figure 10.
The Reset glitch fi lter al lows th e proce ssor t o igno re exte rnal res et pul ses that a re very short , and al so de termin es the minim um
duration of RST
crystal oscillator is fully running and an adequate signal is present on the X1 pin of the LPC2104/2105/2106. Assuming that an
external crystal is used in the crystal oscillator subsystem, after power on, the RST
subsequent resets when crysta l osil lator is already runnin g and sta ble si gnal is on the X1 pi n, the R ST
for 300 ns only.
When the internal Rese t is remo ve d, the proces sor beg ins ex ecuti ng at addr ess 0, w hich is the Res et vect or. At that p oint, al l of
the processor and peripheral registers have been initialized to predetermined values.
External and internal Resets have some small differences. An external Reset causes the value of certain pins to be latched to
configure the part. External circuitry cannot determine when an internal Reset occurs in order to allow setting up those special
pins, so those latches are not reloaded during an internal Reset. Pins that are examined during an external Reset for various
purposes ar e: DBGSEL, RT CK, and EINT0.
that must be asserted in ord er to gu arantee a chi p rese t. Once a sserted, R ST pin c an be d eass erted on ly whe n
pin should be asserted for 10 ms. For all
pin needs to be asserted
It is possible for a chip Reset to occur during a Flash programming or erase operation. The Flash memory will interrupt the
ongoing operation and hold off the completion of Reset to the CPU until internal Flash high voltages have settled.
External
Reset
Reset to
Flash
Memory
Reset to
PCON.PD
Wakeup Timer
StartCount 2
Write "1"
from VPB
Reset
n
C
Q
S
VPB Read
of PDbit
in PCON
F
OSC
to
CPU
Watchdog
Reset
Power Down
EINT0 Wakeup
EINT1 Wakeup
EINT2 Wakeup
C
S
Q
Oscillator
Output (F
OSC
)
PLL
Figure 10: Reset Block Diagram including Wakeup Timer
System Control Block51October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
VPB DIVIDER
The VPB Divider determines the relationshi p between the processor cl ock (cclk) and the clock used by peripheral devices (pcl k).
The VPB Divider serves t wo purpo ses. The fi rst is to p rovides peripheral s with desi red pclk v ia VPB bus so that th ey can operate
at the speed c hosen for the ARM p roces sor. In order to ac hieve this, the VP B bu s ma y be slowed d own to one ha lf or one fo urth
of the processor clock ra te. Beca use the VPB bu s must work prope rly at po wer up (an d its ti ming can not be a ltered i f it doe s not
work since the VPB divider control registers reside on the VPB bus), the default condition at reset is for the VPB bus to run at
one quarter speed. The se co nd p urpo se of the VPB Div ide r is to all ow p ower sav in gs when an app lic at ion do es not require any
peripherals to run at the full processor rate.
The connection of the VPB Divider relative to the oscillator and the processor clock is shown in Figure 11. Because the VPB
Divider is connected to the PLL output, the PLL remains active (if it was running) during Idle mode.
VPBDIV Register (VPBDIV - 0xE01FC100)
The VPB Divider register contains two bits, allowing three divider values, as shown in Table 24.
Table 23: VPBDIV Register Map
AddressNameDescriptionAccess
0xE01FC100VPBDIVControls the rate of the VPB clock in relation to the processor clock.R/W
The rate of the VPB clock is as follows:
0 0: VPB bus clock is one fourth of the processor clock.
0 1: VPB bus clock is the same as the processor clock.
1:0VPBDIV
7:2Reserved
1 0: VPB bus clock is one half of the processor clock.
1 1: Reserved. If this value is written to the VPBDIV register, it has no effect (the
previous setting is retained).
Reserved, user software shou ld not write ones to reserved b its. The value rea d from a
reserved bit is not defined.
Reset
Value
0
NA
System Control Block52October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
Crystal Oscillator
or
External Clock Source
)
(F
osc
PLL
Processor Clock
(cclk)
VPB Divider
Figure 11: VPB Divider Connections
VPB Clock
(pclk)
System Control Block53October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
WAKEUP TIMER
The purpose of the wakeup timer is to ensure that the oscillator and other analog functions required for chip operation are fully
functional before the pr ocessor is allowed to e xecute instructi ons. This is important at power on, all types of R eset, and whenever
any of the aforementioned functions are turned off for any reason. Since the oscillator and other functions are turned off during
Power Down mode, any wakeup of the processor from Power Down mode makes use of the Wakeup Timer.
The Wakeup Timer monitors the crystal oscillator as the means of checking whether it is safe to begin code execution. When
power is applied to the chip, or som e event ca used th e chip to exit Pow er down mode, som e time i s requir ed for the o scillato r to
produce a signal of su fficie nt amplitud e to dr ive the c lock logi c. The am ount of tim e depe nds on m any fac tors, inclu din g the rate
of Vdd ramp (in the cas e o f po w er on ), th e ty pe of c ry sta l a nd i ts ele ctri ca l characteristics (if a quartz crystal is us ed), as well as
any other external circuit ry (e.g. cap acitor s), and the c haracte ristics of th e oscil lator its elf unde r the exis ting ambien t conditions.
Once a clock is detected, the Wakeup Timer counts 4096 clocks, then enables the Flash memory to initialize. When the Flash
memory initialization is complete, the processor is released to execute instructions if the external Reset has been de-asserted.
In the case where an external clock source is used in the system (as opposed to a crystal connected to the oscillator pins), the
possibility that there could be l ittle or no d elay for oscilla tor start-up m ust be consi dered. The Wake up Timer desi gn then ensures
that any other required chip functions will be operational prior to the beginning of program execution.
The LPC2106/2105/2104 does not contain any analog function such as comparators that operate without clocks or any
independent clo ck source such as a dedica ted Watchdog o scillator. The on ly remaining functions that can operate i n the absence
of a clock source are the exter nal interru pts, EINT 0, EIN T1, and EINT2 . If the extern al int errupt i s ena bled to cause wake up and
becomes active (is driven low externally), an oscillator wakeup must be initiated. If the interrupt is also enabled in the Vectored
Interrupt Controller, the completion of interrupt processing is postponed until the wakeup timer expires.
To summarize: on th e LPC2106/2105/210 4, the Wakeup Time r enforces a minimum res et duration based o n the crystal oscill ator,
and is activated whenever there is a wakeup from Power Down mode or any type of Reset.
System Control Block54October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
4. MEMORY ACCELERATOR MODULE (MAM)
INTRODUCTION
Simply put, the Memory Accelerator Module (MAM) attempts to have the next ARM instruction that will be needed in its latches
in time to prevent CPU fetch stal ls. The me thod used is to split the Flash memory into two banks, eac h cap abl e of ind ep endent
accesses. Each of the two Flas h bank s has i ts own pref etch Buff er and Bran ch Trail Buffe r. The Branch Tra il Buffers for the two
banks capture two 128-b it l ine s of Fl as h da ta whe n an In struction Fetch is not satisfied by either the Prefetch buffer nor Branch
Trail buffer for its bank, and for which a prefetch has not been initiated. Each prefetch buffer captures one 128-bit line of
instructions from its Flash bank, at the conclusion of a prefetch cycle initiated speculatively by the MAM.
Each 128 bit value includes four 32-bit ARM instructions or eight 16-bit Thumb instructions. During sequential code execution,
typically one Flash bank contains or is fetching the current instruction and the entire Flash line that contains it. The other bank
contains or is prefetching the next sequential code line. After a code line delivers its last instruction, the bank that contained it
begins to fetch the next line in that bank.
Timing of Flash read operations is programmable and is described later in this section as well as in the System Control Block
section.
Branches and othe r pro gram f low c ha nges cause a break in the seq uential flow of instruction fe tch es de sc rib ed a bo ve. When a
backward branch occurs, there is a distinct possibility that a loop is being executed. In this case the Branch Trail Buffers may
already contain the target instruction. If so, execution continues without the need for a Flash read cycle. For a forward branch,
there is also a chance that the new addres s is alre ady contai ned in one of the Pref etch Buff ers. If it is, t he branch is again taken
with no delay.
When a branch outsi de the c onten ts of the Branch Trail an d Prefetc h buffe rs is ta ken, one Fl ash Acces s cy cle is neede d to loa d
the Branch Trail buffers . Subseq uently , there w ill typic ally b e no furthe r fetch de lays until ano ther suc h “Instr uction Miss ” occurs.
The Flash memory controller detects data accesses to the Flash memory and uses a separate buffer to store the results in a
manner similar to that us ed during code fetches . This allows faster acces s to data if it is accessed sequ entially. A single li ne buffer
is provided for data accesses, as opposed to the two buffers per Flash bank that are provided for code accesses. There is no
prefetch function for data accesses.
Memory Accelerator Module Blocks
The Memory Accelerator Module is divided into several functional blocks:
• A Flash Address Latch for each bank. An Incrementer function is associated with the Bank 0 Flash Address latch.
• Two Flash Memory Banks.
• Instruction Latches, Data Latches, Address Comparison latches.
•Wait logic
Figure 12 shows a simplified block diagram of the Memory Accelerator Module data paths.
In the following de scription s, the term “fe tch” appl ies to an explicit Fl ash read request fro m the ARM. “ prefetch” i s used to denote
a Flash read of instructions beyond the current processor fetch address.
Flash Memory Banks
There are two banks of Flash memory in order to allow two parallel accesses and eliminate delays for sequential accesses.
Memory Accelerator Module (MAM)55October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
Flash programming oper ations are not con trolled by the Me mory Ac celera tor Modu le, but are handle d as a sep arate fun ction. A
“boot block” sector contains Flash programming algorithms that may be called as part of the application program, and a loader
that may be run to allow serial programming of the Flash memory.
The Flash memories are wired so that each sector exists in both banks, such that a sector erase operation acts on part of both
banks simultaneously. In effect, the existence of two banks is transparent to the programming functions.
Memory Address
Flash Memory
ARM Local Bus
Figure 12: Simplified Block Diagram of the Memory Accelerator Module
Bus
Interface
Bank 0
Selection
Memory Data
Flash Memory
Bank 1
Bank
Instruction Latches and Data Latches
Code and Data accesses are treated separately by the Memory Accelerator Module. There are two sets of 128-bit Instruction
Latches and 12 -bit Com parison Address Latches assoc iated with each Flash Bank . On e o f the two sets, called the Branch Trail
Buffer, holds the data and comparison address for that bank from the last Instruction miss. The other set, called the Prefetch
Buffer, holds the data and comparison address from prefetches undertaken speculatively by the MAM. Each Instruction Latch
holds 4 words of code (4 ARM instructions, or 8 Thumb instructions).
Similarly there i s a 1 28-bit Data La tch and 1 3-bit Data Addr ess latch, tha t are u sed d uring D ata cycl es. This sing le se t of latches
is shared by bot h Flas h bank s. Eac h Data a cces s that is not in the Data latch caus es a F lash f etch o f 4 wo rds of data, wh ich ar e
captured in the Data latch. This speeds up sequential Data operations, but has little or no effect on random accesses.
Flash Programming Issues
Since the Flash memory does not al low accesses durin g programming and erase op erations, it is necessar y for the MAM to force
the CPU to wait if a memory access to a Flash address is requested while the Flash module is busy. (This is accomplished by
asserting the ARM7 TDMI-S local bu s signal CLKEN. ) Under some cond itions, this de lay could resu lt in a Watchdog time-out. The
user will need to be a ware of this pos sibilit y and take s teps to insu re that an unw anted Watc hdog reset d oes not cau se a system
failure while programming or erasing the Flash memory.
Memory Accelerator Module (MAM)56October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
In order to preclude the possibility of stale data being read from the Flash memory, the MAM holding latches are automatically
invalidated at the be ginning of any Fl ash programming o r erase operation . Any subsequen t read from a Flash ad dress will cause
a new fetch to be initiated after the Flash operation has completed.
MEMORY ACCELERATOR MODULE OPERATING MODES
Three modes of operation are defined for the MAM, trading off performance for ease of predictability:
0) MAM off. All memory requests result in a Flash read operation (see note 2 below). There are no instruction prefetches.
1) MAM partially ena bl ed. Sequential instruction acc ess es a r e fu lfi lle d f r om the ho ld ing la tches if the data is present. In st ruction
prefetch is enabled. Non-sequential instruction accesses initiate Flash read operations (see note 2 below). This means that all
branches cause mem ory fe tches . All dat a opera tions c ause a Flash rea d b ecause bu ffe red data acce ss timin g is ha rd to pre dict
and is very situation dependent.
2) MAM fully enabled . Any memory request (code or data) for a value that is contai ned in one of the correspondi ng holding latches
is fulfilled from the latch. Instruction prefetch is enabled. Flash read operations are initiated for instruction prefetch and code or
data values not available in the corresponding holding latches.
Table 25: MAM Responses to Program Accesses of Various Types
Program Memory Request Type
MAM Mode
012
Sequential access, data in MAM latchesInitiate Fetch
2
Use Latched Data
Sequential access, data not in MAM latchesInitiate FetchInitiate Fetch
Non-Sequential access, data in MAM latchesInitiate Fetch
2
Initiate Fetch
Non-Sequential access, data not in MAM latchesInitiate FetchInitiate Fetch
1, 2
1
Use Latched Data
1
Initiate Fetch
Use Latched Data
1
Initiate Fetch
1
1
1
1
Table 26: MAM Responses to Data and DMA Accesses of Various Types
MAM Mode
Data Memory Request Type
012
Sequential access, data in MAM latchesInitiate Fetch
2
Initiate Fetch
2
Use Latched Data
Sequential access, data not in MAM latchesInitiate FetchInitiate FetchInitiate Fetch
Non-Sequential access, data in MAM latchesInitiate Fetch
2
Initiate Fetch
2
Use Latched Data
Non-Sequential access, data not in MAM latchesInitiate FetchInitiate FetchInitiate Fetch
1. Instruction prefetch is enabled in modes 1 and 2.
2. The MAM actually uses latch ed data if it i s availa ble, but mimics the t iming of a F lash read o peratio n. This saves power whil e
resulting in the same execution timing. The MAM can truly be turned off by setting the fetch timing value in MAMTIM to one
clock.
Memory Accelerator Module (MAM)57October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
MAM CONFIGURATION
After reset the MAM defaults to the disabled state. Software can turn memory access acceleration on or off at any time. This
allows most of an application to be run at the highest possible performance, while certain functions can be run at a somewhat
slower but more predictable rate if more precise timing is required.
REGISTER DESCRIPTION
All registers, regardless of size, are on word address boundaries. Details of the registers appear in the description of each
function.
Table 27: Summary of System Control Registers
AddressNameDescriptionAccess
MAM
Memory Accelerator Module Control Register. Determines the MAM
0xE01FC000MAMCR
0xE01FC004MAMTIM
*Reset Value refers to the data stored in used bits only. It does not include reserved bits content.
functional mode, that is, to what extent the MAM performance
enhancements are enabled. See Table 28.
Memory Accelerator Module Timing control. Determines the number of
clocks used for Flash memory fetches (1 to 7 processor clocks).
Reset
Value*
R/W0
R/W0x07
Memory Accelerator Module (MAM)58October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
MAM Control Register (MAMCR - 0xE01FC000)
Two configuration bits select the three MAM operating modes, as shown in Table 28. Following Reset, MAM functions are
disabled. Changing the MAM operating mode causes the MAM to invalidate all of the holding latches, resulting in new reads of
Flash information as required.
Table 28: MAM Control Register (MAMCR - 0xE01FC000)
MAMCRFunctionDescription
These bits determine the operating mode of the MAM as follows:
1:0
7:2Reserved
MAM mode
control
0 0 - MAM functions disabled.
0 1 - MAM functions partially enabled.
1 0 - MAM functions fully enabled.
1 1 - reserved
Reserved, user software shou ld not write ones to reserved b its. The value rea d from a
reserved bit is not defined.
Reset
Value
0
NA
MAM Timing Register (MAMTIM - 0xE01FC004)
The MAM Timing regis ter determines how many cclk cycles are used to acces s the Flash memory. This al lows tuning MAM timing
to match the processor operating frequency. Flash access times from 1 clock to 7 clocks are possible. Single clock Flash
accesses would esse ntially remove the MAM from timing c alc ul ations. In this case the MAM mode may be se lected to optimize
power usage.
Table 29: MAM Timing Register (MAMTIM - 0xE01FC004)
MAMTIMFunctionDescription
These bits set the duration of MAM Flash fetch operations as follows:
0 0 0 = 0 - Reserved.
0 0 1 = 1 - MAM fetch cycles are 1 processor clock (cclk) in duration.
0 1 0 = 2 - MAM fetch cycles are 2 processor clocks (cclks) in duration.
0 1 1 = 3 - MAM fetch cycles are 3 processor clocks (cclks) in duration.
1 0 0 = 4 - MAM fetch cycles are 4 processor clocks (cclks) in duration.
1 0 1 = 5 - MAM fetch cycles are 5 processor clocks (cclks) in duration.
1 1 0 = 6 - MAM fetch cycles are 6 processor clocks (cclks) in duration.
1 1 1 = 7 - MAM fetch cycles are 7 processor clocks (cclks) in duration.
2:0
MAM Fetch
Cycle timing
Reset
Value
0x07
Warning: Improper set tin g of t his v alue may result in inco rrect o perati on of the devi ce.
7:3Reserved
Reserved, user software shou ld not write ones to reserved b its. The value rea d from a
reserved bit is not defined.
NA
MAM USAGE NOTES
When changing M AM timing, the MAM must first be turned off by writing a zero to M A MCR . A ne w va lue ma y then be written to
MAMTIM. Finally, the MAM may be turned on again by writing a value (1 or 2) corresponding to the desired operating mode to
MAMCR.
For system cloc k sl ower than 2 0 MH z, MA MTIM c an be 0 01. For s ystem clock betw een 20 M Hz and 40 M Hz , Flas h ac cess ti me
is suggested to be 2 CCLKs, while in systems with system clock faster than 40 MHz, 3 CCLKs are proposed.
Memory Accelerator Module (MAM)59October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
Memory Accelerator Module (MAM)60October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
5. VECTORED INTERRUPT CONTROLLER (VIC)
FEATURES
• ARM PrimeCell™ Vectored Interrupt Controller
• 32 interrupt request inputs
• 16 vectored IRQ interrupts
• 16 priority levels dynamically assigned to interrupt requests
• Software interrupt generation
DESCRIPTION
The Vectored Interrupt Con troller (VIC) takes 32 interrupt reque st inputs and p rogrammably assig ns them into 3 cate gories, FIQ,
vectored IRQ, and non-vectored IR Q. The program mable assig nment sche me means that priorities of interrupts from the v arious
peripherals can be dynamically assigned and adjusted.
Fast Interrupt reQuest (FIQ) requests have the highest priority. If more than one request is assigned to FIQ, the VIC ORs the
requests to produce the FIQ signal to the ARM processor. The fastest possible FIQ latency is achieved when only one request
is classified as FIQ, be caus e then the FIQ service rout ine can si mply start de aling with that de vice . But if m ore th an one requ est
is assigned to the FIQ class, the FIQ service routine can read a word from the VIC that identifies which FIQ source(s) is (are)
requesting an interrupt.
Vectored IRQs hav e the midd le priorit y. Sixt een of the 32 reques ts can be as signe d to th is ca tegory. Any of the 32 reques ts ca n
be assigned to any of the 16 vectored IRQ slots, among which slot 0 has the highest priority and slot 15 has the lowest.
Non-vectored IRQs have the lowest priority.
The VIC ORs the requests from all the vectored and non-vectored IRQs to produce the IRQ signal to the ARM processor. The
IRQ service routine can start by reading a register from the VIC and jumping there. If any of the vectored IRQs are requesting,
the VIC provides the address of the highe st-priority requesting IR Qs service routine, otherwis e it provides the address of a default
routine that is shared by al l the non-vectored IRQs. The default routine can read another VIC register to see what IRQs are active.
All registers in the VIC are word registers. Byte and halfword reads and write are not supported.
Additional information on the Vectored Interrupt Controller is available in the ARM PrimeCell™ Vectored Interrupt Controller
The VIC implements the registers shown in Table 30. More detailed descriptions follow.
Table 30: VIC Register Map
AddressNameDescriptionAccess
0xFFFF F000VICIRQStatus
0xFFFF F004VICFIQStatus
0xFFFF F008VICRawIntr
0xFFFF F00CVICIntSelect
0xFFFF F010VICIntEnable
0xFFFF F014VICIntEnClr
0xFFFF F018VICSoftInt
0xFFFF F01C VICSoftIntClear
0xFFFF F020VICProtection
IRQ Status Register. This register reads out the state of those interrupt
requests that are enabled and classified as IRQ.
FIQ Status Requests. This register reads out the state of those interrupt
requests that are enabled and classified as FIQ.
Raw Interrupt Status Register. This register reads out the sta te of the 32
interrupt requests / software interrupts, regardless of enabling or
classification.
Interrupt Select Registe r. This regis ter classifi es each of the 32 interrupt
requests as contributing to FIQ or IRQ.
Interrupt Enable Register. This register controls which of the 32 interrupt
requests and software interrupts are enabled to contribute to FIQ or
IRQ.
Interrupt Enable Clear Register. This register allows software to clear
one or more bits in the Interrupt Enable register.
Software Interrupt Register . The co ntents of this register are ORed with
the 32 interrupt requests from various peripheral functions.
Software Interrupt Clear Regis ter. Thi s regis ter all ows sof tware to c lear
one or more bits in the Software Interrupt register.
Protection enable register. This registe r allows limiting access to the VIC
registers by software running in privileged mode.
Vector control 0 re gister. Vector Control Registers 0-15 eac h control one
0xFFFF F200VICVectCntl0
0xFFFF F204VICVectCntl1Vector control 1 registerR/W0
0xFFFF F208VICVectCntl2Vector control 2 registerR/W0
0xFFFF F20CVICVectCntl3Vector control 3 registerR/W0
0xFFFF F210VICVectCntl4Vector control 4 registerR/W0
0xFFFF F214VICVectCntl5Vector control 5 registerR/W0
0xFFFF F218VICVectCntl6Vector control 6 registerR/W0
0xFFFF F21CVICVectCntl7Vector control 7 registerR/W0
0xFFFF F220VICVectCntl8Vector control 8 registerR/W0
of the 16 vectored IRQ slots. Slot 0 has the highest priority and slot 15
the lowest.
R/W0
Reset
Value*
0xFFFF F224VICVectCntl9Vector control 9 registerR/W0
0xFFFF F228VICVectCntl10 Vector control 10 registerR/W0
0xFFFF F22CVICVectCntl11 Vector control 11 registerR/W0
0xFFFF F230VICVectCntl12 Vector control 12 registerR/W0
0xFFFF F234VICVectCntl13 Vector control 13 registerR/W0
0xFFFF F238VICVectCntl14 Vector control 14 registerR/W0
0xFFFF F23CVICVectCntl15 Vector control 15 registerR/W0
*Reset Value refers to the data stored in used bits only. It does not include reserved bits content.
This section describes the VIC registers in the order in which they are used in the VIC logic, from those closest to the interrupt
request inputs to tho se most abstracted for us e by software. For most p eople, this is also th e best order to read about the registers
when learning the VIC.
1: writing a 1 clears the corresponding bit in the Software Interrupt register, thus releasing
31:0
the forcing of this request.
0: writing a 0 leaves the corresponding bit in VICSoftInt unchanged.
0
Raw Interrupt Status Register (VICRawIntr - 0xFFFFF008, Read Only)
This register reads out the state of the 32 interrupt requests and software interrupts, regardless of enabling or classification.
Table 33: Raw Interrupt Status Register (VICRawIntr - 0xFFFFF008, Read-Only)
VICRawIntrFunctionReset Value
31:0
1: the interrupt request or software interrupt with this bit number is asserted.
0: the interrupt request or software interrupt with this bit number is negated.
enabled to contribute to FIQ or IRQ. When this register is writt en, ones enable in terrupt requests
or software interrupts to contribu te to FIQ or IRQ, zeroes have no effe ct. See the VICIntEnClear
register (Table 46 below), for how to disable interrupts.
0
1: writing a 1 clears the corresponding bit in the Interrupt Enable register, thus disabling
31:0
interrupts for this request.
0: writing a 0 leaves the corresponding bit in VICIntEnable unchanged.
1: the interrupt request with this bit number is assigned to the FIQ category.
0: the interrupt request with this bit number is assigned to the IRQ category.
0
IRQ Status Register (VICIRQStatus - 0xFFFFF000, Read Only)
This register reads out the state of those interrupt requests that are enabled and classified as IRQ. It does not differentiate
between vectored and non-vectored IRQs.
Table 37: IRQ Status Register (VICIRQStatus - 0xFFFFF000, Read-Only)
VICIRQStatusFunctionReset Value
31:01: the interrupt request with this bit number is enabled, cla ssifi ed as IRQ, and asserte d.0
FIQ Status Register (VICFIQStatus - 0xFFFFF004, Read Only)
This register reads out the state of those interrupt requests that are enabled and classified as FIQ. If more than one request is
classified as FIQ, the FIQ service routine can read this register to see which request(s) is (are) active.
Table 38: IRQ Status Register (VICFIQStatus - 0xFFFFF004, Read-Only)
VICFIQStatusFunctionReset Value
31:01: the interrupt request with this bit number is enabled, cla ssifi ed as FIQ, and ass ert ed.0
Vector Control Registers 0-15 (VICVectCntl0-15 - 0xFFFFF200-23C, Read/Write)
Each of these registers con trols one of the 16 vectored IRQ slots . Slot 0 has the hi ghest priori ty and slot 1 5 the lowest. N ote that
disabling a vectored IRQ slot in one of the VICVectCntl registers does not disable the interrupt itself, the interrupt is simply
changed to the non-vectored form.
Table 39: Vector Control Registers (VICVectCntl0-15 - 0xFFFFF200-23C, Read/Write)
VICVectCntl0-15FunctionReset Value
5
4:0
1: this vectored IRQ slot is enabled, and can produce a unique ISR address when its
assigned interrupt request or software interrupt is enabled, classified as IRQ, and asserted.
The number of the interrupt request or software interrupt assigned to this vectored IRQ slot.
As a matter of good programming practice, software should not assign the same interrupt
number to more than one enabled vectored IRQ slot. But if this does occur, the lowernumbered slot will be used when the interrupt request or software interrupt is enabled,
classified as IRQ, and asserted.
When one or more in terrupt req uest or s oftware int errupt is (are) enab led, class ified as IR Q,
31:0
asserted, and assign ed to a n e nabled vectored IRQ slot, the valu e from this register for the
highest-priority such slot will be provided when the IRQ service routine reads the Vector
Address register (VICVectAddr).
When an IRQ service routin e reads the Vec tor Address register (VIC VectAddr), and no IR Q
slot responds as described above, this address is returned.
If any of the inter rupt requests or software in terrupts that a re assigned to a vecto red IRQ slot
is (are) enabled, classified as IRQ, and asserted, reading from this register returns the
address in the Vector A ddress Register for the h ighest-priority such slot. Otherwise it returns
Table 37 lists the interrupt sources for each peripheral function. Each peripheral device has one interrupt line connected to the
Vectored Interrupt Controller, but may have several internal interrupt flags. Individual interrupt flags may also represent more
than one interrupt source.
Table 44: Connection of Interrupt Sources to the Vectored Interrupt Controller
BlockFlag(s)VIC Channel #
WDTWatchdog Interrupt (WDINT)0
-Reserved for software interrupts only1
ARM CoreEmbedded ICE, DbgCommRx2
ARM CoreEmbedded ICE, DbgCommTx3
If user’s code is runing from the on-chip RAM and an aplication uses interrupts, interrupt vectors must be re-mapped to flash
address 0x0. This is nece ssary because all the except ion vectors are located at addre sses 0x0 and above. This is easily achieved
by configuring MEMM AP registe r (locat ed in Sys tem Con trol Bloc k) to User R AM mod e. App licat ion co de shou ld be li nked s uch
that at 0x4000 0000 the Interrupt Vector Tabe (IVT) will reside.
Although multiple sources can be selected (VICIntSelect) to generate FIQ request, only one interrupt service routine should be
dedicated to service al l avail able/p resent FIQ reque st(s). Th erefore, i f more than one inte rrupt sou rces are classifi ed as FIQ the
FIQ interrupt service rout ine must read VICFIQSta tus to decide based on thi s content what to do and how to process the interrupt
request. However, it is recommended that only one interrupt source should be classified as FIQ. Classifying more than one
interrupt sources as FIQ will increase the interrupt latency.
Following the compl etion of the desired interrupt service routine, clea ring of the interrupt flag on the peripheral level will propagate
to corresponding bits in VIC registers (VICRawIntr, VICFIQStatus and VICIRQStatus). Also, before the next interrupt can be
serviced, it is necessary that write is performed into the VICVectAddr register before the return from interrupt is executed. This
write will clear the respective interrupt flag in the internal interrupt priority hardware.
In order to disable the interrupt at the VIC you need to clear corresponding bit in the VICIntEnClr register, which in turn clears
the related bit in the VICIntEnable register. This also applies to the VICSoftInt and VICSoftIntClear in which VICS oftIn tCle ar will
clear the respective bits in VICSoftInt. For example, if VICSoftInt=0x0000 0005 and bit 0 has to be cleared,
VICSoftIntClear=0x0000 0001 will acom plish this. Be fore the new cl ear operatio n on the sam e bit in VICSof tInt using writin g into
VICSoftIntClear is performed in the future, VICSoftIntClear= 0x0000 0000 must be assi gned. Therefore writing 1 to any bit in Clear
register will have one-time-effect in the destination register.
If the watchdog is enable d for interru pt on unde rflow or in vali d feed seq uence only then there is no way of c learing the interrupt.
The only way you could perform return from interrupt is by disabling the interrupt at the VIC(using VICIntEnClr).
Example:
Assuming that UART 0 and SPI are generating interrupt requests that are classified as vectored IRQs (UART0 being on the
higher level than SPI), while UART1 and I
setup:
VICIntSelect = 0x0000 0000(SPI, I2C, UART1 and UART0 are IRQ => bit10, bit9, bit7 and bit6=0)
VICIntEnable = 0x0000 06C0(SPI, I2C, UART1 and UART0 are enabled interrupts => bit10, bit9, bit 7 and bit6=1)
VICDefVectAddr = 0x…(holds address at what routine for servicing non-vectored IRQs (i.e. UART1 and I2C) starts)
VICVectAddr0 = 0x…(holds address where UART0 IRQ service routine starts)
VICVectAddr1 = 0x…(holds address where SPI IRQ service routine starts)
VICVectCntl0 = 0x0000 0026(interrupt source with index 6 (UART0) is enabled as the one with priority 0 (the highest))
VICVectCntl1 = 0x0000 002A(interrupt source with index 10 (SPI) is enabled as the one with priority 1)
After any of IRQ requests (SPI, I2C, UART0 or UART1) is made, microcontroller will redirect code execution to the address
specified at location 0x00000018. For vectored and non-vectored IRQ’s the following instruction could be placed at 0x18:
LDR pc,[pc,#-0xFF0]
This instruction loads PC with the address that is present in VICVectAddr register.
In case UART0 request has been made, VICVectAddr will be identical to VICVectAddr0, while in case SPI request has been
made value from VICVectAddr1 will be found here. If neithe r UART0 nor SPI have generated IR Q request but UART1 and /or I
were the reason, content of VICVectAddr will be identical to VICDefVectAddr.
2
C are generating non-vectored IRQs, the following could be one possibility for VIC
1. There must be a low level at the DBGSEL input for normal operation. The DBGSEL pin has a built-in p ulldown that will provide
this if the pin is left unconnected in the application. Details of Debug mode may be found in "EmbeddedICE Logic" chapter.
2. This column shows the default functionality of each pin during debug mode with the primary JTAG port.
3. RTCK is an extra signal added to the JTAG port. Multi-ICE (Development system from ARM) uses this signal to maintain
synchronization with targets having slow or widely varying clock frequency. For details refer to "Multi-ICE System Design
considerations Application Note 72 (ARM DAI 0072A)". RTCK is used as an input when enabling debug mode to choose
debug port options. Details of Debug mode may be found later in "EmbeddedICE Logic" chapter.
PIN DESCRIPTION FOR LPC2106/2105 /2104
Pin description for LPC2106/2105/2104 and a brief of corresponding functions are shown in the following table.
Table 46: Pin description and corresponding functions for LPC2106/2105/2104
Pin
Name
P0.0
to
P0.31
LQFP 48
Pin #
13
14
18
21
22
23
TypeDescription
I/OPort 0: Port 0 is a 32-bit bi-directional I/O port with individual direction controls for each bit. The
operation of port 0 pins depends upon the pin function selected via the Pin Connect Block.
O
O
O
I/O
I/O
O
I/O
I/O
O
P0.0TxD0Transmitter output for UART 0.
PWM1Pulse Width Modulator output 1.
I
P0.1RxD0Receiver input for UART 0.
PWM3Pulse Width Modulator output 3.
2
P0.2SCLI
I
P0.3SDAI
P0.4SCKSerial Clock. SPI clock output from master or input to slave.
I
P0.5MISOMaster In Slave Out. Data input to SPI master or data output from SPI
CAP0.0Capture input for Timer 0, channel 0.
MAT0.0Match output for Timer 0, channel 0.
CAP0.1Capture input for Timer 0, channel 1.
MAT0.1Match output for Timer 0, channel 1.
C clock input/output. Open drain output (for I2C compliance).
2
C data input/output. Open drain output (for I2C compliance).
slave.
24
28
29
30
I/O
O
O
O
O
P0.6MOSIMaster Out Slave In. Data output from SPI master or data input to SPI
slave.
I
I
P0.7SSELSlave Select. Selects the SPI interface as a slave.
P0.8TxD1Transmitter output for UART 1.
I
P0.9RxD1Receiver input for UART 1.
CAP0.2Capture input for Timer 0, channel 2.
PWM2Pulse Width Modulator output 2.
PWM4Pulse Width Modulator output 4.
PWM6Pulse Width Modulator output 6.
Pin Configuration73October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
Table 46: Pin description and corresponding functions for LPC2106/2105/2104
Pin
Name
LQFP 48
Pin #
35
36
37
41
44
45
46
47
TypeDescription
O
O
O
O
O
P0.10RTS1Request to Send output for UART 1.
I
I
P0.11CTS1Clear to Send input for UART 1.
I
I
P0.12DSR1Data Set Ready input for UART 1.
P0.13DTR1Data Terminal Ready output for UART 1.
I
P0.14DCD1Data Carrier Detect input for UART 1.
I
I
P0.15RI1Ring Indicator input for UART 1.
I
I
P0.16EINT0External interrupt 0 input.
I
P0.17CAP1.2Capture input for Timer 1, channel 2.
I
CAP1.0Capture input for Timer 1, channel 0.
CAP1.1Capture input for Timer 1, channel 1.
MAT1.0Match output for Timer 1, channel 0.
MAT1.1Match output for Timer 1, channel 1.
EINT1External interrupt 1 input.
EINT2External interrupt 2 input.
MAT0.2Match output for Timer 0, channel 2.
TRSTTest Reset for JTAG interface, primary JTAG pin group.
48
1
2
3
32O
33O
34O
38O
39O
I
P0.18CAP1.3Capture input for Timer 1, channel 3.
I
O
O
O
O
P0.19MAT1.2Match output for Timer 1, channel 2.
I
P0.20MAT1.3Match output for Timer 1, channel 3.
I
P0.21PWM5Pulse Width Modulator output 5.
P0.22TRACECLK Trace Clock. Standard I/O port with internal pullup.
P0.23PIPESTAT0 Pipeline Statu s, bit 0. Standard I/O port with internal pull up.
P0.24PIPESTAT1 Pipeline Statu s, bit 1. Standard I/O port with internal pull up.
P0.25PIPESTAT2 Pipeline Statu s, bit 2. Standard I/O port with internal pull up.
P0.26TRACESYNCTrace Synchronization Standard I/O port with internal pullup.
TMSTest Mode Select for JTAG interface, primary JTAG pin group.
TCKTest Cl ock for JTAG interface, p rimary JTAG pin group.
TDITest Data In for JTAG interface, primary JTAG pin group.
TDOTest Data Out for JTAG interface, primary JTAG pin group.
Pin Configuration74October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
Table 46: Pin description and corresponding functions for LPC2106/2105/2104
Pin
Name
LQFP 48
Pin #
8
9
10
15
16
TypeDescription
O
O
O
O
O
P0.27TRACEPKT0Trace Packet, bit 0. Standard I/O port with internal pullup.
I
TRSTTest Reset for JTAG interface, secondary JTAG pin group.
P0.28TRACEPKT1Trace Packet, bit 1. Standard I/O port with internal pullup.
I
TMSTest Mode Select for JTAG interface, secondary JTAG pin group.
P0.29TRACEPKT2Trace Packet, bit 2. Standard I/O port with internal pullup.
I
TCKTest Clock for JTAG interface, secondary JTAG pin group.
P0.30TRACEPKT3Trace Packet, bit 3. Standard I/O port with internal pullup.
I
I
P0.31EXTIN0External Trigger Input. Standard I/O port with internal pullup.
TDITest Data In for JTAG interface, secondary JTAG pin group.
TDOTest Data Out for JTAG interface, secondary JTAG pin group.
Returned Test Clock output. Extra signal added to the JTAG port. Assists debugger
RTCK26I/O
synchronization when process or frequency v aries. Als o used d uring debu g mode entry to enable
primary JTAG pins. Bi-directional pin with internal pullup.
DBGSEL27I
RST
6I
Debug Select. When low, the part operates normally. When high, debug mode is entered. Input
pin with internal pulldown.
External Reset input. A lo w on this pin resets th e device, causi ng I/O ports and peri pherals to take
on their default states, and processor execution to begin at address 0.
X111IInput to the oscillator circuit and internal clock generator circuits.
X212OOutput from the oscillator amplif ier.
V
V
DD1.8
V
SS
DD3
NC
7, 19, 31,
43
5I1.8V Core Power Supply: This is the power supply voltage for internal circuitry.
17, 40I3.3V Pad Power Supply: This is the power supply voltage for the I/O ports.
4, 20, 25,
42
IGround: 0V reference.
-Not Connected: These pins are not connected.
Pin Configuration75October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
Pin Configuration76October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
7. PIN CONNECT BLOCK
FEATURES
• Allows individual pin configuration
APPLICATIONS
The purpose of the Pin Connect Block is to configure the microcontroller pins to the desired functions.
DESCRIPTION
The pin connect blo ck allows sele cted pi ns of the mi crocontroller to have more than one fu nction. Con figuration register s control
the multiplexers to allow connection between the pin and the on chip peripherals.
Peripherals should be connected to the appropriate pins prior to being activated, and prior to any related interrupt(s) being
enabled. Activity of any enabled peripheral function that is not mapped to a related pin should be considered undefined.
REGISTER DESCRIPTION
The Pin Control Module contains 2 registers as shown in Table 47. below.
Table 47: Pin Connect Block Register Map
AddressNameDescriptionAccess
0xE002C000PINSEL0Pin function select register 0Read/Write
0xE002C004PINSEL1Pin function select register 1Read/Write
Pin Connect Block77October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
Pin Function Select Register 0 (PINSEL0 - 0xE002C000)
The PINSEL0 register con trols the functio ns of the pins as per the settings l isted in Table 50. Th e direction cont rol bit in the IODIR
register is effective only when the GPIO function is selected for a pin. For other functions, direction is controlled automatically.
Table 48: Pin Function Select Register 0 (PINSEL0 - 0xE002C000)
PINSEL0
1:0P0.0GPIO Port 0.0TxD (UART 0)PWM1Reserved0
3:2P0.1GPIO Port 0.1RxD (UART 0)PWM3Reserved0
5:4P0.2GPIO Port 0.2SCL (I
7:6P0.3GPIO Port 0.3SDA (I
9:8P0.4GPIO Port 0.4SCK (SPI)Capture 0.1 (Timer 0)Reserved0
11:10P0.5GPIO Port 0.5MISO (SPI)Match 0.1 (Timer 0)Reserved0
13:12P0.6GPIO Port 0.6MOSI (SPI)Capture 0.2 (Timer 0)Reserved0
15:14P0.7GPIO Port 0.7SSEL (SPI)PWM2Reserved0
17:16P0.8GPIO Por t 0.8TxD UART 1PWM4Reserved0
19:18P0.9GPIO Port 0.9RxD (UART 1)PWM6Reserved0
21:20P0.10GPIO Port 0.10RTS (UART1)Capture 1.0 (Timer 1)Reserved0
23:22P0.11GPIO Port 0.11CTS (UART1)Capture 1.1 (Timer 1)Reserved0
25:24P0.12GPIO Port 0.12DSR (UART1)Match 1.0 (Timer 1)Reserved0
27:26P0.13GPIO Port 0.13DTR (UART 1)Match 1.1 (Timer 1)Reserved0
29:28P0.14GPIO Port 0.14CD (UART 1)EINT1Reserved0
31:30P0 .15GPIO Port 0.15RI (UART1)EINT2Reserved0
Pin
Name
Function when 00Function when 01Function when 10Function when 11
2
C)Capture 0.0 (Timer 0)Reserved0
2
C)Match 0.0 (Timer 0)Reserved0
Reset
Value
Pin Connect Block78October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
Pin Function Select Register 1 (PINSEL1 - 0xE002C004)
The PINSEL1 register con trols the functio ns of the pins as per the settings l isted in Table 49. Th e direction cont rol bit in the IODIR
register is effective only when the GPIO function is selected for a pin. For other functions direction is controlled automatically.
Function control for the pins P0.17 - P0.31 is effective only when the DBGSEL input is pulled LOW during RESET.
Table 49: Pin Function Select Register 1 (PINSEL1 - 0xE002C004)
PINSEL1Pin NameFunction when 00Function when 01Function when 10Function when 11
1:0P0.16GPIO Port 0.16EINT0Match 0.2 (Timer 0)Reserved0
3:2P0.17GPIO Port 0.17Capture 1.2 (Timer 1)ReservedReserved0
5:4P0.18GPIO Port 0.18Capture 1.3 (Timer 1)ReservedReserved0
7:6P0.19GPIO Port 0.19Match 1.2 (Timer 1)ReservedReserved0
9:8P0.20GPIO Port 0.20Match 1.3 (Timer 1)ReservedReserved0
11:10P0.21GPIO Port 0.21PWM5ReservedReserved0
13:12P0.22GPIO Port 0.22ReservedReservedReserved0
15:14P0.23GPIO Port 0.23ReservedReservedReserved0
17:16P0.24GPIO Port 0.24ReservedReservedReserved0
19:18P0.25GPIO Port 0.25ReservedReservedReserved0
21:20P0.26GPIO Port 0.26ReservedReservedReserved0
23:22P0.27GPIO Port 0.27TRSTReservedReserved0
25:24P0.28GPIO Port 0.28TMSReservedReserved0
27:26P0.29GPIO Port 0.29TCKReservedReserved0
29:28P0.30GPIO Port 0.30TDIReservedReserved0
31:30P0.31GPIO Port 0.31TDOReservedReserved0
Reset
Value
Pin Function Select Register Values
The PINSEL registers c ontrol t he functions of dev ice p ins a s shown below. Pairs o f bi ts in t hese re giste rs corre spond to sp ecific
device pins.
Table 50: Pin Function Select Register Bits
Pinsel0 and Pinsel1 ValuesFunctionValue after Reset
00Primary (default) function, typically GPIO Port
01First alternate function
10Second alternate function
11Reserved
The direction control bit in the IODIR register is effective only when the GPIO function is selected for a pin. For other functions,
direction is controlled automatically. Each derivative typically has a different pinout and therefore a different set of functions
possible for each pin. Details for a specific derivative may be found in the appropriate data sheet.
Pin Connect Block79October 02, 2003
00
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
Pin Connect Block80October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
8. GPIO
FEATURES
• Direction control of individual bits
• Separate control of output set and clear
• All I/O default to inputs after reset
APPLICATIONS
• General purpose I/O
• Driving LEDs, or other indicators
• Controlling off-chip devices
• Sensing digital inputs
PIN DESCRIPTION
Table 51: GPIO Pin Description
Pin NameTypeDescription
P0.0 - P0.31
Input/
Output
General purpose in put/output. The number of GP IO s ac tua lly a va ila ble d epe nds on the use of
alternate functions.
REGISTER DESCRIPTION
The GPIO contains 4 registers as shown in Table 52.
Table 52: GPIO Register Map
AddressNameDescriptionAccess
0xE0028000IOPIN
0xE0028004IOSET
0xE0028008IODIR
0xE002800CIOCLR
GPIO Pin value register. The c urre nt sta te of the port pins can always be read
from this register, regardless of pin direction and mode.
GPIO 0 Output set register. This register controls the state of output pins in
conjunction with the IOCLR register. Writing ones produces highs at the
corresponding port pins. Writing zeroes has no effect.
GPIO 0 Direction co ntrol register. This re gister individual ly controls the direct ion
of each port pin.
GPIO 0 Output clear register. This register controls the state of output pins.
Writing ones produces lows at the corresponding port pins and clears the
corresponding bits in the IOSET register. Writing zeroes has no effect.
Read Only
Read/Set
Read/Write
Clear Only
GPIO81October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
GPIO Pin Value Register (IOPIN - 0xE0028000)
This register provides the value of the GPIO pins. This value reflects any outside world influence on the pins.
Note: for test purposes, writi ng to this registe r stores th e value in the outpu t registe r, bypas sing th e need to us e both the IOSET
and IOCLR registers. This feature is of little or no use in an application because it is not possible to write to individual bytes in
this register.
Table 53: GPIO Pin Value Register (IOPIN - 0xE0028000)
IOPINDescription
31:0GPIO pin value bits. Bit 0 corresponds to P0.0 ... Bit 31 corresponds to P0.31Undefined
Value afte r
Reset
GPIO Output Set Register (IOSET - 0xE0028004)
This register is us ed to pro duce a HIG H level output at the po rt pins if th ey are c onfigured as GPIO in an OU TPUT mode. Writing
1 produces a HIGH l evel at the corre sponding port pi ns. Writing 0 has no effect. If any pi n is configured as an input or a s econdary
function, writing to IOSET has no effect.
Reading the IOSET register returns the value in the GPIO output regi ster, as determined by prev ious writes to IOSET and IOCL R
(or IOPIN as noted above). This value does not reflect the effect of any outside world influence on the I/O pins.
Table 54: GPIO Output Set Register (IOSET - 0xE0028004)
IOSETDescription
31:0Output value SET bits. Bit 0 corresponds to P0.0 ... Bit 31 corresponds to P0.310
Value afte r
Reset
GPIO Output Clear Register (IOCLR - 0xE002800C)
This register is use d to produce a LO W level at port pins if they are configure d as GPIO in an OUTPUT mode. W riting 1 produc es
a LOW level at the corresponding port pins and clears the corresponding bits in the IOSET register. Writing 0 has no effect. If
any pin is configured as an input or a secondary function, writing to IOCLR has no effect.
31:0Output value CLEAR bits. Bit 0 corresponds to P0.0 ... Bit 31 corresponds to P0.310
Value afte r
Reset
GPIO Direction Register (IODIR - 0xE0028008)
This register is used to contro l the di rection o f the pi ns whe n they a re config ured as GPIO port pins. D irection bit for a ny pin must
be set accor ding to the pi n functionality.
Table 56: GPIO Direction Register (IODIR - 0xE0028008)
IODIRDescription
31:0Direction control bits (0 = INPUT, 1 = OUTPUT). Bit 0 controls P0.0 ... Bit 31 controls P0.310
GPIO82October 02, 2003
Value afte r
Reset
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
GPIO USAGE NOTES
If for the specified output pin corresponding bit is set both in GPIO Output Set Register (IOSET) and in GPIO Output Clear
Register (IOCLR), observed pin will output level determined by the later write access of IOSET nad IOCLR. This means that in
case of sequence:
IOSET = 0x0000 0080
IOCLR = 0x0000 0080
pin P0.7 will have low output, since access to Clear register came after access to Set register.
GPIO83October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
GPIO84October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
9. UART 0
FEATURES
• 16 byte Receive and Transmit FIFOs.
• Register locations conform to ‘550 industry standard.
• Receiver FIFO trigger points at 1, 4, 8, and 14 bytes.
*Reset Value refers to the data stored in used bits only. It does not include reserved bits content.
UART 0 contains ten 8-bit registers as shown in Table 58. The Divisor Latch Access Bit (DLAB) is contained in U0LCR7 and
The U0RBR is the top byte of the UART0 Rx FIFO. The top byte of the Rx FIFO contai ns the oldest cha rac ter received and can
be read via the bus interface. The LSB (bit 0) represents the “oldest” received data bit. If the character received is less than 8
bits, the unused MSBs are padded with zeroes.
The Divisor Latch Access Bit (DLAB) in U0LCR must be zero in order to access the U0RBR. The U0RBR is always Read Only.
The U0THR is the top byte of the UART0 Tx FIFO. The top byte is the newest character in the Tx FIFO and can be written via
the bus interface. The LSB represents the first bit to transmit.
The Divisor Latch Access Bit (DLAB) in U0LCR must be zero in order to access the U0THR. The U0THR is always Write Only.
Writing to the UART0 Transmit Holding Register causes the data to be stored in the
UART0 transmit FIFO. The by te will be sent when it rea ches the bo ttom of the FIF O and
the transmitter is available.
The UART0 Divisor Latch is part of the UART0 Baud Rate Generator and hold s the v al ue us ed to d iv ide the VPB c lock (pc lk) in
order to produce the baud ra te cloc k, whi ch must be 1 6x the des ired ba ud rate. The U0DLL an d U0DLM regist ers toge ther form
a 16 bit divisor w here U0DLL contains th e lower 8 bit s of the div isor and U0D LM contai ns the high er 8 bits of the divisor. A ‘h0000
value is treated like a ‘h0001 value as division by zero is not allowed.The Divisor Latch Access Bit (DLAB) in U0LCR must be
one in order to access the UART0 Divisor Latches.
The U0IER is used to enable the four UART0 interrupt sources.
Table 63: UART0 Interrupt Enable Register Bit Descriptions (U0IER - 0xE000C004 when DLAB = 0)
U0IERFunctionDescription
0: Disable the RDA interrupt.
RBR Interrupt
0
1
2
7:3Reserved
Enable
THRE Interrupt
Enable
Rx Line Status
Interrupt Enable
1: Enable the RDA interrupt.
U0IER0 enables the Receive Data Available interrupt for UART0. It also controls the
Character Receive Time-out interrupt.
0: Disable the THRE interrupt.
1: Enable the THRE interrupt.
U0IER1 enables the TH RE i nte rrupt fo r UAR T0. The status of this interrupt can be read
from U0LSR5.
0: Disable the Rx line status interrupts.
1: Enable the Rx line status interrupts.
U0IER2 enables the UART0 Rx line stat us inter rupts. Th e status of this i nterr upt can b e
read from U0LSR[4:1].
Reserved, user software should not write ones to reserved bits. The value read from a
reserved bit is not defined.
The U0IIR provides a status cod e that denotes the priority and so urce of a pending inte rrupt. The int errupts are frozen duri ng an
U0IIR access. If an interrupt occurs during an U0IIR access, the interrupt is recorded for the next U0IIR access.
7:6FIFO EnableThese bits are equivalent to U0FCR0.0
Interrupts are handled as described in Table 65. Given the status of U0IIR[3:0], an interrupt handler routine can determine the
cause of the interrupt an d ho w to cle ar the active interrupt. Interrupts are handl ed as described in Table 65. The U0IIR must be
read in order to clear the interrupt prior to exitting the Interrupt Service Routine.
Interrupt
Pending
Interrupt
Identification
1: No pending interrupts.
Note that U0IIR0 is active low. The pending interrupt can be determined by evaluating
U0IER3:1.
011: 1. Receive Line Status (RLS)
010: 2a.Receive Data Available (RDA)
110: 2b.Character Time-out Indicator (CTI)
001: 3. THRE Interrupt.
U0IER3 identifies an interrupt corresponding to the UART0 Rx FIFO. All other
combinations of U0IER3:1 not listed above are reserved (000,100,101,111).
Reserved, user software should not write ones to reserved bits. The value read from a
reserved bit is not defined.
Reset
Value
1
0
NA
UART 088October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
The UART0 RLS interrupt (U0IIR3:1=011) is the highest priority interrupt and is set whenever any one of four error conditions
occur on the UART0 Rx input: overrun error (OE), parity error (PE), framing error (FE) and break interrupt (BI). The UART0 Rx
error condition that set the interrupt can be observed via U0LSR4:1. The interrupt is cleared upon an U0LSR read.
The UART0 RDA interrupt (U0IIR3:1=010) shares the second level priority with the CTI interrupt (U0IIR3:1=110).The RDA is
activated when the UART0 R x FIFO reach es the trig ger level de fined in U 0FCR7:6 and is rese t when th e UART0 Rx FIFO dept h
falls below the trigger level. When the RDA interrupt goes active, the CPU can read a block of data defined by the trigger level.
The CTI interrupt (U0IIR3:1=110 ) is a second level interru pt and is set when the UAR T0 Rx FIFO c ontains at least one chara cter
and no UART0 Rx FIFO activity ha s occurre d in 3.5 to 4.5 characte r times. Any UART0 Rx F IFO activity (read or w rite of UART 0
RSR) will clear the interrupt. This interrupt is int end ed to flush the UART0 RBR after a m essa ge has be en received that is not a
multiple of the tri gge r lev el si ze . Fo r ex am ple , if a peripheral wished to send a 105 c hara cte r me ss age and the trigger level was
10 characters, the CPU would receive 10 RDA interrupts resulting in the transfer of 100 characters and 1 to 5 CTI interrupts
(depending on the service routine) resulting in the transfer of the remaining 5 characters.
Rx data available or trigger l evel reache d in FIFO (U0FCR0=1 )
Minimum of one character in the Rx FIFO and no character
input or removed durin g a time period depend ing on how many
characters are in FIFO and what th e trigg er le vel is set at (3.5
to 4.5 character times).
The exact time will be:
[(word length) X 7 - 2] X 8 + {(trigger level - number of
characters) X 8 + 1] RCLKs
Interrupt
Source
U0RBR Read or
U0 RBR Read
U0IIR Read (if
Interrupt
Reset
UART0 FIFO
drops below
trigger level
source of
interrupt) or
THR write
The UART0 THRE interrupt (U0IIR3:1=001) is a third level interrupt and is activated when the UART0 THR FIFO is empty
provided certain i nitialization con ditions have bee n met. These init ialization condit ions are intended to give the UART0 THR FIFO
a chance to fill up with data to eliminate many THRE interrupts from occurring at system start-up. The initialization conditions
implement a one character delay minus the stop bit whenever THRE=1 and there have not been at least two characters in the
U0THR at one time since the las t THRE =1 ev ent . This dela y is prov id ed to give the CPU time to write data to U0THR without a
THRE interrupt to decode and service. A THRE interrupt is set immediately if the UART0 THR FIFO has held two or more
characters at one time a nd curre ntly, th e U0THR is empt y. Th e THRE in terrupt i s reset when a U0THR w rite oc curs or a read of
the U0IIR occurs and the THRE is the highest interrupt (U0IIR3:1=001).
UART 089October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
UART0 FIFO Control Register (U0FCR - 0xE000C008)
The U0FCR controls the operation of the UART0 Rx and Tx FIFOs.
Table 66: UART0 FIFO Control Register Bit Descriptions (U0FCR - 0xE000C008)
U0FCRFunctionDescription
Active high enable for both UART0 Rx and Tx FIFOs and U0FCR7:1 access. This bit
0FIFO Enable
1Rx FIFO Reset
2Tx FIFO Reset
5:3Reserved
Rx Trigger Level
7:6
Select
must be set for proper UART0 opearation. Any transition on this bit will automatically
clear the UART0 FIFOs.
Writing a logic 1 to U 0FCR 1 wi ll clear all bytes in UART0 Rx FIFO a nd res et th e p oi nter
logic. This bit is self-clearing.
Writing a logic 1 to U0FCR2 will cle ar al l by tes in UAR T0 Tx FIF O an d res et th e po int er
logic. This bit is self-clearing.
Reserved, user software should not write ones to reserved bits. The value read from a
reserved bit is not defined.
00: trigger level 0 (default=’h1)
01: trigger level 1 (default=’h4)
10: trigger level 2 (default=’h8)
11: trigger level 3 (default=’he)
These two bits determine how many receiver UART0 FIFO characters must be written
before an interrupt is activated. The four trigger levels are defined by the user at
compilation allowing the user to tune the trigger levels to the FIFO depths chosen.
Reset
Value
0
0
0
NA
0
UART 090October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
UART0 Line Control Register (U0LCR - 0xE000C00C)
The U0LCR determines the format of the data character that is to be transmitted or received.
Table 67: UART0 Line Control Register Bit Descriptions (U0LCR - 0xE000C00C)
U0LCRFunctionDescription
00: 5 bit character length
1:0
2Stop Bit Select
3Parity Enable
5:4Parity Select
6Break Control
7
Word Length
Select
Divisor Latch
Access Bit
01: 6 bit character length
10: 7 bit character length
11: 8 bit character length
0: 1 stop bit
1: 2 stop bits (1.5 if U0LCR[1:0]=00)
0: Disable parity generation and checking
1: Enable parity generation and checking
0: Disable break transmission
1: Enable break transmission.
Output pin UART0 TxD is forced to logic 0 when U0LCR6 is active high.
0: Disable access to Divisor Latches
1: Enable access to Divisor Latches
UART0 Line Status Register (U0LSR - 0xE000C014, Read Only)
Reset
Value
0
0
0
0
0
0
The U0LSR is a read-only register that provides status information on the UART0 Tx and Rx blocks.
UART 091October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
Table 68: UART0 Line Status Register Bit Descriptions (U0LSR - 0xE000C014, Read Only)
U0LSRFunctionDescription
0: U0RBR is empty
1: U0RBR contains valid data
U0LSR0 is set when the U0RBR holds an unread character and is cleared when the
UART0 RBR FIFO is empty.
0: Overrun error status is inactive.
1: Overrun error status is active.
The overrun error condition is set as so on as it occur s. An U0L SR read clea rs U0LS R1.
U0LSR1 is set when UART0 R SR has a new c haracter a ssembled and th e UART0 RB R
FIFO is full. In t his cas e, the UART0 RBR FIFO will not be ov erwritten and the cha racter
in the UART0 RSR will be lost.
0: Parity error status is inactive.
1: Parity error status is active.
When the parity bit of a receiv ed character is in the wrong state , a parity error occ urs. An
U0LSR read clears U0LSR2. Time of parity error detection is dependent on U0FCR0.
A parity error is associated with the character being read from the UART0 RBR FIFO.
0: Framing error status is inactive.
1: Framing error status is active.
When the stop bit of a received character is a log ic 0, a framing error oc curs. An U0LSR
read clears U0LSR3. The time of the framing error detection is dependent on U0FCR0.
A framing error is associated with the character being read from the UART0 RBR FIFO.
Upon detection of a framing error, the Rx will attempt to resynchronize to the data and
assume that the bad stop bit is a ctually an ea rly start bit. Ho wever, it ca nnot be assum ed
that the next received byte will be correct even if there is no Framing Error.
0
1
2
3
Receiver
Data Ready
(RDR)
Overrun
Error
(OE)
Parity Error
(PE)
Framing
Error
(FE)
Reset
Value
0
0
0
0
4
5
6
7
Break
Interrupt
(BI)
Transmitter
Holding
Register
Empty
(THRE)
Transmitter
Empty
(TEMT)
Error in Rx
FIFO
(RXFE)
0: Break interrupt status is inactive.
1: Break interrupt status is active.
When RxD0 is he ld in the spaci ng state (all 0 ’s) for one full character transmi ssion (sta rt,
data, parity, stop), a break interrupt occ urs. Once the brea k condition has be en detected,
the receiver goes idle until RxD0 goes to marking state (all 1’s). An U0LSR read clears
this status bit. The time of break detection is dependent on U0FCR0.
The break interrupt is associated with the character being read from the UART0 RBR
FIFO.
0: U0THR contains valid data.
1: U0THR is empty.
THRE is set immediately upon detection of an empty UART0 THR and is cleared on a
U0THR write.
0: U0THR and/or the U0TSR contains valid data.
1: U0THR and the U0TSR are empty.
TEMT is set when both U0TH R and U 0TSR are e mpty; TEM T is cl eared when either t he
U0TSR or the U0THR contain valid data.
0: U0RBR contains no UART0 Rx errors or U0FCR0=0.
1: UART0 RBR contains at least one UART0 Rx error.
U0LSR7 is set when a character with a Rx error such as framing error, parity error or
break interrupt, is l oaded in to the U 0RBR. Th is bit i s cleare d when th e U0LSR register is
read and there are no subsequent errors in the UART0 FIFO.
0
1
1
0
UART 092October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
UART0 Scratch Pad Register (U0SCR - 0xE000C01C)
The U0SCR has no effect on the UART0 operation. This register can be written and/or read at user’s discretion. There is no
provision in the interrupt interface that would indicate to the host that a read or write of the U0SCR has occurred.
The architecture of the UART0 is shown below in the block diagram.
The VPB interface provides a communications link between the CPU or host and the UART0.
The UART0 receiver block, U0Rx, monitors the serial input line, RxD0, for valid input. The UART0 Rx Shift Register (U0RSR)
accepts valid characters via RxD0. After a valid character is assembled in the U0RSR, it is passed to the UART0 Rx Buffer
Register FIFO to await access by the CPU or host via the generic host interface.
The UART0 transmitter block, U0Tx, accepts data written by the CPU or host and buffers the data in the UA RT0 Tx Holding
Register FIFO (U0TH R). The U ART0 Tx Shift Regi st er (U0T SR) rea ds the data s tored in the U0T HR and asse mbles the da ta t o
transmit via the serial output pin, TxD0.
The UART0 Baud Rate Generato r block, U0 BRG, gener ates the t iming en ables used by the U ART0 Tx b lock. The U0BRG clo ck
input source is the VPB cloc k (pclk). The main cl ock is divided do wn per the divisor s pecified in the U0DL L and U0DLM registers.
This divided down clock is a 16x oversample clock, NBAUDOUT.
The interrupt int erface cont ains reg isters U0IER a nd U 0IIR. The interru pt interf ace rece ives sev eral one clock wi de enabl es from
the U0Tx and U0Rx blocks.
Status information from the U0 Tx a nd U0R x is s tore d in th e U 0LSR. Co ntrol info rma tio n for th e U 0Tx and U0Rx is sto red in the
U0LCR.
UART 094October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
U0INTR
INTERRUPT
U0IER
U0IIR
U0SCR
U0THR
THR
U0BRG
U0DLL
U0DLM
U0RBR
U0FCR
U0LSR
LCRU0LCR
U0Tx
U0Rx
U0TSR
U0RSR
NTXRDY
TxD0
NBAUDOUT
RCLK
NRXRDY
RxD0
PA[2:0]
PSEL
PSTB
PWRITE
PD[7:0]
AR
MR
pclk
DDISVPB
Interface
Figure 15: UART0 Block Diagram
UART 095October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
UART 096October 02, 2003
Philips SemiconductorsPreliminary User Manual
LPC2106/2105/2104ARM-based Microcontroller
10. UART 1
FEATURES
• UART 1 is identical to UART 0, with the addition of a modem interface.
• 16 byte Receive and Transmit FIFOs.
• Register locations conform to ‘550 industry standard.
• Receiver FIFO trigger points at 1, 4, 8, and 14 bytes.
• Built-in baud rate generator.
• Standard modem interface signals included.
PIN DESCRIPTION
Table 70: UART1 Pin Description
Pin NameTypeDescription
RxD1InputSerial Input. Serial receive data.
TxD1OutputSerial Output. Serial transmit data.
Clear To Send. Active low s ignal indicates if the external mode m is ready to acce pt transmitted
CTS1Input
DCD1Input
DSR1Input
DTR1Output
RI1Input
RTS1Output
data via TxD1 from the UART 1. In norma l opera tion of the mo dem in terface (U1MCR 4=0), the
complement value of this signal is stored in U1MSR4. State change information is stored in
U1MSR0 and is a source for a priority level 4 interrupt, if enabled (U1IER3=1).
Data Carrier Detect. Active low signal indicates if the external modem has established a
communication link with the UART1 and data may be exchanged. In normal operation of the
modem interface (U1MCR4=0), the complement value of this signal is stored in U1MSR7. State
change information is stored in U1MSR3 and is a source for a priority level 4 interrupt, if
enabled (U1IER3=1).
Data Set Ready. Active low signal indicates if the external modem is ready to establish a
communications link with the UART1. In normal operation of the modem interface
(U1MCR4=0), the complement value of this signal is stored in U1MSR5. State change
information is stored in U1MSR1 and is a source for a priority level 4 interrupt, if enabled
(U1IER3=1).
Data Terminal Ready. Active low signal indicates that the UART1 is ready to establish
connection with external modem. The complement value of this signal is stored in U1MCR0.
Ring Indicator. Active low signal indicates that a telephone ringing signal has been detected
by the modem. In normal operation of the modem interface (U1MCR4=0), the complement
value of this signa l is stored in U1MSR6. State change in formation i s stored in U1MSR 2 and is
a source for a priority level 4 interrupt, if enabled (U1IER3=1).
Request To Send. Active low signal in dicates that the UART1 would like to transmit data to the
external modem. The complement value of this signal is stored in U1MCR1.
*Reset Value refers to the data stored in used bits only. It does not include reserved bits content.
UART1 contains twel ve 8 -bi t registers as shown in Table 71. The Div is or La tc h Acc es s Bit (D LAB) i s contained in U1LCR7 and
The U1RBR is the top byte of the UART1 Rx FIFO. The top byte of the Rx FIFO contai ns the oldest cha rac ter received and can
be read via the bus interface. The LSB (bit 0) represents the “oldest” received data bit. If the character received is less than 8
bits, the unused MSBs are padded with zeroes.
The Divisor Latch Access Bit (DLAB) in U1LCR must be zero in order to access the U1RBR. The U1RBR is always Read Only.
The U1THR is the top byte of the UART1 Tx FIFO. The top byte is the newest character in the Tx FIFO and can be written via
the bus interface. The LSB represents the first bit to transmit.
The Divisor Latch Access Bit (DLAB) in U1LCR must be zero in order to access the U1THR. The U1THR is always Write Only.
Writing to the UART1 Transmit Holding Register causes the data to be stored in the
UART1 transmit FIFO. The by te will be sen t when it reache s the bottom of the FIFO and
the transmitter is available.
The UART1 Divisor Latch is part of the UART1 Baud Rate Generator and hold s the v al ue us ed to d iv ide the VPB c lock (pc lk) in
order to produce the baud ra te cloc k, whi ch must be 1 6x the des ired ba ud rate. The U1DLL an d U1DLM regist ers toge ther form
a 16 bit divisor w here U1DLL contains th e lower 8 bit s of the div isor and U1D LM contai ns the high er 8 bits of the divisor. A ‘h0000
value is treated like a ‘h0001 value as division by zero is not allowed.The Divisor Latch Access Bit (DLAB) in U1LCR must be
one in order to access the UART1 Divisor Latches.
The U1IER is used to enable the four interrupt sources.
Table 76: UART1 Interrupt Enable Register Bit Descriptions (U1IER - 0xE0010004 when DLAB = 0)
U1IERFunctionDescription
0: Disable the RDA interrupt.
RBR Interrupt
0
THRE Interrupt
1
Rx Line Status
2
Interrupt Enable
Enable
Enable
1: Enable the RDA interrupt.
U1IER0 enables the Receive Data Available interrupt for UART1. It also controls the
Receive Time-out interrupt.
0: Disable the THRE interrupt.
1: Enable the THRE interrupt.
U1IER1 enables the TH RE i nte rrupt fo r UAR T1. The status of this interrupt can be read
from U1LSR5.
0: Disable the Rx line status interrupts.
1: Enable the Rx line status interrupts.
U1IER2 enables the UART1 Rx line stat us inter rupts. Th e status of this i nterr upt can b e
read from U1LSR[4:1].
Reset
Value
0
Reset
Value
0
0
0
Modem Status
3
Interrupt Enable
7:4Reserved
0: Disable the modem interrupt.
1: Enable the modem interrupt.
U1IER3 enables the modem interrupt. The status of this interrupt can be read from
U1MSR[3:0].
Reserved, user software should not write ones to reserved bits. The value read from a
reserved bit is not defined.
0
NA
UART 1100October 02, 2003
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.