background image

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. By using this user’s directory, the system configuration file and user’s program 
can be stored on this disk. 

Search the EM-1220-LX’s CD-ROM for the latest user directory file, or download the file from 
www.moxa.com. The format is 

em1220-1.x.dsk

. You must download this file to a PC first, and 

then use Console Terminal or Telnet Console to copy the file to the EM-1220-LX. 

You can save this file to the EM-1220-LX’s RAM disk, and then upgrade the user directory. The 
following is a step-by-step example. 

To enable the RAM disk, use the following commands. 

/>upramdisk 

/>cd ramdisk 

Use the built-in FTP client to download the em1220-1.x.dsk file from the PC. 

/ramdisk>ftp  <destination  PC’s  IP> 

Login Name: xxxx 

Login Password: xxxx 

ftp> bin 

ftp> get em1220-1.x.dsk 

ftp>quit 

/ramdisk>upkernel /ramdisk/em1220-1.x.dsk 

/reboot 

 

 

 

 

 

4-11

Summary of Contents for EM-1220 LX

Page 1: ...EM 1220 LX User s Manual Fourth Edition January 2010 www moxa com product 2010 Moxa Inc All rights reserved Reproduction without permission is prohibited...

Page 2: ...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...

Page 3: ...et Button 1 11 Real time Clock 1 11 Chapter 2 Getting Started 2 1 Powering on the EM 1220 DK 2 2 Connecting the EM 1220 LX to a PC 2 2 Console Port 2 2 Telnet 2 3 Configuring the Ethernet Interface 2...

Page 4: ...File System User Directory 4 11 Loading Factory Defaults 4 12 Autostarting User Applications on Bootup 4 12 Checking the Kernel and Root File System Versions 4 12 Chapter 5 EM 1220 LX Device API 5 1 R...

Page 5: ...an ideal solution for embedded applications that use a lot of memory and that must be housed in a small space without sacrificing performance In this chapter we cover the following topics Overview Ord...

Page 6: ...ing system for software program development Software written for desktop PCs is easily ported to the EM 1220 LX with a GNU cross compiler so that you will not need to spend time modifying existing sof...

Page 7: ...w Control RTC CTS XON XOFF Serial Ports Speed 50 bps to 921 6 Kbps supports Any Baudrate Serial Console RS 232 1 TxD RxD GND Storage Expansion SD signals for external Secure Digital SD socket connecti...

Page 8: ...e System JFFS2 for Kernel Root File System Read Only and User Directory Read Write Msh Minix shell command pppd Dial in out over serial port daemon PPPoE Point to Point over Ethernet daemon snmpd SNMP...

Page 9: ...EM 1220 LX User s Manual Introduction Hardware Block Diagram 1 5...

Page 10: ...User s Manual Introduction Appearance EM 1220 LX Embedded Module EM 1220 DK Carrier Board EM 1220 LX Embedded Module MOXA ART ARM9 32 bit Communication Processor onboard 16 MB RAM EM 1220 LX Developme...

Page 11: ...pin marked J1 on the embedded module must be matched with the pin marked J1 on the development kit Be careful when inserting the module to avoid damaging the product LED Indicators The following table...

Page 12: ...afety First Be sure to disconnect the power cord before installing and or wiring the EM 1220 LX embedded module and or the EM 1220 DK carrier board Wiring Caution Calculate the maximum possible curren...

Page 13: ...nnect one end of the Ethernet cable to the 10 100M Ethernet port of EM 1220 DK and the other end of the cable to the Ethernet network If the cable is properly connected the EM 1220 DK will indicate a...

Page 14: ...r RS 232 port It is designed for serial console terminals which are useful for identifying the EM 1220 LX boot up message Serial Console Port Pinouts Serial Console Cable 4 3 2 1 Pin Signal 1 TxD 2 Rx...

Page 15: ...ata Loading factory defaults will only load the configuration file The files in the EM 1220 LX that will be replaced include a etc boa conf h etc group b etc hosts i etc inetd conf c etc inittab j etc...

Page 16: ...er 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 Developing Your A...

