Moxa Technologies EM-1240-LX User Manual

EM-1240-LX User’s Manual
www.moxa.com/product
First Edition, November 2006
Moxa Systems Co., Ltd.
Tel: +886-2-8919-1711 Fax: +886-2-8919-1722
Web:
Moxa Technical Support
Worldwide: The Americas
www.moxa.com
support@moxa.com support@usa.moxa.com
EM-1240-LX User’s Manual
The software described in this manual is furnished under a license agreement and may be used only in
accordance with the terms of that agreement.
Copyright Notice
Copyright © 2006 Moxa Systems Co., Ltd.
All rights reserved.
Reproduction without permission is prohibited.
Trademarks
Moxa is a registered trademark of The Moxa Group.
All other trademarks or registered marks in this manual belong to their respective manufacturers.
Disclaimer
Information in this document is subject to change without notice and does not represent a commitment on the part of Moxa.
Moxa provides this document “as is,” without warranty of any kind, either expressed or implied, including, but not limited to, its particular purpose. Moxa reserves the right to make improvements and/or changes to this manual, or to the products and/or the programs described in this manual, at any time.
Information provided in this manual is intended to be accurate and reliable. However, Moxa assumes no responsibility for its use, or for any infringements on the rights of third parties that may result from its use.
This product might include unintentional technical or typographical errors. Changes are periodically made to the information herein to correct such errors, and these changes are incorporated into new editions of the publication.
Table of Contents
Chapter 1 Introduction..................................................................................................1-1
Overview.................................................................................................................................. 1-2
Package Checklist .................................................................................................................... 1-2
Product Features ...................................................................................................................... 1-2
Product Specifications ............................................................................................................. 1-3
Hardware Specifications............................................................................................... 1-3
Software Specifications ................................................................................................ 1-4
Hardware Block Diagram ........................................................................................................ 1-5
Appearance .............................................................................................................................. 1-5
Dimensions .............................................................................................................................. 1-7
Installing the EM-1240-LX...................................................................................................... 1-8
LED Indicators......................................................................................................................... 1-8
Wiring Requirements............................................................................................................... 1-8
Connecting the Power................................................................................................... 1-9
Grounding the EM-1240-LX ........................................................................................ 1-9
Connecting Data Transmission Cables .................................................................................... 1-9
Connecting to the Network......................................................................................... 1-10
Connecting to a Serial Device .................................................................................... 1-10
Serial Console Port ..................................................................................................... 1-11
Internal SD Socket ..................................................................................................................1-11
Additional Functions...............................................................................................................1-11
Reset Button ............................................................................................................... 1-11
Real-time Clock.......................................................................................................... 1-12
Chapter 2 Getting Started.............................................................................................2-1
Powering on the EM-1240-LX ................................................................................................ 2-2
Connecting the EM-1240-LX to a PC...................................................................................... 2-2
Console Port ................................................................................................................. 2-2
Telnet............................................................................................................................ 2-3
Configuring the Ethernet Interface .......................................................................................... 2-4
Installing a Secure Digital (SD) Memory Card........................................................................ 2-6
Developing Your Applications................................................................................................. 2-7
Installing the EM-1240-LX Tool Chain ....................................................................... 2-7
Compiling Hello.c ........................................................................................................ 2-9
Uploading “Hello” to the EM-1240-LX ..................................................................... 2-10
Running “Hello” on the EM-1240-LX ....................................................................... 2-11
Make File Example Code ........................................................................................... 2-12
Chapter 3 Software Package ........................................................................................3-1
EM-1240-LX Software Architecture ....................................................................................... 3-2
Journaling Flash File System (JFFS2).......................................................................... 3-3
EM-1240-LX Software Package.............................................................................................. 3-4
Chapter 4 Configuring the EM-1240-LX.......................................................................4-1
Enabling and Disabling Daemons............................................................................................ 4-2
Adding a Web Page.................................................................................................................. 4-3
IPTABLES............................................................................................................................... 4-3
NAT.......................................................................................................................................... 4-7
NAT Example............................................................................................................... 4-7
Enabling NAT at Bootup.............................................................................................. 4-7
Configuring Dial-in/Dial-out Service ...................................................................................... 4-8
Dial-out Service............................................................................................................ 4-8
Dial-in Service.............................................................................................................. 4-8
Configuring PPPoE.................................................................................................................. 4-8
How to Mount a Remote NFS Server ...................................................................................... 4-9
Dynamic Driver Module Load/Unload.................................................................................... 4-9
Upgrading the Kernel............................................................................................................. 4-10
Upgrading the Root File System & User Directory................................................................4-11
User Directory Backup—EM-1240-LX to PC....................................................................... 4-12
Loading Factory Defaults ...................................................................................................... 4-13
Mirroring the Application Program and Configuration.......................................................... 4-13
Autostarting User Applications on Bootup ............................................................................ 4-13
Checking the Kernel and Root File System Versions............................................................. 4-13
Chapter 5 EM-1240-LX Device API...............................................................................5-1
RTC (Real-time Clock)............................................................................................................ 5-2
Buzzer ...................................................................................................................................... 5-2
UART Interface........................................................................................................................ 5-2
Chapter 6 UC Finder......................................................................................................6-1
Windows UC Finder ................................................................................................................ 6-2
Linux UC Finder...................................................................................................................... 6-5
Appendix A System Commands.....................................................................................A-1
busybox: µClinux normal command utility collection............................................................ A-1
File manager ................................................................................................................ A-1
Editor ........................................................................................................................... A-1
Network ....................................................................................................................... A-2
Process......................................................................................................................... A-2
Other............................................................................................................................ A-2
Moxa Special Utilities ................................................................................................. A-2
Appendix B SNMP Agent with MIB II & RS-232 Like Group......................................... B-1
Appendix C EM-1240-LX FAQ .........................................................................................C-1
Appendix D Service Information.....................................................................................D-1
Moxa Internet Services ........................................................................................................... D-2
Problem Report Form ............................................................................................................. D-3
Product Return Procedure....................................................................................................... D-4
1
1

