Table of Contents Chapter 1 Introduction ....................1-1 Overview..........................1-2 Ordering Information ....................... 1-2 Product Specifications ......................1-3 Hardware Specifications....................1-3 Software Specifications ....................1-4 Hardware Block Diagram ......................1-5 Appearance ..........................1-6 Dimensions ..........................1-7 Installing the EM-1220-LX...................... 1-7 LED Indicators......................... 1-7 Wiring Requirements .......................
Page 4
Configuring Dial-in/Dial-out Service ..................4-8 Dial-out Service......................4-8 Dial-in Service......................4-8 Configuring PPPoE........................4-9 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 Loading Factory Defaults ......................
Introduction Chapter 1 The Moxa EM-1220-LX is a mini RISC-based ready-to-run embedded module that features dual 10/100 Mbps Ethernet ports and two RS-232/422/485 serial ports in a µClinux ARM9 module. In addition, the EM-1220-LX supports an external SD socket for installing an SD memory card for storage expansion, and offers high performance communication and unlimited storage in a super compact, palm-sized module.
EM-1220 LX User’s Manual Introduction Overview The EM-1220-LX is a mini RISC-based communication platform that is ideal for embedded applications. The EM-1220-LX supports 2 RS-232/422/485 serial ports and dual 10/100 Mbps Ethernet LAN ports to provide users with a versatile communication platform.
EM-1220 LX User’s Manual Introduction -20 to 80°C (-4 to 176°F), 5 to 95% RH Storage temperature -40 to 85°C (-40 to 185°F) is optional for EM-1220-T model Two 2 × 17 pin-headers; pitch: 2.5 × 2.5 mm Module Interface Software Specifications µClinux Kernel 2.6.9...
EM-1220 LX User’s Manual Introduction Dimensions EM-1220-LX Embedded Module 80cm 50cm EM-1220-DK Carrier Board Installing the EM-1220-LX To use the EM-1220-LX Development Kit, insert the EM-1220-LX embedded module vertically onto the development kit. Note that the pin marked “J2” on the embedded module must be matched with the pin marked “J2”...
EM-1220 LX User’s Manual Introduction Wiring Requirements This section describes how to connect the EM-1220-LX to serial devices. Be sure to heed the following common safety precautions before proceeding with the installation of any electronic device: 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.
EM-1220 LX User’s Manual Introduction ATTENTION This product should be mounted to a well-grounded mounting surface such as a metal panel. 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.
EM-1220 LX User’s Manual Introduction Connecting to a Serial Device Connect the serial cable between the EM-1220-DK and the serial device(s). Serial ports P1 and P2 on EM-1220-DK use male DB9 connectors, and can be configured for RS-232, RS-422, or RS-485 by software. The pin assignments are shown in the following table:...
EM-1220 LX User’s Manual Introduction Additional Functions Reset Button Press the Reset button on the EM-1220-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.
Getting Started Chapter 2 In this chapter, we explain the basic procedure for getting the EM-1220-LX connected and ready for use. In this chapter we cover the following topics: Powering on the EM-1220-DK Connecting the EM-1220-LX to a PC Console Port Telnet Configuring the Ethernet Interface Installing a Secure Digital (SD) Memory Card...
EM-1220 LX User’s Manual Getting Started Powering on the EM-1220-DK Connect the SG wire to the Shielded Contact located on the upper left corner of the EM-1220-DK, and then power on the EM-1220-DK by connecting the power adaptor. It takes about 16 seconds for the system to boot up.
EM-1220 LX User’s Manual Getting Started Telnet If you know at least one of the Default IP Address Default Netmask two IP addresses and netmasks, then you can use Telnet to LAN 1 192.168.3.127 255.255.255.0 connect to the EM-1220-LX’s LAN 2 192.168.4.127...
EM-1220 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-1220-LX’s network settings. 1. Change directories by issuing the command cd /etc. Type the command vi rc to use VI Editor to edit the configuration file. The IP addresses for the EM-1220-LX’s LAN1 and LAN2 are:...
Page 20
EM-1220 LX User’s Manual Getting Started 2. You may also configure the EM-1220-LX to request IP addresses from a DHCP server. In this case, use the sharp sign (#) to comment out one or both “ifconfig” lines, and then add the setting about the “dhcpcd”...
EM-1220 LX User’s Manual Getting Started Installing a Secure Digital (SD) Memory Card The EM-1220 Development Kit has an internal SD socket for storage expansion. To access this socket, perform the following steps to install the SD memory card. Step 1: Locate the SD socket.
EM-1220 LX User’s Manual Getting Started Compiling Hello.c The Tool Chain path is: PATH=/usr/local/bin:$PATH The EM-1220-LX CD includes several example programs. We use Hello.c to illustrate how to compile and run applications. Issue the following commands from your PC to compile Hello.c:...
EM-1220 LX User’s Manual Getting Started Uploading “Hello” to the EM-1220-LX To use FTP to upload hello to the EM-1220-LX, issue the following commands from the PC: #ftp 192.168.3.127 ftp> cd /home ftp> bin ftp> put ./hello ftp> quit #telnet 192.168.3.127...
EM-1220 LX User’s Manual Getting Started Running “Hello” on the EM-1220-LX To run the Hello program, issue the following commands on the EM-1220-LX: # chmod 755 hello #./hello The words “hello world” are printed on the screen. ATTENTION Be sure to calculate the amount of Flash Memory used by the User File System in the Flash ROM.
EM-1220 LX User’s Manual Getting Started Make File Sample Code The following Make File example code was copied from the Hello example on the EM-1220-LX’s CD-ROM. srcdir = . LDFLAGS = -Wl,-elf2flt LIBS = CFLAGS = # Change these if necessary...
Software Package Chapter 3 This chapter includes information about the software used with the EM-1220-LX. In this chapter, we cover the following topics: EM-1220-LX Software Architecture Journaling Flash File System (JFFS2) EM-1220-LX Software Package...
EM-1220 LX User’s Manual Software Package EM-1220-LX Software Architecture The pre-installed µClinux operating system used by the EM-1220-LX follows the standard µClinux architecture. This means that programs following the POSIX standard are easily ported to the EM-1220-LX with the GNU Tool Chain provided by www.uClinux.org. In addition to the Standard POSIX API, device drivers for the buzzer and UART for the serial ports are also included.
EM-1220 LX User’s Manual Software Package The partition sizes are hard coded into the kernel binary. You must rebuild the kernel to change the partition sizes. The flash memory map is shown in the following table. Flash Context Flash Address...
Configuring the EM-1220-LX Chapter 4 In this chapter, we describe how to configure the EM-1220-LX Series products. The following topics are covered in this chapter: Enabling and Disabling Daemons Adding a Web Page IPTABLES NAT Example Enabling NAT at Bootup Configuring Dial-in/Dial-out Service Dial-out Service Dial-in Service...
EM-1220 LX User’s Manual Configuring the EM-1220-LX Enabling and Disabling Daemons The following daemons are enabled when the EM-1220-LX boots up for the first time. SNMP Agent daemon: snmpd Telnet Server / Client daemon: telnetd Internet Daemons: inetd FTP Server / Client daemon:...
EM-1220 LX User’s Manual Configuring the EM-1220-LX Adding a Web Page Default Home Page address: /home/httpd/index.html You may change the default home page directory by editing the web server’s configuration file, located at: /etc/boa.conf Type the following command to edit the boa.conf file: /etc>vi boa.conf...
Page 35
EM-1220 LX User’s Manual Configuring the EM-1220-LX Source NAT (SNAT)—changes the first source packet IP address Destination NAT (DNAT)—changes the first destination packet IP address MASQUERADE—a special form for SNAT. If one host can connect to the Internet, then other computers that connect to this host can connect to the Internet when the computer does not have an actual IP address.
Page 36
EM-1220 LX User’s Manual Configuring the EM-1220-LX The EM-1240-LX supports the following sub-modules. Be sure to use the module that matches your application. You must load a module before you can use it. Use the insmod command to load a module.
Page 37
EM-1220 LX User’s Manual Configuring the EM-1220-LX Examples: # iptables -L -n In this example, since we do not use the -t parameter, the system uses the default ‘filter’ table. Three chains are included: INPUT, OUTPUT, and FORWARD. INPUT chains are accepted automatically, and all connections are accepted without being filtered.
EM-1220 LX User’s Manual Configuring the EM-1220-LX Examples: Example 1: Accept all packets from lo interface. # iptables –A INPUT –i lo –j ACCEPT Example 2: Accept TCP packets from 192.168.0.1. # iptables –A INPUT –i eth0 –p tcp –s 192.168.0.1 –j ACCEPT Example 3: Accept TCP packets from Class C network 192.168.1.0/24.
EM-1220 LX User’s Manual Configuring the EM-1220-LX Enabling NAT at Bootup In most real world situations, you should use a simple shell script to enable NAT when the EM-1220-LX boots up, as indicated by the following: 1. setting iptables 2. iptables-save > /home/xxx.file (xxx.file is the user defined file name) 3.
EM-1220 LX User’s Manual Configuring the EM-1220-LX Configuring PPPoE PPPoE relies on two widely accepted standards: PPP and Ethernet, which permits the use of PPPoE(Point-to-Point Over Ethernet). PPPoE is a specification for connecting users on an Ethernet to the Internet through a common broadband medium, such as a single DSL line, wireless device or cable modem, used by many ADSL service providers.
EM-1220 LX User’s Manual Configuring the EM-1220-LX For example, to unload the UART driver, type the following command: />rmmod mxser For the EM-1240-LX, the factory default is to load the UART driver mxser.ko. An additional driver module for controlling the SD/MMC memory card is loaded for the EM-1240-LX. The location and file name for these driver modules is given below.
EM-1220 LX User’s Manual Configuring the EM-1220-LX Upgrading the Root File System & User Directory The EM-1220-LX uses JFFS2 for the root file system and user directory. By default, the root file system is pre-set to READ only. The EM-1220-LX provides a read/write user’s directory in the JFFS2 file system.
EM-1220 LX User’s Manual Configuring the EM-1220-LX Loading Factory Defaults The easiest way to “Load Factory Defaults” is with the “Upgrade User directory” operation. Refer to the previous section, “Upgrading the Root File System & User Directory,” for an introduction.
EM-1220-LX Device API Chapter 5 In this chapter, we discuss the Device API for the EM-1220-LX Series. We introduce the APIs for the following functions: RTC (Real-time Clock) Buzzer UART Interface GPIO...
EM-1220 LX User’s Manual EM-1220-LX Device API RTC (Real-time Clock) The device node is located at /dev/rtc. The EM-1220-LX supports µClinux standard simple RTC control. You must include <linux/rtc.h> to use these functions. 1. Function: RTC_RD_TIME int ioctl(fd, RTC_RD_TIME, struct rtc_time *time);...
EM-1220 LX User’s Manual EM-1220-LX Device API GPIO GPIO means General Purpose I/O. It is a user-programmable design that both digital input and digital output can be easily defined as the signals are all made with TTL format. Moxa GPIO API For customers using EM-1220 or EM-1240, we will provide an API library with static link.
Page 47
EM-1220 LX User’s Manual EM-1220-LX Device API int set_gpio_mode(unsigned int pio, int mode) --to configure GPIO ports to be DI ports or DO ports. Input: unsigned int pio - GPIO port number Each GPIO point will be regarded as a port. We support from Port 0 to Port 9 for EM-1240, and from Port 0 to Port 7 for EM-1220.
Page 48
EM-1220 LX User’s Manual EM-1220-LX Device API Limits 1. Both SD card and GPIO share the same signals. To enable GPIO, SD must be disabled, and vice versa. Drivers will not automatically check if it is SD or GPIO signals, users must decide before using these signals.
Page 49
EM-1220 LX User’s Manual EM-1220-LX Device API typedef struct gpio_set_struct { io_number; mode_data; } gpio_t; * To get the GPIO mode now. * Input: unsigned int pio - the GPIO number, from 0 to MAX_GPIO-1 * Output: < 0 - some error...
Page 50
EM-1220 LX User’s Manual EM-1220-LX Device API return GPIO_NODE_ERROR; pset.io_number = gpio_no; pset.mode_data = mode; if ( ioctl(fd, IOCTL_GPIO_SET_MODE, &pset) != 0 ) { close(fd); return GPIO_ERROR; close(fd); return GPIO_OK; * To set the GPIO now data. * Input: unsigned int pio - the GPIO number, from 0 to MAX_GPIO-1...
System Commands Appendix A µClinux normal command utility collection File manager copy file list file make symbolic link file mount and check file system mount delete file change file owner & group & user chmod change file owner chown change file group chgrp sync file system;...
Page 52
EM-1220 LX User’s Manual System Commands Network ping to test network ping routing table manager route display network status netstat set network IP address ifconfig tftp protocol tftp user interface to TELNET protocol telnet file transfer protocol iptables command iptables...
Page 53
SNMP Agent with MIB II & RS-232 Like Appendix B Group The EM-1220-LX has a built-in SNMP (Simple Network Management Protocol) agent that supports RFC1317 RS-232 like group and RFC 1213 MIB-II. The following table lists the variable implementation for the EM-1220-LX. The full SNMP object ID of EM-1220-LX is .iso.3.6.1.4.1.8691.12.1220.
EM-1220-LX FAQ Appendix C Why can I only use vfork( ),and am not able to use fork( )? FAQ 1 μClinux only supports vfork( ). It does not support fork( ). Note that when using Answer 1 vfork ( ), the parent process will hang until the child process calls an exec group API, or exits.
Need help?
Do you have a question about the EM-1220 LX and is the answer not in the manual?
Questions and answers