Home

EM-1220 LX User`s Manual v3

image

Contents

1. close fd return GPIO_OK Vici To set the GPIO now data put unsigned int pio the GPIO number from 0 to MAX_GPIO 1 int data 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_NO gpio_no CHECK GPIO DATA data fd open GPIO DEVICE NODE O_RDWR if fd 0 return GPIO NODE ERROR psetio number gpio no pset mode data data if ioctl fd IOCTL GPIO SET DATA amp pset 0 close fd return GPIO ERROR close fd return GPIO_OK A System Commands uClinux normal command utility collection File manager Editor cp copy file Is list file In make symbolic link file mount mount and check file system rm delete file chmod change file owner amp group amp user chown change file owner chgrp change file group sync sync file system save system file buffer to hardware mv move file pwd display active file directly 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 10 lines of each file to standard output touch update the access and modification times of each file to the current time vi text editor cat dump file context grep print lines ma
2. User Application API Application Interface POSIX Socket Factory Default Configuration etc home Protected System Configuration rc amp boot parameters IP Configuration Parameters Inittab inetd conf boa cont User Directory UFFS2 Read Write ARP ICMP IPV4 TCP UDP FTP Protocol Stack Telnet NTP SNMP V1 HTTP PPP Device Driver Ethernet UART RTC Buzzer GPIO Microkernel Memory control Schedule Process bario ARMS CPU SDRAM FlashROM RS 232 422 485 Ethemet The EM 1220 LX s Flash ROM is divided into smaller partitions including the Boot Loader Linux Kernel amp Root File System Image and User Directory partitions OS Kerner amp Root File System ROMES Read ONLY For most applications users often spend a lot time maintaining the operating system and modifying the system configuration In order to au dod save on the total cost of development and User Directory Mini Root File System maintenance the EM 1220 LX is specially User Configuration Configuration designed to partition a User Directory for storing the user s system configuration parameters Linux Kernel amp Root The EM 1220 LX has a built in mechanism that prevents system crashes to help preserve system reliability The procedure is described below Boot Loader HW When the Linux kernel boots up the kernel mounts the root file system and then enables services and daemons The kernel also looks for s
3. Ethernet network The top left LED on the connector glows a solid orange when connected to a 10 Mbps Ethernet network 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 100 Mbps Pin Signal indicator indicator 1 ET 2 ETx 3 ERx 4 ERE 5 nm j 6 ERx 7 us 8 E 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 RS 232 422 485 Pinouts Male DB9 Port 12345 RS 485 RS 485 Pin RS 232 RS 422 4wire 2 wire 1 DCD TXDAC TxDA 2 2 RxD TxDB TxDB 3 TxD RxDB RxDB DataB 6789 4 DTR RxDAC RxDA DataA 5 GND GND GND GND 6 DSR m Em 7 RTS m ES 8 CTS gt te EM 1220 LX User s Manual Introduction Serial Console Port The serial console port on the EM 1220 DK is a 4 pin pin header 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 amp Pinouts Serial Console
4. Uploading Hello to the EM 1220 LX Running Hello on the EM 1220 LX Make File Sample Code 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 Once the system is ready the Ready LED will light up ATTENTION After connecting the EM 1220 DK 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 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 Serial Console Port Settings convenient means of connecting to the EM 1220 LX This method is particularly Baudrate 19200 bps useful when using the EM 1220 LX for the Parity None first time Since the communication is over a direct serial connection you do not need to Data bits 8 know either of the IP addresses in order to Stop bits 1 make contact Flow Control None Use the serial console port settings shown on the right Once the connection is established Terminal VT100 the following window will open de s sp er a NET Registered protocol family 1 NET Registered protocol family 17 VFS Mounted root jffs2 filesys
5. to check the current status of the GPIO either high or low voltage 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 Output represents high 0 represents low Return lt 0 is wrong 0 is correct 5 3 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 int mode represents DI 0 represents DO Output represents high 0 represents low Return 0 is wrong 0 is correct int set_gpio_data 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 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 int data 1 represents high 0 represents low Output represents high 0 represents low Return 0 is wrong 0 is correct How to use 1 The device driver must be loaded insmod gpio ko 2 The program must include lt moxadevice h gt and link to libmoxalib a Here is an e
6. A 2 SNMP Agent with MIB Il amp RS 232 Like Group B 1 EM 1220 EX FAQ iini dept uenti eese teet eed ee eae C 1 1 Introduction 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 yClinux 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 The EM 1220 LX is 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 Oooo OoUoOooo O Overview Ordering Information Product Features Product Specifications Hardware Specifications Software Specifications Hardware Block Diagram Appearance Dimensions Installing the EM 1220 LX LED Indicators Wiring Requirements Connecting the Power gt Grounding the EM 1220 DK Carrier Board Connecting Data Transmission Cables Connecting to the Network Connecting to a Serial Device gt Serial Console Port Internal SD Socket Additional Functions Reset Button gt Real time Clock EM 1220 LX User s Manual Introduction Overview The EM 1220 LX is a mini RISC based communication platform that is ideal
7. possibility refer to the NFS HOWTO document at http nfs sourceforge net nfs howto server html home usr 192 168 3 1 rw no_root_squash no_all_squash 2 The EM 1220 LX must run the portmap utility This program is enabled by default in the Jetc rc file Use the following command to mount the remote NFS server gt mount t nfs remote ip remote export directory lt local directory gt Dynamic Driver Module Load Unload Besides supporting traditional static drivers the EM 1220 LX also supports the dynamic driver module load unload mechanism It allows users to load a special driver into the kernel to enable hardware features for specific applications To load unload a dynamic driver module use the following commands Load module insmod module directory module file name For example to load the UART driver type the following command insmod lib modules 2 6 9 MoXaRt kernel drivers char mxser ko Show module list gt lsmod Unload module gt rmmod lt module name listed by lsmod command gt 4 9 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 UART 1i
8. snmpd busybox Tinylogin Telnetd telnet inetd ftpd ftp boa ntpdate Linux Tool Chain Signal reserved for external Reset to Default button connection Accepts external 3 3 VDC through pin header 80 x 50 mm 10 to 60 C 14 to 141 F 5 to 95 RH 40 to 75 C 40 to 167 F is optional for EM 1220 T model 20 to 80 C 4 to 176 F 5 to 95 RH 40 to 85 C 40 to 185 F is optional for EM 1220 T model Two 2 x 17 pin headers pitch 2 5 x 2 5 mm uClinux 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 1 4 EM 1220 LX User s Manual Introduction Hardware Block Diagram Ethernet RS 232 422 485 RS 232 Appearance EM 1220 LX Embedded Module EM 1220 DK Carrier Board EM 1220 Embedded Module EM 1220 DK 1 5 EM 1220 LX User s Man
9. 0 1 x bin Use the upkernel command to upgrade the kernel and root file system ramdisk upkernel em1220 1 x bin ramdisk reboot 4 10 EM 1220 LX User s Manual Configuring the EM 1220 LX The kerne The version is 1 0 This step will destory your old kernel Do you want to continue it Y N V Erased 2048 Kibyte 0 100 complete Format OK Now update the kernel Please wait Update the kernel OK Please restart system H Upgrading the Root File System amp 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 gt upramdisk gt cd ramdisk Use the built in FTP client to download the em1220 1 x dsk file from the PC ramdisk gt ftp lt destination PC s IP gt Login Name xxxx L
10. 4 Code amp compile your program Step 5 Download program to the EM 1220 LX by FTP or NFS Step 6 Debug the program If the program is OK proceed to Step 7 If the program needs to be modified go back to Step 4 Step 7 Back up the user directory and distribute the code to additional EM 1220 LX units 2 6 EM 1220 LX User s Manual Getting Started Installing the EM 1220 LX Tool Chain Linux The PC must have the Linux operating system pre installed to install 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 Chain can be found on the EM 1220 LX Document amp Software CD To install the Tool Chain insert the CD into your PC and then issue the following command mount t iso9660 dev cdrom mnt cdrom Next run the following script from the root to install the compilers linkers and libraries in the usr local directory sh mnt cdrom tool chain linux installer arm elf moxa toolchain 1 1 sh The Tool Chain installation will take a few minutes to complete ATTENTION The Tool Chain can be downloaded from Moxa s website To do this navigate to the EM 1220 LX product page click the Documentation amp Drivers link and then click Go under Driver amp Software Downloads Compiling Hello c The Tool Chain path is PATH usr local bin PATH The EM 1220 LX CD in
11. 525 1525 O 100 1525 1525 O 100 4096 688 3408 17 If the flash memory is full you will no longer be able to save data to the Flash ROM To free up some memory use the console cable to connect to the EM 1220 LX s serial console terminal and then delete files from the Flash ROM 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 2 10 Getting Started EM 1220 LX User s Manual Getting Started CC arm elf gcc CPP arm elf gcc E all hello hello CC o 80 CFLAGS LDFLAGS LIBS 0 c clean rm f 0BJS hello core gdb 3 Software Package This chapter includes information about the software used with the EM 1220 LX In this chapter we cover the following topics OA EM 1220 LX Software Architecture gt Journaling Flash File System JFFS2 O EM 1220 LX Software Package EM 1220 LX User s Manual Software Package EM 1220 LX Software Architecture The pre installed yClinux operating system used by the EM 1220 LX follows the standard uClinux 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
12. ActiveOpens udpTable ipForwDatagrams tcpPassiveOpens udpLocalAddress ipInUnknownProtos tcpAttemptFails udpLocalPort ipInDiscards tcpEstabResets ipInDelivers tcpCurrEstab ipOutRequests tcpInSegs ipOutDiscards tcpOutSegs ipOutNoRoutes tcpRetransSegs ipReasmTimeout tcpConnTable ipReasmReqds tcpConnState ipReasmFails tcpConnLocalAddress ipFragOKs tepConnLocalPort ipFragFails tepConnRemAddress ipFragCreates tepConnRemPort ipAddrTable tcpInErrs ipAdEntAddr tcpOutRsts ipAdEntIfIndex ipAdEntNetMask ipAdEntBcastAddr ipAdEntReasmMaxSize ipRouteTable ipRouteDest ipRoutelfIndex ipRouteMetric1 ipRouteMetric2 ipRouteMetric3 ipRouteMetric4 ipRouteNextHop ipRouteType ipRouteProto ipRouteAge ipRouteMask ipRouteMetric5 ipRouteInfo ipNetToMediaTable ipNetToMedialfIndex ipNetToMediaPhysAddress ipNetToMediaNetAddress ipNetToMediaType ipRoutingDiscards B 2 EM 1220 LX User s Manual SNMP Agent with MIB Il amp RS 232 Like Group snmp MIB snmpInPkts snmpOutPkts snmpInBadVersions snmpInBadCommunityNames snmpInBadCommunity Uses snmpInASNParseErrs snmpInTooBigs snmpInNoSuchNames snmpInBad Values snmpInReadOnlys snmpInGenErrs snmpInTotalReq Vars snmpInTotalSetVars snmpInGetRequests snmpInGetNexts snmpInSetRequests snmpInGetResponses snmpInTraps snmpOutTooBigs snmpOutNoSuchNames snmpOutBadValues snmpOutGenErrs snmpOutGetRequests snmpOutGetNexts snmpOutSetRequests snmpOutTraps snmpE
13. Cable Pin Signal 1 TxD i 2 RxD ap 3 NC z 4 GND m Internal SD Socket The EM 1220 DK 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 The internal SD socket is located on the bottom of the EM 1220 DK Plug the SD card into the socket directly and remember to press the SD card in first before removing it Note that the SD function shares the same chipset with the DIO If you would like to enable the SD function the DIO must be disabled If you would like to enable the DIO the SD function must be disabled 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 To reset an embedded Linux system always use the software reboot command gt reboot to protect the integrity of data being transmitted or processed The Reset button is not designed to hard reboot the EM 1220 DK ATTENTION Resetting to factory defaults will not format the user directory and will not erase all of the user s data Loading factory defaults will only load the configuration file The fil
14. EM 1220 LX User s Manual Third Edition February 2009 www moxa com product MOXA 2009 Moxa Inc All rights reserved Reproduction without permission is prohibited EM 1220 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 2009 Moxa Inc All rights reserved Reproduction without permission is prohibited Trademarks MOXA is a registered trademark of Moxa Inc 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 inco
15. MAC address 01 02 03 04 05 06 iptables A INPUT i eth0 p all m mac mac source 01 02 03 04 05 06 j DROP NAT Network Address Translation protocol translates IP addresses used on one network into different IP addresses used on another network One network is designated the inside network and the other is the outside network Typically the EM 1220 LX connects several devices on a network and maps local inside network addresses to one or more global outside IP addresses and remaps the global IP addresses on incoming packets back into local IP addresses Click the following link for more information about iptables and NAT http www netfilter org documentation gHOWTO NAT HOWTO html NAT Example The IP addresses of all packets leaving LANI are changed to 192 168 3 127 you will need to load the module ipt MASQUERADE 1 First load the following device drivers x tables ko xt multiport ko xt MARK ko xt tcpudp ko ip tables ko ip nat ko iptable nat ko ipt MASQUERADE ko 2 echo 1 gt proc sys net ipv4 ip forward 3 iptables t nat A POSTROUTING o eth0 j SNAT to source 192 168 3 127 or 4 iptables t nat A POSTROUTING o eth0 j MASQUERADE 4 7 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 setti
16. ROR define CHECK_GPIO_MODE m if m GPIO INPUT amp amp m GPIO OUTPUT return GPIO MODE ERROR define CHECK_GPIO_DATA d if d GPIO HIGH amp amp d GPIO_LOW return GPIO_DATA_ERROR 5 5 EM 1220 LX User s Manual EM 1220 LX Device API typedef struct gpio_set_struct int io number int 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 si 1 input ii 0 ouput int get_gpio_mode unsigned int gpio_no int fd gpio_t pset CHECK_GPIO_NO gpio_no fd open GPIO_DEVICE_NODE O_RDWR if fd 0 return GPIO NODE ERROR psetio number gpio no if ioctl fd IOCTL GPIO GET DATA amp pset 0 close fd return GPIO ERROR close fd return pset mode_data Vici To set the GPIO now mode Tapat unsigned int pio the GPIO number from 0 to MAX_GPIO 1 int mode want to set mode 1 for input 0 for output Output 0 some error E 0 OK int set_gpio_mode unsigned int gpio_no int mode int fd gpio_t pset CHECK_GPIO_NO gpio_no CHECK_GPIO_MODE mode fd open GPIO_DEVICE_NODE O_RDWR if fd 0 EM 1220 LX User s Manual EM 1220 LX Device API return GPIO NODE ERROR psetio number gpio no pset mode data mode if ioctl fd IOCTL GPIO SET MODE amp pset 0 close fd return GPIO ERROR
17. S Server Dynamic Driver Module Load Unload Upgrading the Kernel Upgrading the Root File System amp User Directory Loading Factory Defaults Autostarting User Applications on Bootup Checking the Kernel and Root File System Versions 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 e SNMP Agent daemon snmpd Telnet Server Client daemon telnetd Internet Daemons inetd FTP Server Client daemon ftpd WWW Server daemon boa ATTENTION How to enable disable telnet ftp server a Edit the file etc inetd conf Example default enable discard dgram udp wait root bin discard discard stream tcp nowait root bin discard telnet stream tcp nowait root bin telnetd ftp stream tcp nowait root bin ftpd 1 b Disable the daemon by typing in front of the first character of the row How to enable disable etc inittab www server a Edit the file etc inittab 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 Time client and sends requests to the Network Time Server to request the correct time Set the time server address for adjusting the system time with the command ntpdate ntp server ip Save the system time to the hardware
18. TTENTION You may reset the IP address immediately by issuing the command ifconfig eth0 192 168 5 127 This will change the IP address of LAN1 Issuing this command will NOT however update the rc file in the EM 1220 LX s flash memory so the next time you reboot the IP address will revert to its previous value 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 Step 2 Insert the SD card into the socket Make sure the card is situated correctly Step 3 Push the SD card inward Push 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 follows insmod lib modules 2 6 9 MoXaRt kernel drivers mmc mmc core ko insmod lib modules 2 6 9 MoXaRt kernel drivers mmc mmc block ko insmod lib modules 2 6 9 MoXaRt kernel drivers mmc moxasd ko Step 5 To remove the SD memory card first press the card in The card will pop out part of the way after which you can pull it out directly Developing Your Applications Step 1 Connect the EM 1220 DK to a Linux PC Step 2 Install Tool Chain GNU Cross Compiler amp uClibc Step 3 Configure cross compiler and uClibc environment variables Step
19. a Rede atte om HR aded hs 4 3 IPTABLES apra ciao lia dla RA Ain AES Ma ee Ro ATA IM t 4 3 NATL ala ient eei nme 4 7 Chapter 5 Appendix A Enabling NAT at Boop ccceseesstsssdapssceecessosesste einem 4 8 Configuring Dial in Dial out Service ii 4 8 Dial out Service neroni edt tpe epe pte ere pen 4 8 Diadl 1 Service uic bees D belt aee ete fed 4 8 Configuring PPPOE 4 ot hee nh eee deb ntes 4 0 How to Mount a Remote NES Server ii 4 0 Dynamic Driver Module Load Unload i 4 0 Upgrading the Kernel 25 hss gs ach ee el GRAS AG Rea RA 4 10 Upgrading the Root File System amp User Directory eene 4 11 Loading Factory Defaults nesies eei rette eene at 4 12 Autostarting User Applications on Bootup iii 4 12 Checking the Kernel and Root File System Versions esee 4 12 EM 1220 ELX Device AP iier nnn R craig 5 1 RIG Realume Clock oie deme Rm RED 5 2 lnv ld 5 2 UART Interfaces eoe ve teen eren ana 5 2 GPIO iE RA aen 5 3 Svslem Gommafids fucile banale A 1 uClinux normal command utility collection i A 1 File managers ana nae uil r E EU SI i A 1 Editori EAT TTEA E A 1 Network aiii RA e E eau eq eie tere AI ne et A 2 PLOCESS m WPO R A 2 QUE Baste A A 2 Moxa Special Utilities 2 ino cR PEE no p OE eds
20. acket is going to be received 0 Name of an interface via which a packet is going to be sent p The protocol of the rule or of the packet to check S Source address network name host name network IP address or plain IP address sport Source port number d Destination address dport Destination port number j Jump target Specifies the target of the rules i e how to handle matched packets For example ACCEPT the packet DROP the packet or LOG the packet 4 6 EM 1220 LX User s Manual Configuring the EM 1220 LX NAT NOTE 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 iptables A INPUT i eth0 p tcp s 192 168 1 0 24 j ACCEPT Example 4 Drop TCP packets from 192 168 1 25 iptables A INPUT i eth0 p tcp s 192 168 1 25 j DROP Example 5 Drop TCP packets addressed for port 21 iptables A INPUT i eth0 p tcp dport 21 j DROP Example 6 Accept TCP packets from 192 168 0 24 to the EM 1240 LX s port 137 138 139 iptables A INPUT i eth0 p tcp s 192 168 0 24 dport 137 139 j ACCEPT Example 7 Log TCP packets that visit EM 1240 LX s port 25 iptables A INPUT i eth0 p all m mac mac source 01 02 03 04 05 06 j DROP Example 8 Drop all packets from
21. b modules 2 6 9 MoXaRt kernel drivers char mxser ko SD MMC lib modules 2 6 9 MoXaRt kernel drivers mmc mmc core ko lib modules 2 6 9 MoXaRt kernel drivers mmc mmc block ko lib modules 2 6 9 MoXaRt kernel drivers mmc moxasd ko Upgrading the Kernel The EM 1220 LX kernel is em1220 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 file to the EM 1220 LX s RAM disk and then upgrade the kernel The following is a step by step example To enable the RAM disk use the following command upramdisk As illustrated below after executing upramdisk you may use mount to determine if the new ramdisk was created successfully or not upramdisk mount dev mtdblock2 on type j s2 ro noatime prac on proc type proc rw nodiratime dev ram0 on var type ext2 rw dev mtdblock3 on var tmp type j s2 rw noatime dev mtdblock3 on home type j s2 rw ncoatime dev mtdblock3 on etc type jffs2 rw noatime dev mtdblock3 on usr bin type jfis2 rw noatime dev ram0 on ramdisk type ramf s rw Use the following command to navigate to the device node gt cd ramdisk Use the built in FTP client to download the file em1220 1 x bin from the PC ramdisk ftp destination PC s IP Login Name xxxx Login Password xxxx ftp bin ftp get em122
22. cludes 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 cd tmp mkdir example cp r mnt cdrom example tmp example Go to the Hello subdirectory and then issue the command make to compile Hello c Finally execute the program to generate hello and hello gdb 2 7 EM 1220 LX User s Manual Getting Started ello i 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 plete 1 1 1 1 1 1 1 4 1 1 1 mand successful is current directory 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 EM 1220 LX User s Manual A cx Telnet 192 168 3127 Ht HHH HO HH HH 1 HHH HH HHHHHH RO HERRER AREA HHHRHHH HHH HH RARA er information check noxa com ATTENTION 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 lk blocks Used Available Use Mounted on 1
23. ent 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 Note The EM 1220 LX does not support SNMP trap RFC1213 MIB II supported SNMP variables system MIB interface MIB at MIB icmp MIB sysDescr ifNumber atTable icmpInMsgs sysObjectID ifTable atIfIndex icmpInErrors sysUpTime ifIndex icmpInDestUnreachs sysContact ifDescr atPhysAddress icmpInTimeExcds sysName ifType atNetAddress icmpInParmProbs sysLocation ifMtu icmpInSrcQuenchs sysServices ifSpeed icmpInRedirects ifPhysAddress icmpInEchos ifAdminStatus icmpInEchoReps ifOperStatus icmpInTimestamps ifLastChange icmpInAddrMasks ifInOctets icmpInAddrMaskReps ifInUcastPkts icmpOutMsgs ifinNUcastPkts icmpOutErrors ifInDiscards icmpOutDestUnreachs ifInErrors icmpOutTimeExcds iffnUnknownProtos icmpOutParmProbs ifOutOctets icmpOutSrcQuenchs ifOutUcastPkts icmpOutRedirects ifOutNUcastPkts icmpOutEchos ifOutDiscards icmpOutEchoReps ifOutErrors icmpOutTimestamps ifOutQLen icmpOutAddrMasks ifSpecific icmpOutAddrmaskReps EM 1220 LX User s Manual SNMP Agent with MIB Il amp RS 232 Like Group ip MIB tcp MIB udp MIB ipForwarding tcpRtoAlgorithm udpInDatagrams ipDefaultTTL tcpRtoMin udpNoPorts ipInReceives tcpRtoMax udpInErrors ipInHdrErrors tepMaxConn udpOutDatagrams ipInAddrErrors tcp
24. ernet and SD the wClinux operating system comes pre installed Package Checklist EM 1220 LX embedded module EM 1220 LX Development Kit Product Description The EM 1220 LX Development Kit includes a carrier board for testing and configuring the EM 1220 LX embedded module The carrier board comes with a power adaptor and has two built in serial ports and two built in Ethernet ports Package Checklist EM 1220 LX embedded module EM 1220 DK carrier board for the EM 1220 LX Quick Installation Guide Document amp Software CD Cross over Ethernet cable Console port cable CBL 4PINDB9F 100 4 pin header to DB9 female cable 100 cm Universal Power Adaptor Product Warranty Statement NOTE Please notify your sales representative if any of the above items are missing or damaged 1 2 EM 1220 LX User s Manual Introduction Product Features The EM 1220 LX has the following features MOXA ART ARMO 32 bit 192 MHz processor On board 16 MB RAM 8 MB flash disk 2 software selectable RS 232 422 485 serial ports Dual 10 100 Mbps Ethernet ports for network redundancy Ready to run uClinux Kernel 2 6 platform SD signals supported for external SD socket connection Built in RTC buzzer 10 GPIOs reserved for system integration Credit card size design for easy integration at any field site Full function development kit for quick evaluation and application development 40 to 75 C wide temperature mode
25. es 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 motd d etc password k etc protocols e etc ramfs img l letc rc f etc resolv conf m etc services g etc version n home httpd index html EM 1220 LX User s Manual Introduction 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 1220 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 2 Getting Started 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 u u Ooo Powering on the EM 1220 DK Connecting the EM 1220 LX to a PC gt gt Console Port Telnet Configuring the Ethernet Interface Installing a Secure Digital SD Memory Card Developing Your Applications gt VV VV Installing the EM 1220 LX Tool Chain Compiling Hello c
26. 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 The EM 1220 LX uses the Moxa ART ARMO RISC CPU Unlike the X86 CPU which uses a CISC design the ARM9 s RISC design architecture and modern semiconductor technology provide the EM 1220 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 plenty storage capacity and an additional SD socket provides you with flexible storage expansion for running applications The dual LAN ports built into the ARM9 make the EM 1220 LX an ideal communication platform for 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 uClinux operating system provides an open software operating 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 software code The operating system device drivers and your own software can all be stored in the EM 1220 LX s Flash memory Ordering Information EM 1220 LX Embedded Module Product Description The EM 1220 LX is a mini RISC based ready to run embedded module that supports 2 serial ports dual Eth
27. l available Product Specifications Hardware Specifications Model CPU RAM Flash LAN LAN Protection Serial Ports Serial Console Storage Expansion GPIO Real time Clock Watchdog Timer Buzzer Signals LED Signals EM 1220 LX Embedded Module MOXA ART ARMO 32 bit 192 MHz processor 16 MB 8 MB Auto sensing 10 100 Mbps x 2 Built in 1 5 KV magnetic isolation Two 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 bit s 1 1 5 2 Parity None even odd space mark Flow Control RTC CTS XON XOFF Speed 50 bps to 921 6 Kbps supports Any Baudrate RS 232 x 1 TxD RxD GND SD signals for external Secure Digital SD socket connection GPIO x 10 to enable GPIO SD must be disabled Yes Yes Buzzer signals reserved for external buzzer connection LAN 10 100 x 2 on LAN Connector Signals reserved for the following LED connections System Ready x 1 Serial Port Status x 2 pairs TxD RxD for each pair 1 3 EM 1220 LX User s Manual Introduction Reset Signal Power Input Dimensions W x L Operating temperature Storage temperature Module Interface Software Specifications Kernel Protocol Stack File System Msh pppd PPPoE
28. llowing rc line 1 cf 34 2 State OPEN RE 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 into the rc file as below dhcpcd p a eth0 amp dhcpcd p a ethl amp Note that the EM 1220 LX will send out DHCP broadcast packets and then get the IP addresses from the first DHCP server that responds E COM8 19200 Hone 8 1 T100 i i bin sh hostname moxa com tw org cat etc motd Jats lisconfig lo 127 0 0 1 ethO 192 168 3 127 netmask 255 255 255 0 ethl 192 168 4 127 netmask 255 255 255 0 a ethO amp if you want DHCF please set this a ethl amp if you want CHCE please set this default gw 192 168 3 254 dev eth0 rtc clock to system clock nis portmap portmap amp factory amp broadcast version Inecid amp simple snmp daemon isnmpd amp Loading your driver here gt uart driver for dev ttyMO dev ttyM1 insmod lib modules 2 6 9 MoXaRt kernel drivers char mxser ko etc rc modified line 1 of 36 2 State OPEN mm mm mm mm Got Break Signal 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 issuing the vi reboot command for the changes to take affect A
29. nableAuthenTraps RFC1317 RS 232 like group supported variables rs232 MIB rs232Number rs232PortTable rs232PortIndex rs232PortType rs232PortInSigNumber rs232PortOutSigNumber rs232PortInSpeed rs232PortOutSpeed rs232AsyncPortTable rs232AsyncPortIndex rs232AsyncPortBits rs232AsyncPortStopBits rs232A syncPortParity rs232InSigTable rs232InSigPortIndex rs232InSigName rs232InSigState rs232O0utSigTable rs232O0utSigPortIndex rs2320utSigName rs232OutSigState B 3 C EM 1220 LX FAQ FAQ 1 Answer 1 FAQ 2 Answer 2 FAQ 3 Answer 3 Why can I only use vfork and am not able to use fork uClinux only supports vfork It does not support fork Note that when using vfork the parent process will hang until the child process calls an exec group API or exits When using a pthread group API why can t I use SIGUSRI and SIGUSR2 Since a pthread group API uses SIGUSRI and SIGUSR2 to do a pthread control suspend and restart the exit function we cannot use the SIGUSRI and SIGUSR2 signals You will get the same result if you link the pthread This means that you cannot use 1pthread to add an option to the linker What is the correct format for linking to an API arm elf gcc W1 elf2flt In this example the API converts elf format to flat format
30. nfiguring 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 All users on the Ethernet share a common connection so the Ethernet principles that support multiple users on a LAN combine with the PPP principles which apply to serial connections Create the Connection gt pppd pty pppoe I ETHERNET INTERFACE m 1412 user USER NAME password USER PASSWORD amp ETHERNET INTERFACE Ethernet card connected to ADSL modem for example eth0 USER NAME User account for example moxa Q adsl net USER PASSWORD Password for user account To check if PPPOE is successfully connected use the command gt ifconfig ppp0 How to Mount a Remote NFS Server Currently the EM 1220 LX only supports NFS Network File System clients Users can open NFS service on a Linux PC to enable the EM 1220 LX to push data to it The EM 1220 LX can use NFS to mount a remote disk as a local disk for data or log purposes 1 First the NFS server must open an export directory and allow access to the IP address Edit the file etc exports on your Linux PC and then run the NFS daemon The following example gives one
31. ng iptables iptables save gt home xxx file xxx file is the user defined file name vi etc re Append echo 1 gt proc sys net ipv4 ip_forward Append iptables restore home xxx file xxx file is the user defined file name Pe OS Configuring Dial in Dial out Service Dial out Service Direct cable connection e Without username and password use gt pppd connect chat v dev ttyMO 38400 crtscts amp e With username and password use gt pppd connect chat v user xxxxx password xxxxx dev ttyMO 38400 crtscts amp Connect Using a Modem Use gt pppd connect chat v ATDT phone number CONNECT user xxxxx password xxxxx dev ttyMO 38400 crtscts amp ATTENTION If dial out fails the pppd connection will be blocked and users will need to shut down pppd and re dial Since the return value is always OK regardless of whether or not the connection is blocked the API must be set up to check the network status to determine if the connection is complete Dial in Service Direct cable connection Use either of the following gt pppd Local IP Address Remote IP Address dev ttyM1 38400 local crtscts or gt pppd Local IP Address Remote IP Address dev ttyMO 38400 local crtscts login auth Connect Using a Modem Use gt pppd connect chat v AT CONNECT local IP Address Remote IP Address dev ttyMO 38400 crtscts login auth 4 8 EM 1220 LX User s Manual Co
32. nnecting to a Serial Device e 1 9 Serial Console Porti eet at Rp e ra n rr Ptr e ERE 1 10 Internal SD Socket eee meet UR DER Rer E eci 1 10 Additional Functions n eerte Do te ard EU OE D e iii 1 10 Reset Button 5a m necs reesteri LA e iti e Ae 1 10 Real time Clock toes ERE 1 11 Getting Started oie ettet arc iere hacerte 2 1 Powering on the EM 1220 DK iii 2 2 Connecting the EM 1220 EX toa BC iiiter uet lo tee e Rete te ERR ERR 2 2 Console Port sprona 2 2 Telnet nocte lionel eil pala a ER te olii es 2 3 Configuring the Ethernet Interface e 2 4 Installing a Secure Digital SD Memory Card i 2 6 Developing Your Applications i 2 6 Installing the EM 1220 LX Tool Chain i 2 7 Compiling Hello 6 5 2 2 ete ecu m distin a aio 2 7 Uploading Hello to the EM 1220 LX essere eene 2 9 Running Hello on the EM 1220 LX i 2 9 Make File Sample Code ie e caa Pe e etd ER 2 10 Software Package rato lille siii dillo aio E 3 1 EM 1220 LX Software Architecture i 3 2 Journaling Flash File System JFFS2 i 3 3 EM 1220 EX Software Package e Benet t eerie 3 4 Configuring the EM 1220 LX eeeeeeeeeeeeeeeeeeeenee nennen nnn 4 1 Enabling and Disabling DaemMons enne en trennen 4 2 Adding Web Pase stv ariana al A
33. o use these functions after the Tool Chain package is installed include lt moxadevice h gt in your application define RS232 MODE 0 define RS485 2WIRE MODE T define RS422_MODE 2 define RS485_4WIRE_MODE 3 Function MOXA_SET_OP_MODE int mode mode which mode you want to set int ioctl fd MOXA SET OP MODE amp mode Description Sets the interface mod 2 Function MOXA GET OP MOD G int mode int ioctl fd MOXA_GET_OP_MODE amp mode Description Gets the interface mod 5 2 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 Dynamic link will not be supported Users can use our source code and the system call within ioctl command to communicate with drivers API List 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 9 for EM 1240 and from Port 0 to Port 7 for EM 1220 Output represents DI 0 represents DO Return lt 0 is wrong 0 is correct int get gpio data unsigned int pio
34. ocess OUTPUT chain processes packets after the routing process It has three extensions TTL MARK TOS The following figure shows the IPTABLES hierarchy Incoming Packets Mangle Table PREROUTING Chain NAT Table PREROUTING Chain Local Host Packets Mangle Table INPUT Chain Other Host Packets Mangle Table FORWARD Chain Filter Table INPUT Chain Local Process Mangle Table OUTPUT Chain Filter Table FORWARD Chain Mangle Table POSTROUTING Chain NAT Table OUTPUT Chain Filter Table OUTPUT Chain NAT Table POSTROUTING Chain Outgoing Packets 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 NOTE a module x_tables xt_conntrack xt_helper xt_mark xt_pkttype xt_state xt_tcpudp xt_CLASSIFY xt dccp xt length xt MARK xt quota xt statistic xt comment xt dscp xt multiport xt realm xt string xt connbytes xt esp xt mac xt NFQUEUE xt sctp xt tcpmss xt limit arptable filter ip nat iptable raw ipt hashlimit ipt owner ipt time arp tables ip nat snmp basic ip tables ipt iprange ipt recent ipt tos arpt mangle ip nat tftp ipt addrtype ipt layer7 ipt REDIRECT ipt TOS ip nat amanda iptable filter i
35. of the EM 1220 LX by using the following command gt cat etc version 4 12 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 Oooo 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 uClinux standard simple RTC control You must include lt linux rtc h gt to use these functions 1 Function RTC RD TIM int ioctl fd RTC RD TIME struct rtc time time Description Reads time information from RTC G 2 Function RTC_SET_TIME int ioctl fd RTC SET TIME struct rtc time time Description Sets RTC time Buzzer The device node is located at dev console The EM 1220 LX supports uClinux standard buzzer control The EM 1220 LX s buzzer runs at a fixed frequency of 100 Hz You must include sys kd h to use these functions 1 Function 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 modem tty device node is located at dev com0 com1 The EM 1220 LX Series supports uClinux standard termios control The Moxa UART Device API supports configurations ttyMO to ttyM1 as RS 232 422 485 T
36. ogin Password xxxx ftp gt bin ftp gt get em1220 1 x dsk ftp gt quit ramdisk gt upkernel ramdisk em1220 1 x dsk reboot upkernel em1220 1 0 dsk To check the source tile context The firmware source file is OK The version is 1 6 This step will destory your old kernel Do you want to continue it V N V Formating disk Erased 2560 Kibyte eg 100 complete Format OK Now update the root filesystem Please wait the root file system OK Please push the reset button 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 amp User Directory for an introduction You may also press the RESET button for more than 5 seconds to load the factory default configuration or input the command Idfactory 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 program amp Checking the Kernel and Root File System Versions Use the following commands to check the version of the kernel and root file system To check the kernel version gt kversion To check the root file system firmware version of the EM 1220 LX type gt fsversion You may also check the user directory version
37. packet filter rule tables Several different tables 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 matching packet A rule such as a jump to a user defined chain in the same table is called a target The EM 1220 LX supports three types of IPTABLES tables Filter tables NAT tables and Mangle tables A Filter Table includes three chains INPUT chain OUTPUT chain FORWARD chain B NAT Table includes three chains PREROUTING chain transfers the destination IP address DNAT POSTROUTING chain works after the routing process and before the Ethernet device process to transfer the source IP address SNAT OUTPUT chain produces local packets sub tables Source NAT SNAT changes the first source packet IP address 4 3 EM 1220 LX User s Manual Configuring the EM 1220 LX 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 REDIRECT a special form of DNAT that re sends packets to a local host independent of the destination IP address C Mangle Table includes two chains PREROUTING chain pre processes packets before the routing pr
38. ples 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 iptables F iptables X iptables Z Define policy for chain rules Usage iptables t tables P INPUT OUTPUT FORWARD PREROUTING OUTPUT POSTROUTING ACCEPT DROP P Set the policy for the chain to the given target INPUT For packets coming into the EM 1240 LX OUTPUT For locally generated packets FORWARD For packets routed out through the EM 1240 LX PREROUTING To alter packets as soon as they come in POSTROUTING To alter packets as they are about to be sent out Examples iptables P INPUT DROP iptables P 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 denies incoming packets Append or delete rules Usage iptables t table AI INPUT OUTPUT FORWARD io interface p tcp udp icmp all s IP network sport ports d IP network dport ports j ACCEPT DROP A Append one or more rules to the end of the selected chain I Insert one or more rules in the selected chain as the given rule number i Name of an interface via which a p
39. pt ah ipt LOG ipt REJECT ipt ttl ip nat ftp iptable mangle ipt ecn ipt MASQUERADE ipt SAME ipt TTL ip nat irc iptable nat ipt ECN ipt NETMAP ipt TCPMSS ipt ULONG The EM 1220 LX does NOT 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 access We recommend using the Serial Console to set up IPTABLES Click on the following links for more information about iptables http www linuxguruz com iptables http www netfilter org documentation HOWTO packet filtering HOWTO html Since the IPTABLES command is very complex to illustrate the IPTABLES syntax we have divided our discussion of the various rules into three categories Observe and erase chain rules Define policy rules and Append or delete rules Observe and erase chain rules Usage iptables t tables L n t tables Table to manipulate default filter example nat or filter L chain List List all rules in selected chains If no chain is selected all chains are listed n Numeric output of addresses and ports iptables t tables FXZ F Flush the selected chain all the chains in the table if none is listed X Delete the specified user defined chain Z Set the packet and byte counters in all chains to zero 4 5 EM 1220 LX User s Manual Configuring the EM 1220 LX Exam
40. rporated into new editions of the publication Technical Support Contact Information www moxa com support Moxa Americas Moxa China Shanghai office Toll free 1 888 669 2872 Toll free 800 820 5036 Tel 1 714 528 6777 Tel 86 21 5258 9955 Fax 1 714 528 6778 Fax 86 10 6872 3958 Moxa Europe Moxa Asia Pacific Tel 49 89 3 70 03 99 0 Tel 886 2 8919 1230 Fax 49 89 3 70 03 99 99 Fax 886 2 8919 1231 Chapter 1 Chapter 2 Chapter 3 Chapter 4 Table of Contents Introduction sica da 1 1 OVEIVIEW zi iaa cite e rei Red aote alba 1 2 rdermg Information rece bre ete ERU o t ER P oS ERE 1 2 Product Eeatures ail illa NA ALGA Ue dte et d o eodem Senne 1 3 Product Specifications tid nmn OR Uta om a ai 1 3 Hardware Sp ecifications cn ea A ia bat i ei dts 1 3 Software Specifications ient HR So e 1 4 Hardware Block Diagram iret e ote eere Pre IR IRE UE Ve DUE de a 1 5 APPCALADCE m M M 1 5 DIMENSIONS Gli o aee cro d ite qe cute aa eite ata e eid ees 1 6 Installing th EM 1220 D X aprire eo eet EU e e RE p REPRE 1 7 LED Indicators ono LL Sur pP Dee m REED 1 7 Wiring Reguirements 5 05 nosmet eo amat RE E RA eR 1 7 Connecting th Power asili aa AR tb m b DAI at 1 8 Grounding the EM 1220 DK Carrier Board esee 1 8 Connecting Data Transmission Cables i 1 9 Connecting to the Network canine onietuc ti epo de aan 1 9 Co
41. rt If you are not able to connect on the first try unplug and then re plug the power cord from the EM 1220 DK e Telnet Reminder When connecting to the EM 12200 LX over a LAN you must configure your PC s Ethernet card to be on the same subnet as the EM 1220 LX that you wish to contact 2 3 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 Product EM 1220 Series For further information check http iwww moxa com tw State OPEN iPS E RT IMCO Type the command vi rc to use VI Editor to edit the configuration file The IP addresses for the EM 1220 LX s LANI and LAN2 are 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 E COM8 19200 None 8 1 T100 bin sh hostname moxa com tw for cat etc motd RTS li ig lo 127 0 0 1 ifconfig ethO 192 168 3 127 netmask 255 255 2 lisconfig ethl 192 168 4 127 netmask 255 255 2 route add default gw 192 168 3 254 dev eth0 rtc clock to system clock Loading your driver here gt uart driver for dev ttyMO dev ttyM1 insmod lib modules 2 6 9 MoXaRt kernel drivers char mxser ko set the serial port interface now default set to RS232 if you want to change then you need modify fo
42. s real time clock with the command hwclock w Visit http www ntp org for a recommended public NTP server list How to update the system time periodically with Network Time Protocol 1 Create a shell script file that includes the following description bin sh ntpdate ntp server ip hwclock w Sleep 100 The min time is 100ms 2 Save and make this shell script executable by typing chmod 755 shell script name Edit the file etc inittab by adding the following line ntp unknown directory shell script name 4 2 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 n KR A minimal config that makes the home page an unauthenticated CGI alias ing 2 Pr f Auth cgi bin cgi demo etc config config laddType text plain txt laddType image gif gif laddType text htmi html laddType text html htm laddType text xml xml l ddType image jpeg jpe JAddType image jpeg jpeg l ddTvpe image jpeg ipo laddType image x icon ico To add your web page place your home page in the following directory home httpd IPTABLES IPTABLES is an administrative tool for setting up maintaining and inspecting the Linux kernel s IP
43. sing may feel hot to the touch Connecting the Power Connect the live wire end of the 12 48 VDC power adaptor to the terminal block of EM 1220 DK carrier board If the power is properly supplied the Ready LED will glow a solid green after a 25 to 30 second delay Grounding the EM 1220 DK Carrier Board A ATTENTION This product should be mounted to a well grounded mounting surface such as a metal panel SG l SG The Shielded Ground sometimes called 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 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 1 8 EM 1220 LX User s Manual Introduction Connecting Data Transmission Cables This section describes how to connect the EM 1220 DK carrier board to the network serial devices and serial COM terminal Connecting to the Network Connect 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 valid connection to the Ethernet in the following ways The top right LED on the connector glows a solid green when connected to a 100 Mbps
44. tching a pattern cut remove sections from each line of files find search for files in a directory hierarchy more dump file by one page test test if file exists or not echo echo string EM 1220 LX User s Manual System Commands Network ping ping to test network route routing table manager netstat display network status ifconfig set network IP address tftp tftp protocol telnet user interface to TELNET protocol ftp file transfer protocol iptables iptables command Process kill kill process killall kill process by name ps report process status sleep suspend command on 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 environment clear clear the terminal screen reboot reboot power off on the server halt halt the server gzip gunzip zcat_ compress or expand files hostname show system s host name tar tar archiving utility Moxa Special Utilities cat etc version show user directory version upramdisk mount ramdisk downramdisk unmount ramdisk kversion show kernel version setinterface set UART interfaces program A 2 B SNMP Agent with MIB Il amp RS 232 Like Group The EM 1220 LX has a built in SNMP Simple Network Managem
45. tem Freeing init memory 56K BusyBox v1 00 2006 03 31 09 54 0000 Built in shell msh Enter help for a list of built in commands Product EM 1220 Serial For further information check http www moxa com tw 2 2 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 LAN1 192 168 3 127 255 255 255 0 connect to the EM 1220 LX s LAN2 192 168 4 127 255 255 255 0 console Telnet can be used locally by using a crossover Ethernet cable to connect your computer to the EM 1220 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 ca Telnet 192 168 3 127 moxa com tw login root Password Welcome to Product EM 1220 For further information check http www moxa com tu Bus yBox v1 88 2085 12 08 087 21 0080 Built in shell msh Enter help for a list of built in commands d Once you open the msh command shell you can proceed to configure the EM 1220 LX s network settings as described in the next section AN ENTION e Serial Console Reminder Remember to choose VT100 as the terminal type Use the CBL 4PINDB9F 100 cable that comes with the EM 1220 Development Kit to connect to the serial console po
46. than emulating a block device designed for use on flash ROM chips It recognizes flash ROM chips special write requirements does wear leveling to extend flash life keeps the 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 on boot up JFFS2 a later version of JFFS provides improved wear leveling and garbage collection performance improved RAM footprint and response to system memory pressure improved concurrency and support for suspending flash erases marking of bad sectors with continued use of the remaining good sectors thus enhancing the write life of the devices native data compression inside the file system design and support for hard links Key features of JFFS2 are e Directly targeted to Flash ROM e Robust Consistent across power failure e No integrity scan fsck is required at boot time after normal or abnormal shutdown e Explicit wear leveling e Transparent compression Although JFFS2 is a journaling file system this does not preclude the loss of data The file system will remain in a consistent state across power failures and will always be mountable However if the board is powered down during a write then the incomplete write will be rolled back on the next boot Any writes that were already completed will not be affected Additional information about JFFS2 is a
47. 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 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 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 Keep input wiring and output wiring separate tis advisable to label the wiring to all devices in the system 1 7 EM 1220 LX User s Manual Introduction A ATTENTION Safety 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 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 1220 LX and or the EM 1220 DK When plugged in the EM 1220 LX s and or the EM 1220 DK s internal components generate heat and consequently the outer ca
48. ual Introduction EM 1220 LX Embedded Module MOXA ART ARMO 32 bit Communication Processor onboard 16 MB RAM EM 1220 LX Development Kit LAN Port 1 LAN Port 2 Power Input Dimensions EM 1220 LX Embedded Module 80cm rn ers 358 C EY Myy halt 50cm EM 1220 LX User s Manual Introduction EM 1220 DK Carrier Board 117 cm 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 on the development kit and the 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 70 cm The following table explains the function of the five LED indicators on the EM 1220 LX Development Kit 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 1220 LX to serial devices Be sure to heed the following common safety precautions before proceeding with
49. vailable at http sources redhat com jffs2 jffs2 pdf http developer axis com software jffs http www linux mtd infradead org 3 3 EM 1220 LX User s Manual Software Package EM 1220 LX Software Package Bin dev upkernel mtdblock1 passwd gt tinylogin mtdrl login gt tinylogin mtd1 tinylogin mtdblock0 telnetd mtdr0 snmpd mtd0 mail cuml sh cum0 routed ttyM1 netstat ttyMO arp urandom chat random pppd Zero portmap ttypf ntpdate ttype necid ttypd eraseall ttypc kversion ttypb init ttypa expand ttyp9 inetd ttyp8 hwclock ttyp7 ftpd ttyp6 ftp ttyp5 mke2fs ttyp4 e2fsck ttyp3 discard ttyp2 dhcpcd ttypl cpu ttyp0 busybox ttySO boa tty3 downramdisk tty2 upramdisk ttyl ttyO roml rom0 ptypf ptype ptypd ptypc ptypb ptypa ptyp9 ptyp8 ptyp7 ptyp6 ptyp5 ptyp4 ptyp3 ptyp2 ptypl 3 4 EM 1220 LX User s Manual Software Package Bin dev ptypO PPP pio rtc raml ram0 null kmem mem cua0 console tty 4 Configuring the EM 1220 LX In this chapter we describe how to configure the EM 1220 LX Series products The following topics are covered in this chapter Oooo L DODCDUDDUOCLC Enabling and Disabling Daemons Adding a Web Page IPTABLES NAT NAT Example Enabling NAT at Bootup Configuring Dial in Dial out Service gt Dial out Service gt Dial in Service Configuring PPPoE How to Mount a Remote NF
50. xample gt arm elf gcc wl elf2flt o TestGpioAp TestGpioAp c Imoxalib Ipthread 5 4 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 2 Both moxadevice h and libmoxalib a are supported in Tool Chain v1 6 or newer version GPIO Library Source Code Vici History Date Author Comment 12 06 2005 Victor Yu Create it si include lt stdio h gt include lt stdlib h gt include lt fcntl h gt following about GPIO API implement define GPIO DEVICE NODE dev pio define IOCTL GPIO GET MODE 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 define GPIO DATA ERROR 3 the GPIO data error define GPIO NODE ERROR 4 open GPIO device node error define GPIO ERROR 5 some error get error number from errno define GPIO INPUT 1 the GPIO mode is input define GPIO OUTPUT 0 the GPIO mode is output define GPIO HIGH 1 the GPIO data is high define GPIO LOW 0 the GPIO data is low define GPIO OK 0 function is OK define CHECK GPIO NO p if p gt MAX GPIO V return GPIO NO ER
51. ystem configuration parameters via rc or inittab Normally the kernel uses the User Directory to boot up the system The kernel will only use the default configuration etc amp home when the User Directory crashes The EM 1220 LX uses ROMFS for the Linux kernel image Root File System and Protected configuration and uses JFFS2 for the User Directory 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 3 2 EM 1220 LX User s Manual Software Package Flash Context Flash Address Size Access control Boot loader 0 Ox3 ffff 256 K Read ONLY Kernet amp 0x40000 0x3fffff 4M Read ONLY Root File System JFFS2 User Directory 0x400000 0x7fffff 256 K to 4M Read Write JFFS2 Developers should only store their own programs to partitions etc home tmp and usr bin In addition executable files should be stored in usr bin since doing so will allow developers to use hotkeys In addition to the flash file systems a RAM based file system is mounted on var Journaling Flash File System JFFS2 The flash User Directory is formatted by the Journaling Flash File System JFFS2 which places a compressed file system on the flash transparent to the user Axis Communications in Sweden developed the Journaling Flash File System JFFS2 JFFS2 provides a file system directly on flash rather

Download Pdf Manuals

image

Related Search

Related Contents

A01467801 MANUAL DE INSTRUCOES MRP B  GISELLE ALMEIDA BARRETO  NifMo あんしん保証 利用規約  BenQ BL3200PT User Guide Manual  Operating Instructions  User manual  Cooper Lighting UMX Series Watertight User's Manual  Cisco Systems EFG120 Installation Manual  据付工事説明書  Duracell Ultra Batteries AAA 4 + 4 Free  

Copyright © All rights reserved.
Failed to retrieve file