Chapter 1 Introduction

The Moxa EM-1240-LX Series of Mini RISC-based Ready-to-Run Embedded Computer features dual 10/100 Mbps Ethernet ports and four RS-232/422/485 serial ports in a built-in µClinux ARM9 module. In addition, EM-1240-LX provides SD memory card for storage expansion, offers high performance communication and unlimited storage in a super compact, palm-size module. EM-1240-LX is an ideal solution for embedded applications that use a lot of memory and must be housed in a small physical space without sacrificing performance. This chapter covers the following topics:
Overview Package Checklist Product Features Product Specifications
¾ Hardware Specifications
¾ Software Specifications Hardware Block Diagram Appearance Dimensions Installing the EM-1240-LX LED Indicators Wiring Requirements
¾ Connecting the Power
¾ Grounding EM-1240-LXConnecting Data Transmission Cables
¾ Connecting to the Network
¾ Connecting to a Serial Device
¾ Serial Console PortInternal SD Socket
Additional Functions
¾ Reset Button
¾ Real-time Clock
EM-1240-LX User’s Manual Introduction

Overview

The EM-1240-LX Series of mini RISC-based communication platforms are ideal for your embedded applications. The EM-1240-LX comes with 4 RS-232/422/485 serial ports and dual 10/100 Mbps Ethernet LAN ports to provide users with a versatile communication platform.
The EM-1240-LX uses the MOXA ART ARM9 RISC CPU. Unlike the X86 CPU, which uses a CISC design, the ARM9’s RISC design architecture and modern semiconductor technology provide the EM-1240-LX with a powerful computing engine and communication functions, but without generating too much heat. The built-in 8 MB NOR Flash ROM and 16 MB SDRAM give you enough storage capacity and an additional SD socket provides you with flexible storage expansion to run applications. The dual LAN ports built into the ARM9 make the EM-1240-LX an ideal communication platform for some of the simple data acquisition and protocol conversion applications, and the two RS-232/422/485 serial ports allow you to connect a variety of serial devices.
The pre-installed µClinux operating system provides an open software operating system for software program development. Software written for desktop PCs is easily ported to the EM-1240-LX by using a GNU cross complier, so that you will not need to spend time modifying existing software code. The operating system, device drivers, and your own software can all be stored in the EM-1240-LX’s Flash memory.

Package Checklist

EM-1240-LX
Mini RISC-based ready-to-run embedded computer with 4 serial ports, dual Ethernet, SD, μClinux OS.
EM-1240-LX Series products are shipped with the following items:
1 EM-1240 embedded module
1 EM-1240 Development Kit (optional)
Quick Installation Guide
Document & Software CD
Cross-over Ethernet cable
CBL-RJ45M9-150: 150 cm, 8-pin RJ45 to male DB9 serial port cable
CBL-RJ45F9-150: 150 cm, 8-pin RJ45 to female DB9 console port cable
Power cord
Product Warranty Statement
NOTE: Notify your sales representative if any of the above items are missing or damaged.

Product Features

EM-1240-LX Series products have the following features:
MOXA ART ARM9 32-bit 192 MHz communication processor
On-board 16 MB RAM, 8 MB Flash ROM
4 software-selectable RS-232/422/485 serial ports
2 10/100 Mbps Ethernet
RS-232 console full signal and PPP supported
Ready-to-run μCLinux Kernel 2.6.9 communication platform
SD signal supported
1-2
EM-1240-LX User’s Manual Introduction

Product Specifications

Hardware Specifications

Model CPU RAM Flash LAN LAN Protection
Serial Port
Serial Console Storage Expansion
EM-1240 Embedded Module
MOXA ART ARM9 32-bit 192 MHz processor
16 MB
8 MB
Auto-sensing 10/100 Mbps x 2
Built-in 1.5 KV magnetic isolation
Four serial ports supporting RS-232/422/485 signals
RS-232 signals: TxD, RxD, DTR, DSR, RTS, CTS, DCD, GND
RS-422 signals: TxD+, TxD-, RxD+, RxD-, GND
4 wire RS-485 signals: TxD+, TxD-, RxD+, RxD-, GND
2 wire RS-485 signals: Data+, Data-, GND
Serial Protection: 15 KV ESD for all signals
Data bits: 5,6,7,8
Stop bits: 1,1.5,2
Parity: None, even, odd, space, mark
Flow Control: RTC/CTS, XON/XOFF
Speed: 50 bps to 921.6 Kbps, support Any Baudrate
RS-232 x 1, TxD, RxD, DTR, DSR, RTS, CTS, DCD, GND
SD signals for external Secure Digital (SD) socket connection
GPIO Real-time Clock Watchdog T imer Buzzer Signals
LED Signals
Reset Signal Power Input Dimensions (W x L) Operating temperature Storage temperature Module Interface
GPIO x 10 (to enable GPIO, SD must be disabled.)
Ye s
Ye s
Buzzer signals reserved for external buzzer connection
LAN 10/100 x 2 on LAN Connector
Reserve signals for the following LED connection:
System Ready x 1
Serial Port Status x 4 pairs (TxD, RxD, 2 for each pair)
Reserve signal for external “Reset to Default” button connection
Accept external 5 VDC through pin header
90 x 80 mm
-10 to 60
-20 to 80
Two 2 x 28 pin-header, pitch: 1.27 x 1.27 (mm)
o
C(14 to 141oF), 5 to 95%RH
o
C(-4 to 176oF), 5 to 95%RH
1-3
EM-1240-LX User’s Manual Introduction

Software Specifications