Page 17: ...turn on until the operating system is ready Connecting the EM 1220 LX to a PC There are two ways to connect the EM 1220 LX to a PC Console Port The serial console port offers users a convenient means...

Page 18: ...n name and password as requested The defaults are Login root Password root Once you open the msh command shell you can proceed to configure the EM 1220 LX s network settings as described in the next s...

Page 19: ...220 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...

Page 20: ...e IP addresses from the first DHCP server that responds 3 Issue the vi write command to save the file and then reboot Since the EM 1220 LX only reads the rc file when booting up you must reboot e g by...

Page 21: ...ed correctly Step 3 Push the SD card inward Step 4 Before using the SD card check the etc rc file to ensure that the driver module for the SD card control is loaded The loading sequence should be as f...

Page 22: ...the EM 1220 LX Linux GNU Tool Chain Debian 3 0R Woody Redhat 7 3 8 0 and compatible versions are recommended The Tool Chain requires about 100 MB of hard disk space on your PC The EM 1220 LX Tool Cha...

Page 23: ...xample programs We use Hello c to illustrate how to compile and run applications Issue the following commands from your PC to compile Hello c cd tmp mkdir example cp r mnt cdrom example tmp example Go...

Page 24: ...l 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 t...

Page 25: ...TION Be sure to calculate the amount of Flash Memory used by the User File System in the Flash ROM Use one of the following two commands to determine the amount of memory in use df k or df If the flas...

Page 26: ...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 CC arm elf gcc CPP arm elf gcc E all h...

Page 27: ...ckage 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...

Page 28: ...order to save on the total cost of development and maintenance the EM 1220 LX is specially designed to partition a User Directory for storing the user s system configuration parameters The EM 1220 LX...

Page 29: ...he flash directory structure in RAM at all times and implements a log structured file system that is always consistent even if the system crashes or unexpectedly powers down It does not require fsck o...

Page 30: ...kversion init expand inetd hwclock ftpd ftp mke2fs e2fsck discard dhcpcd cpu busybox boa downramdisk upramdisk mtdblock1 mtdr1 mtd1 mtdblock0 mtdr0 mtd0 cum1 cum0 ttyM1 ttyM0 urandom random zero ttypf...

Page 31: ...EM 1220 LX User s Manual Software Package Bin dev ptyp0 ppp pio rtc ram1 ram0 null kmem mem cua0 console tty 3 5...

Page 32: ...ing a Web Page IPTABLES NAT NAT Example Enabling NAT at Bootup Configuring Dial in Dial out Service Dial out Service Dial in Service Configuring PPPoE How to Mount a Remote NFS Server Dynamic Driver M...

Page 33: ...ittab b Disable the www service by typing in front of the first character of the row How to enable Network Time Protocol ntpdate is a time adjusting client utility The EM 1220 LX plays the role of Tim...

Page 34: ...are defined with each table containing built in chains and user defined chains Each chain is a list of rules that apply to a certain type of packet Each rule specifies the action to be taken with a m...

Page 35: ...nt of the destination IP address C Mangle Table includes two chains PREROUTING chain pre processes packets before the routing process OUTPUT chain processes packets after the routing process It has th...

Page 36: ...support IPV6 and ipchains IPTABLES supports packet filtering or NAT Take care when setting up the IPTABLES rules If the rules are not correct remote hosts that connect via a LAN or PPP may be denied...

Page 37: ...OUTPUT ACCEPT iptables P FORWARD ACCEPT iptables t nat P PREROUTING ACCEPT iptables t nat P OUTPUT ACCEPT iptables t nat P POSTROUTING ACCEPT In this example the policy accepts outgoing packets and de...

Page 38: ...les A INPUT i eth0 p all m mac mac source 01 02 03 04 05 06 j DROP NAT NAT Network Address Translation protocol translates IP addresses used on one network into different IP addresses used on another...

Page 39: ...ct chat v user xxxxx password xxxxx dev ttyM0 38400 crtscts Connect Using a Modem y Use pppd connect chat v ATDT phone_number CONNECT user xxxxx password xxxxx dev ttyM0 38400 crtscts ATTENTION If dia...

