LPC2148 User Guide
LPC2148 User Guide
The MCB2140 User's Guide describes the MCB2140 Board and contains detailed operating
instructions for the hardware.
Introduction gives an overview of the MCB2140 Evaluation Board, hardware and software
requirements, where to find information quickly, and where to find Technical Support.
Setup shows the MCB2140 Board components, how to connect, configure, and use the
board, and describes the jumpers.
Theory of Operation explains the components of the MCB2140 board in detail.
Writing Programs describes how to write programs, download to flash, and configure your
project for debugging for the MCB2140 board.
Example Programs lists example programs available on the installation CD. There are stepby-step instructions on building and running programs on the MCB2140 board.
Introduction
The Keil MCB2140 Evaluation Board allows you to generate and test application programs for
the NXP LPC2100 microcontroller family. With this hands-on process, you can determine the
hardware and software requirements for current and future product development.
The MCB2140 Evaluation Board ships with an LPC214x device that is a superset of several
other device variants of the NXP LPC2100 microcontroller series. The MCB2140 Board contains
all hardware components required in a single-chip LPC2100 system.
Kit Contents
Home Introduction Kit Contents
Features
Home Introduction Features
The connectors on the MCB2140 evaluation board provide easy access to many of the on-chip peripherals.
Hardware Requirements
Home Introduction Hardware Requirements
Two unused USB ports to supply power to the board, and to perform
ULINK USB-JTAG downloading and debugging.
Or
An unused RS232 COM port for Flash In-System Programming (ISP) via Serial Interface.
To program the MCB2140 using the Flash Magic utility, you need:
A serial cable, 9-pin male to 9-pin female, no longer than 10ft/3m, wired one-to-one.
Software Requirements
Home Introduction Software Requirements
You must install the following required software to use the MCB2140 Evaluation Board:
Quick Start
Home Introduction Quick Start
Use the following table to locate important information about the MCB2140 board and get started quick.
To
See
Setup
Writing Programs
Schematics
Setup
Home Setup
Setting up the MCB2140 evaluation board is easy. Explanations for the board setup
and its components are presented here. Details about the connecting and configuring procedures
for the MCB2140 board are also presented, with a separate topic for the connector descriptions.
Setup includes using the MCB2140 board with ULINK.
The MCB2140 board requires a USB connection for power and either a serial connection
for In-System Programming, or another USB connection for the ULINK-USB adapter
between your development PC and the JTAG connector.
Before you start, make sure you have satisfied the hardware and software requirements.
Board Setup
Home Setup Board Setup
The MCB2140 Evaluation Board connects directly to the Keil Vision Debugger using the
Keil ULINK USB-JTAG Adapter, so no additional software is required on the board.
The MCB21400 Evaluation Board connects to a PC via a standard USB cable that provides power.
Board Components
Home Setup Board Components
The following illustration shows the important interface and hardware components
of the MCB2140 board.
The following picture shows how to connect ULINK to the MCB2140 board.
Note
If your application program puts the ARM device in idle or power-down mode, the
Embedded ICE in the LPC2000 core (and subsequently the ULINK) stops working.
Therefore, do not put the ARM device into the power saving modes during the
software development cycle.
To connect the MCB2140 Evaluation Board for serial programming, you must:
After setting up the MCB2140 Board, use Flash Magic to verify the COM connection.
1. Start Flash Magic (using Start Programs Flash Magic) and configure
the COM Port interface as illustrated.
2. Verify the COM connection using the menu command ISP Read Device Signature....
3. The Read Device Signature... displays the following window. Then close the Window.
If there are any errors, recheck your PC COM port designation and the jumper settings:
J1 & J10 ON
J8 & J9 OFF
State
Description
J1 - ISP
OFF
J2 - AV
ON
J3 - 3.3V
ON
J4 - VBAT
ON
J5 - V3A
ON
J6 - LED
ON
J7 - INT1
ON
J8 - ETM
OFF
J9 - JTAG
ON
J10 - RST
ON
J11 - VREF
ON
ON
J13 - AOUT
ON
ON
ON
Jumper J9 - OFF
Jumper Descriptions
Home Setup Jumper Descriptions
J1 - ISP: Enable for In-System Programming: lets the RTS line of the COM0 port
generate a signal on P0.14 (EINT1). When RTS is active P0.14 is driven low.
This is used to enter In-System Programming (ISP) mode.
J2 - AV: Analog Voltage for AIN0: connects the POT1 potentiometer to the analog
input AIN0.
J3 - 3.3V: Supply Voltage for CPU: connects the 3.3V Supply Voltage to the CPU.
J4 - VBAT: Supply Voltage for CPU: connects battery Supply Voltage to the CPU.
J5 - V3A: Analog Reference Voltage for CPU: connects the 3.3V Supply Voltage
to the CPU Analog Reference Input V3A.
J6 - LED: Enable LED Driver: enables the LED driver connecting the on-board LEDs
to GPIO Port1.16 - Port1.23.
J7 - INT1: Enable Push Button INT1: connects the push button INT1 to the CPU
I/O pin P0.14 (EINT1 input). Pushing the button generates a low signal.
J8 - ETM: Enable Embedded Trace Module: enables the Embedded Trace Module
(ETM). Port1.16 - Port1.23 LEDs cannot be used when J8 is set because these pins
share the same ETM signals.
J9 - JTAG: Enable JTAG Interface: enables the JTAG interface. This is required for
ISP flashing and for debugging via Keil ULINK or other JTAG debuggers.
J10 - RST: Enable Reset via COM0 Port: When RST is set, you may generate a CPU
RESET signal using the DTR signal of the COM0 port. An active DTR signal generates
a CPU RESET.
J11 - VREF: A/D Converter Reference Voltage: connects 3.3V Supply Voltage VREF
of the CPU.
J12 - D-: USB Line: connect the USB Line D- to the USB connector.
J13 - AOUT: D/A Output for loudspeaker: connects the AOUT output to the LF
amplifier.
J14 - D+: USB Line: connect the USB Line D+ to the USB connector.
J15 - VR: Vbus signal:connects 5V supply from the USB connector to the Vbus
pin (P0.23), indicating the presence of USB BUS power to the device.
Theory of Operation
Home Theory of Operation
The Theory of Operation explains the MCB2140 board hardware. The descriptions
help you to understand the MCB2140 board components and how to use the available
I/O interfaces.
The MCB2140 is designed to be a very flexible evaluation board for the NXP LPC2100
family of microprocessors. The MCB2140 evaluation board can be expanded to build
hardware prototypes.
Block Diagram
Home Theory of Operation Block Diagram
The hardware block diagram displays input, configuration, power system, and User
I/O on the board. This visual presentation helps you to understand the MCB2140
board components.
Technical Data
Home Theory of Operation Technical Data
Parameter
Description
Supply Voltage
Supply Current
XTAL Frequency
Microcontroller
NXP LPC214x
Peripherals
2 RS232 Interfaces,
1 JTAG Interface,
1 Analog Output (connected to
speaker by default)
1 Analog Input (connected to
potentiometer by default)
1 ETM Interface (optional)
Board Size
Prototyping Area
Home Theory of Operation Prototyping Area
The prototyping area provides blocks for connecting the address and data line, ports P0 and P1, +3.3V DC(Vcc),
and ground (GND).
Note
All microcontroller signals are brought out to pins and are driven directly
by the microcontroller. Exercise caution to avoid overloading these
signal lines.
Microcontroller
Home Theory of Operation Microcontroller
The NXP LPC214x microcontroller (IC1) provided with the MCB2140 board is a high-end LPC214x device
with advanced ADC, DAC and USB capabilities.
A 12.0 MHz crystal (Q1) provides the clock signal for the CPU.
Power Supply
Home Theory of Operation Power Supply
Power is supplied to the MCB2140 board on your PC using a standard USB connector.
The voltage regulator (IC3) generates 3.3 Volts DC. The Power LED indicates when power is applied to the board.
Caution: Do not attach additional power supplies (such as batteries) while the USB supplies power to the MCB2140.
This may harm your P
Configuration
Home Theory of Operation Configuration
The MCB2140 evaluation board is very flexible and configures easily to suit your needs. Configuration jumpers control
the built-in features such as debug interfaces and Analog Input Voltages.
Refer to Configuring the MCB2140 and Jumper Descriptions for a description of the possible settings.
After changing configuration jumpers, you must reset the MCB2140 board.
Note
The LPC21xx device provides many configuration options. Some of these settings are available via configuration
resistors which are illustrated in the schematics topic.
JTAG Interface
Home Theory of Operation JTAG Interface
The JTAG Interface connector provides debugging and emulator support for the NXP LPC21xx device.
The JTAG Interface allows application debugging and programming of on-chip and off-chip Flash devices.
The standard JTAG 20-pin connector works with the Keil ULINK and many third party tool vendors.
LEDs
Home Theory of Operation LEDs
Push Buttons
Home Theory of Operation Push Buttons
The RESET push button connects to the reset circuit. This resets the microcontroller.
The INT1 push button connects to the external interrupt 1 (EINT1) of the microcontroller.
Removing Jumper J7 disables this button.
Potentiometer
Home Theory of Operation Potentiometer
The potentiometer on the MCB2140 board connects to Port 0.28 (AIN2) when the Jumper J2 is enabled.
The voltage range is 0.0-3.3 Volts.
Speaker
Home Theory of Operation Speaker
The MCB2140 board includes a speaker controlled by the output of the on-chip D/A converter.
The LM386M low voltage power amplifier (IC4) amplifies the D/A output to drive the speaker.
Jumper J13 connects the D/A output (Port 0, pin 25, P0.25/AOUT) to the input of the LM386M amplifier.
Removing this jumper disables the speaker.
Serial Ports
Home Theory of Operation Serial Ports
The MCB2140 board connects the ASC0 on-chip serial UART to the MAX563 (IC2), which converts the logic
signals to RS-232 voltage levels. The ASC0 UART may be used in bootstrap mode to download other utilities
for debugging or downloading flash.
In addition to the standard 3-wire interface, the COM0 DB9 connector is wired to allow a board RESET via
the DTR pin, and to enable In-System Programming (ISP) via the RTS pin as shown in the figure below.
Note
The Flash Magic Utility uses the DTR and RTS pins to control Flash downloading. You must install jumpers
J1 and J10 to program Flash with this utility.
The COM1 DB9 connector uses the standard 3-wire interface and does not connect the DTR or RTS pins
to any board component as shown in the figure below.
SD Connector
Home Theory of Operation SD Connector
The MCB2140 board supports one SD memory card connector that allows you to connect a wide range
of memory cards.
Writing Programs
Home Writing Programs
The Writing Programs topics introduce you to the Keil development tools, and show you, step-by-step,
the process of using them with the MCB2140 board. You will learn how to use Vision to create, compile,
download, debug, and run a program on the MCB2140 board.
Writing programs for the MCB2140 board is easy.
1. Create the Application Program using the Vision IDE and the RealView C/C++ Compiler.
2. Download the program to the on-chip Flash of the MCB2140 Board.
3. Debug the program using the Vision Debugger and ULINK.
Note
Use the Keil MDK-ARM Lite Edition if no other version is installed on the computer.
To use the MCB2140 Board download the Lite Edition of the Keil Microcontroller Development Kit (MDK-ARM).
The MDK-ARM Lite Edition includes:
The required steps for creating application programs are outlined here.
Vision includes a Project Manager that makes it easy for you to design applications quickly. The topics below
show you how to create a project, set the target options, configure the output files, compiler and linker options,
and build an application program that is ready to download to the MCB2140 board.
1. Creating a Project
2. Setting Target Options
3. Configuring Output Files
4. Configuring Compiler Options
5. Configuring Linker Options
6. Building a Program
Creating a Project
Home Writing Programs Creating Application Programs Creating a Project
Follow the steps below to create a new project file and to specify and organize your source (and debug) files that
are a part of this project.
1. Create a New Project File with the Vision menu command Project New Project.
Select a microcontroller from the Device Database. Use the MCB2140 Board to develop code for many of the
LPC214x's family of devices.
2. Add Startup Code.
The Startup file provides pre-configured startup code for the MCB2140 board. The Startup file you use varies
depending on the toolset you select.
3. Add a Linker Control Script to control the link process for the GNU tools. The scripts are located in the same
folder, root\ARM\GNU\BOARDS\KEIL\MCB2140\BLINKY. Two pre-configured linker control script files
are available:
Flash.ld configures the linker for program code in Flash ROM (typical configuration).
RAM.ld configures the linker for program code in RAM (used for more extensive debugging).
Copy the linker control script file of your choice to your project folder. This file is required to set up the
Linker controls.
4. Add your own Source Code to the project using the Vision editor (or any editor of your choice)
by either:Right-clicking a group in the Project Window, and selecting Add Files to Group
from the context menu,Or Use the Components, Environment and Books toolbar button
(or select Project Components, Environment and Books Project Components) to
display the dialog below.Within this dialog you may create and organize files into groups or create
new project targets with different tool configurations.
Use the Options for Target toolbar button to display the Target dialog.
Type in the XTAL (MHz) of 12.0 for the MCB2140 board's oscillator frequency.
Configure the Output Files in the Project Options for Target Output dialog. The steps for configuring
these files are:
1. Select Folder for Objects... allows you to specify sub-folders for the output files.
By default, objects are stored in the same folder as the project file.
2. Enable Debug Information to store symbolic debug information within the executable file for source
level program testing with the Vision debugger.
3. Enable Create HEX File to generate an Intel HEX file for Flash programming with the NXP LPC2000 Flash Utility
Configure the C Compiler Options in the Project Options for Target C dialog. The steps for configuring
these options are:
1. Enable Compile Thumb Code directs the compiler to generate ARM Thumb instruction set code for this project.
2. Enable Support Calls between ARM and Thumb Instruction Set allows you to intermix Thumb and native
ARM code within the same project.
3. Enable APCS (ARM Procedure Call Standard) creates an application with standard parameter passing
conventions.
For more options information, refer to the Vision User's Guide Options Settings chapter.
Configure the Linker Options in the Project Options for Target Linker dialog. The steps for configuring
these options are:
1. Text Start: 0x00000000 is the starting location in on-chip Flash ROM for code and constants in your program.
2. Data Start: 0x40000000 is the starting location in on-chip RAM for variables in your program.
3. Linker Script File: .\flash.ld specifies the linker script file you selected in Create A Project. Clicking the
Edit button allows you to configure the linker options contained in that file.
For detailed information about linker options, refer to the Vision IDE User's Guide, Vision Dialog Pages, Project,
Options, Linker.
Building a Program
Home Writing Programs Creating Application Programs Building a Program
When the building a program function starts, you may watch the progress in Vision's Command window.
The created executable files are placed in an output folder, ready for downloading. The steps and progress are:
1. Start the build
Click on the Build toolbar button to generate your application program. Vision translates all your
source files and links the project.
2. Monitor progress
The build activity progress (assembling, compiling and linking) displays in Vision's Command window.
Any errors or warnings detected during the build process also display in this window.
3. Program Files
The build creates an Executable File in ELF Format in the Output folder you designated earlier.
The ULINK USB-JTAG adapter requires this file for downloading to the MCB2140 board using the JTAG
or other emulators.
The build creates an Intel HEX executable file. The LPC2000 FLASH ISP Utility requires this file for
downloading through the serial port.
The program is now built and ready for test.
Programming Flash
Home Writing Programs Programming Flash
You may use either of the following tools to download programs to the Flash memory of the MCB2140
evaluation board:
The ULINK USB-JTAG Adapter connects the USB port of your PC to the JTAG port of the MCB2140.
It supports programming Flash, emulation, and debug capabilities.
The Flash Magic Utility connects the COM port of your PC to the serial port of the MCB2140. It may be used
only for programming Flash via the ISP Flash Interface.
The ULINK USB-JTAG Adapter allows you to debug and test programs and to program Flash memory on the
MCB2140 Evaluation Board. To setup ULINK for Programming Flash within the Vision IDE, you must:
1. Connect the ULINK to the JTAG connector of the MCB2140 Board.
Note that the red cable marks pin 1 of the JTAG-connector.
Make sure that the jumper J9 (JTAG) is ON.
Note
The Embedded ICE in the LPC2000 core is disabled when the device is in Power Down or Idle mode.
ULINK stops working if your code puts the ARM device into Idle or Power Down mode. Therefore,
do not enable either of the power saving modes of the LPC2148 during the software development
cycle in your application program.
Check the Update Target before Debugging option to ensure that the Flash ROM gets programmed
whenever the debugger starts.
Click the Settings button to open the Flash Download Setup dialog.
4. Configure the Flash Download Setup dialog.
In the RAM for Algorithm section, set the Start: parameter to 0x40000000 and the Size: parameter
to0x0800
5. Click the Add button and select the LPC2000 256kB Flash algorithm.
Use the Download to Flash toolbar button to download the application program into the LPC2100
device.
The ULINK-JTAG adapter can also be used for downloading and debugging application code in Flash
ROM or in RAM of the LPC2100 microcontroller.
The Flash Magic utility connects the PC's COM port to the serial port of the MCB2140 and provides
In-System Flash Programming (ISP) support for Intel HEX files. The installation program for this utility may be
downloaded from the Flash Magic Web Site.
Flash Magic may be run as a stand-alone utility or as an external tool from within Vision IDE.
To configure the MCB2140 Evaluation Board for Flash programming see Configuring the MCB2140.
Stand Alone
Home Writing Programs Programming Flash Downloading with Flash Magic Stand Alone
Downloading with the Flash Magic utility requires the following steps to download code to the LPC2148's
on-chip Flash ROM.
To configure the MCB2140 Evaluation Board for Flash programming, select and start
Programs Flash Magic Flash Magic.
1. Select COM 1 for the COM Port, specify 9600 as the Baud Rate, and select either the LPC2148
as the Device depending on the board you have.
2. Enable Erase blocks used by Hex File.
3. Select the Hex File, for example: root\ARM\BOARDS\KEIL\MCB2130\BLINKY\BLINKY.HEX.
4. In the Options Advanced Options dialog, select theHardware Config tab, then check the Use DTR
and RTS to control RST and P0.14 check box.
5. Click Start to download the Hex File into the Flash ROM of the LPC2148.
J1 & J10 ON
J8 & J9 OFF
Within Vision
Home Writing Programs Programming Flash Downloading with Flash Magic Within Vision
You can configure the Vision Flash Download Command to program the MCB2140 using the Flash Magic
utility from within Vision. The steps to setup the MCB2140 for programming Flash are:
1. Configure Flash Programming.
Use the toolbar button and click the Utilities tab to display the Utilities dialog, or
Select the Project Options for Target Utilities dialog.
Note
Make sure the program path in the Command text box corresponds to where you installed the
download utility.
Click the Download to Flash button or use the Vision command Flash Download to
download the application program into the MCB2140 device.
4. Vision uses Flash Magic in batch mode for Flash programming. Monitor the progress in the
Output Window that displays the messages Flash Magic generates.
Debugging Programs
Home Writing Programs Debugging Programs
Vision IDE offers a very powerful and comprehensive set of debugging tools designed to make program
testing easier and reduce the time it takes to produce a working application.
Using the Vision debugger and the embedded ICE capability of the MCB2140, you may set breakpoints
and step through your code, and also view the status of on-chip peripherals using the Peripheral dialogs
custom-designed for the LPC2148 device.
The required steps for configuring the debugger on the MCB2140
board are described in the topic Debugging with ULINK.
Detailed information can be found in the Vision User's Guide in the Debugging topic and in the Getting
Started User's Guide (..\Keil\ARM\HLP\GSA.CHM) in the chapter Testing Programs.
Follow these steps to program debugging using the Vision Debugger and the ULINK USB_JTAG Adapter.
1. Connect the ULINK to the JTAG connector of the MCB2140 Board. Note that the red cable marks pin 1
of the JTAG-connector.
Make sure that the jumper J9 (JTAG) is ON.
Note
The Embedded ICE in the LPC2000 core is disabled when the device is in Power Down or Idle mode.
ULINK stops working if your code puts the ARM device into Idle or Power Down mode. Therefore,
do not enable either of the power saving modes of the LPC214x during the software development
cycle in your application program.
Use the Options for Target toolbar button and click the Debug tab to display the Debug dialog.
Select the Use: radio button and then ULINK ARM Debugger in the drop-down list to choose the
ULINK USB-JTAG Adapter as the debugging tool.
Check the Load Application at Startup and the Run to main() options to load your application
and execute code up to the beginning of your main() function when the debugger starts.
Click the Settings button to open the ARM Target Driver Setup dialog.
This dialog displays the IDCODE of the ARM device on the MCB2140 Board.
Select the Verify Code Download option under Download Optionsto compare the loaded
application program with the Flash ROM content. You may disable this option to speed up
the debugger start.
4. Start the Debugger
Use the Start/Stop Debug Session toolbar button to start debugging the program.
Or
Use the Vision command, Debug - Start/Stop Debug
Session, to start debugging the program.