Kernel
Protocol Stack
File System
Msh pppd PPPoE snmpd busybox Tinylogin Telnetd telnet inetd ftpd ftp boa ntpdate
Linux Tool Chain
Windows Tool Chain
UC Finder
µClinux Kernel 2.6.9 Supports dynamic driver module load / unload
ARP, ICMP, IPV4, TCP, UDP, FTP, Telnet, SNMP V1/V2c, HTTP, CHAP, PAP, DHCP, NTP, NFS V2/V3, SMTP, Telnet, FTP, PPP, PPPoE
JFFS2 for Kernel, Root File System (Read Only) and User Directory (Read / Write)
Minix shell command
Dial in/out over serial port daemon
Point-to-Point over Ethernet daemon
SNMP V1/V2c Agent daemon
Linux normal command utility
login and user manager utility
Telnet server daemon
Telnet client program
TCP server manager program
FTP server program
FTP client program
Web server daemon
Network Time Protocol client utility
Tool Chain
Arm-elf-gcc (V2.95.3): C/C++ PC Cross Compiler uClibc (V0.9.26): POSIX standard C library
Arm-elf-gcc (V2.95.3): C/C++ PC Cross Compiler uClibc (V0.9.26): POSIX standard C library
UC’s LAN IP broadcast searching utility for Windows and Linux
1-4
EM-1240-LX User’s Manual Introduction

Hardware Block Diagram

Appearance

EM-1240 Embedded Module + Development Kit
EM-1240
Development Kit
EM-1240
Embedded Module
1-5
EM-1240-LX User’s Manual Introduction
EM-1240 Embedded Module
EM-1240 Development Kit
1-6
EM-1240-LX User’s Manual Introduction

Dimensions

EM-1240 Embedded Module.
EM-1240 Development Kit
1-7
EM-1240-LX User’s Manual Introduction

Installing the EM-1240-LX

If you would like to use the EM-1240 Embedded Module and the EM-1240 Development Kit, insert the EM-1240 Embedded Module vertically onto the Development Kit. Note that the pin marked “JP4” on the Embedded Module must be matched with the pin marked “JP6” on the Development Kit; and the Pin marked “JP3” on the Embedded Module must be matched with the Pin marked “JP4” on the Development Kit. Be careful when inserting the module to avoid damaging the product.

LED Indicators

The following table explains the function of the five LED indicators located on the EM-1240-LX’s top panel.
LED Name LED Color LED Function
Ready Green Power is on and functioning normally.
Green Serial port 1 or 2 is transmitting data. P1/P2 (Tx)
Off Serial port 1 or 2 is not transmitting data.
Yellow Serial port 1 or 2 is receiving data. P1/P2 (Rx)
Off Serial port 1 or 2 is not receiving data.

Wiring Requirements

This section describes how to connect the EM-1240-LX to serial devices.
You should heed the following common safety precautions before proceeding with the installation of any electronic device:
y Use separate paths to route wiring for power and devices. If power wiring and device wiring
paths must cross, make sure the wires are perpendicular at the intersection point.
NOTE: Do not run signal or communication wiring and power wiring in the same wire
conduit. To avoid interference, wires with different signal characteristics should be routed separately.
y Use the type of signal transmitted through a wire to determine which wires should be kept
separate. The rule of thumb is that wiring that shares similar electrical characteristics can be bundled together.
y Keep input wiring and output wiring separate. y It is advisable to label the wiring to all devices in the system.
1-8
EM-1240-LX User’s Manual Introduction
ATTENTION
Safety First!
Be sure to disconnect the power cord before installing and/or wiring your EM-1240-LX.
Wiring Caution!
Calculate the maximum possible current in each power wire and common wire. Observe all electrical codes dictating the maximum current allowable for each wire size.
If the current goes above the maximum ratings, the wiring could overheat, causing serious damage to your equipment.
Temperature Caution!
Be careful when handling the EM-1240-LX. When plugged in, the EM-1240-LX’s internal components generate heat, and consequently the outer casing may feel hot to the touch.

Connecting the Power

Connect the “live-wire” end of the 12-48 VDC power adapter to the EM-1240-LX’s terminal block. If the power is properly supplied, the “Ready” LED will glow a solid green after a 25 to 30 second delay.

Grounding the EM-1240-LX

Grounding and wire routing help limit the effects of noise due to electromagnetic interference (EMI). Run the ground wire from the ground screw to the grounding surface prior to connecting devices.
ATTENTION
This product should be mounted to a well-grounded mounting surface such as a metal panel.
SG
V+V-
12-48V
SG: The Shielded Ground (sometimes called
Protected Ground) contact is the left most contact of the 3-pin power terminal block connector when viewed from the angle shown here. Connect the SG wire to an appropriate grounded metal surface.

Connecting Data Transmission Cables

This section describes how to connect the EM-1240-LX to the network, serial devices, and serial COM terminal.
1-9
EM-1240-LX User’s Manual Introduction

Connecting to the Network

Connect one end of the Ethernet cable to the EM-1240-LX’s 10/100M Ethernet port and the other end of the cable to the Ethernet network. If the cable is properly connected, the EM-1240-LX will indicate a valid connection to the Ethernet in the following ways:
y The top-right LED on the connector glows a solid green when connected to a 100 Mbps
Ethernet network.
y The top-left LED on the connector glows a solid orange when connected to a 10 Mbps
Ethernet network.
y The LEDs will flash when Ethernet packets are being transmitted or received.
The 10/100 Mbps Ethernet LAN 1 and LAN 2 ports use 8-pin RJ45 connectors. Pinouts for these ports are given in the following diagram.
8-pin RJ45
10 Mbps indicator
1
100 Mbps indicator
8
Pin Signal
1 ETx+ 2 ETx­3 ERx+ 4 --­5 --­6 ERx­7 --­8 ---

Connecting to a Serial Device

Connect the serial cable between the EM-1240-LX and the serial device(s).
Serial ports P1 and P2 use male DB9 connectors, and can be configured for RS-232/422/485 by software. The pin assignments are shown in the following table:
DB9 Male Port
12345
6789
RS-232/422/485 Pinouts
Pin RS-232 RS-422
1 DCD TxDA(-) TxDA(-) --­2 RxD TxDB(+) TxDB(+) --­3 TxD RxDB(+) RxDB(+) DataB(+) 4 DTR RxDA(-) RxDA(-) DataA(-) 5 GND GND GND GND 6 DSR --- --- --­7 RTS --- --- --­8 CTS --- --- ---
RS-485
(4-wire)
RS-485
(2-wire)
1-10
EM-1240-LX User’s Manual Introduction

Serial Console Port

The serial console port is a 4-pin pin-header RS-232 port. It is designed for serial console terminals, which are useful for identifying the EM-1240-LX boot up message.
Serial Console Port & Pinouts
4 3 2 1
Pin Signal
1 TxD 2 RxD 3 NC 4 GND

Internal SD Socket

The EM-1240-LX provides an internal SD socket for storage expansion. It allows users to plug in a
Secure Digital (SD) memory card compliant with the SD 1.0 standard for up to 1 GB of additional memory space. To install an additional SD card, you must first remove the EM-1240-LX’s outer cover to access the slot. The internal SD socket is located at the backside of the EM-1240-LX bottom board; you can find the SD plug-in slot at the right of the EM-1240-LX, lower than the cover screw. Plug the SD card into the socket directly and remember to press the SD card first if you want to take it out. Please note that the SD function shares the same chipset with DIO. If you would like to enable SD function, the DIO must be disabled. If you would like to enable DIO, the SD function must be disabled.

Additional Functions

Serial Console Cable

Reset Button

Press the Reset button on the EM-1240-DK continuously for at least 5 seconds to load the factory
default configuration. After the factory default configuration has been loaded, the system will reboot automatically. We recommend that you only use this function if the software is not working properly and you want to load factory default settings. To reset an embedded Linux system, always
use the software reboot command />reboot to protect the integrity of data being transmitted or
processed. The Reset button is not designed to hard reboot the EM-1240 Development Kit.
1-11
EM-1240-LX User’s Manual Introduction
ATTENTION
Resetting to factory defaults will not format the user directory and erase all of the user’s data. Loading factory defaults will only load the configuration file. The files in the EM-1240-LX that will be replaced include:
a. /etc/boa.conf b. /etc/hosts c. /etc/inittab d. /etc/password e. /etc/ramfs.img f. /etc/resolv.conf g. /etc/version h. /etc/group i. /etc/inetd.conf j. /etc/motd k. /etc/protocols l. /etc/rc m. /etc/services
n. /home/httpd/index.html
ATTENTION
This function only takes effect when the user directory is working correctly. If the user directory has crashed, the kernel will automatically load the factory defaults.

