LPC2148
LPC2148
General description
The LPC2141/42/44/46/48 microcontrollers are based on a 16-bit/32-bit ARM7TDMI-S CPU with real-
time emulation and embedded trace support, that combine microcontroller with embedded high speed
flash memory ranging from 32 kB to 512 kB. A 128-bit wide memory interface and a unique accelerator
architecture enable 32-bit code execution at the maximum clock rate. For critical code size applications,
the alternative 16-bit Thumb mode reduces code by more than 30 % with minimal performance penalty.
Due to their tiny size and low power consumption, LPC2141/42/44/46/48 are ideal for applications
where miniaturization is a key requirement, such as access control and point-of-sale. Serial
communications interfaces ranging from a USB 2.0 Full-speed device, multiple UARTs, SPI, SSP to
I2C-bus and on-chip SRAM of 8 kB up to 40 kB, make these devices very well suited for
communication gateways and protocol converters, soft modems, voice recognition and low end imaging,
providing both large buffer size and high processing power. Various 32-bit timers, single or dual 10-bit
ADC(s), 10-bit DAC, PWM channels and 45 fast GPIO lines with up to nine edge or level sensitive
external interrupt pins make these microcontrollers suitable for industrial control and medical systems.
Features
16-bit/32-bit ARM7TDMI-S microcontroller in a tiny LQFP64 package.
8 kB to 40 kB of on-chip static RAM and 32 kB to 512 kB of on-chip flash memory. 128-
bit wide interface/accelerator enables high-speed 60 MHz operation.
In-System Programming/In-Application Programming (ISP/IAP) via on-chip boot loader
software. Single flash sector or full chip erase in 400 ms and programming of 256 bytes in 1 ms.
EmbeddedICE RT and Embedded Trace interfaces offer real-time debugging with the on-
chip RealMonitor software and high-speed tracing of instruction execution.
USB 2.0 Full-speed compliant device controller with 2 kB of endpoint RAM. In addition,
the LPC2146/48 provides 8 kB of on-chip RAM accessible to USB by DMA.
One or two (LPC2141/42 vs. LPC2144/46/48) 10-bit ADCs provide a total of 6/14 analog
inputs, with conversion times as low as 2.44 μs per channel.
Single 10-bit DAC provides variable analog output (LPC2142/44/46/48 only).
Two 32-bit timers/external event counters (with four capture and four compare channels
each), PWM unit (six outputs) and watchdog.
Low power Real-Time Clock (RTC) with independent power and 32 kHz clock input.
Block diagram
Pinning information
Pin description
[1] 5 V tolerant pad providing digital I/O functions with TTL levels and hysteresis and 10 ns slew rate
control.
[2] 5 V tolerant pad providing digital I/O functions with TTL levels and hysteresis and 10 ns slew rate
control. If configured for an input function, this pad utilizes built-in glitch filter that blocks pulses
shorter than 3 ns.
[3] Open-drain 5 V tolerant digital I/O I2C-bus 400 kHz specification compatible pad. It requires
external pull-up to provide an output functionality.
[4] 5 V tolerant pad providing digital I/O (with TTL levels and hysteresis and 10 ns slew rate control)
and analog input function. If configured for an input function, this pad utilizes built-in glitch filter that
blocks pulses shorter than 3 ns. When configured as an ADC input, digital section of the pad is disabled.
[5] 5 V tolerant pad providing digital I/O (with TTL levels and hysteresis and 10 ns slew rate control)
and analog output function. When configured as the DAC output, digital section of the pad is disabled.
[6] 5 V tolerant pad with built-in pull-up resistor providing digital I/O functions with TTL levels and
hysteresis and 10 ns slew rate control. The pull-up resistor’s value typically ranges from 60 kΩ to 300
kΩ.
[7] Pad is designed in accordance with the Universal Serial Bus (USB) specification, revision 2.0 (Full-
speed and Low-speed mode only).
[8] 5 V tolerant pad providing digital input (with TTL levels and hysteresis) function only.
[9] Pad provides special analog functionality.
1. Functional description
Architectural overview
The ARM7TDMI-S is a general purpose 32-bit microprocessor, which offers high performance and very
low power 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 (CISC). 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 employed so that all parts of the processing and memory systems
can operate continuously. 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
The LPC2141/42/44/46/48 flash memory provides a minimum of 100,000 erase/write cycles and 20
years of data-retention.
4. Memory map
The LPC2141/42/44/46/48 memory map incorporates several distinct regions, as shown in Figure 5. In
addition, the CPU interrupt vectors may be remapped to allow them to reside in either flash memory (the
default) or on-chip static RAM. This is described in “System control”.
5. Interrupt controller
The Vectored Interrupt Controller (VIC) accepts all of the interrupt request inputs and categorizes them
as Fast Interrupt Request (FIQ), vectored Interrupt Request (IRQ), and non-vectored IRQ as defined by
programmable settings. The programmable assignment scheme means that priorities of interrupts from
the various peripherals can be dynamically assigned and adjusted. Fast interrupt request (FIQ) has the
highest priority. If more than one request is assigned to FIQ, the VIC combines 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, because then the FIQ service routine does not need to branch into the
interrupt service routine but can run from the interrupt vector location. If more than one request is
assigned to the FIQ class, the FIQ service routine will read a word from the VIC that identifies which
FIQ source(s) is (are) requesting an interrupt. Vectored IRQs have the middle priority. Sixteen of the
interrupt requests can be assigned to this category. Any of the interrupt requests can 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 combines 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 pending, the VIC
provides the address of the highest-priority requesting IRQs service routine, otherwise it provides the
address of a default routine that is shared by all the non-vectored IRQs. The default routine can read
another VIC register to see what IRQs are active.
Interrupt sources
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.
Features
• Bit-level set and clear registers allow a single instruction set or clear of any number of bits in one port.
• Direction control of individual bits.
• Separate control of output set and clear.
• All I/O default to inputs after reset.
8. 10-bit ADC
The LPC2141/42 contain one and the LPC2144/46/48 contain two analog to digital converters. These
converters are single 10-bit successive approximation analog to digital converters. While ADC0 has six
channels, ADC1 has eight channels. Therefore, total number of available ADC inputs for LPC2141/42 is
6 and for LPC2144/46/48 is 14.
Features
• 10 bit successive approximation analog to digital converter.
• Measurement range of 0 V to VREF (2.0 V ≤ VREF ≤ VDDA).
• Each converter capable of performing more than 400,000 10-bit samples per second.
• Every analog input has a dedicated result register to reduce interrupt overhead.
• Burst conversion mode for single or multiple inputs.
• Optional conversion on transition on input pin or timer match signal.
• Global Start command for both converters (LPC2142/44/46/48 only).
9. 10-bit DAC
The DAC enables the LPC2141/42/44/46/48 to generate a variable analog output. The
maximum DAC output voltage is the VREF voltage.
9.1 Features
• 10-bit DAC.
• Buffered output.
• Power-down mode available.
• Selectable speed versus power.
10.1 Features
• Fully compliant with USB 2.0 Full-speed specification.
• Supports 32 physical (16 logical) endpoints.
• Supports control, bulk, interrupt and isochronous endpoints.
• Scalable realization of endpoints at run time.
• Endpoint maximum packet size selection (up to USB maximum specification) by software at run time.
• RAM message buffer size based on endpoint realization and maximum packet size.
• Supports SoftConnect and GoodLink LED indicator. These two functions are sharing one pin.
• Supports bus-powered capability with low suspend current.
• Supports DMA transfer on all non-control endpoints (LPC2146/48 only).
• One duplex DMA channel serves all endpoints (LPC2146/48 only).
• Allows dynamic switching between CPU controlled and DMA modes (only in LPC2146/48).
• Double buffer implementation for bulk and isochronous endpoints.
11. UARTs
The LPC2141/42/44/46/48 each contains two UARTs. In addition to standard transmit and receive
data lines, the LPC2144/46/48 UART1 also provide a full modem control handshake interface.
Compared to previous LPC2000 microcontrollers, UARTs in LPC2141/42/44/46/48 introduce a
fractional baud rate generator for both UARTs, enabling these microcontrollers to achieve standard
baudrates such as 115200 with any crystal frequency above 2 MHz. In addition, auto-CTS/RTS flow-
control functions are fully implemented in hardware (UART1 in LPC2144/46/48 only).
11.1 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
• Built-in fractional baud rate generator covering wide range of baud rates without a need for external
crystals of particular values.
• Transmission FIFO control enables implementation of software (XON/XOFF) flow control on both
UARTs.
• LPC2144/46/48 UART1 equipped with standard modem interface signals. This module also provides
full support for hardware flow control (auto-CTS/RTS).
12.1 Features
• Compliant with standard I2C-bus interface.
• Easy to configure as master, slave, or master/slave.
• Programmable clocks allow versatile rate control.
• Bidirectional data transfer between masters and slaves.
• Multi-master bus (no central master).
• Arbitration between simultaneously transmitting masters without corruption of serial data on the bus.
• Serial clock synchronization allows devices with different bit rates to communicate via one serial bus.
• Serial clock synchronization can be used as a handshake mechanism to suspend and resume serial
transfer.
• The I2C-bus can be used for test and diagnostic purposes.
13.1 Features
• Compliant with Serial Peripheral Interface (SPI) specification.
• Synchronous, Serial, Full Duplex, Communication.
• Combined SPI master and slave.
• Maximum data bit rate of one eighth of the input clock rate.
14.1 Features
• Compatible with Motorola’s SPI, TI’s 4-wire SSI and National Semiconductor’s Microwire buses.
• Synchronous serial communication.
• Master or slave operation.
• 8-frame FIFOs for both transmit and receive.
• Four bits to 16 bits per frame.
15.1 Features
• A 32-bit timer/counter with a programmable 32-bit prescaler.
• External event counter or timer operation.
• Four 32-bit capture channels per timer/counter that can take a snapshot of the timer value when an
input signal transitions. A capture event may also optionally generate an interrupt.
• Four 32-bit match registers that allow:
• Four external outputs per timer/counter corresponding to match registers, with the following
capabilities:
– Set LOW on match.
– Set HIGH on match.
– Toggle on match.
– Do nothing on match.
16. Watchdog timer
The purpose of the watchdog is to reset the microcontroller within a reasonable amount of time if it
enters an erroneous state. When enabled, the watchdog will generate a system reset if the user program
fails to ‘feed’ (or reload) the watchdog within a predetermined amount of time.
16.1 Features
• Internally resets chip if not periodically reloaded.
• Debug mode.
• Enabled by software but requires a hardware reset or a watchdog reset/interrupt to be disabled.
• Incorrect/Incomplete feed sequence causes reset/interrupt if enabled.
• Flag to indicate watchdog reset.
• Programmable 32-bit timer with internal pre-scaler.
• Selectable time period from (TPCLK × 256 × 4) to (TPCLK × 232 × 4) in multiples of TPCLK × 4.
17.1 Features
• Measures the passage of time to maintain a calendar and clock.
• Ultra-low power design to support battery powered systems.
• Provides Seconds, Minutes, Hours, Day of Month, Month, Year, Day of Week, and Day of Year.
• Can use either the RTC dedicated 32 kHz oscillator input or clock derived from the external
crystal/oscillator input at XTAL1. Programmable reference clock divider allows fine adjustment of the
RTC.
• Dedicated power supply pin can be connected to a battery or the main 3.3 V.
One match register (MR0) controls the PWM cycle rate, by resetting the count upon match. The other
match register controls the PWM edge position. Additional single edge controlled PWM outputs require
only one match register each, since the repetition rate is the same for all PWM outputs. Multiple single
edge controlled PWM outputs will all have a rising edge at the beginning of each PWM cycle, when an
MR0 match occurs. Three match registers can be used to provide a PWM output with both edges
controlled. Again, the MR0 match register controls the PWM cycle rate. The other match registers
control the two PWM edge positions. Additional double edge controlled PWM outputs require only two
match registers each, since the repetition rate is the same for all PWM outputs. With double edge
controlled PWM outputs, specific match registers control the rising and falling edge of the output. This
allows both positive going PWM pulses (when the rising edge occurs prior to the falling edge), and
negative going PWM pulses (when the falling edge occurs prior to the rising edge).
18.1 Features
• Seven match registers allow up to six single edge controlled or three double edge controlled PWM
outputs, or a mix of both types.
• The match registers also allow:
– Continuous operation with optional interrupt generation on match.
– Stop timer on match with optional interrupt generation.
– Reset timer on match with optional interrupt generation.
• Supports single edge controlled and/or double edge controlled PWM outputs. Single edge controlled
PWM outputs all go HIGH at the beginning of each cycle unless the output is a constant LOW. Double
edge controlled PWM outputs can have either edge occur at any position within a cycle. This allows for
both positive going and negative going pulses.
• Pulse period and width can be any number of timer counts. This allows complete flexibility in the
trade-off between resolution and repetition rate. All PWM outputs will occur at the same repetition rate.
• Double edge controlled PWM outputs can be programmed to be either positive going or negative going
pulses.
• Match register updates are synchronized with pulse outputs to prevent generation of erroneous pulses.
Software must ‘release’ new match values before they can become effective.
• May be used as a standard timer if the PWM mode is not enabled.
• A 32-bit Timer/Counter with a programmable 32-bit Prescaler.
19.2 PLL
The PLL accepts an input clock frequency in the range of 10 MHz to 25 MHz. The input frequency is
multiplied up into the range 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 value cannot be higher than 6
on this family of microcontrollers due to the upper frequency limit of the CPU). The CCO operates in
the range of 156 MHz to 320 MHz, so there is an additional divider in the loop to keep the CCO within
its frequency range while the PLL is providing the desired output frequency. The output divider may be
set to divide by 2, 4, 8, or 16 to produce the output clock. Since the minimum output divider value is 2,
it is insured that the PLL output has a 50 % duty cycle. The PLL is turned off and bypassed following a
chip reset and may be enabled by software. The program must configure and activate the PLL, wait for
the PLL to Lock, then connect to the PLL as a clock source. The PLL settling time is 100 μs.
The Wake-up Timer ensures that the oscillator and other analog functions required for chip operation are
fully functional before the processor is allowed to execute instructions. This is important at power on, all
types of reset, 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 wake-up of the processor
from Power-down mode makes use of the Wake-up Timer.
The Wake-up 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 some event caused the chip to exit Power-down
mode, some time is required for the oscillator to produce a signal of sufficient amplitude to drive the
clock logic. The amount of time depends on many factors, including the rate of VDD ramp (in the case
of power on), the type of crystal and its electrical characteristics (if a quartz crystal is used), as well as
any other external circuitry (e.g. capacitors), and the characteristics of the oscillator itself under the
existing ambient conditions.
20.1 EmbeddedICE
Standard ARM EmbeddedICE logic provides on-chip debug support. The debugging of the target
system requires a host computer running the debugger software and an EmbeddedICE protocol
convertor. EmbeddedICE protocol convertor converts the remote debug protocol commands to the
JTAG data needed to access the ARM core. The ARM core has a Debug Communication Channel
(DCC) function built-in. The DCC allows a program running on the target to communicate with the host
debugger or another separate host without stopping the program flow or even entering the debug state.
The DCC is accessed as a co-processor 14 by the program running on the ARM7TDMI-S core. The
DCC allows the JTAG port to be used for sending and receiving data without affecting the normal
program flow. The DCC data and control registers are mapped in to addresses in the EmbeddedICE
logic.
20.3 RealMonitor
RealMonitor is a configurable software module, developed by ARM Inc., which enables real-time
debug. It is a lightweight debug monitor that runs in the background while users debug their foreground
application. It communicates with the host using the DCC, which is present in the EmbeddedICE logic.
The LPC2141/42/44/46/48 contain a specific configuration of RealMonitor software programmed into
the on-chip flash memory.