Moxa Technologies UC-7420/7410 manual

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106

Go to page of

A good user manual

The rules should oblige the seller to give the purchaser an operating instrucion of Moxa Technologies UC-7420/7410, along with an item. The lack of an instruction or false information given to customer shall constitute grounds to apply for a complaint because of nonconformity of goods with the contract. In accordance with the law, a customer can receive an instruction in non-paper form; lately graphic and electronic forms of the manuals, as well as instructional videos have been majorly used. A necessary precondition for this is the unmistakable, legible character of an instruction.

What is an instruction?

The term originates from the Latin word „instructio”, which means organizing. Therefore, in an instruction of Moxa Technologies UC-7420/7410 one could find a process description. An instruction's purpose is to teach, to ease the start-up and an item's use or performance of certain activities. An instruction is a compilation of information about an item/a service, it is a clue.

Unfortunately, only a few customers devote their time to read an instruction of Moxa Technologies UC-7420/7410. A good user manual introduces us to a number of additional functionalities of the purchased item, and also helps us to avoid the formation of most of the defects.

What should a perfect user manual contain?

First and foremost, an user manual of Moxa Technologies UC-7420/7410 should contain:
- informations concerning technical data of Moxa Technologies UC-7420/7410
- name of the manufacturer and a year of construction of the Moxa Technologies UC-7420/7410 item
- rules of operation, control and maintenance of the Moxa Technologies UC-7420/7410 item
- safety signs and mark certificates which confirm compatibility with appropriate standards

Why don't we read the manuals?

Usually it results from the lack of time and certainty about functionalities of purchased items. Unfortunately, networking and start-up of Moxa Technologies UC-7420/7410 alone are not enough. An instruction contains a number of clues concerning respective functionalities, safety rules, maintenance methods (what means should be used), eventual defects of Moxa Technologies UC-7420/7410, and methods of problem resolution. Eventually, when one still can't find the answer to his problems, he will be directed to the Moxa Technologies service. Lately animated manuals and instructional videos are quite popular among customers. These kinds of user manuals are effective; they assure that a customer will familiarize himself with the whole material, and won't skip complicated, technical information of Moxa Technologies UC-7420/7410.

Why one should read the manuals?

It is mostly in the manuals where we will find the details concerning construction and possibility of the Moxa Technologies UC-7420/7410 item, and its use of respective accessory, as well as information concerning all the functions and facilities.

After a successful purchase of an item one should find a moment and get to know with every part of an instruction. Currently the manuals are carefully prearranged and translated, so they could be fully understood by its users. The manuals will serve as an informational aid.