Page 40: ...ETHERNET_INTERFACE m 1412 user USER_NAME password USER_PASSWORD ETHERNET_INTERFACE Ethernet card connected to ADSL modem for example eth0 USER_NAME User account for example moxa adsl net USER_PASSWORD...

Page 41: ...0 1 x bin which can be downloaded from www moxa com You must first download this file to your PC and then use Console Terminal or Telnet Console to copy the file to the EM 1220 LX You can save this fi...

Page 42: ...est user directory file or download the file from www moxa com The format is em1220 1 x dsk You must download this file to a PC first and then use Console Terminal or Telnet Console to copy the file t...

Page 43: ...input the command ldfactory from the Telnet console to restore the factory defaults Autostarting User Applications on Bootup Edit the etc rc file by adding your application program E g ap directory ap...

Page 44: ...5 5 Chapter 5 EM 1220 LX Device API 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...

Page 45: ...ction KDMKTONE ioctl fd KDMKTONE unsigned int arg Description Buzzer will beep as stipulated by the function arguments UART Interface The normal tty device node is located at dev ttyM0 ttyM1 and the m...

Page 46: ...t int get_gpio_mode unsigned int pio to check if the current GPIO setting is DI or DO Input unsigned int pio GPIO port number Each GPIO point will be regarded as a port We support from Port 0 to Port...

Page 47: ...unsigned int pio int data to check the current status of the GPIO either high or low voltage used when the GPIO points are configured as DO Input unsigned int pio GPIO port number Each GPIO point wil...

Page 48: ...DE 1 define IOCTL_GPIO_SET_MODE 2 define IOCTL_GPIO_GET_DATA 3 define IOCTL_GPIO_SET_DATA 4 define MAX_GPIO 10 define GPIO_NO_ERROR 1 the GPIO number error define GPIO_MODE_ERROR 2 the GPIO mode error...

Page 49: ...gpio_no fd open GPIO_DEVICE_NODE O_RDWR if fd 0 return GPIO_NODE_ERROR pset io_number gpio_no if ioctl fd IOCTL_GPIO_GET_DATA pset 0 close fd return GPIO_ERROR close fd return pset mode_data To set th...

Page 50: ...data Input unsigned int pio the GPIO number from 0 to MAX_GPIO 1 int data 1 for high 0 for low Output 0 some error 0 OK int set_gpio_data unsigned int gpio_no int data int fd gpio_t pset CHECK_GPIO_N...

Page 51: ...rectly df list active file system space du estimate file space usage mkdir make new directory rmdir delete directory head print the first 10 lines of each file to standard output tail print the last 1...

Page 52: ...time Other dmesg dump kernel log message stty set serial port mknod make device node free display system memory usage date print or set the system date and time env run a program in a modified enviro...

Page 53: ...sysServices ifNumber ifTable ifIndex ifDescr ifType ifMtu ifSpeed ifPhysAddress ifAdminStatus ifOperStatus ifLastChange ifInOctets ifInUcastPkts ifInNUcastPkts ifInDiscards ifInErrors ifInUnknownProto...

Page 54: ...RouteIfIndex ipRouteMetric1 ipRouteMetric2 ipRouteMetric3 ipRouteMetric4 ipRouteNextHop ipRouteType ipRouteProto ipRouteAge ipRouteMask ipRouteMetric5 ipRouteInfo ipNetToMediaTable ipNetToMediaIfIndex...

Page 55: ...nmpOutTooBigs snmpOutNoSuchNames snmpOutBadValues snmpOutGenErrs snmpOutGetRequests snmpOutGetNexts snmpOutSetRequests snmpOutTraps snmpEnableAuthenTraps RFC1317 RS 232 like group supported variables...

Page 56: ...ad group API why can t I use SIGUSR1 and SIGUSR2 Answer 2 Since a pthread group API uses SIGUSR1 and SIGUSR2 to do a pthread control suspend and restart the exit function we cannot use the SIGUSR1 and...

Reviews: