Download User`s Manual of Board Microcontroller CP-JR ARM7

Transcript
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
CP-JR ARM7 LPC2368
CP-JR ARM7 LPC2368 is ARM7TDMI-S Core Board
Microcontroller that uses 16/32-Bit 100 Pin (LQFP)
Microcontroller No.LPC2368 from Philips (NXP). All
resources inside LPC2368 is quite perfect, so it is
the most suitable to learn and study because if user
can learn and understand the applications of all
resources inside MCU well, it makes user can modify,
apply and develop many excellent applications in the
future. Because Hardware system of LPC2368 includes
the necessary devices within only one MCU such as
USB,
Ethernet,
SD/MMC
Memory
Card,
ADC,
DAC,
Timer/Counter, PWM, Capture, I2C, SPI, UART, and etc.
So, ETT Team tries to find out and research the
detailed information of LPC2368 and design it to be
Board Microcontroller version “CP-JR ARM7 LPC2368”.
We hope that user will buy this device to learn,
modify, and develop application in the future as
desired under the reasonable price. The main purpose
of designing this Board CP-JR ARM7 LPC2368 is to be
able to support both users who want to learn, study
or try device and including person who want to really
modify and develop devices. The structure of board
consists of the basic components that are necessary
to learn and test such as LED to display Output
Logic, Push Button Switch to test Logic Input, Volume
ETT CO.,LTD.
-1-
WWW.ETT.CO.TH
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
to adjust voltage to test A/D, and Mini Speaker to
generate various Beep sound. Moreover, it provides
other devices in the high level to support the
applications such as Port USB, SD/MMC Memory Card,
Port Ethernet LAN, Dot-Matrix LCD, RS232, RS232,
RS422/485. Furthermore, there is available GPIO; it
makes user can design and use it with other devices
as desired. So, CP-JR ARM7 LPC2368 is one of the most
interesting multi-purpose boards.
Specifications of Board
1.
Use 16/32 Bit ARM7TDMI-S MCU No.LPC2368 from
Philips (NXP)
2. Has 512KB Flash Memory and 58KB Static RAM
internal MCU
3. Use 12.00MHz Crystal, so MCU can process data
with the maximum high speed at 72MHz when
using it with Phase-Locked Loop (PLL) internal
MCU.
4. Has RTC Circuit (Real Time Clock) with
32.768KHz XTAL and Battery Backup
5. Support In-System Programming (ISP) and InApplication Programming (IAP) through On-Chip
Boot-Loader Software via Port UART-0 (RS232)
6. Has circuit to connect with standard 20 Pin
JTAG ARM for Real Time Debugging
7. 7-12 VAC/DC Power Supply uses Connector type
as Terminal and DC-Jack with Bridge Rectifier
Circuit,
+5V/800mA
Regulate
and
+3V3/3A
Regulate
8. Has standard 2.0 USB as Full Speed inside (USB
Function has 32 End Point)
9. Has circuit to connect with Ethernet LAN
10/100Mb by using 1 Channel standard RJ45
Connector
10. Has 1 Channel Circuit to connect with SD
Memory Card or MMC Memory Card
11. Has RS232 Communication Circuit by using 2
Channel 4-PIN ETT standard Connector
12. Has RS422/485 Serial Communication Circuit by
using 1 Channel 6-PIN ETT standard Connector
ETT CO.,LTD.
-2-
WWW.ETT.CO.TH
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
13. Has Circuit to connect with Dot-Matrix LCD
with circuit to adjust its contrast by using
14 PIN ETT standard Connector
14. 3 sets of Push Button Switch with RESET Switch
15. Has 2 LED Circuits to display status of
testing Output
16. Has circuit to generate 0-3V3 Voltage by using
an adjustable Resistor Circuit for testing A/D
17. 1 Mini Speaker to generate Beep sound
18. Available 25 Bit GPIO for various applications
such as A/D, D/A, I2C, SPI and Input/Output
• Header 10Pin IDE (P2[0..7]) for GPIO or
Full-Duplex Serial UART
• Header 10Pin IDE (P0[4..7],P1[20..23]) for
GPIO or 4x4 Matrix Key
•
•
•
•
ETT CO.,LTD.
3 Pin Header(P0[26])for GPIO or D/A
4 Pin Header(P0[24..25]) for GPIO or A/D
4 Pin Header(P0[27..28]) for GPIO or I2C Bus
6 Pin Header(P0[15..18] for GPIO or SPI Bus
-3-
WWW.ETT.CO.TH
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
Structure of Board CP-JR ARM7 LPC2368
Figure displays
LPC2368.
ETT CO.,LTD.
the
structure
-4-
of
Board
CP-JR
ARM7
WWW.ETT.CO.TH
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
7
8
5
6
34
35
36
28
9
40
10
3
2
12
11
13
14
41
42
1
37
15
31
33
24
38
16
32
29
4
39
30
27
22
21
23
17
18
19
20
26
25
Figure displays position of devices on Board CP-JR
ARM7 LPC2368.
• No.1 is MCU No.LPC2368 (100Pin LQFP).
• No.2 is 12MHz Crystal to be Time Base of MCU.
• No.3 is 32.768 KHz Crystal to be Time Base of
RTC internal MCU.
• No.4 is 3V Battery for Backup of RTC.
• No.5 is JTAG ARM Connector for Real
Time
Debugging.
• No.6 is GPIO (P0[4..7],P1[20..23]) Connector for
Keyboard Matrix 4x4 or GPIO.
• No.7
is UART-0(RS232) Connector
Download Hex File into CPU
to
use
and
• No.8 is UART-2(RS232) Connector to use.
• No.9 is Character LCD Connector; it can be used
with +5V Supply LCD.
• No.10 is VR to adjust the contrast or brightness
of Character LCD.
ETT CO.,LTD.
-5-
WWW.ETT.CO.TH
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
• No.11 is USB Connector to connect with USB Hub
version 2.0.
• No.12 is LED to display status of operation and
the USB connection.
• No.13
is
Jumper
Connection.
to
select
Mode
of
USB
• No.14 and No.15 is Power Supply Connector of
board; it can be used with 7-12V AC/DC.
• No.16 is LED to display status of Power +VDD
(+3V3).
• No.17 is SW1 that is ISP LOAD or P2.10/EINT0.
• No.18 is SW2 or RESET Switch.
• No.19 and No.20 is SW3 and SW4 to test Logic
Input of P4[28] and P4[29].
• No.21 and No.22 is LED to test Logic Output of
P3[25] and P3[26].
• No.23 is VR to adjust 0-3V3 Voltage for testing
A/D (P0[23]/AD0[0]).
• No.24
is Mini
frequencies.
Speaker
to
generate
various
• No.25 is Jumper to select Power Supply for
SD/MMC Memory Card.
• No.26 is LED to display status of Power Supply
of SD/MMC Memory Card.
• No.27 is socket to insert Memory Card; it can be
used with both SD Memory Card and MMC Memory
Card.
• No.28 and No.29 is Jumper to select operation of
RS422/485.
• No.30 is IC Line Driver of RS422 Receive; it can
be used with 75176 or MAX3088.
• NO.31 is IC Line Driver of RS422 Transmit and
RS485 Transceiver; it can be used with No.75176
or MAX3088.
• No.32 and No.33 is Jumper to set Enable/Disable
Fail-Save Resistor
RS422
Receive,
Transceiver).
ETT CO.,LTD.
and Terminate Resistor of
RS455
Transmit
(RS485
-6-
WWW.ETT.CO.TH
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
•
•
•
•
•
•
•
•
•
No.34 is RS422/485 Connector.
No.35 is LED to display status of Ethernet LAN.
No.36 is RJ45 Ethernet LAN Connector.
No.37 is IC Physical Ethernet Driver No.DP83848.
Connector 38 is GPIO (P2[0..7]
Full-Duplex UART1 or GPIO.
Connector
for
No.39 is SPI0-Bus Connector or GPIO P0[15..18].
No.40 is I2C-Bus Connector or GPIO P0[27..28].
No.41 is A/D Connector or GPIO P0[24..25].
No.42 is D/A Connector or GPIO P0.26.
Applications of LED Display
LED Display circuit of Board will be connected
as Sink Current type and it is used with +3.3V Power
Supply. In this case, it runs with Logic “0” (0V) and
stops running with Logic “1” (+3.3V). It is
controlled by 2 GPIOs that are P3[25] and P3[26].
This circuit is used to test operation of Output.
+3V3
+3V3
R53
560
R54
560
D12
P3.25
D13
P3.26
P3.25
P3.26
If we want to use this function, we must set
function of P3[25] and P3[26] to be Output Port first
and then control the desired Logic for P3[25] and
P3[26] as example below.
ETT CO.,LTD.
-7-
WWW.ETT.CO.TH
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
// Config Pin GPIO = P3[26:25] Drive LED
PINSEL7 &= 0xFFC3FFFF;
// Config P3[26:25] = GPIO Function
PINMODE7 &= 0xFFC3FFFF;
// Enable Pull-Up on P3[26:25]
FIO3DIR |= 0x02000000;
// Set P3[25] = Output
FIO3DIR |= 0x04000000;
// Set P3[26] = Output
FIO3CLR
FIO3CLR
= 0x02000000;
= 0x04000000;
// LED(P3[25]) = ON
// LED(P3[26]) = ON
FIO3SET
FIO3SET
= 0x02000000;
= 0x04000000;
// LED(P3[25]) = OFF
// LED(P3[26]) = OFF
Application of Push Button Switch
This circuit uses Push Button Switch Circuit
with Pull-Up circuit; in this case, it can be used
with +3.3V Power Supply. If Switch is not pressed,
its status is Logic “1”; on the other hand, if Switch
is pressed, its status is Logic “0”. It is used to
test operation of Input Logic; moreover, this circuit
has 3 sets as follows;
• SW1 (P2[10]) for ISP Download and test Input or
Interrupt(EINT0)
• SW3 (P4[28]) to test Logic Input
• SW4 (P4[29]) to test Logic Input
+3V3
+3V3
+3V3
R56
10K
R1
22K
R57
10K
R58
SW1
R59
P4.28
P4.29
1K
P2.10
1K
ISP LOAD
C15
100n
ETT CO.,LTD.
SW3
P4.28
R3
1K
-8-
SW4
P4.29
WWW.ETT.CO.TH
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
Applications of Voltage Divider (0-3V3)
The Voltage Divider Circuit uses Adjustable
Variable Resistor (VR) and it can be used with +3.3V
Power Supply. In this case, its Output is voltage in
the rage of 0V to +3.3V depend on the adjusting VR.
The Output will be inputted into Pin P0[23] to
generate Input voltage for testing operation of A/D
(P0[23]) circuit.
+3V3
R55
P0.23
470
P1
10K
Application of Sound Generator
Sound Generator Circuit uses Mini Speaker with
NPN Transistor circuit to drive current into speaker
and can be used with +3.3V Power Supply. In this
case, it runs with Logic “1” and stop running with
Logic “0”. If we want to use this function, we must
send signal Logic that is various frequencies into
speaker to generate various frequency ranges as
desired; in this case, it is controlled by P2[8].
ETT CO.,LTD.
-9-
WWW.ETT.CO.TH
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
R50
+3V3
10
SP1
SPEAKER
D11
LL4148
R51
Q3
BC817
P2.8
1K
R52
10K
If we want to use this function, we must
configure function of P2[8] to be Output Port first
and then control Logic for P2[8]ON/OFF to be the
desired frequencies as example below.
// Config Pin GPIO = P2[8] Drive Mini Speaker Generate Beep
PINSEL4 &= 0xFFFCFFFF;
// Config P2[8] = GPIO Function
FIO2DIR |= 0x00000100;
// Config P2[8] = Output
// Loop Generate Beep on Speaker(P2.8)
while(1)
//
{
for (i = 0; i < 500; i++)
//
{
FIO2SET
= 0x00000100;
//
delay(5000);
FIO2CLR
= 0x00000100;
//
delay(5000);
}
delay(10000000);
Loop Continue
Start Beep Pulse
P2[8] = “1” (ON
Speaker)
P2[8] = “0” (OFF Speaker)
// Stop Beep Pulse
}
ETT CO.,LTD.
-10-
WWW.ETT.CO.TH
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
Application of Character LCD
The LCD Connection can be used with Character
Dot-Matrix LCD only. It connects circuit as 4 BIT
Data and signals that are connected with LCD will be
signal from P1[24..29] and P1[31] about 7 Bit. The
method to connect signal cable from Connector of Port
LCD to LCD Display is to use the signal name to be
the reference, so we must connect all 14 signal
cables according to its names as below.
The method to connect signal cable with LCD is shown
as below;
•
•
•
•
•
•
•
DB4
DB5
DB6
DB7
RS
RW
EN
=
=
=
=
=
=
=
P1[24]
P1[25]
P1[26]
P1[28]
P1[28]
P1[29]
P1[31]
+5V
10K
+VCC
P1.28
P1.31
P1.25
P1.27
+5V
RS
EN
D1
D3
D5
D7
1
3
5
7
9
11
13
2
4
6
8
10
12
14
GND
VO
RW
D0
D2
D4
D6
P1.29
P1.24
P1.26
ET-CLCD
GND
RS
VO
EN
D1
RW
D0
D3
D5
D2
D4
D7
D6
ET-CLCD
ETT CO.,LTD.
-11-
WWW.ETT.CO.TH
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
Application of JTAG ARM
JTAG or JTAG ARM is 20 Pin IDE Connector to
interface with JTAG Debugger. Its circuit and signal
is arranged under the standard of JTAG as shown
below.
+3V3
R4 R5 R6 R7
10K 10K 10K 10K
J1
JTAG
1
3
5
7
9
11
13
15
17
19
TRST
TDI
TMS
TCK
RTCK
TDO
RESET
RUN/DEBUG
J2
2
4
6
8
10
12
14
16
18
20
1
2
3
R8 R9 R10 R11
10K 10K 10K 10K
VTref
VTarget
TRST
TDI
TMS
GND
GND
GND
TCK
RTCK
GND
GND
TDO
RES#
GND
GND
NC
NC
GND
GND
ARM JTAG Pin Connector
If connecting with JTAG to Download Code of
Debug, we must set Jumper J2(RUN/DEB) on DEB side;
however, after we have already developed program, we
must always set Jumper J2(RUN/DEB) on RUN side again.
Ethernet LAN
The method to connect signal between network and
Board CP-JR ARM7 LPC2368 is to use standard RJ45
Ethernet Connector. This circuit uses signal Pin
P1[0,1,4,8,9,10,14..17] for the connection; moreover,
it uses Chips Physical Ethernet No.DP83848 to be
Driver.
ETT CO.,LTD.
-12-
WWW.ETT.CO.TH
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
There are 2 methods to connect Ethernet LAN
cable of board with Network; Direct Line and Through
Hub.
• The
first case; it connects with computer
directly; LAN cable must be connected as Cross
type.
• The second case; it connects signal through Hub
of computer Sever and
connected as Direct type.
its
cables
must
be
SD/MMC Memory Card
It supports the connection with SD Memory Card
and MMC Memory Card; in this part, there is LED SD to
display status of Power Supply for the Memory Card.
ETT CO.,LTD.
-13-
WWW.ETT.CO.TH
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
Power Supply of Memory Card can be selected by Jumper
J26(SD/VDD); so we can select to use Power Supply
either from +VDD of Board or from the control of
signal
Pin
MCIPWR.
Normally,
we
set
Jumper
J26(SD/VDD) on SD side to use Power Supply of Memory
Card from the control of MCIPWR. All circuits to
connect with Memory Card uses signal pins from MCU as
follows;
•
•
•
•
•
•
•
MCIDAT0 uses P0.22.
MCIDAT1 uses P2.11.
MCIDAT2 uses P2.12.
MCIDAT3 uses P2.13.
MCICMD uses P0.20.
MCICLK uses P0.19.
MCIPWR uses P0.21.
• CD uses P0.8 (GPIO) to test Insert Memory
Card.
• WP uses P0.9 (GPIO) to test the setting of
Write Protect of Memory Card.
Application of RS232
Port RS232 is signal RS232 that has been done by
MAX3232 Converter circuit completely. There are 2
channels that are UART-0 and UART-2. Both channels
can
be
connected
with
signal
RS232
to
transmit/receive data. Moreover, UART-0 can be used
to be ISP Download function to Download Hex File into
MCU; in this case, it must be used with SW1 (ISP
LOAD) and SW2 (RESET) to reset CPU to start running
in Boot-Loader Mode to Download Hex File into CPU
(see more information in “Download Hex File into MCU
of Board”).
ETT CO.,LTD.
-14-
RXD0
TXD0
GND
1
2
3
4
GND
4
TXD2
3
RXD2
2
UART-2
+3V3
1
+3V3
UART-0(Download)
WWW.ETT.CO.TH
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
• UART-0 uses signal pin from P0.2(TXD0) and
P0.3(RXD0).
• UART-2 uses signal pin from P0.10(TXD2) and
P0.11 (RXD2).
Because Hardware UART of LPC2368 can configure
many points of signal Pin to connect; for example,
UART-2 can use signal Pin P0[10] and P0[11] or signal
Pin P2[8] and P2[9]. Board CP-JR ARM7 LPC2368 selects
signal Pin P0[10] and P0[11] to be the connecting
point with UART-2; so, we must set command to use
signal Pin correctly. Be careful if we use UART
because the Default value of UART-2 is disabled, so
we must enable operation of UART-2 Circuit before
command to Initial values for UART, otherwise we can
not command UART. The example Code to configure
initial values for UART is shown below.
// Config UART-0 Connect to P0[2]:P0[3]
PINSEL0 &= 0xFFFFFF0F;
// Reset P0.2,P0.3 Pin Config
PINSEL0 |= 0x00000010;
// Select P0.2 = TxD(UART-0)
PINSEL0 |= 0x00000040;
// Select P0.3 = RxD(UART-0)
// Config UART-2 Connect to P0[10]:P0[11]
PINSEL0 &= 0xFF0FFFFF;
// Reset P0.10,P0.11 Pin Config
PINSEL0 |= 0x00100000;
// Select P0.10 = TxD(UART-2)
PINSEL0 |= 0x00400000;
// Select P0.11 = RxD(UART-2)
PCONP
|= 0x01000000;
// UART2 Power-ON
The cable that is used to connect RS232 between
Comport of computer PC and UART-0 Connector and UART2 Connector of Board CP-JR ARM7 LPC2368 is shown
below.
ETT CO.,LTD.
-15-
WWW.ETT.CO.TH
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
1
6
2
7
3
8
4
9
5
CD
DSR
RXD
RTS
TXD
CTS
DTR
RI
GND
RXD
TXD
GND
1
2
3
4
ET-RS232
DB9(FEMALE)
RS232-PC
1
14
2
15
3
16
4
17
5
18
6
19
7
20
8
21
9
22
10
23
11
24
12
25
13
TXD
RXD
RTS
CTS
DSR
RXD
TXD
GND
GND
DTR
1
2
3
4
ET-RS232
DB25(FEMALE)
RS232-PC
Figure displays the Cable circuit for RS232.
ETT CO.,LTD.
-16-
WWW.ETT.CO.TH
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
Application of RS422/485
For RS422/485 Communication Circuit of Board CPJR ARM7 LPC2368 uses UART-3 and then use signal Pin
P0[0] and P0[1] to be the connecting point. We can
use this circuit to configure operation of Line
Driver Circuit to be either RS422 (Full Duplex) or
RS485 (Half-Duplex). If it is RS422, it can transmit
and receive data simultaneously as bidirectional as
RS232 but this function is longer distance. On the
other hand, if it is RS485, we can configure its
format of communication to be either Half-Duplex or
Full Duplex; in this case, if it is RS485 (FullDuplex), it is similar to RS422 but we must control
ON/OFF circuit of the transmitter; on the other hand,
if it is RS485 (Half-Duplex), it will alternate
function between receiver and transmitter by using
signal P1[19] to be Output Port function for setting
the direction of data. If status of P1[19] is Logic
“1”, it configures the direction of data to be
transmitter but if status of P1[19] is Logic “0”, it
configures the direction of data to be receiver. The
IC Line Driver of circuit can select either No.75176
or MAX3088; if using 75176, the maximum point that
can be connected signal of RS485 as Multi-Drop type
is 32 points; but if using MAX3088, the maximum point
that can be connected as Multi-Drop type is 256
points. The connector of RS422/485 is CPA-6 Connector
that has arranged as shown below.
RS422/485
3
4
5
6
RX(+)
TX(-)
TX(+)
GND
2
+5V
RX(-)
1
Figure displays position of signal Pin when using it
to be RS422.
ETT CO.,LTD.
-17-
WWW.ETT.CO.TH
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
RS422/485
3
4
5
6
RX(+)
TX(-)
TX(+)
GND
2
+5V
RX(-)
1
Figure displays position of signal Pin when using it
to be RS485 (Full-Duplex).
RS422/485
4
5
6
485(+)
GND
3
NC
485(-)
2
+5V
NC
1
Figure displays position of signal Pin when using it
to be RS485 (Half-Duplex).
ETT CO.,LTD.
-18-
WWW.ETT.CO.TH
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
+5V
J16
3
2
1
J15
RL
RH
3
2
1
J17
3
2
1
RZ
+5V
C42
U6
75176
1
2
3
4
R
RE
DE
D
R60
1K
R61
1K
R62
120
100n
VCC
B
A
GND
8
7
6
5
+5V
+5V
1
2
3
J19
U7
75176
RXD3
1
2
3
422/485
+5V
RXRX+
TXTX+
C43
FULL/HALF
J20
1
2
3
4
R
RE
DE
D
100n
VCC
B
A
GND
J18
RS422/485
1
2
3
4
5
6
8
7
6
5
P1[19]
R63
1K
TXD3
R64
1K
J21
TH
R65
120
J23
1
2
3
J22
+5V
1
2
3
1
2
3
TZ
TL
Figure displays circuit of RS422/485.
If we want to use it to be RS422, we must
install 2 IC Line Driver Circuits and set Jumper J19
and J20 to be RS422 (Full Duplex) as follow; set
Jumper J19 (FULL/HALF) on FULL side and then set
Jumper J20 (422/485) on 422 side.
If using RS485 (Full Duplex), we must install 2
IC Line Driver as same as RS422; but in this case, we
must set Jumper J19 and J20 to be RS485 (Full Duplex)
as follows; set Jumper J19 (FULL/HALF) on FULL side
and then set Jumper J20 (422/485) on 485 side. The
ETT CO.,LTD.
-19-
WWW.ETT.CO.TH
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
operation is similar to RS422 because it can
simultaneously
transmit
and
receive
data
as
bidirectional type like RS422 but it can be connected
as Multi-Drop type. The circuit can receive data all
the time through IC Line Driver of U6 and IC Line
Driver U7 will transmit data. In this case, it can
control ON/OFF operation of transmitting data by
signal from P1[19]; if status of P1[19] is Logic “1”,
it enables operation of transmitting data but if
status of P1[19] is Logic “0”, it disables operation
of
transmitting
data.
When
the
operation
of
transmitting data is disabled, its status is similar
to removing cable of the transmitter from circuit, so
signal on the transmitter does not crash data of
other devices. We must write program to control all
devices to transmit only one data into a line once.
If using RS485 (Half-Duplex), we must install
only one IC Line Driver at position U7; in this case,
we must set Jumper J19 and J20 to be RS485 (Half
Duplex) as follows; set Jumper J19 (FULL/HALF) on
HALF side and then set Jumper J20 (422/485) on 485
side. Moreover, we must interface cable of CPA-6(J18)
Connector at the position TX(-) and TX(+); in this
case, function of TX(-) is RS485(-) and function of
TX(+) is RS485(+). Direction and function of this
signal RS485 depends on status Logic of P1[19] that
is Pin Output Port and its function is Direction
Control.
The method to set Jumper of Fail-Save Resistor
and Terminate Resistor is describes as follows; if
Board is generally installed in the beginning
position and destination of these Jumper Cables, we
must enable and then set Jumper(EN/DIS) of RZ, RL,
RH, TZ, TL and TH on EN side or always Enable. The
Fail-Safe Resistor (RL, RH, TL and TH) makes status
Logic in the signal cable is in the correct IDLE
status while not receiving and transmitting any data.
For the Terminate Resistor (RZ and TZ) will
compensate the resistance or Impedance that is
occurred in the line if it is very long line.
Code for writing program to configure operation
of UART-3 of RS422/485, we must use P0[0] and P0[1]
ETT CO.,LTD.
-20-
WWW.ETT.CO.TH
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
to be the connecting Pin and then use P1[19] to
control the direction of receiving and transmitting
data of RS485. Be careful, the Default value of the
UART-3 Circuit in LPC2368 is normally disabled; so,
if we want to enable operation of this circuit, we
must not forget to write command to enable operation
of UART-3 before setting configurations into circuit.
The method to enable operation of UART-3 is to be
controlled by Bit in Register PCONP as example below.
// Config UART-3(RS422/485) Connect to P0[0]:P0[1]
PINSEL0 &= 0xFFFFFFF0;
// Reset P0.0,P0.1 Pin Config
PINSEL0 |= 0x00000002;
// Select P0.0 = TxD(UART3)
PINSEL0 |= 0x00000008;
// Select P0.1 = RxD(UART3)
PCONP
|= 0x02000000;
// UART3 Power-ON
// Config P1.19 = Output Control Direction RS485
// P1.19 = "0" = Received RS485
// P1.19 = "1" = Transmit RS485
PINSEL3 &= 0xFFFF3FFF;
// P1.19 = GPIO
IODIR1
= 0x00080000;
// Pin Control Direction RS485 = Output
// Select Direction RS485 = Receive
IOCLR1
= 0x00080000;
// RS485 Direction = 0 (Receive)
// Select Direction RS485 = Transmit
IOSET1
= 0x00080000;
// RS485 Direction = 1 (Transmit)
Port I/O Connectors of Board
For Port I/O Connector of CPU is arranged
outwards, so it makes user be able to connect as
desired; in this case, there are 6 sets as follows;
• 2 Sets of IDE 10 Pin Connector; each set has 8
Bit
that
is
P2[0..7]
and
KEY4X4
(P0[4..7],P1[20..23]). Its signal arrangement is
shown below.
ETT CO.,LTD.
-21-
WWW.ETT.CO.TH
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
P2.0
P2.1
P0.4
P0.5
P2.2
P2.3
P0.6
P0.7
P2.4
P2.5
P1.20
P1.21
P2.6
P2.7
P1.22
P1.23
+3V3
GND
+3V3
GND
P2[0..7]
P0[4..7],P1[20..23]
• SPI-0 Connector is 1x6 Header that is connecting
point P0[15..18] for using it to be general GPIO
function or SPI Bus function as desired.
o P0.15 = SCK/SCK0
o P0.16 = SSEL/SSEL0
o P0.17 = MISO/MISO0
o P0.18 = MOSI/MOSI0
• I2C-0 Connector is 1x4 Header that is connecting
point P0[27..28] for using it to be general GPIO
function or I2C Bus function as desired.
o P0.27 = SDA0
o P0.28 = SCL0
• A/D Connector is 1x4 Header that is connecting
point P0[24..25] for using it to be general GPIO
function or A/D function as desired.
o P0.24 = AD0.1
o P0.25 = AD0.2
• D/A Connector is 1x3 Header that is connecting
point P0[26] for using it to be general GPIO
function or D/A(Aout) function as desired.
o P0.26 = AOUT or D/A
Power Supply Circuit
Power Supply Circuit can be used with 7-12V
AC/DC; in this case, we can interface Power Supply
into board at the connecting point that is Terminal
or Jack-DC as desired. This connecting Power Supply
ETT CO.,LTD.
-22-
WWW.ETT.CO.TH
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
will be sent to Bridge Rectifier Circuit and +3V3/3V
Regulate and +5V/800mA Regulate.
Power Supply Circuit in the part of 3.3V
Regulate Circuit will supply power into CPU and all
I/O Circuit of Board, except Character LCD and Line
Driver Circuit of RS422/485 because both devices use
+5VDC Power Supply from Regulate Circuit.
U3
LD1085
3
IN
OUT
7-12Vdc
D10
BRIDGE
3
+
C31
220uF/25V
C32
100n
IN
R49
560
+
C30
100n
U4
AP1117-5.0
GND
3
2
1
1
J13
2
C29
470uF/16V
1
1
2
+3V3
GND
J12
D9
PWR
+5V
OUT
2
+
C33
100uF/16V
C34
100n
How to Download Hex File into MCU of Board
The method to download Hex File into Flash
Memory of MCU in Board is to use Program Flash Magic
of “Embedded System Academy,Inc” that is connected
with MCU through Serial Port of computer PC. This
program can be downloaded free without any charge
from website www.esacademy.com.
Proceeding to Download Hex File into MCU
1. Interface RS232 Cable between RS232 Serial Port
of PC and Board UART-0.
2. Supply power into board; in this case, we can
see red LED PWR is in status ON.
3. Run Program Flash Magic; if it is version
4.02.260, it will display result as shown below.
ETT CO.,LTD.
-23-
WWW.ETT.CO.TH
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
4. Start setting the initial values into program as
desired; in this case, it is used with LPC2368
of Board CP-JR ARM7 LPC2368 of ETT, so we
configure values into program as follows;
2.1
2.2
2.3
2.4
2.5
ETT CO.,LTD.
Select COM port corresponding with the
COM Port Number that is used (in the
example, it is COM2).
Set Baud Rate in the range 2400-115200;
if setting very high Baud Rate and
Error is occurred, please reduce Baud
Rate. In this example, it uses Baud
Rate 19200.
Set Device to be LPC2368.
Set Interface to be None ISP.
Set
Crystal
Oscillator
with
MHz
corresponding with the value internal
-24-
WWW.ETT.CO.TH
User’s Manual of Board Microcontroller CP-JR ARM7 LPC2368
2.6
Board. In this case, it is 12.000MHz,
so we must set to be 12.
Press ISP LOAD Switch and RESET Switch
on Board “CP-JR ARM7 LPC2368” to reset
MCU to run in Boot Loader following the
processes;
ƒ Press ISP LOAD Switch and hold
ƒ Press RESET Switch while ISP LOAD
Switch is being held.
ƒ Remove RESET Switch but ISP LOAD
Switch is being held.
ƒ Lastly, remove ISP LOAD Switch.
5. Select format of erasing data to be “Erase all
Flash + Code Rd Prot”.
6. Set Option to be “Verify after programming”.
7. Click
“Browse”
to
select
HEX
File
for
downloading.
8. Click “Start”, Program Flash Magic will start
downloading data into MCU instantly. In this
case, we can see the status operation at Status
Bar and we must wait for the operation until it
is completely.
9. When the operation of program is complete, press
RESET Switch on Board and MCU will start running
follow the downloaded program instantly.
ETT CO.,LTD.
-25-
WWW.ETT.CO.TH
1
2
3
4
U1
LPC2368
C
P3.25
P3.26
+3V3
P4.28
P4.29
L1
BEAD
+
C1
10u
27
26
82
85
10
12
+3V3
13
42
84
C2
C3
100n 100n
C5
C6
C4
100n 100n 100n
B
38
39
40
43
44
45
21
20
+3V3
C10
C7
C8
C9
100n 100n 100n 100n
PMEG4005ET
D1
+3V3
D2
B1
3V
PMEG4005ET
28
54
71
96
19
15
31
41
55
72
97
83
11
P1.16/ENET-MDC
P1.17/ENET-MDIO
P1.18/USB_UP_LED/PWM1.1/CAP1.0
P1.19/CAP1.1
P1.20/PWM1.2/SCK0
P1.21/PWM1.3/SSEL0
P1.22/MAT1.0
P1.23/PWM1.4/MISO0
P0.8/I2STX_WS/MISO1/MAT2.2
P0.9/I2STX_SDA/MOSI1/MAT2.3
P0.10/TXD2/SDA2/MAT3.0
P0.11/RXD2/SCL2//MAT3.1
P0.15/TXD1/SCK0/SCK
P1.24/PWM1.5/MOSI0
P1.25/MAT1.1
P1.26/PWM1.6/CAP0.0
P1.27/CAP0.1
P1.28/PCAP1.0/MAT0.0
P1.29/PCAP1.1/MAT0.1
P1.30/USB_VBUS/AD0.4
P1.31/SCK1/AD0.5
P0.16/RXD1/SSEL0/SSEL
P0.17/CTS1/MISO0/MISO
P0.18/DCD1/MOSI0/MOSI
P0.19/DSR1/MCICLK/SDA1
P0.20/DTR1/MCICMD/SCL1
P0.21/RI1/MCIPWR/RD1
P0.22/RTS1/MCIDAT0/TDI
P0.23/AD0.0/I2SRX_CLK/CAP3.0
P0.24/AD0.1/I2SRX_WS/CAP3.1
P0.25/AD0.2/I2SRX_SDA/TXD3
P0.26/AD0.3/AOUT/RXD3
P0.27/SDA0
P0.28/SCL0
P0.29/USB_D+
P0.30/USB_D-
P3.25/MAT0.0/PWM1.2
P3.26/MAT0.1/PWM1.3
P4.28/MAT2.0/TXD3
P4.29/MAT2.1/RXD3
P2.0/PWM1.1/TXD1/TRACECLK
P2.1/PWM1.2/RXD1/PIPESTAT0
P2.2/PWM1.3/CTS1/PIPESTAT1
P2.3/PWM1.4/DCD1/PIPESTAT2
P2.4/PWM1.5/DSR1/TRACESYNC
P2.5/PWM1.6/DTR1/TRACEPKT0
P2.6/PCAP1.0/RI1/TRACEPKT1
P2.7/RD2/RTS1/TRACEPKT2
VDDA
VREFA
DC-DC_3.3V_VDD1
DC-DC_3.3V_VDD2
DC-DC_3.3V_VDD3
P2.8/TD2/TXD2/TRACEPKT3
P2.9/USB_CONNECT/RXD2/EXTINT0
P2.10/EINT0
P2.11/EINT1/MCIDAT1/I2STX_CLK
P2.12/EINT2/MCIDAT2/I2STX_WS
P2.13/EINT3/MCIDAT3/I2STX_SDA
VDD1
VDD2
VDD3
VDD4
TRST
TDI
TMS
TCK
RTCK
TDO
RSTOUT
RESET
VBAT
VSS1
VSS2
VSS3
VSS4
VSS5
VSS6
VSS7
VSSA
Y1
23
A
RTCX1
C11
22pF
12MHz
RTCX2
46
47
98
99
81
80
79
78
77
76
48
49
62
63
61
60
59
58
57
56
9
8
7
6
25
24
29
30
75
74
73
70
69
68
67
66
65
64
53
52
51
50
4
2
3
5
100
1
14
17
TXD3
RXD3
TXD0
RXD0
+3V3
P0.4
P0.5
P0.6
P0.7
CD
WP
TXD2
RXD2
P0.16
P0.17
P0.18
MCICLK
MCICMD
MCIPWR
MCIDAT0
P0.23
+3V3
P0.24
P0.25
P0.26
P0.27
P0.28
2
J2
1
2
3
18
C
SW1
P2.0
P2.1
P2.2
P2.3
P2.4
P2.5
P2.6
P2.7
ISP LOAD
C15
100n
+3V3
R3
1K
P0.15
P0.16
P0.17
P0.18
J3
1
2
3
4
5
6
J4
P2.0-P2.7
P2.0
P2.2
P2.4
P2.6
1
3
5
7
9
+3V3
P2.1
P2.3
P2.5
P2.7
2
4
6
8
10
SPI-0
+3V3
ISP_BOOT
MCIDAT1
MCIDAT2
MCIDAT3
+3V3
P0.27
P0.28
R2
47K
TRST
TDI
TMS
TCK
RTCK
TDO
RESET
+3V3
RESET
C16
100n
RESET
J5
1
2
3
4
I2C-0
SW2
P0.24
P0.25
16
C13
22pF
2
4
6
8
10
12
14
16
18
20
R8 R9 R10 R11
10K 10K 10K 10K
ISP_BOOT
J6
KEY4X4
P0.4
P0.6
P1.20
P1.22
1
3
5
7
9
+3V3
+3V3
J7
1
2
3
4
P0.26
P0.5
P0.7
P1.21
P1.23
2
4
6
8
10
B
J8
1
2
3
D/A
A/D
Y2
32.768KHz
C14
22pF
Title
Size
C12
22pF
A4
Date:
File:
1
1
3
5
7
9
11
13
15
17
19
R1
22K
USB_D+
USB_D-
RESET
J1
JTAG
TRST
TDI
TMS
TCK
RTCK
TDO
RESET
P0.15
P2.8
USB_CON
D
R4 R5 R6 R7
10K 10K 10K 10K
RUN/DEBUG
LCD_DB4
LCD_DB5
LCD_DB6
LCD_DB7
LCD_RS
LCD_RW
USB_VBUS
LCD_EN
87
86
32
33
34
35
36
37
P0.0/RD1/TXD3/SDA1
P0.1/TD1/RXD3/SCL1
P0.2/TXD0
P0.3/RXD0
P0.4/I2SRX_CLK/RD2/CAP2.0
P0.5/I2SRX_WS/TD2/CAP2.1
P0.6/I2SRX_SDA/SSEL1/MAT2.0
P0.7/I2STX_CLK/SCK1/MAT2.1
XTAL1
ENET-MDC
ENET-MDIO
USB_LED
DIR_485
P1.20
P1.21
P1.22
P1.23
P1.0/ENET-TXD0
P1.1/ENET-TXD1
P1.4/ENET-TX_EN
P1.8/ENET-CRS
P1.9/ENET-RXD0
P1.10/ENET-RXD1
P1.14/ENET-RX_ER
P1.15/ENET-RX_CLK
22
D
95
94
93
92
91
90
89
88
XTAL2
ENET-TXD0
ENET-TXD1
ENET-TX_EN
ENET-CRS
ENET-RXD0
ENET-RXD1
ENET-RX_ER
ENET-RX_CLK
3
A
CP-JR ARM7 LPC2368
Number
ETT CO.,LTD.(WWW.ETT.CO.TH)
31-Jan-2008
D:\My Circuit\LPC2368.Ddb
Revision
1.0
Sheet 1 of 4
Drawn By:
4
1
2
+3V3
3
R16
ENET-RXD0
ENET-RXD1
+3V3
PFBIN2
RX_CLK
RX_DV/MII_MODE
CRS/CRS_DV/LED_CFG
RX_ER/MDIX_EN
COL/PHYAD0
RXD_0/PHYAD1
RXD_1/PHYAD2
RXD_2/PHYAD3
RXD_3/PHYAD4
IOGND
IOVDD33
ENET-RX_CLK
R15
4K87 1%
U2
DP83848
C19
RBIAS
PFBOUT
AVDD33
NC
NC
AGND
PFBIN1
TD+
TDAGND
RD+
RD-
+3V3
+
100n
24
C20
23
10u
22
21
20
19
C21 100n
18 PFBOUT
17
16
15
14
13
R17 R18
2K2 2K2
R19
50
ENET-TX_EN
ENET-TXD0
ENET-TXD1
B
+3V3
+3V3
1
C23
100n
R20
50
R21
50
C24
100n
C25
100n
C26
100n
J9
RJ45_PRJ-005
TD+
4
CT
2
TD-
3
RD+
5
CT
6
RD-
C
TX+
TX-
1CT:1
RX+
RXR22
50
1
2
3
4
5
6
7
8
9
10
11
12
C22
100n
100Mb
R23
+3V3
1
2
3
6
4
5
+3V3
7
8
NC
+3V3
10K
R24
D4
LED_LINK
B
CHS GND
+3V3
8
2K2
D
R14
7
+3V3
ENET-CRS
ENET-RX_ER
37
38
39
40
41
42
43
44
45
46
47
48
2K2
680
+3V3
36
35
34
50 MHz
33
32
31
30
29
28 LED_LINK
27 LED_SPEED
26 LED_ACT
25
GND OUT
OSC1
50MHz
DGND
IOGND
X1
X2
IOVDD33
MDC
MDIO
RESET_N
LED_LINK/AN0
LED_SPEED/AN1
LED_ACT/COL/AN_EN
25MHZ_OUT
2
D3
TK_CLK
TX_EN
TXD_0
TXD_1
TXD_2
TXD_3/SNI_MODE
PWR_DOWN/INT
NC
NC
NC
NC
NC
C
1
+3V3
R13
PFBOUT
+3.3V E/D
PFBOUT
C18
100n
ENET-MDC
ENET-MDIO
RESET
10K
4
100n
4
R12
C17
D
3
2K2
R25
110
LINK
R26
LED_ACT
D5
2K2
R27
110
ACT
Title
A
Size
A4
Date:
File:
1
2
3
A
CP-JR ARM7 LPC2368
Number
ETT CO.,LTD.(WWW.ETT.CO.TH)
31-Jan-2008
D:\My Circuit\LPC2368.Ddb
Revision
1.0
Sheet 2 of 4
Drawn By:
4
1
D
R28
10K
RS
R29
10K
EN
R30
10K
R28-R34=NA
10K
D4
R32
10K
D5
R33
10K
D6
R34
10K
D7
4
R66,R67 = NA
3
4
22K
P2
10K Contrast
+5V
2
+3V3
LCD_RS
LCD_EN
LCD_DB5
LCD_DB7
+5V
RS
EN
D1
D3
D5
D7
1
3
5
7
9
11
13
GND
VO
RW
D0
D2
D4
D6
2
4
6
8
10
12
14
6
N
R37
LCD_RW
Q1
FDC6327
3K3
LCD_DB4
LCD_DB6
+
C27 C28
10u 100n
CD
9
1
2
3
4
5
6
7
8
WP
MCIDAT0
MCIDAT1
CN1
SD-CARD
DAT2
CD/DAT3
CMD
VSS
VDD
CLK
VSS
DAT0
DAT1
C
C
D7
UGL
R40 +3V3
560
USB_LED
+5V-USB
USB_CON
J11
U3
LD1085
3
+3V3
OUT
D10
BRIDGE
7-12Vdc
3
+
C31
220uF/25V
C32
100n
IN
1
2
3
R42
2K2
C30
100n
R43
2K2
USB_VBUS
R45
1K5
D9
PWR
R46
560
R44
3K3
B
D8
USC
+5V-USB
OUT
USB_DUSB_D+
+
C33
100uF/16V
R47
33
+5V
2
Title
Size
A4
Date:
File:
3
1
D- 2
D+ 3
4
R48
33
C34
100n
A
2
Q2
BC807
UMODE
R49
C35
18pF
1
R41
10K
560
C29
470uF/16V
U4
AP1117-5.0
GND
3
2
1
1
J13
2
+
1
1
2
IN
GND
J12
B
D
D6
SD
3K3
ET-CLCD (5V)
+3V3
R36
10K
MCICLK
R39
560
R66
MCIPWR
WP
J26
+3V3
MCIDAT2
MCIDAT3
MCICMD
5
1
J10
R35
10K
CD
R67
0 SD/VDD
P
R38
RW
R31
3
1
2
3
+3V3
2
J14
USB PORT_B
C36
18pF
A
CP-JR ARM7 LPC2368
Number
ETT CO.,LTD.(WWW.ETT.CO.TH)
31-Jan-2008
D:\My Circuit\LPC2368.Ddb
Revision
1.0
Sheet 3 of 4
Drawn By:
4
1
2
R50
+3V3
3
+3V3
+3V3
+3V3
10
SP1
SPEAKER
D
R53
560
D11
LL4148
R54
560
R55
P1
10K
470
R51
Q3
BC817
1K
D
P0.23
D12
P3.25
P2.8
4
+5V
D13
P3.26
P3.25
J16
3
2
1
P3.26
R52
10K
J15
RL
+3V3
R56
10K
P4.28
R58
R57
10K
P4.29
1K
R59
1
2
3
4
1K
SW3
P4.28
SW4
P4.29
U6
75176
R
RE
DE
D
VCC
B
A
GND
1
2
3
B
U5
C1+
VCC
16
C39
100n
C38
100n
3
4
C40
100n
5
12
11
9
10
RXD2
TXD2
RXD0
TXD0
+5V
C1-
V+
C2+
V-
C2-
GND
R1O
T1I
R2O
T2I
R1I
T1O
R2I
T2O
13
14
8
7
J20
U7
75176
+3V3
R
RE
DE
D
VCC
B
A
GND
RXRX+
TXTX+
1
2
3
4
5
6
8
7
6
5
R63
1K
R64
1K
R65
120
J21
TH
J23
1
2
3
1
2
3
J22
+5V
1
2
3
TZ
TL
J25
DOWNLOAD
Title
1
2
3
4
Size
A4
Date:
File:
2
J18
RS422/485
B
1
2
3
4
RXD-0
TXD-0
1
+5V
100n
J24
UART-2
RXD-2
TXD-2
ICL3232
A
1
2
3
4
6
+3V3
R62
120
+5V
TXD3
C41
100n
R61
1K
C
DIR_485
2
15
R60
1K
J19
422/485
C37
100n
+5V
8
7
6
5
C43
RXD3
1
2
3
1
3
2
1
100n
FULL/HALF
+3V3
J17
RZ
+3V3
C42
C
RH
3
2
1
3
A
CP-JR ARM7 LPC2368
Number
ETT CO.,LTD.(WWW.ETT.CO.TH)
31-Jan-2008
D:\My Circuit\LPC2368.Ddb
Revision
1.0
Sheet 4 of 4
Drawn By:
4