Real-time Clock

The EM-1240-LX’s real time clock is powered by a lithium battery. We strongly recommend that you do not replace the lithium battery without the help of Moxa’s support team. If the battery needs to be changed, contact the Moxa RMA service team for RMA service.
ATTENTION
The battery may explode if replaced by an incorrect type. To avoid this potential danger, always be sure to use the correct type of battery.
1-12
2
2

Chapter 2 Getting Started

In this chapter, we explain the basic procedure for getting the EM-1240-LX connected and ready for your needs.
In this chapter, we cover the following topics:
Powering on the EM-1240-LX Connecting the EM-1240-LX to a PC
¾ Console Port
¾ Telnet Configuring the Ethernet Interface Installing a Secure Digital (SD) Memory Card Developing Your Applications
¾ Installing the EM-1240-LX Tool Chain
¾ Compiling Hello.c
¾ Uploading “Hello” to the EM-1240-LX
¾ Running “Hello” on the EM-1240-LX
¾ Make File Sample Code
EM-1240-LX User’s Manual Getting Started

Powering on the EM-1240-LX

Connect the SG wire to the Shielded Contact located on the upper left corner of the EM-1240-LX, and then power on the EM-1240-LX by connecting the power adaptor. It takes about 16 seconds for the system to boot up. Once the system is ready, the Ready LED will light up.
ATTENTION
After connecting the EM-1240-LX to the power supply, it will take about 16 seconds for the operating system to boot up. The green Ready LED will not turn on until the operating system is ready.

Connecting the EM-1240-LX to a PC

There are two ways to connect the EM-1240-LX to a PC.

Console Port

The serial console port offers users a convenient means of connecting to the EM-1240-LX. This method is particularly useful when using the EM-1240-LX for the first time. Since the communication is over a direct serial connection, you do not need to know either of the IP addresses in order to make contact.
Use the serial console port settings shown on the right. Once the connection is established, the following window will open.
Serial Console Port Settings
Baudrate Parity Data bits Stop bits Flow Control Terminal
19200 bps
None
8
1
None
VT100
2-2
EM-1240-LX User’s Manual Getting Started

Telnet

If you know at least one of the two IP addresses and netmasks, then you can use Telnet to connect to the EM-1240-LX’s console.
Telnet can be used locally by using a crossover Ethernet cable to connect your computer to the EM-1240-LX, or over a LAN or the Internet. The default IP addresses and netmasks are shown above. To login, type the Login name and password as requested. The defaults are:
Login: root Password: root
LAN 1 LAN 2
Default IP Address Default Netmask
192.168.3.127 255.255.255.0
192.168.4.127 255.255.255.0
Once you open the “msh command shell” you can proceed to configure the EM-1240-LX’s network settings, as described in the next section.
ATTENTION
y Serial Console Reminder: Remember to choose VT100 as the terminal type. Use the
CBL-RJ45F9-150 cable that comes with the EM-1240-LX to connect to the serial console
port. If you are not able to conect on the first try, unplug and then re-plug the EM-1240-LX’s
power cord.
y Telnet Reminder: When connecting to the EM-1240-LX over a LAN, you must configure
your PC’s Ethernet card to be on the same subnet as the EM-1240-LX you wish to contact.
2-3
EM-1240-LX User’s Manual Getting Started

Configuring the Ethernet Interface

In this section, we use the serial console to explain how to modify the EM-1240-LX’s network settings.
1. Change directories by issuing the command cd /etc.
2. Type the command vi rc to use the VI Editor to edit the configuration file. The IP addresses
for the EM-1240-LX’s LAN1 and LAN2 are given as
ifconfig eth0 192.168.3.127
ifconfig eth1 192.168.4.127
as shown in the following figure. Edit these two lines to modify the static IP addresses.
2-4
Loading...
+ 44 hidden pages