Table of contents for the manual

  • Page 1

    UC-7420/7410 User ’ s Manual Third Edition, June 2005 www .moxa.com/product Moxa Technologies Co., Ltd. Tel: +886-2-8919-1230 Fax: +886-2-8919-1231 Web: www.moxa.com MOXA Technical Support World wide: support@moxa.com.tw The Americas support@ moxa.com[...]

  • Page 2

    UC-7420/7410 User’s Manual The software d escribed in t his manual is furnished u nder a license a greement and m ay be used only in accordance with the term s of that agreement. Copyright Notice Copyright © 2005 Moxa Technologies Co., Ltd. All rights reserved. Reproducti on without perm ission is pr ohibited. Trademarks MOXA is a re gistered tr[...]

  • Page 3

    Table of Contents Chapter 1 Introduction .................................................................................................. 1-1 Overview.................................................................................................................................. 1-2 Package Ch ecklis t............................................[...]

  • Page 4

    Compiling tcps2.c..................................................................................................... 2-16 Uploading tcps2-release a n d Running the Pr ogram ................................................. 2-17 Testing Procedure Summary .................................................................................... 2-1 9 Cha[...]

  • Page 5

    W indows UC Finde r .............................................................................................................. .. 6-2 Installing th e Software................................................................................................ 6-2 Broadcast Search ......................................................................[...]

  • Page 6

    1 1 Chapter 1 Introduction Welcome to M OXA UC-742 0/7410 RISC -based Com munication Pl atforms. A vailable features include eight RS-232/422/485 seri al ports, dual 10/100 Mbps Ethe rnet ports, a PCMCIA interface for wireless L AN communi cation, and C ompactFl ash and USB ports for mass storage disk expansion, m aking UC- 7420/7410 ideal for your[...]

  • Page 7

    UC-7420/7410 User’s Manual Introduction 1-2 Overview UC-7420/741 0 RISC-based C ommunicat ion Platfo rms are i deal for embedded applications. UC-7420/7 410 has eig ht RS-232/ 422/485 ser ial ports, dual 10/100 M bps Ethernet ports, a PCMCIA interface for wireless LAN communicatio n, an d CompactFlash and USB port for m ass storage flash disk e x[...]

  • Page 8

    UC-7420/7410 User’s Manual Introduction 1-3 y PCMCIA/CompactFlash expansion ( UC-7420 only) y USB Host for mass storage device (UC-7420 on ly) y LCM display and Keypad for HMI y Linux-rea dy communicat ion platform y DIN-Rail or wall mounting installation y Robust fanless desig n Product Hardware Specifications UC-7410-LX UC7420-LX CPU Intel Xsca[...]

  • Page 9

    UC-7420/7410 User’s Manual Introduction 1-4 Hardware Introduction Appearance and Dimensions Appearance UC-7410/7420 Rear Vie w DC 12-48V USB LAN1 LAN2 Console V+ V- PCMCIA CF 12-48 VDC Power Input CF x 1 PCMCIA x 1 10/100 Mbps Ethernet x 2 USB 2.0 Host x 2, A T ype Connector USB 1.1 Client x 1, miniB Connector RS-232 PPP/Console UC-7410/7420 Top [...]

  • Page 10

    UC-7420/7410 User’s Manual Introduction 1-5 Dimensions 197 mm [7.76"] 125 mm [4.92"] 44 mm [1.73"][...]

  • Page 11

    UC-7420/7410 User’s Manual Introduction 1-6 Hardware Block Diagram The following block diagram shows the layou t of UC-7420’s internal componen ts (the layout for UC-7410 is sl ightly di fferent). USB Host USB controller PCI to cardbus Bridge Moxa UART ASIC PCI Bus USB Client PCMCIA & CompactFlash Console LAN2 LAN1 RS-232/422/485 RS-232 Eth[...]

  • Page 12

    UC-7420/7410 User’s Manual Introduction 1-7 Reset-type Buttons UC-7420/7410 ha s two reset-type button s. The button lab eled Reset has the same effect as unpluggin g the powe r and the n plugging the powe r back in. The button la beled Re set to default returns UC-7420/7410 to the factory default parameter configuration. Reset Button Pressing th[...]

  • Page 13

    UC-7420/7410 User’s Manual Introduction 1-8 Placement Options W all or Cabinet The two metal brackets that co me standard with UC-7420/7410 are used to attach UC-7420/7410 to a wall, or the inside of a cabinet. Use two scre ws per bracket first to attach the brackets to the bottom of the UC-7420/7410 (Fig. A). Next, us e two screws per bracket to[...]

  • Page 14

    UC-7420/7410 User’s Manual Introduction 1-9 DIN-Rail Mounting The aluminum DIN-Rail attachm ent plate is included in the package. If you need to reattach the DIN-Rail attachment plate to UC-7420/7410, make sure the stiff metal spring is situated towards the top, as shown in the figures b elow. 1. Insert the top of the DIN-Rail into the slot just [...]

  • Page 15

    UC-7420/7410 User’s Manual Introduction 1-10 y You can use the type of signal transmitted through a wire to determine which wires should be kept separate. The rule o f thumb is that wiring that shares sim ilar electrical characteristics can be bundled toge ther. y Keep input wir ing and output wiring sepa rate. y Where necessary, it is strongl y [...]

  • Page 16

    UC-7420/7410 User’s Manual Introduction 1-11 Connecting to a Serial Device Use properly wired serial cables to conn ect UC-7420/7410 to serial devices. UC-7420/7 410’s serial ports (P 1 to P8) use 8-pin RJ 45 connectors. T he ports can be configured by software f or RS-232, RS-422, or 2-wire RS-485 . The precise pin assignments are show n in th[...]

  • Page 17

    UC-7420/7410 User’s Manual Introduction 1-12 Software Introduction Software Architecture The Linux operating system that is pre-installed in UC-7420/7410 follows th e standard Linux architecture, making it easy to po rt programs that follow the POSIX standard to UC-7420/7410. Porting is d one with t he GNU Tool Chain provi ded by Mo xa. In ad dit[...]

  • Page 18

    UC-7420/7410 User’s Manual Introduction 1-13 services and daemons. During this time, the kern el will start searching for system configuration parameters via rc or inittab. Normally, the kernel uses t he User Root File System to boot up the system. T he Mini Root File System is protected, and cannot be ch anged by the user, prov iding a “safe?[...]

  • Page 19

    UC-7420/7410 User’s Manual Introduction 1-14 OS shell command bash Busybox Linux normal command u tility collection Utilities tinylogin lo gin and u ser manager utility telnet telnet client program ftp FTP client program smtpclient email utility scp Secure file transfer Client Program Daemons pppd dial in/out over serial port daem on snmpd snmpd [...]

  • Page 20

    UC-7420/7410 User’s Manual Introduction 1-15 Protocol stacks and utilities Arp (utility) N/A Yes Yes iptable N/A N/A Yes Open VPN N/A N/A Yes WatchDog API N/A N/A Yes Crontable N/A N/A Yes upfirm N/A N/A Yes backupuf N/A N/A Yes backupfs, bf Yes Yes N/A minicom Yes Yes Replace by tip Directory Change /var User File System User File System Chang e[...]

  • Page 21

    2 2 Chapter 2 Getting Started In this chapter, we explain how to conn ect UC-7420/7410, turn on the power, and then get started using the programm ing and ot her functio ns. The following topics are covered in this chapter:  Powering on UC-7420/7410  Connecting UC-7420/7410 to a PC ¾ Serial Console ¾ Telnet Console ¾ SSH Console  Config[...]

  • Page 22

    UC-7420/7410 User’s Manual Getting Started 2-2 Powering on UC-7420/7410 Connect the SG wire to the Shielded Con tact located in the upp er left corner of the UC-7420/7410, and then power on U C-7420/7410 by conn ecting it to the power adaptor. It takes ab out 30 to 60 seconds for the system to boo t up. Once the system is ready, the Ready LED wil[...]

  • Page 23

    UC-7420/7410 User’s Manual Getting Started 2-3 Telnet Console If you know at least one of the tw o IP addresses an d netmasks, then you can use Telnet to c onnect to UC-7420/7410’s co nsole utility. The default IP a ddress and Netm ask for each of the two ports are given below: Default IP Address Netmask LAN 1 192.168.3.127 255.255.255 .0 LAN 2[...]

  • Page 24

    UC-7420/7410 User’s Manual Getting Started 2-4 ATTENTION Serial Console Reminder Remember to choose VT100 as the terminal type. Use cable C BL-RJ45F9- 150, which com es with UC-7420/7410 , to connect to the serial console por t. Telnet Reminder When conn ecting to UC-7420/741 0 over a LAN, you must conf igure your PC’s Eth ernet IP address to b[...]

  • Page 25

    UC-7420/7410 User’s Manual Getting Started 2-5 Linux Users From a Linux machine, use t he “ssh” command to access UC-7420/7410’s C onsole utility via SSH. #ssh 192.168.3.127 Select yes to complete the connection. [root@bee_notebook root]# ssh 192.168.3.127 The authenticity of host ‘192.168.3.127 (192.168.3.127)’ can’t be established. [...]

  • Page 26

    UC-7420/7410 User’s Manual Getting Started 2-6 Dynamic IP addresses : By default, UC-7420/7410 is configured for “static” IP addr esses. To configure one or both LAN ports to request an IP address dynami cally, replace static with dhcp and th en delete the address, network , netmask, and broa dcast lines. Default Setting for LAN1 Dynam ic Set[...]

  • Page 27

    UC-7420/7410 User’s Manual Getting Started 2-7 NOTE After changing the IP settings, use the networking restart command to activate the new IP address. However, the LCM display will still sh ow the old IP address. To update the LCM display, you will need to reboot the UC-7420 /7410. Modifying Network Settings over the Network IP settings can be ac[...]

  • Page 28

    UC-7420/7410 User’s Manual Getting Started 2-8 3. Configure the Wireless LAN card’s d efault SSID setting profile. (Default SSID is “any”) #vi /etc/wlan/wlan.conf // Consult your network ad ministrator for SSID required in your wireless network. For example, SSID_waln0=” any”, Enable _wlan0=y // 4. Duplicate the configuration profile to[...]

  • Page 29

    UC-7420/7410 User’s Manual Getting Started 2-9 IEEE802.11g The following I EEE802.11g wireless modules are supported: y ASUS — WL -107g y CNET — CWC -854 (181D version) y Edmiax — EW-7108PCg y Amigo — AWP-914W y GigaByte — GN-WMGK y Other brands that use the Ralink RT2560 series chip set To configu re the WLAN for IEEE80 2.11g: 1. Unplu[...]

  • Page 30

    UC-7420/7410 User’s Manual Getting Started 2-10 3. Additional WLAN parameters are contained in the file RT2500STA.dat . To open the file, navigate to t he RT2500ST A folde r and invoke vi, or ty pe the follo wing comm and #vi /etc/Wireless/RT2500STA/RT2500STA.dat to edit the file with vi editor. Settin g options for the various parameters are lis[...]

  • Page 31

    UC-7420/7410 User’s Manual Getting Started 2-11 NetworkT ype —Sets the wireless operation mode Setting Explanation Infra Infrastructure mode (use s access points to transm it data) Adhoc Adhoc mode (transmit s data from host to host) Channel —Sets the channel Setting Explanation 0 auto 1 to 14 the channel y ou want to use AuthMode —Sets the[...]

  • Page 32

    UC-7420/7410 User’s Manual Getting Started 2-12 T urboR ate —Enabl es or disables T urboRate Setting Explanation 0 disable 1 enable BGProtection —Sets 1 1b/1 1g protection (t his functio n is for e ngineering t esting o nly) Setting Explanation 0 auto 1 always on 2 always off ShortSlot —Enables or disables t he short slo t time Setting Expl[...]

  • Page 33

    UC-7420/7410 User’s Manual Getting Started 2-13 Test Program — Developing Hello.c In this section, we use the standard “Hello” programming example to illu strate how to develop a program for UC-7420/7 410. In gene ral, prog ram developm ent involves t he followi ng seven st eps. Step 1: Connect UC-7 420/7410 to a Linu x PC. Step 2: Install [...]

  • Page 34

    UC-7420/7410 User’s Manual Getting Started 2-14 If there isn’t enough “Available” space for you r application, you will need to delete some existing files. To do this, connect your PC to the UC-7420 /7410 with the console cab le, and then use the console utility to delete the files from UC-7420/7410 ’s flash memory. NOTE If the flash m em[...]

  • Page 35

    UC-7420/7410 User’s Manual Getting Started 2-15 Uploading “Hello” to UC-742 0/7410 and Running the Program Use the follo wing comm and to upl oad hello-release to the UC-7420/7410 via FTP. 1. From the PC, type: #ftp 192.168.3.127 2. Use bin command to set the transfer mode to Binary mode, and the put command to initiate the file transfer: ftp[...]

  • Page 36

    UC-7420/7410 User’s Manual Getting Started 2-16 Compiling tcps2.c The source code for the tcps2 exam ple is located on the CD -ROM at CD-ROM://example/TCPServer2/tcps 2.c . Use the following commands to copy the file to a specific directory on your PC. We use the direrctory /home/uc7400/1st_application/ . Note that you need to copy 3 files — Ma[...]

  • Page 37

    UC-7420/7410 User’s Manual Getting Started 2-17 Uploading tcps2-release and Running the Program Use the following commands to use FTP to up load tcps2-release to the UC-7420/7410. 1. From the PC, type: #ftp 192.168.3.127 2. Next, use the bin command to set the transfer mode to Binary , and the put command to initiate the file transfer: ftp> bi[...]

  • Page 38

    UC-7420/7410 User’s Manual Getting Started 2-18 4. The program should start running in the background. Use either the #jobs or #ps –ef command to check if the t cps2 program is actuall y running i n the backgr ound. #jobs // use this command to check if the program is running 192.168.3.127 – PuTTY root@Moxa:~# ls –al drwxr—xr-x 2 root roo[...]

  • Page 39

    UC-7420/7410 User’s Manual Getting Started 2-19 158 root 1532 S /sbin/getty 115200 ttyS1 162 root 3652 S /usr/sbin/sshd 163 root 2208 S -bash 169 root 2192 S ftpd: 192.168.3.110: root: IDLE 187 root 1264 S ./tcps2-release 188 root 1592 S ps -ef root@Moxa:~# NOTE Use the kill -9 command for PID 187 to terminate this program: #kill -9 %187 Testing [...]

  • Page 40

    UC-7420/7410 User’s Manual Getting Started 2-20 NOTE The tcps2.c application is a simple example designe d to give use rs a basic unde rstanding of the concepts inv olved in com bining Ethe rnet comm unication and serial port c ommuni cation. However, the example program has some limita tions that make it unsu itable for real-life applications. 1[...]

  • Page 41

    3 3 Chapter 3 Managing Embedded Linux This chapte r includes inf ormati on about vers ion contr ol, deploy ment, up dates, and peri pherals. The information in this chapter will be particu larly useful when you need to run the same application on several UC -7420/74 10 units. The following topics are covered in this chapter:  System Version Info[...]

  • Page 42

    UC-7420/7410 User’s Manual Managing Embedded Linux 3-2 System Version Information To determine the hardware capability of your UC-7 420/7410 , and what kind of software functions are supported , check the vers ion numbers of your UC-7420/7410 ’s hardware, kern el, and user file system. Contact Moxa to determine th e hardware version. You will n[...]

  • Page 43

    UC-7420/7410 User’s Manual Managing Embedded Linux 3-3 Since different Flash disks have different sizes, it’ s a good idea to check the size of your Flash disk before upgrading the firmware, o r before using the disk to stor e your application and data files. Use the #df –h command to list the size of each memory block, and how m uch free spa[...]

  • Page 44

    UC-7420/7410 User’s Manual Managing Embedded Linux 3-4 226 Transfer complete. ftp> get UC7420-1.5.frm local: UC7420-1.5.frm remote: UC7420-1.5.frm 200 Port command successful. 150 Opening data connection for UC7420-1.5.frm 226 Transfer complete. 13167772 bytes received in 2.17 secs (5925.8 kB/s) ftp> 3. Next, use the u pfirm command to upgr[...]

  • Page 45

    UC-7420/7410 User’s Manual Managing Embedded Linux 3-5 Backing Up the User File System 1. Create a back up file. The s pecific com mands used t o back up the user file sy stem depen d on whether the firmware version is earlier or later than version V1.5. Firmware versions earlier than V1.5 (not includin g V1.5) #upramdisk #backupfs /mnt/ramdisk/u[...]

  • Page 46

    UC-7420/7410 User’s Manual Managing Embedded Linux 3-6 Back up the user file system to a PC (refer to the previous subsection, “Backing Up the User File System,” for instructions), and then typ e the follo wing commands to copy the backup to ad ditional UC-7420/7410 un its. #upramdisk #cd /mnt/ramdisk #upfirm usrfs-backup 192.168.3.127 – Pu[...]

  • Page 47

    UC-7420/7410 User’s Manual Managing Embedded Linux 3-7 192.168.3.127 – PuTTY root@Moxa:~# cd /etc root@Moxa:/etc# ps -ef PID Uid VmSize Stat Command 1 root 1296 S init 2 root S [keventd] 3 root S [ksoftirqd_CPU0] 4 root S [kswapd] 5 root S [bdflush] 6 root S [kupdated] 7 root S [mtdblockd] 8 root S [khubd] 10 root S [jffs2_gcd_mtd3] 32 root D [[...]

  • Page 48

    UC-7420/7410 User’s Manual Managing Embedded Linux 3-8 192.168.3.127 – PuTTY root@Moxa:~# ps -ef PID Uid VmSize Stat Command 1 root 1296 S init 2 root S [keventd] 3 root S [ksoftirqd_CPU0] 4 root S [kswapd] 5 root S [bdflush] 6 root S [kupdated] 7 root S [mtdblockd] 8 root S [khubd] 10 root S [jffs2_gcd_mtd3] 32 root D [ixp425_csr] 34 root S [i[...]

  • Page 49

    UC-7420/7410 User’s Manual Managing Embedded Linux 3-9 SxxRUNFILE stands for S: start the run file while linux bo ots up. xx : a number between 00 -99. The smaller number has a higher priority. RUNFILE: the file name. 192.168.3.127 – PuTTY root@Moxa:/ect/rc.d/rc3.d# ls S19nfs-common S25nfs-user-server S99showreadyled S20snmpd S55ssh S24pcmcia S[...]

  • Page 50

    UC-7420/7410 User’s Manual Managing Embedded Linux 3-10 192.168.3.127 – PuTTY root@Moxa:~# date Fri Jun 23 23:30:31 CST 2000 root@Moxa:~# hwclock Fri Jun 23 23:30:35 2000 -0.557748 seconds root@Moxa:~# date 120910002004 Thu Dec 9 10:00:00 CST 2004 root@Moxa:~# hwclock –w root@Moxa:~# date ; hwclock Thu Dec 9 10:01:07 CST 2004 Thu Dec 9 10:01:[...]

  • Page 51

    UC-7420/7410 User’s Manual Managing Embedded Linux 3-11 Save the shell script using a ny file nam e. E.g., fixtime How to run the shell script automa tically when the kernel boots up Copy the example shell script fixtime to directory /etc/init.d , and then use chmod 755 fixtime to change the shell script mod e. Next, use vi editor to edit th e fi[...]

  • Page 52

    UC-7420/7410 User’s Manual Managing Embedded Linux 3-12 Connecting Peripherals USB Mass S torage This function is o nly available for firm ware version V1. 5 (and later versi ons). The UC-7420/7410 supports PNP (plug -n-play), and hot pluggability for connecting USB mass storage devices. UC-7420/ 7410 has a built-in auto m ount utility that eases[...]

  • Page 53

    4 4 Chapter 4 Managing Communications In this chapt er, we ex plain how to configure UC -7420/741 0’s various comm unication funct ions. The following topics are covered in this chapter:  Telnet / FTP  DNS  Web Service — Apache ¾ Saving a Web Page to the CF Card  IPTABLES  NAT ¾ Enabling NAT Bootup  Dial-up Service — PPP ?[...]

  • Page 54

    UC-7420/7410 User’s Manual Managing Communication 4-2 Telnet / FTP In addition to suppo rting Telnet client/server and FTP client/server, the UC-7420/7410 system also supports SSH and sftp client/server. To enable or disable the Telnet/ftp server, you first need to edit the file /etc/inetd.conf . Enabling the Telnet/ftp server The following examp[...]

  • Page 55

    UC-7420/7410 User’s Manual Managing Communication 4-3 /usr/www/cgi-bin/ Before you modify the homepage, use a browser (such as Microsoft Intern et Explore or Mozilla Firefox) from your PC to test if the Apach e Web Server is working. Type the LAN1 IP address in the browser’s address box to op en the homepage. E.g. , if the default IP address is[...]

  • Page 56

    UC-7420/7410 User’s Manual Managing Communication 4-4 To open the de fault CGI t est script re port page, t ype http://192.168.3.127 /cgi-bin/test-cgi in you r browser’s address box. NOTE The CGI f unction is e nabled b y default. If y ou want t o disable the f unction, m odify the fil e /etc/apache/httpd.conf . When you devel op your own CGI a[...]

  • Page 57

    UC-7420/7410 User’s Manual Managing Communication 4-5 Step 2: Use the follow ing comm ands to config ure the Apache we b server’s DocumentR oot: #cd /etc/apache #vi httpd.conf …… DocumentRoot “/mnt/hda” //Change the document root directory //to your CF card. …… 192.168.3.127 – PuTTY ServerRoot “/etc/apache” PidFile /var/run/ht[...]

  • Page 58

    UC-7420/7410 User’s Manual Managing Communication 4-6 IPTABLES IPTABLES is an administrative tool for setting up , maintaining, and insp ecting the Linux kernel’s IP packet filter rule tables. Seve ral different tables are defined, with each table con taining built-in chains and user-defi ned chains. Each chain is a list of rules that apply to [...]

  • Page 59

    UC-7420/7410 User’s Manual Managing Communication 4-7 UC-7420/741 0 supports the following s ub-modules. B e sure to use the module t hat matches you r application. ip_conntrack ipt_ MARK ipt_ah ipt_state ip_conntrack_ftp ip t_MASQUERADE ipt_esp ipt_tcpmss ipt_conntrack_irc ipt_ MIRROT ipt_length ipt_tos ip_nat_ftp ipt_ REDIRECT ipt_limit ipt_ tt[...]

  • Page 60

    UC-7420/7410 User’s Manual Managing Communication 4-8 The basic syntax t o enable an d load an IPT ABLES module is as follows: #lsmod #modprobe ip_tables #modprobe iptable_filter Use lsmod to check if the ip_tables m odule has alr eady been loade d in the UC-7420/7410. Use modprobe to insert an d enable the m odule. Use the following command to l[...]

  • Page 61

    UC-7420/7410 User’s Manual Managing Communication 4-9 OUTPUT: For locally -generated packets. FORWARD: For packets routed out through th e UC-7420/7410. 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 ?[...]

  • Page 62

    UC-7420/7410 User’s Manual Managing Communication 4-10 NAT NAT (Network Address Trans lation) pr otocol tr anslates IP a ddresses used on one network different IP addresses use d on anot her networ k. One networ k is designat ed the insi de network and the other is the outside network. Typically, UC -7420/74 10 connects several de vices on a netw[...]

  • Page 63

    UC-7420/7410 User’s Manual Managing Communication 4-11 # Step 1. Insert modules. # Here 2> /dev/null means the standard error messages will be dump to null device. modprobe ip_tables 2> /dev/null modprobe ip_nat_ftp 2> /dev/null modprobe ip_nat_irc 2> /dev/null modprobe ip_conntrack 2> /dev/null modprobe ip_conntrack_ftp 2> /dev[...]

  • Page 64

    UC-7420/7410 User’s Manual Managing Communication 4-12 The pppd options are descri bed below: connect ‘chat etc...’ This option gives the command to contact the PPP server. The ‘chat’ pro gram is used to dial a remote computer. T he entire command is enclosed in single quotes beca use pppd expects a one-word ar gument for t he ‘connect?[...]

  • Page 65

    UC-7420/7410 User’s Manual Managing Communication 4-13 How to check the connection Once you’ve set up a PPP connection, the re are so me steps you can take t o test the connection. First, type: /sbin/ifconfig (The folder ifconfig may be located elsewhe re, dependin g on your di stributi on.) You s hould be able to see all the network interfaces[...]

  • Page 66

    UC-7420/7410 User’s Manual Managing Communication 4-14 Setting up a Machine for Incoming PPP Connections This first example applies to using a modem, and requiring authorization with a usern ame and password. pppd/dev/ttyM0 115200 crtscts modem 192.168.16.1:192.168.16.2 login auth You should also add the following line to the file /etc/ppp/pap-se[...]

  • Page 67

    UC-7420/7410 User’s Manual Managing Communication 4-15 no_root_squash If no_root_squash is selected, then the root on the client machin e will have the same level of access to files on the system as the root on the server. This can ha ve serious security implications, alth ough it may be necessary if you want to do administrative work on th e cli[...]

  • Page 68

    UC-7420/7410 User’s Manual Managing Communication 4-16 Steps 2 & 3: #mkdir –p /home/nfs/public #mount –t nfs NFS_Server(IP):/directory /mount/point Example : #mount –t nfs 192.168.3.100/home/public /home/nfs/public Mail smtpclient is a minimal SMTP client th at takes an email message body and passes it on to an SMTP server. It is suitab[...]

  • Page 69

    UC-7420/7410 User’s Manual Managing Communication 4-17 20: system.9.1.3.4 (octet st ring) The MIB module for ma naging IP and ICMP i mplementa tions 21: system.9.1.3.5 (octet st ring) The MIB module for ma naging UDP implem entations 22: system.9.1.3.6 (octet st ring) View- based Access Co ntrol Mo del for SNMP. 23: system.9.1.3.7 (octet st ring)[...]

  • Page 70

    UC-7420/7410 User’s Manual Managing Communication 4-18 Setup 1: Ethernet Bridging for Pr ivate Networks on Different Subnets 1. Set up four machines, as show n in the following diagram. OpenVPN A OpenVPN B Host A eth0: 192.168.2.171 Host B eth0: 192.168.4.172 ixp0: 192.168.8.174 eth1: 192.168.2.173 local net local net Internet Internet ixp1: 192.[...]

  • Page 71

    UC-7420/7410 User’s Manual Managing Communication 4-19 fi i=`expr $i + 1` read f1 f2 case “$f1” in address ) IPADDR=$f2 ; ; netmask ) NETMASK=$f2 ; ; broadcast ) BROADCAST=$f2 ; ; esac done break fi done < /etc/network/interfaces } # get the ip address of the specified interface mname= module_up() { oIFS=$IFS IFS=‘ ‘ FOUND=“no” for[...]

  • Page 72

    UC-7420/7410 User’s Manual Managing Communication 4-20 # connect tap device to the bridge brctl addif br0 tap${i} # null ip address of tap device ifconfig tap${i} 0.0.0.0 promisc up i=`expr $i + 1` if [ $i -ge $maxtap ]; then break fi done # null ip address of internal interface ifconfig $iface 0.0.0.0 promisc up # enable bridge ip ifconfig br0 $[...]

  • Page 73

    UC-7420/7410 User’s Manual Managing Communication 4-21 4. Create a configuration file named A-tap0-br.co nf and an execut able script file name d A-tap0-br.sh on OpenVPN A. # point to the peer remote 192.168.8.174 dev tap0 secret /etc/openvpn/secrouter.key cipher DES-EDE3-CBC auth MD5 tun-mtu 1500 tun-mtu-extra 64 ping 40 up /etc/openvpn/A-tap0-b[...]

  • Page 74

    UC-7420/7410 User’s Manual Managing Communication 4-22 virtual device, it sends the traffic to its peer. 7. To create an indirect connectio n t o Host B fr om Host A, y ou need to a dd the fol lowing routing item: route add –net 192.168.4.0 netmask 255.255.255.0 dev eth0 To create an indirect connection to Host A from Host B, y ou need to add t[...]

  • Page 75

    UC-7420/7410 User’s Manual Managing Communication 4-23 Setup 3: Routed IP 1. Set up four machines as shown in the following diag ram: OpenVPN A OpenVPN B Host A eth0: 192.168.2.171 Host B eth0: 192.168.4.172 ixp0: 192.168.8.174 eth1: 192.168.2.173 local net local net Internet Internet ixp1: 192.168.4.174 eth0: 192.168.8.173 2. Create a confi gura[...]

  • Page 76

    UC-7420/7410 User’s Manual Managing Communication 4-24 Note that the param eter “ifconfig” defines t he firs t argument as t he local internal interface and the second argument as the intern al interface at the remote peer. Note that $5 is the argument that the OpenVPN program passes to the script file. Its value is the seco nd argu ment o f [...]

  • Page 77

    5 5 Chapter 5 Programmer’s Guide This chapter includes importan t information for programmers. This following functions are covered in this chapter:  Flash Memory Map  Linux Tool Chain Introduction  Debug with GDB  Device API  RTC (Real Time Clock)  Buzzer  WDT (Watch Dog Timer)  UART  LCM  KeyPad  Make File Examp[...]

  • Page 78

    UC-7420/7410 User’s Manual Programmer’s Guide 5-2 Flash Memory Map Partition sizes are hard coded into th e kernel bina ry. To chang e the partition sizes, you will need to rebuild the kernel. The flash memory map is shown in the following table. Address Size Contents 0x00000000 – 0x0005FFFF 384 KB Boot Loa der—Read ONLY 0x00060000 – 0x00[...]

  • Page 79

    UC-7420/7410 User’s Manual Programmer’s Guide 5-3 Obtaining help Use the Linux man utility to obtain help on many of the utilities provid ed by the tool chain . For example to get help on the armv5b-linux-gcc com piler, issue the command: #man armv5b-linux-gcc Cross Compiling Applications and Libraries To compile a simple C application , just u[...]

  • Page 80

    UC-7420/7410 User’s Manual Programmer’s Guide 5-4 2. Use the foll owing comm and on the h ost to change to the di rectory that contains hello-de bug : cd /my_work_directory/myfilesystem/testprograms 3. Enter the following command: #ddd --debugger mxscaleb-gdb hello-debug & 4. Enter the following c ommand at t he GDB, DDD comm and prom pt: T[...]

  • Page 81

    UC-7420/7410 User’s Manual Programmer’s Guide 5-5 WDT (Watch Dog Timer) This function is o nly available for firm ware version V1. 5 (and later versi ons). 1. Introductio n The WDT works like a watch dog function. You can enab le it or disable it. When the user enables WDT but the appli cation doe s not ackn owledge it, the system wi ll reboot.[...]

  • Page 82

    UC-7420/7410 User’s Manual Programmer’s Guide 5-6 int swtd_disable(int fd) Description: Disable the application to ack sWatchDo g. And the kernel will be auto ack it. User does not to do i t at perio dic. Input : int fd - the file handle from swtd_open() return value. Output: OK will be zero. The other has some er ror, to get error code from er[...]

  • Page 83

    UC-7420/7410 User’s Manual Programmer’s Guide 5-7 int swtd_close(int fd) Description: Close the file handle. Input : int fd - the file handle from swtd_open() return value. Output: OK will be zero. The other has s ome error, t o get error code from errno( ). 4. Special Note When you “kill the application with -9” or “kill without option?[...]

  • Page 84

    UC-7420/7410 User’s Manual Programmer’s Guide 5-8 #include <sys/stat.h> #include <sys/ioctl.h> #include <sys/select.h> #include <sys/time.h> #include <moxadevice.h> static void mydelay(unsigned long msec) { struct timeval time; time.tv_sec = msec / 1000; time.tv_usec = (msec % 1000) * 1000; select(1, NULL, NULL, NU[...]

  • Page 85

    UC-7420/7410 User’s Manual Programmer’s Guide 5-9 UART The normal tty de vice node is located at /dev/ttyM0 … ttyM7 , and the m odem tty dev ice node is located at /dev/cum0 … cum7 . UC-7420/7410 suppor ts Linux standard termios con trol. The Moxa UART Device API allows you to configure ttyM0 to ttyM7 as RS-232, RS-422, 4-wire RS-485, or 2-[...]

  • Page 86

    UC-7420/7410 User’s Manual Programmer’s Guide 5-10 Baud rate inaccuracy Divisor = 921600/Tar get Baud Rate. (Only Integer part) ENUM = 8 * (9 21600/Targer - Divisor) ( Round up or down) Inaccuracy = (Tar get Baud Rate – 921600 /(Divisor + (ENUM/8))) * 100% E.g., To calculate 500000 bp s Divisor = 1, ENUM = 7, Inaccuracy = 1.7% *The Inaccura c[...]

  • Page 87

    UC-7420/7410 User’s Manual Programmer’s Guide 5-11 Special Note 1. UC-7420/7410’s kernel will store the “pressed k ey history” in a buffer. The maximum buffer size is 31 keys. If the buffer overflows, the firs t key of the 31 that was pressed will be drop ped, without sounding the buzzer. 2. Currently, UC-7420/7410 does NO T support press[...]

  • Page 88

    6 6 Chapter 6 UC Finder The UC Finder utility is used to search the LAN or intranet for Moxa Universal Communicators. UC Finder c omes in ha ndy if you forget the IP address, for troublesho oting field problems, an d for testing. UC Fi nder works by sending a broadcast m essage over the L AN to search fo r UC-7420/7410 MAC addresses. It will then q[...]

  • Page 89

    UC-7420/7410 User’s Manual UC Finder 6-2 Windows UC Finder The UC Finder utility is used to search the LAN or intranet for Moxa Universal Communicators. Installing the Sof tware 1. Once the Setup program starts running, click on Next to proceed. 2. Click on Next when the Select Addi tional Tool s window opens to proceed with the installation.[...]

  • Page 90

    UC-7420/7410 User’s Manual UC Finder 6-3 3. Click on Next to install program files in the default dir ectory, or select an alternative location. 4. Click on Finish to complete the installation of UC Finder.[...]

  • Page 91

    UC-7420/7410 User’s Manual UC Finder 6-4 Broadcast Search The Broadcast Search function is used to locate all UC-7420/ 7410 units that ar e connected to the same LAN as your Windows computer. Since the Broadcast Search function searches by MAC address and not IP address, all UC-7420/7410s connected to the LAN will be found, regardless of whether [...]

  • Page 92

    UC-7420/7410 User’s Manual UC Finder 6-5 3. When the search is complete, the same information is displayed in the UC Finder window. NOTE UC Finde r is designe d to determ ine the IP addres ses of all UC units conn ected to the sam e LAN the host that is running UC Finder. To configur e UC’s IP addresses or other conf iguration parameters, use T[...]

  • Page 93

    A A Appendix A System Commands busybox (V0.60.4): Linux normal command utility collection File manager 1. cp c o p y f i l e 2. ls list file 3. ln make symbolic lin k file 4. mount mount and che ck file syst em 5. rm delete file 6. chmod change file owner & gr oup & user 7. chown c h a n g e f i l e o w n e r 8. chgrp c h a n g e f i l e g [...]

  • Page 94

    UC-7420/7410 User’s Manual System Commands A-2 Process 1. kill kill process 2. ps display now running process Other 1. dmesg dum p kernel log message 2. sty t o s e t s e r i a l p o r t 3. zcat dump .gz file context 4. mknod make device node 5. free display system memory usage 6. date print or set the system date and time 7. env run a program in[...]

  • Page 95

    B B Appendix B Windows Tool Chain Introduction UC-7420/7410’s Windows Too l Chain is a cross development environment that simulates the Linux root file system, allowing users to develop applications on a Windows PC. The followin g topics are c overed in t his appendi x.  Introduction  Installation Procedure  Using the BASH Shell  GDB [...]

  • Page 96

    UC-7420/7410 User’s Manual Windows Tool Chain Introduction B-2 Introduction UC-7420/7410’s Windows Too l Chain is a cross development environment that simulates the Linux root file system, allowing users to develop applications in a Windows env ironment. Install the Windows tool chain to set up a Linux-lik e environm ent on your Windows machine[...]

  • Page 97

    UC-7420/7410 User’s Manual Windows Tool Chain Introduction B-3 Installation Procedure 1. Insert the CD i nto your PC’s CD-R OM drive, and r un tool-chainwindowscompilersetup.exe to start installation. Once the Setup program starts running, click on Next to proceed. 2. Select the Root Directory . Note If the directory C:UC was create d dur[...]

  • Page 98

    UC-7420/7410 User’s Manual Windows Tool Chain Introduction B-4 3. By default, the Local Package Directory is the same as on the CD-ROM: tool-chainwindowscompiler . Click on Next to pr oceed. Note: It may take anywhere from 5 to 20 minute s to check the packages in the CD-ROM after you click on Next . 4. All re quired pa ckage are selected by [...]

  • Page 99

    UC-7420/7410 User’s Manual Windows Tool Chain Introduction B-5 y Base Categor y: List all packages that will be installed by default (along with any dependencies). If you view t he Base column fo r the Base cat egory, you s hould see eve ry package selected for installation. y Packages: In the packa ges listing field, pack age names are arrange d[...]

  • Page 100

    UC-7420/7410 User’s Manual Windows Tool Chain Introduction B-6 6. Checkmark Create icon o n Desktop t o place a Moxa BASH Shell icon on your desktop, and then click on Finish . 7. Click on OK to close the Installation Complete window. Using the BASH Shell A command-line interface is used to develop app lications with the tool chain. To access the[...]

  • Page 101

    UC-7420/7410 User’s Manual Windows Tool Chain Introduction B-7 -rwxr—xr-x 1 stephen_ mkpasswd 53 Jan 10 22:03 moxa.bat -rw-r--r-- 1 stephen_ mkpasswd 3262 Jan 10 22:03 moxa.ico drwxr—xr-x 2 stephen_ mkpasswd 0 Jan 10 19:48 tmp drwxr—xr-x 14 stephen_ mkpasswd 0 Jan 10 19:48 usr drwxr—xr-x 6 stephen_ mkpasswd 0 Jan 10 18:12 var stephen_lin@[...]

  • Page 102

    UC-7420/7410 User’s Manual Windows Tool Chain Introduction B-8[...]

  • Page 103

    C C Appendix C Service Information This appen dix shows y ou how to co ntact Moxa for info rmation abo ut this and other pro ducts, and how to repo rt problems. The followin g topics are c overed in t his appendi x:  MOXA Internet Services  Problem Report Form  Product Return Procedure[...]

  • Page 104

    UC-7420/7410 User’s Manual Service Information C-2 MOXA Internet Services Customer satisfaction is our num b er one concern, and to ensure that customers receive the full benefit of our products, Moxa Internet Services has bee n set up to provide technical s upport, dri ver updates, product infor mation, and user’s manual upd ates. The followin[...]

  • Page 105

    UC-7420/7410 User’s Manual Service Information C-3 Problem Report Form MOXA UC-7420/7410 Customer name: Comp any: T el: Fax: Email: Date: 1. Moxa Product:  UC-7 410-LX  UC-7420-LX 2. Serial Number: ___________ ______ Problem Desc ription: Please describe the sym ptoms of the problem as clearly as possible, incl uding any error messages you [...]

  • Page 106

    UC-7420/7410 User’s Manual Service Information C-4 Product Return Procedure For product repair, exc hange, o r refund, the customer m ust:  Provide e vidence of origi nal purchase.  Obtain a Product Return Agreement (PRA) from the sales representative or dealer.  Fill out the Problem Report Form (PRF). Include as much detail as possible [...]