Ecee LPC 2138 - User Manual
Ecee LPC 2138 - User Manual
Ecee LPC 2138 - User Manual
com
CONTENTS
CHAPTER-1: OVERVIEW
Creating a Project
Creating Project File
Select Microcontroller from Device Database
Automatic mode
Manual mode
JTAG Programming/Debugging
CHAPTER-1: OVERVIEW
The eCee LPC2138 Development and Evaluation Board from RhydoLabz can be used to
evaluate and demonstrate the capabilities of NXP LPC2138 microcontrollers. The board (with a base
board and header board) is designed for general purpose applications and includes a variety of
hardware to exercise microcontroller peripherals. The LPC2138 Board contains all hardware
components that are required in a single-chip LPC2138 system plus 2 COM ports for serial RS232
output and interfaces like Lcd, Buzzer, Keyboard, Temperature Sensor, Potentiometer, Led’s,
EEPROM etc .
FEATURES
FUNCTION MODULE
INTERFACE OVERVIEW
LCD CONTRAST
SERIAL PORT
INTERFACE (COM1) LCD DISPLAY
MAX3232
USB POWER
INTERFACE
DC ADAPTER
PLUG IN
5V REGULATOR IC
EXTERNAL EEPROM
ADC VARIABLE POT
TEMPERATURE
SENSOR- LM35
BUZZER
EXTERNAL
INTERRUPT
RESET SWITCH
PERIPHERALS DESCRIPTION
CON1 USB Jack
CON2 Power Jack
JTAG (JP1) JTAG Connector
COM0 UART0 Interface via Female DB9 Connector
COM1 UART1 Interface via Female DB9 Connector
LCD CONT. LCD Contrast Adjust through Pot
CAN PORT CAN Interfacing through Male DB9
LCD1 LCD Display Module, HD44780U
D1- D8 Light Emitting Diodes
S1- S16 Matrix Keypad Switches
EXT.INT (S17) External Interrupt Key
RESET (S18) Reset Key
A2DIN (R18) Potentiometer as ADC input
U1 HDP1206 X (Buzzer)
U2 LM35 (Temperature Sensor)
U3 74LV244 (LED Driver IC)
U4 External EEPROM 24C04
U5 LM7805 (Regulator IC- 5V)
U6 LD1117S33 (Regulator IC- 3.3V)
U7 74LV244 (LCD Driver IC)
U8 MAX3232 (Level Converter)
U9 LM386 (Audio Amplifier)
U10 TJA1040 (CAN interfacing IC)
JUMPER LIST
POWER SUPPLY
eCee NXP LPC 2138 Board has two power supplies; you can choose one of the following ways to
supply power
GND
2
1N4007
PHONEJACK D10 CON2
LED
2
1
J11 + C12
47uf/16v C13 C14 C15 C16 C17
2 0.1uF 47uf/10v 10uf/10v 0.1uF 10uf/10v
1
CON2 R30
470R
CLOCK SOURCE
eCee NXP LPC 2138 evaluation board has two clock sources:
32.768 KHz Crystal as the RTC clock source
10 MHz Crystal as the MCU clock source
LED INTERFACING
LED’s are the simplest devices to test port functioning. The board contains 8 LED’s
connected to PORT1 pins 16 to 23 (P1.16 to P1.23).
Note: For the LEDs to work, the LED jumper (J8) must be in position.
V3.3
C9
R13 0.1uF
10K R14
D1
470R
J8 U3 LED
2 1 1 20 R15
1E VCC D2
19 470R
2E LED
LED
P116 2 18 R16
1A1 1Y1 D3
P117 4 16 470R
1A2 1Y2 LED
P118 6 14
1A3 1Y3 R23
P119 8 12 D4
1A4 1Y4
P120 11 9 470R
2A1 2Y1 LED
P121 13 7
2A2 2Y2 R24
P122 15 5 D5
2A3 2Y3
P123 17 3 470R
2A4 2Y4 LED
10 R25
GND D6
470R
74LV244 LED
R26
D7
470R
LED
R27
D8
470R
LED
The board has all port pins available at Berge strip and at round machine cut female connector.
The connection is as given below.
J1 J2 J3 J4
P00 P025
1 1 1 1
P01 P026
2 2 2 2
P02 P027
3 3 3 3
P03 P028
4 4 4 4
P04 P029
5 5 5 5
P05 P030
6 6 6 6
P06 P031
7 7 7 7
P07 P116
8 8 8 8
P08 P117
9 9 9 9
P09 P118
10 10 10 10
P010 P119
11 11 11 11
P011 P120
12 12 12 12
P012 P121
13 13 13 13
P013 P122
14 14 14 14
P014 P123
15 15 15 15
P015 P124
16 16 16 16
P016 P125
17 17 17 17
P017 RTCK P126
18 18 18 18
P018 TDO P127
19 19 19 19
P019 TDI P128
20 20 20 20
P020 TCK P129
21 21 21 21
P021 TMS P130
22 22 22 22
P022 TRST P131
23 23 23 23
P023 V5. 0
24 24 24 24
RST GND
25 25 25 25
CON25 CON25 CON25 CON25
C1
10uF C2
0.1uF
V5.0
LED-
B1 R7
10uf/10v 0R
C3
V5.0
BUZZER
J5 Q1 LED_PWM
P07 2 1 R1 BC850 Q2
3 R4 R6 BC850
BUZ 1K 2
1 1K 330R
R2
J7 LED_PWM
10K R5 C6
2K2 10uF/16V
The display is a standard 2x16 LCD which displays 2 lines of 16 characters. Each character is 40
pixels, making it 1280 pixels overall. The display receives ASCII codes for each character at the data
inputs (D0–D7).
Connection Diagram
The LCD module can be used in 4-bit or 8-bit mode. The module uses HD44780U (from Hitachi) as
the controller IC. The eCee LPC 2138 development board uses 4-bit interface. PORT1 pins (P1.17 –
P1.23) are used for data/command control pins. An On-Board potentiometer enables to adjust the LCD
contrast to a better view in every angle.
Note: For the LCD module to work, the LCD jumper (J13) must be in position
LCD INTERFACING
V5.0
V3.3
C7 C8
C20 0.1uf 10uf/10v
2
CTR
J13 U7 15 LCD2X16
LED+
2 1 1 20 LED- 16
1E VCC LED-
19
2E RS 4
LCD RS
P021 2 18 LED_PWM R/W 5
1A1 1Y1 R/W
P117 4 16 RS E 6
1A2 1Y2 E
P118 6 14 R/W
1A3 1Y3 7
P119 8 12 E D0
1A4 1Y4 8
P120 11 9 D4 D1
2A1 2Y1 9
P121 13 7 D5 D2
2A2 2Y2 10
P122 15 5 D6 D3
2A3 2Y3 D4 11
P123 17 3 D7 D4
2A4 2Y4 D5 12
D5
D6 13
GND
10 D6
GND D7 14
D7
74LV244
1
The Lcd module has16 pins for interfacing out of which 8 are data pins (DB0-DB7) and 3
(RS,RW,EN) are control pins.
The LPC 2138 microcontrollers come with two UART modules - UART0 and UART1. It has
only asynchronous (no clock connection) mode of operation. The UART0 operates through P0.0
(TXD) and P0.1 (RXD) pins while the UART1 uses P0.8 (TXD) and P0.9 (RXD) pins. The LPC
2138 UART output itself operates at CMOS voltages, and needs an external serial line driver to
convert its output into a higher symmetrical line voltage. The MAX3232 serial driver serves this
purpose.
Note: For the UART module to work, the ISP(J17) and RST(J21) jumpers must be removed.
TTL<>RS232
V3.3
C22 J14
16
0.1uF 1
U8 6
2
V3.3
VCC
1 2 7
C1+ V+
3
C21 8
0.1uF 3 6 4
C1- V-
4 9
C2+ C24 C25 5 R40 R41
C23 0.1uF 0.1uF P014
0.1uF 5 COM1
10K 22K
C2 -
P08 11 14 J16 J17
T1 IN T1 OUT
P00 10 7 2 1 2 1 P014
T2 IN T2 OUT J18
P09 12 13
R1 OUT R1 IN
P01 9 8 1
R2 OUT R2 IN EXT.INT ISP
6
2
GND
RTS 7
1
3 EXT.INT Q3
MAX3232 V3.3 8 ISP * J20 BC850 R45 RTS
4
15
9 C30
33K
5 S17 0.1uf
2
RST
1
R43
J21 33K
JRST
2
S18 Q4 BC850
RESET
C31
0.1uF
D13
4148
CREATING HYPERTERMINAL IN PC
The serial data transmitted through UART can be viewed on a PC using a Windows tool for
Serial Port Communication called HyperTerminal.
Now Disconnect the Hyper Terminal. Then open the Property from ‘File’.
Disconnect
Connect
HyperTeminal
MATRIX KEYBOARD
A keypad is simply an array of push buttons connected in rows and columns, so that each can be
tested for closure with the minimum number of connections. There are 16 keys on a phone type pad
arranged in a 4X4 matrix. Assume the columns are labeled 1, 2, 3, 4 and the rows A, B, C, D. If we
assume that all the rows and columns are initially high, a keystroke can be detected by setting each
row low in turn and checking each column for a zero. In the KEYPAD circuit the 8 keypad pins are
connected to Port0. While coding, Pins P0.14-P0.17 should be initialized as outputs and pins
P0.10-P0.13 as inputs. These input pins are pulled high to logic 1. The output rows are also initially
set to 1. If a 0 is now output on row A, there is no effect on the inputs unless a button in row A is
pressed. If these are checked in turn for a 0, a button in this row which is pressed can be identified as a
specific combination of output and input bits.
V3. 3
P010
P011
P012
P013
S1 S2 S3 S4
LM35 temperature sensor can be used to measure environment temperature, in the range of -
55 Deg C to 150 Deg C. It’s connected to Port 0 P0.27 (AD0.0) analog channel.
Note: For the temperature sensor to work, the TEMP jumper (J6) must be in position.
V3.3
C4
0.1uF
U2
3 R3 J6
2 1 P027
2
1 1K TEMP
LM35
C5
0.1uF
EXTERNAL INTERRUPT
This development board uses External Interrupt 1 - EINT1 (Button S17). It is connected to P0.14.
Note: Place jumper on EXT_INT (J16) pin for the proper functioning of external interrupt.
V3.3
J16 J17
2 1 2 1 P014
EXT.INT ISP
1
EXT.INT Q3
ISP * J20 BC850 R45 RTS
C30
33K
S17 0.1uf
2
D12
4148
The eCee LPC 2138 development board has 4K SERIAL EEPROM interfacing. Internally organized
with 256 pages of 2-byte each, the 4K requires an 9-bit data word address for random word addressing
with data transfer rate 100 kbits/s. Also it is to be noted that an external EEPROM (AT24C04) is the
slave device to be communicated with the microcontroller, via I2C protocol.
EEPROM
V3.3
U4
1 8
A0 VCC
2 7
A1 WC
3 6 P02
A2 SCL
4 5 P03
GND SDA
EEPROM24C04
V3.3
R1 P0.11 U1
10K P1.16 16 19 P0.0 JP1 JP2
P1.16/TRACEPKT0 P0.0/TXD0/PWM1
P1.17 12 21 P0.1 P0.0 P0.25
P1.17/TRACEPKT1 P0.1/RXD0/PWM3/EINT0 1 1
P1.18 8 22 P0.2 P0.1 P0.26
P1.18/TRACEPKT2 P0.2/SCL/CAP0.0 2 2
P1.19 4 26 P0.3 P0.2 P0.27
P1.19/TRACEPKT3 P0.3/SDA/MAT0.0/EINT1 3 3
P1.20 48 27 P0.4 P0.3 P0.28
P1.20/TRACESSYNC P0.4/SCK0/CAP0.1/AIN6 4 4
P1.21 44 29 P0.5 P0.4 P0.29
P1.21/PIPESTAT0 P0.5/MISO0/MAT0.1/AIN7 5 5
P1.22 40 30 P0.6 P0.5 P0.30
P1.22/PIPESTAT1 P0.6/MOSI0/CAP0.2/AIN8 6 6
P1.23 36 31 P0.7 P0.6 P0.31
P1.23/PIPESTAT2 P0.7/SSEL0/PWM2/EINT2 7 7
P0.7 P1.16
8 8
33 P0.8 P0.8 P1.17
P0.8/TXD1/PWM4/AIN9 9 9
P1.24 32 34 P0.9 P0.9 P1.18
P1.24/TRACECLK P0.9/RXD1/PWM6/EINT3 10 10
P1.25 28 35 P0.10 P0.10 P1.19
P1.25/EXTIN0 P0.10/RTS1/CAP1.0/AIN10 11 11
P1.26 24 37 P0.11 P0.11 P1.20
P1.26/RTCK P0.11/CTS1/CAP1.1/SCL1 12 12
P1.27 64 38 P0.12 P0.12 P1.21
P1.27/TDO P0.12/DSR1/MAT1.0/AIN11 13 13
P1.28 60 39 P0.13 P0.13 P1.22
P1.28/TDI P0.13/DTR1/MAT1.1/AIN12 14 14
P1.29 56 41 P0.14 P0.14 P1.23
P1.29/TCK P0.14/DCD1/EINT1/SDA1 15 15
P1.30 52 45 P0.15 P0.15 P1.24
P1.30/TMS P0.15/RI1/EITN2/AIN13 16 16
P1.31 20 P0.16 P1.25
P1.31/TRST 17 17
46 P0.16 P0.17 P1.26
P0.16/EINT0/MAT0.2/CAP0.2 18 18
6 47 P0.17 P0.18 P1.27
VSS-1 P0.17/CAP1.2/SCK1/MAT1.2 19 19
18 53 P0.18 P0.19 P1.28
VSS-2 P0.18/CAP1.3/MISO1/MAT1.3 20 20
GND 25 54 P0.19 P0.20 P1.29
VSS-3 P0.19/MAT1.2/MOSI1/CAP1.2 21 21
42 55 P0.20 P0.21 P1.30
VSS-4 P0.20/MAT1.3/SSEL1/EINT3 22 22
V3.3 50 1 P0.21 P0.22 P1.31
VSS-5 P0.21/PWM5/AIN14/CAP1.3 23 23
2 P0.22 P0.23 V5.0
P0.22/AIN15/CAP0.0/MAT0.0 24 24
23 58 P0.23 RESET GND
C1 0.1uF C2 C3 C4 VDD-1 P0.23 25 25
43
0.1uF 0.1uF 0.1uF VDD-2
VBAT GND 51 9 P0.25 HEADER 25 HEADER 25
VDD-3 P0.25/AIN4/AOUT
10 P0.26
10K P0.26/AIN5
D1 V3.3 VBAT 49 11 P0.27
VBAT P0.27/AIN0/CAP0.1/MAT0.1
63 13 P0.28
VREF P0.28/AIN1/CAP0.2/MAT0.2
7 14 P0.29
R18 VDD-A P0.29/AIN2/CAP0.3/MAT0.3
1N4148 GND 59 15 P0.30
VSS-A P0.30/AIN3/EINT3/CAP0.0
17 P0.31
BT1 C5 C6 P0.31OUT
C22 0.1uf RESET 57
1.8V 0.1uF 0.1uF RESET
3 62
RTCX1 XTAL1
Y1 Y2
5 61
RTCX2 XTAL2
32.768KHZ 10MHZ
LPC2138
C29
C30 C31 C32
33PF 33PF 33PF 33PF
ADC POTENTIOMETER
The eCee LPC 2138 development board has a potentiometer connected to its ADC pin P0.28.
ADC PORT
V3. 3
3K3
R17
10K R18
J9
1 2 P028
0.1uf A2DIN
C10
AUDIO AMPLIFIER
V5. 0
C27 C28
6
10uf/10v 0.1uf
U9
VCC
R46 G8
BP
1K
LM386
4
C33
0.1uF
C32
0.1uF
CREATING A PROJECT
Keil µVision3 software is a standard Windows application for project development and can be
installed like any standard application. µVision3 includes a project manager which makes it easy to
design applications for an ARM based microcontroller. You need to perform the following steps to
create a new project:
The section provides a step-by-step tutorial that shows you how to create a simple µVision3 project.
Click Keil
uVision3
To create a new project file select from the µVision3 menu File – New – µVision Project….
This opens a standard Windows dialog that asks you for the new project file name. You should use a
separate folder for each project. You can simply use the icon Create New Folder in this dialog to
get an empty new folder.
Select this folder and enter the file name for the new project, eg. Project1. µVision3 creates a
new project file with the name PROJECT1.UV2 which contains a default target and file group
name. You can see these names in the Project Workspace – Files.
When you create a new project µVision3 asks you to select a CPU for your project. The Select
Device dialog box shows the µVision3 device database. Just select the microcontroller you use. For
the example in this chapter we are using the Philips LPC 2138 controller. This selection sets
necessary tool options for the LPC2132 device and simplifies in this way the tool configuration.
Select uC
Click OK
An embedded program requires CPU initialization code that needs to match the configuration
of your hardware design. This Startup Code depends also on the tool chain that you are using. Since
you might need to modify that file to match your target hardware, the file should be copied to your
project folder.
For most devices, µVision3 asks you to copy the CPU specific Startup Code to your project. This is
required on almost all projects (exceptions are library projects and add-on projects). The Startup
Code performs configuration of the microcontroller device and initialization of the compiler run-time
system. Answer with YES to this question.
Click YES
Note: The CPU Startup Code typically requires some configuration; however the default
configuration gives you a good starting point for single chip applications.
You may create a new source file with the menu option File – New. This opens an empty editor
window where you can enter your source code. µVision3 enables the C color syntax highlighting
when you save your file with the dialog File – Save As… under a filename with the extension *.C.
Here we save our example file under the name led.C.
Once you have created your source file you can add this file to your project. µVision3 offers several
ways to add source files to a project. For example, you can select the file group in the Project
Workspace – Files page and click with the right mouse key to open a local menu. The option Add
Files opens the standard files dialog. Select the file led.c you have just created.
Right Click –
Source Group
µVision3 lets you set options for your target hardware. The dialog Options for Target opens via the
toolbar icon or via the Project - Options for Target menu item. In the Target tab you specify all
relevant parameters of your target hardware and the on-chip components of the device you have
selected. The following dialog shows the settings for our example.
The CPU Startup Code (on most ARM targets the file name is Startup.S) may be open from the
Project Workspace - Files Tab. Most startup files have embedded comments for the µVision3
Configuration Wizard which provides menu driven selections.
The default settings of the Startup Code give a good starting point on most single chip
applications. However you need to adapt the configuration for your target hardware. CPU/PLL clock
and BUS system are target specific and cannot be automatically configured. You need to ensure
that the settings in the startup file match the other settings in your project.
The button Edit as Text opens the Startup Code in a standard editor window and allows you to
review the source code of this file.
Once you have successfully generated your application you can start debugging. After you
have tested your application, it is required to create an Intel HEX file to download the software into an
EPROM programmer or simulator. µVision3 creates HEX files with each build process when Create
HEX file under Options for Target – Output is enabled.
Build Project
Typical, the tool settings under Options – Target are all you need to start a new application. You may
translate all source files and link the application with a click on the Build Target toolbar icon. When
you build an application with syntax errors, µVision3 will display errors and warning messages in the
Output Window – Build page. A double click on a message line opens the source file on the correct
location in a µVision3 editor window.
PROGRAMMING STEPS
eCee NXP LPC 2138 development board supports two modes of programming
I. AUTOMATIC MODE
(The JTAG explained in this section is the ARM-JTAG Debugger/Programmer from Rhydolabz.com)
Note : Connect the JTAG debugger to the development board and make sure that the JTAG Jumper in
the development board (Marked JTAG – J15) is inserted.
JTAG
V3.3
C18
R31 R32 R33 R34 C19
10K 10K 10K 10K 0.1uf 10uf/10v
JP1
1 2
TRST
3 4
TDI
5 6
TMS
7 8
TCK
9 10
RTCK
11 12
TDO
13 14
RST
15 16
1
17 18
J15 19 20
JTAG
JTAG
2
This section explains how to interface ARM-JTAG, a wiggler compatible module, with ARM
evaluation board. This is a stable and easy to use device which provides a low cost alternative for
programming/debugging a target board. It supports Remote Debug Interfacing (RDI).
This ARM-JTAG module is compatible with H-JTAG software which is free software available
for H-JTAG debugging process.
Install the H-JTAG software in your PC.
The example screens showed here uses uvision 3V3.50 from Keil Software.
Before you start downloading and debugging process, certain settings have to be configured in
Kiel uV Project. First, create a new Kiel uV project or open an already existing one, add the needed
program in source group and build it. Make sure that the .hex file is created. Now select Flash menu
and click Configure Flash Tools in it.
Select RDI Interface Driver and click on Settings in the Debug option. Check whether Load
Application at Startup and Run to main are enabled.
Click Browse in the “Browse for RDI Driver DLL” option and select the H-JTAG.dll file from the
installed HFlasher location.(Usually found in C:\Program Files\H-JTAG\H-JTAG.dll). Click “OK”.
Click Utilities enable Use External Tool for Flash Programming. Click Browse in the
Command Option and select the file H-Flasher.exe (Usually found in C:\Program Files\H-JTAG\H-
Flasher.exe). Enable Run Independent option. Click OK. This will exit you from the Configuration
Menu.
Debugging/Programming
Connect your evaluation board to the JTAG debugger. Make sure that the JTAG is connected to the
parallel port of your PC using the cable provided.
Launch H-JTAG software from start menu.
It detects device id of the controller connected to the evaluation board. If the device is not detected,
RESET the evaluation board and Click “Detect Target” (In Operations Menu) again. In the example,
we use LPC 2138 microcontroller from NXP with ARM7TDMI-S processor.
Minimize the H-JTAG screen and pop-up the Keil window. Click Download in the Flash Menu for
downloading the program using JTAG. The H-JTAG automatically pop-up.
Select Flash Selection under Program Wizard to select the microcontroller in the evaluation board.
Here we use NXP’s LPC2138 controller.
Now select Configuration and set external crystal frequency in the XTAL (MHz) text box. Enter the
frequency of the crystal used in the evaluation board.
Now Select the Programming option and set Type as Intel hex Format and select the Source
File from your program folder. We can also check the Flash and Target unit by clicking Check. Now
click Program button to program the Target board.
3 RTXC1
4 P1.19 I/O Led4/LCD (E/D)
5 RTXC2
6 VSS GND
7 VDDA +3V3
25 VSS GND
26 P0.3 I/O SDA0
27 P0.4 I/O N/C
51 VDD +3V3
52 P1.30 I/O TMS
53 P0.18 I/O N/C
62 XTAL1
63 VREF +3V3
TECHNICAL SUPPORT
If you are experiencing a problem that is not described in this manual, please contact us. Our
phone lines are open from 9:00 AM – 5.00 PM (Indian Standard Time) Monday through Saturday
excluding holidays. Email can be sent to [email protected]
This product is intended for personal or lab experimental purpose and in no case should be
used where it harmfully effect human and nature. No liability will be accepted by the publisher for any
consequence of its use. Use of the product software and or hardware is with the understanding that any
outcome whatsoever is at the users own risk. All products are tested for their best performance before
shipping, still rhydoLABZ is offering One year Free service warranty (Components cost + Shipping
cost will be charged from Customer).
DISCLAIMER
All rights are reserved. Reproduction in whole or in part is prohibited without the prior written consent
of the copyright owner. The information presented in this document does not form part of any
quotation or contract, is believed to be accurate and reliable and may be changed without notice.