UC-7112-LX Plus Software User’s Manual Fifth Edition, June 2009 www.moxa.com/product © 2009 Moxa Inc. All rights reserved. Reproduction without permission is prohibited.
UC-7112-LX Plus Software 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.
Table of Contents Chapter 1 Introduction ..................................................................................................1-1 Overview.................................................................................................................................. 1-2 Software Architecture .............................................................................................................. 1-2 Journaling Flash File System (JFFS2)....................................................
Dial-up Service—PPP............................................................................................................ 4-12 PPPoE .................................................................................................................................... 4-15 NFS (Network File System)................................................................................................... 4-18 Setting up the UC-7112-LX Plus as an NFS Client..................................................
1 Chapter 1 Introduction The Moxa UC-7112-LX Plus is a RISC-based ready-to-run computer that has two 10/100 Mbps Ethernet ports, an internal SD socket, two RS-232/422/485 serial ports, and pre-installed Linux operating system that uses MMU technology for more efficient operation. The UC-7112-LX Plus offers high performance communication and unlimited storage in a super compact, palm-size ARM9 box.
UC-7112-LX Plus Software User’s Manual Introduction Overview The UC-7112-LX Plus uses a Moxa ART ARM9 192 Mhz RISC CPU. Unlike the X86 CPU, which uses a CISC design, the RISC architecture and modern semiconductor technology provide these embedded computers with a powerful computing engine and communication functions, but without generating a lot of heat. A 16 MB NOR Flash ROM and on-board 32 MB SDRAM give you enough memory to install your application software directly on the embedded computer.
UC-7112-LX Plus Software User’s Manual Introduction Normally, the kernel uses the Root File System to boot up the system. The Root File System is protected, and cannot be changed by the user. This type of setup creates a “safe” zone. For more information about the memory map and programming, refer to Chapter 6, Programmer’s Guide. Journaling Flash File System (JFFS2) The Root File System and User directory in the flash memory is formatted with the Journaling Flash File System (JFFS2).
UC-7112-LX Plus Software User’s Manual Introduction Software Package Moxa Boot Loader (v1.2) Linux 2.6.9 ARP, PPP, CHAP, PAP, IPv4, ICMP, TCP, UDP, DHCP, FTP, SNMP V1/V3, HTTP, NTP, NFS, SMTP, SSH 1.0/2.
2 Chapter 2 Getting Started In this chapter, we explain how to connect the UC-7112-LX Plus, how to turn on the power, how to get started programming, and how to use the UC-7112-LX Plus’s other functions.
UC-7112-LX Plus Software User’s Manual Getting Started Powering on the UC-7112-LX Plus Connect the SG wire to the shielded contact located on the terminal block in the left corner of the UC-7112-LX Plus, and then power on the computer by connecting it to the power adaptor. It takes about 30 to 60 seconds for the system to boot up. Once the system is ready, the Ready LED will light up.
UC-7112-LX Plus Software User’s Manual Getting Started The following window will open when a connection has been established. To log in, type the Login name and password as requested. The default values are both root: Login: root Password: root Telnet Console If you know at least one of the two IP addresses and netmasks, then you can use Telnet to connect to the UC-7112-LX Plus’s console utility.
UC-7112-LX Plus Software User’s Manual Getting Started Use a straight-through Ethernet cable to connect to a hub or switch that is connected to your local LAN. The default IP addresses and netmasks are shown above. To log in, type the Login name and password as requested. The default values are both root: Login: root Password: root You can proceed with configuring the network settings of the target computer when you reach the bash command shell. Configuration instructions are given in the next section.
UC-7112-LX Plus Software User’s Manual Getting Started SSH Console The UC-7112-LX Plus supports an SSH Console to provide users with better security options. Windows Users Click on the link http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html to download PuTTY (free software) to set up an SSH console for the UC-7112-LX Plus in a Windows environment. The following figure shows a simple example of the configuration that is required.
UC-7112-LX Plus Software User’s Manual Getting Started Configuring the Ethernet Interface The network settings of the UC-7112-LX Plus can be modified with the serial console port, or online over the network. Modifying Network Settings with the Serial Console In this section, we use the serial console to configure the network settings of the target computer. 1.
UC-7112-LX Plus Software User’s Manual Getting Started Modifying Network Settings over the Network IP settings can be activated over the network, but the new settings will not be saved to the flash ROM without modifying the file /etc/network/interfaces. For example, type the command #ifconfig to 192.168.1.1. eth0 192.168.1.1 to change the IP address of LAN1 root@Moxa:~# ifconfig eth0 192.168.27.
UC-7112-LX Plus Software User’s Manual Getting Started Step 3: The SD socket is located on the back of bottom board. Insert the SD memory card as shown in the figure. NOTE: To remove the SD card from the slot, press the SD card in slightly with your finger, and then remove your finger to cause the card to spring out partially. You may now grasp the top of the card with two fingers and pull it out. Before removing the SD card, remember to type /sync to ensure that your data has been written.
UC-7112-LX Plus Software User’s Manual Getting Started Installing the Tool Chain (Linux) The Linux Operating System must be pre-installed in the PC before installing the UC-7112-LX Plus GNU Tool Chain. Fedora core or compatible versions are recommended. The Tool Chain requires approximately 100 MB of hard disk space on your PC. The UC-7112-LX Plus Tool Chain software is located on the UC-7112-LX Plus CD.
UC-7112-LX Plus Software User’s Manual Getting Started Compiling Hello.c The package CD contains several example programs. Here we use Hello.c as an example to show you how to compile and run your applications.
UC-7112-LX Plus Software User’s Manual Getting Started Developing Your First Application We use the tcps2 example to illustrate how to build an application. The procedure outlined in the following subsections will show you how to build a TCP server program plus serial port communication that runs on the UC-7112-LX Plus.
UC-7112-LX Plus Software User’s Manual Getting Started root@server11:/home/w341/1st_application [root@server11 1st_application]# pwd /home/UC7112LX plus/1st_application [root@server11 1st_application]# 11 total 20 -rw-r—r-- 1 root root 514 Nov 27 11:52 Makefile -rw-r—r-- 1 root root 4554 Nov 27 11:52 tcps2.c -rw-r—r-- 1 root root 6164 Nov 27 11:55 tcps2.c [root@server11 1st_application]# make_ /usr/local/arm-linux/bin/arm-linux-gcc -o tcps2-release tcps2.
UC-7112-LX Plus Software User’s Manual Getting Started Uploading and Running the “tcps2-release” Program Use the following commands to use FTP to upload tcps2-release to the UC-7112-LX Plus. 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> bin ftp> put tcps2-release root@server11:/home/w341/1st_application [root@server11 1st_application]# ftp 192.168.3.127 Connected to 192.168.3.
UC-7112-LX Plus Software User’s Manual 4. Getting Started The program should start running in the background. Use the #ps –ef command to check if the tcps2 program is actually running in the background. #ps // use this command to check if the program is running 192.168.3.
UC-7112-LX Plus Software User’s Manual NOTE Use the kill -9 Getting Started command for PID 728 to terminate this program: #kill -9 %728 Summary of Testing Procedure 1. 2. 3. 4. 5. 6. 7. 8. 9. Compile tcps2.c (#make). Upload and run tcps2-release in the background (#./tcps2-release &). Check that the process is running (#jobs or #ps -ef). Use a serial cable to connect PC1 to the UC-7112-LX Plus’s serial port 1. Use an Ethernet cable to connect PC2 to the UC-7112-LX Plus.
3 Chapter 3 Managing Embedded Linux This chapter includes information about version control, deployment, updates, and peripherals. The information in this chapter will be particularly useful when you need to run the same application on several UC-7112-LX Plus units.
UC-7112-LX Plus Software User’s Manual Managing Embedded Linux System Version Information To determine the hardware capability of your UC-7112-LX Plus, and what kind of software functions are supported, check the version numbers of your UC-7112-LX Plus’s hardware, kernel, and user file system. Contact Moxa to determine the hardware version. You will need the Production S/N (Serial number), which is located on the UC-7112-LX Plus’s bottom label. To check the kernel version, type: #kversion 192.168.3.
UC-7112-LX Plus Software User’s Manual Managing Embedded Linux Since different Flash disks have different sizes, it is a good idea to check the size of your Flash disk before upgrading the firmware, or before using the disk to store your application and data files. Use the #df –h command to list the size of each memory block and how much free space is available in each block. 192.168.3.127 – PuTTY root@Moxa:~# df -h Filesystem Size Used Available Use% /dev/mtdblock2 8.0M 6.0M 2.0M /dev/ram0 499.0k 16.
UC-7112-LX Plus Software User’s Manual Managing Embedded Linux 192.168.3.127 – PuTTY root@Moxa:/mnt/ramdisk# ftp 192.168.3.193 Connected to 192.168.3.193 (192.168.3.193). 220 TYPSoft FTP Server 1.10 ready… Name (192.168.3.193:root): root 331 Password required for root. Password: 230 User root logged in. Remote system type is UNIX. Using binary mode to transfer files. ftp> cd newsw 250 CWD command successful. “/C:/ftproot/newsw/” is current directory. ftp> bin 200 Type set to I.
UC-7112-LX Plus Software User’s Manual Managing Embedded Linux Loading Factory Defaults To load the the factory default settings, you must press the reset button for more than 5 seconds. All files in the /home will be destroyed and /etc directory will be loaded with the default files. Note that while pressing the reset button, the Ready LED will blink once every second for the first 5 seconds. The Ready LED will turn off after 5 seconds, and the factory defaults will be loaded.
UC-7112-LX Plus Software User’s Manual Managing Embedded Linux To run a private daemon, you can edit the file rc.local, as follows: #cd /etc/rc.d #vi rc.local 192.168.3.127 – PuTTY root@Moxa:~# cd /etc/rc.d root@Moxa:/etc/rc.d# vi rc.local Next, use vi to open your application program. We use the example program tcps2-release, which we set to run in the background. 192.168.3.
UC-7112-LX Plus Software User’s Manual Managing Embedded Linux Setting the Run-Level In this section, we outline the steps you should take to set the Linux run-level and execute requests. Use the following command to enable or disable settings: 192.168.3.127 – PuTTY root@Moxa:/ect/rc.d/rc3.d# ls S19nfs-common S25nfs-user-server S99showreadyled S20snmpd S55ssh S24pcmcia S99rmnologin root@Moxa:/etc/rc.d/rc3.d# #cd /etc/rc.d/init.
UC-7112-LX Plus Software User’s Manual Managing Embedded Linux Adjusting the System Time Setting the Time Manually The UC-7112-LX Plus has two time settings. One is the system time, and the other is the RTC (Real Time Clock) time kept by the UC-7112-LX Plus’s hardware. Use the #date command to query the current system time or set a new system time. Use #hwclock to query the current RTC time or set a new RTC time.
UC-7112-LX Plus Software User’s Manual Managing Embedded Linux NTP Client The UC-7112-LX Plus has a built-in NTP (Network Time Protocol) client that is used to initialize a time request to a remote NTP server. Use #ntpdate to update the system time. #ntpdate time.stdtime.gov.tw #hwclock –w Visit http://www.ntp.org for more information about NTP and NTP server addresses. 10.120.53.100 – PuTTY root@Moxa:~# date ; hwclock Sat Jan 1 00:00:36 CST 2000 Sat Jan 1 00:00:37 2000 -0.
UC-7112-LX Plus Software User’s Manual Managing Embedded Linux Cron—Daemon for Executing Scheduled Commands Start Cron from the directory /etc/rc.d/rc.local. It will return immediately, so you don’t need to start it with ‘&’ to run in the background. The Cron daemon will search /etc/cron.d/crontab for crontab files, which are named after accounts in /etc/passwd. Cron wakes up every minute, and checks each command to see if it should be run in that minute.
4 Chapter 4 Managing Communications In this chapter, we explain how to configure the UC-7112-LX Plus’s various communication functions.
UC-7112-LX Plus Software User’s Manual Managing Communications Telnet / FTP In addition to supporting Telnet client/server and FTP client/server, the UC-7112-LX Plus 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 example shows the default content of the file /etc/inetd.conf.
UC-7112-LX Plus Software User’s Manual Managing Communications Web Service—Apache The Apache web server’s main configuration file is /etc/apache/conf/httpd.conf, with the default homepage located at /home/httpd/htdocs/index.html.
UC-7112-LX Plus Software User’s Manual NOTE Managing Communications The CGI function is enabled by default. If you want to disable the function, modify the file /etc/apache/conf/httpd.conf. When you develop your own CGI application, make sure your CGI file is executable. 192.168.3.
UC-7112-LX Plus Software User’s Manual Managing Communications Step 3: Download the PHP package from the CD-ROM. You can find the package in CD-ROM/software/php/php.tar.gz. 192.168.3.127 – PuTTY root@Moxa:/bin# cd /mnt/ramdisk root@Moxa:/mnt/ramdisk# ftp 192.168.27.130 Connected to 192.168.27.130. 220 (vsFTPd 2.0.1) Name (192.168.27.130:root): root 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files.
UC-7112-LX Plus Software User’s Manual Managing Communications Step 6: Test it. Use the browser to access http://192.168.3.127/phpinfo.php If you want to uninstall PHP, follow steps 2 to 5 but select the uninstall option.
UC-7112-LX Plus Software User’s Manual Managing Communications IPTABLES IPTABLES is an administrative tool for setting up, maintaining, and inspecting the Linux kernel’s IP 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 what to do with a matching packet.
UC-7112-LX Plus Software User’s Manual Managing Communications Incoming Packets Mangle Table PREROUTING Chain NAT Table PREROUTING Chain Local Host Packets Other Host Packets Mangle Table INPUT Chain Mangle Table FORWARD Chain Filter Table INPUT Chain Filter Table FORWARD Chain Local Process Mangle Table POSTROUTING Chain Mangle Table OUTPUT Chain NAT Table OUTPUT Chain Filter Table OUTPUT Chain NAT Table POSTROUTING Chain Outgoing Packets The UC-7112-LX Plus supports the following sub-modules.
UC-7112-LX Plus Software User’s Manual NOTE Managing Communications The UC-7112-LX Plus does NOT support IPV6 and ipchains. The basic syntax to enable and load an IPTABLES module is as follows: #lsmod #insmod ip_tables #insmod iptable_filter Use lsmod to check if the ip_tables module insmod to insert and enable the module. has already been loaded in the UC-7112-LX Plus.
UC-7112-LX Plus Software User’s Manual Managing Communications 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 UC-7112-LX Plus. OUTPUT: For locally-generated packets. FORWARD: For packets routed out through the UC-7112-LX Plus. PREROUTING: To alter packets as soon as they come in.
UC-7112-LX Plus Software User’s Manual Managing Communications Example 7: Drop all packets from 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 NOTE: In Example 7, remember to issue the command #insmod ipt_mac first to load module ipt_mac. NAT NAT (Network Address Translation) protocol translates IP addresses used on one network to different IP addresses used on another network.
UC-7112-LX Plus Software User’s Manual Managing Communications Enabling NAT at Bootup In most real world situations, you will want to use a simple shell script to enable NAT when the UC-7112-LX Plus boots up. The following script is an example. #!/bin/bash # If you put this shell script in the /home/nat.sh # Remember to chmod 744 /home/nat.sh # Edit the rc.local file to make this shell startup automatically. # vi /etc/rc.d/rc.local # Add a line in the end of rc.local /home/nat.
UC-7112-LX Plus Software User’s Manual Managing Communications The pppd daemon is used to connect to a PPP server from a Linux system. For detailed information about pppd see the man page. Example 1: Connecting to a PPP server over a simple dial-up connection The following command is used to connect to a PPP server by modem. Use this command for old ppp servers that prompt for a login name (replace username with the correct name) and password (replace password with the correct password).
UC-7112-LX Plus Software User’s Manual Managing Communications 192.1.1.17 This is a degenerate case of a general option of the form x.x.x.x:y.y.y.y. Here x.x.x.x is the local IP address and y.y.y.y is the IP address of the remote end of the PPP connection. If this option is not specified, or if just one side is specified, then x.x.x.x defaults to the IP address associated with the local machine’s hostname (located in /etc/hosts), and y.y.y.y is determined by the remote machine.
UC-7112-LX Plus Software User’s Manual Managing Communications Try typing: netstat –nr This should show three routes, something like this: Kernel routing table Destination Gateway iface 129.67.1.165 0.0.0.0 ppp0 127.0.0.0 0.0.0.0 0.0.0.0 129.67.1.165 ppp0 Genmask Flags Metric Ref Use 255.255.255.255 UH 0 0 6 255.0.0.0 0.0.0.0 U UG 0 0 0 0 0 lo 6298 If your output looks similar but doesn’t have the destination 0.0.0.
UC-7112-LX Plus Software User’s Manual 4. Managing Communications Edit the file /etc/ppp/pap-secrets and add the following: “username@hinet.net” *“password” * “username@hinet.net” is the username obtained from the ISP to log in to the ISP account. “password” is the corresponding password for the account. 5.
UC-7112-LX Plus Software User’s Manual 6. Managing Communications Add one of two files: /etc/ppp/options.eth0 or /etc/ppp/options.eth1. The choice depends on which LAN is connected to the ADSL modem. If you use LAN1 to connect to the ADSL modem, then add /etc/ppp/options.eth0. If you use LAN2 to connect to the ADSL modem, then add /etc/ppp/options.eth1.
UC-7112-LX Plus Software User’s Manual Managing Communications NFS (Network File System) The Network File System (NFS) is used to mount a disk partition on a remote machine, as if it were on a local hard drive, allowing fast, seamless sharing of files across a network. NFS allows users to develop applications for the UC-7112-LX Plus, without worrying about the amount of disk space that will be available. The UC-7112-LX Plus supports NFS protocol for client.
UC-7112-LX Plus Software User’s Manual Managing Communications SNMP The UC-7112-LX Plus has built-in SNMP V1 (Simple Network Management Protocol) agent software. It supports RFC1317 RS-232 like group and RFC 1213 MIB-II. See Appendix B for a simple example that allows you to use an SNMP browser on the host site to query the UC-7112-LX Plus, which is the SNMP agent. The UC-7112-LX Plus will respond. NOTE Click on the following links for more information about MIB II and RS-232 like groups: http://www.
UC-7112-LX Plus Software User’s Manual Managing Communications Copy the file that is generated to the OpenVPN machine. 2. Generate a script file named openvpn-bridge on each OpenVPN machine. This script reconfigures interface “eth1” as IP-less, creates logical bridge(s) and TAP interfaces, loads modules, enables IP forwarding, etc. #---------------------------------Start----------------------------#!/bin/sh iface=eth1 # defines the internal interface maxtap=`expr 1` # defines the number of tap devices.
UC-7112-LX Plus Software User’s Manual Managing Communications start() { ifcfg_vpn if [ ! \( -d “/dev/net” \) ]; then mkdir /dev/net fi if [ ! \( -r “/dev/net/tun” \) ]; then # create a device file if there is none mknod /dev/net/tun c 10 200 fi # load modules “tun” and “bridge” mname=tun module_up mname=bridge module_up # create an ethernet bridge to connect tap devices, internal interface brctl addbr br0 brctl addif br0 $iface # the bridge receives data from any port and forwards it to other ports.
UC-7112-LX Plus Software User’s Manual Managing Communications done brctl delif br0 $iface brctl delbr br0 ifconfig br0 down ifconfig $iface $IPADDR netmask $NETMASK broadcast $BROADCAST killall -TERM openvpn } case “$1” in start) start ;; stop) stop ;; restart) stop start ;; *) echo “Usage: $0 [start|stop|restart]” exit 1 esac exit 0 #---------------------------------- end ----------------------------- Create link symbols to enable this script at boot time: # ln -s /etc/openvpn/openvpn-bridge /etc/rc.
UC-7112-LX Plus Software User’s Manual Managing Communications Note: Select cipher and authentication algorithms by specifying “cipher” and “auth”. To see with algorithms are available, type: # openvpn --show-ciphers # openvpn --show—auths 4. Start both of OpenVPN peers, # openvpn --config A-tap0-br.conf& # openvpn --config B-tap0-br.conf& If you see the line “Peer Connection Initiated with 192.168.8.
UC-7112-LX Plus Software User’s Manual Managing Communications Setup 2: Ethernet Bridging for Private Networks on the Same Subnet 1. Set up four machines as shown in the following diagram: Host A local net OpenVPN A LAN1: 192.168.2.173 LAN1: 192.168.2.171 Internet LAN2: 192.168.8.173 LAN1: 192.168.8.174 LAN1: 192.168.4.172 LAN2: 192.168.4.174 Host B 2. OpenVPN B local net The configuration procedure is almost the same as for the previous example.
UC-7112-LX Plus Software User’s Manual Managing Communications #!/bin/sh # value after “-net” is the subnet behind the remote peer route add -net 192.168.4.0 netmask 255.255.255.0 gw $5 #--------------------------------- end ------------------------------ Create a configuration file named B-tun.conf and an executable script file named B-tun.sh on OpenVPN B: remote 192.168.8.173 dev tun secret /etc/openvpn/secrouter.key cipher DES-EDE3-CBC auth MD5 tun-mtu 1500 tun-mtu-extra 64 ping 40 ifconfig 192.168.4.
5 Chapter 5 Application Development with Linux Tool Chain This chapter describes how to install the Linux tool chain, which contains a suite of cross compilers and other tools, as well as the libraries and header files that are necessary to compile your applications. The tool chain components must be installed on a host computer (PC) running Linux. We have confirmed that the following Linux distributions can be used to install the tool chain: Fefora core 1 & 2.
UC-7112-LX Plus Software User’s Manual Linux Tool Chain Steps for Installing the Linux Tool Chain The tool chain needs about 485 MB of hard disk space. To install it, follow these steps: 1. Insert the package CD into your PC and then issue the following commands: #mount /dev/cdrom /mnt/cdrom #sh /mnt/cdrom/tool-chain/linux/install.sh 2. Wait for the installation process to complete. This should take a few minutes. 3. Add the directory /usr/local/arm-linux/bin to your path.
UC-7112-LX Plus Software User’s Manual Linux Tool Chain On-Line Debugging with GDB The tool chain also provides an on-line debugging mechanism to help you develop your program. Before performing a debugging session, add the option -ggdb to compile the program. A debugging session runs on a client-server architecture on which the server gdbserver is installed in the targe computer and the client ddd is installed in the host computer.
6 Chapter 6 Programmer’s Guide This chapter includes important information for programmers.
UC-7112-LX Plus Software User’s Manual Programmer’s Guide Flash Memory Map Partition sizes are hard coded into the kernel binary. To change the partition sizes, you will need to rebuild the kernel. The flash memory map is shown in the following table. Address 0x00000000 – 0x0003FFFF 0x00040000 – 0x001FFFFF 0x00200000 – 0x009FFFFF 0x00A00000 – 0x00FFFFFF NOTE Size 256 KB 1.
UC-7112-LX Plus Software User’s Manual Programmer’s Guide Buzzer The device node is located at /dev/console. The UC-7112-LX Plus supports Linux standard buzzer control, with The UC-7112-LX Plus’s buzzer running at a fixed frequency of 100 Hz. You must include . Function: KDMKTONE ioctl(fd, KDMKTONE, unsigned int arg); Description: The buzzer’s behavior is determined by the argument arg.
UC-7112-LX Plus Software User’s Manual Input int fd Programmer’s Guide - the file handle, from the swtd_open() return value. unsigned long time - The time you wish to ack sWatchDog periodically. You must ack the sWatchDog before timeout. If you do not ack, the system will be reboot automatically. The minimal time is 50 msec, the maximum time is 60 seconds. The time unit is msec. Output errno() returns the error code. A value of 0 (zero) indicates no error.
UC-7112-LX Plus Software User’s Manual Programmer’s Guide Output A value of 0 (zero) indicates no error. Otherwise, you can get the error code from the function errno(). 4. Special Note When you “kill the application with -9” or “kill without option” or “Ctrl+c” the kernel will change to auto ack the sWatchDog. When your application enables the sWatchDog and does not ack, your application may have a logical error, or your application has made a core dump. The kernel will not change to auto ack.
UC-7112-LX Plus Software User’s Manual Programmer’s Guide time.tv_sec = msec / 1000; time.
UC-7112-LX Plus Software User’s Manual Programmer’s Guide UART The normal tty device node is located at /dev/ttyM0 … ttyM1. The UC-7112-LX Plus supports Linux standard termios control. The Moxa UART Device API allows you to configure ttyM0 to ttyM1 as RS-232, RS-422, 4-wire RS-485, or 2-wire RS-485. UC-7112-LX Plus supports RS-232, RS-422, 2-wire RS-485, and 4-wire RS485. You must #define #define #define #define 1. include .
UC-7112-LX Plus Software User’s Manual Programmer’s Guide Baudrate inaccuracy Divisor = 921600/Target Baud Rate. (Only Integer part) ENUM = 8 * (921600/Targer - Divisor) ( Round up or down) Inaccuracy = (Target Baud Rate – 921600/(Divisor + (ENUM/8))) * 100% E.g., To calculate 500000 bps Divisor = 1, ENUM = 7, Inaccuracy = 1.7% *The Inaccuracy should less than 2% for work reliably. Special Note 1. If the target baudrate is not a special baudrate (e.g.
7 Chapter 7 Software Lock “Software Lock” is an innovative technology developed by the Moxa engineering team. It can be adopted by a system integrator or developer to protect applications from being copied. An application is compiled into a binary format bound to the embedded computer and the operating system (OS) that the application runs on. As long as one obtains it from the computer, he/she can install it on the same hardware and the same operating system.
A Appendix A Boot Loader Utility for Firmware Upgrade or Recovery Moxa provides a boot loader utility for firmware upgrade or recovery. You will need the following items to use this utility. 1. The embedded computer whose firmware you would like to upgrade or recover. 2. A PC or a laptop computer. 3. A console port cable for connecting through HyperTerminal. 4. A cross-over Ethernet cable for upgrading the firmware through a TFTP server and LAN port. 5. The firmware for the embedded computer.
UC-7112-LX Plus Linux User’s Manual Boot Loader Utility If you are familiar with Moxa’s embedded computers and the firmware upgrade procedure, you may skip to Step D. However, we suggest that you follow all procedures to ensure that each step is correct. A. Configure HyperTerminal for the Console Port. 1. Connect your embedded computer to a power source. 2. Connect the console port of the UC-7112-LX Plus Series embedded computer to your PC using a console port cable.
UC-7112-LX Plus Linux User’s Manual Boot Loader Utility 4. After HyperTerminal launches, enter a name for the connection. 5. Click Cancel when the “Connect To” window opens.
UC-7112-LX Plus Linux User’s Manual Boot Loader Utility 6. Select File Æ Properties from the main HyperTerminal screen. 7. You may change the COM port number on the Properties window. Click Configure to view additional configuration options.
UC-7112-LX Plus Linux User’s Manual 8. Boot Loader Utility Use the following parameters to configure the Port Settings: Bits per second: 115200 Data bits: 8 Parity: None Stop bit: 1 Flow control: None. Click OK to continue.
UC-7112-LX Plus Linux User’s Manual 9. Boot Loader Utility Click the Settings tab and then select VT100 for Emulation. Click OK to finish the configuration.
UC-7112-LX Plus Linux User’s Manual Boot Loader Utility B. Check if Your Embedded Computer Supports the Boot Loader Utility 1. Power on the embedded computer. If the following information appears on the HyperTerminal screen, it means that you can use the boot loader utility to upgrade or recover the firmware. PRESS FOR SYSTEM RECOVERY 2. Some models support the boot loader utility, but the screen will not appear.
UC-7112-LX Plus Linux User’s Manual Boot Loader Utility C. Download and install the TFTP program. 1. You will need to download a free TFTP server package to upgrade the firmware for the boot loader utility. Link to the following URL to download: ftp://papa.indstate.edu/ Download the TFTP program located in the following path. /winsock-1/Windows95/Daemons/TFTPD/ Download the file named tftpd32d.zip. 2. When you finish downloading, extract the files to your PC.
UC-7112-LX Plus Linux User’s Manual Boot Loader Utility D. Download and upgrade the firmware through HyperTerminal. 1. Connect to Moxa’s website at http://www.moxa.com and select Software from the Support drop-down menu. 2. Under Search for Software, select the product line and then choose the specific product model. Click on Search to continue.
UC-7112-LX Plus Linux User’s Manual 3. Boot Loader Utility Extract the file and put the latest firmware image in the same directory that the TFTP files reside.
UC-7112-LX Plus Linux User’s Manual Boot Loader Utility 4. Connect LAN1 of the embedded computer to your PC using a cross-over Ethernet cable. The LAN1 port is located on the top panel of the embedded computer. 5. While holding down the DEL key on your PC, power on the embedded computer. You will be guided to the boot loader utility menu. 6. In the boot loader utility, select [1] Network Configuration, and then [1] Change IP Setting to configure IP addresses.
UC-7112-LX Plus Linux User’s Manual 7. Boot Loader Utility You will need to enter the IP addresses of the embedded computer and your PC. Follow the steps below to configure the IP addresses. a. From Start Æ Settings, select Network Connections. b. Right-click on Local Area Connection, and then select Properties.
UC-7112-LX Plus Linux User’s Manual Boot Loader Utility c. Click the General tab and select Internet Protocol (TCP/IP), and then click on Properties.
UC-7112-LX Plus Linux User’s Manual Boot Loader Utility d. Next, select Use the following IP address and enter the following information. IP address: 192.168.1.1 (for example) Subnet mask: 255.255.255.
UC-7112-LX Plus Linux User’s Manual Boot Loader Utility 8. Go back to the boot load utility menu and enter the local IP address. This local IP address is the IP address of the embedded computer. Note that the local IP address must be on the same network as the server IP address. For example, if the server IP address is 192.168.1.1, you can choose a local IP address from the range 192.168.1.2 to 192.168.1.255. 9.
UC-7112-LX Plus Linux User’s Manual Boot Loader Utility 10. Press the ESC key to exit the IP setting option. Next, select [3] Firmware Upgrade, and then [1] Load from LAN to continue. 11. To start the TFPF server, double-click on the tftpd32 icon to launch the TFTP server.
UC-7112-LX Plus Linux User’s Manual Boot Loader Utility 12. When the TFTP server has been launched, the following screen will appear. 13. Go back to the boot loader utility menu and enter the firmware image file name. 14. The firmware upgrade will start running.
UC-7112-LX Plus Linux User’s Manual Boot Loader Utility 15. It will take several minutes for the firmware files to be written to your embedded computer. Do not power off your computer! 16. When you see Update Kernel OK, the firmware upgrade has finished. At this point, you may reboot the embedded computer to complete the firmware upgrade or recovery from the boot loader utility. 17. If you cannot reboot your embedded computer, contact Moxa’s technical support staff for assistance.
B Appendix B System Commands Linux normal command utility collection File manager 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14.
UC-7112-LX Plus Linux User’s Manual Boot Loader Utility Process 1. 2. kill ps kill process display now running process 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. dmesg sty zcat mknod free date env clear reboot halt du gzip, gunzip hostname dump kernel log message to set serial port dump .
C Appendix C Using SNMP Browser to Query the UC ***** SNMP QUERY STARTED ***** 1: sysDescr.0 (octet string) Version 1.0 2: sysObjectID.0 (object identifier) enterprises.8691.12.240 3: sysUpTime.0 (timeticks) 0 days 03h:50m:11s.00th (1381100) 4: sysContact.0 (octet string) Moxa Systems Co., LDT. 5: sysName.0 (octet string) Moxa 6: sysLocation.0 (octet string) Unknown 7: sysServices.0 (integer) 6 8: ifNumber.0 (integer) 6 9: ifIndex.1 (integer) 1 10: ifIndex.2 (integer) 2 11: ifIndex.
UC-7112-LX Plus Software User’s Manual Using SNMP Browser 39: ifPhysAddress.1 (octet string) 00.90.E8.10.02.41 (hex) 40: ifPhysAddress.2 (octet string) 00.90.E8.10.02.40 (hex) 41: ifPhysAddress.3 (octet string) 00 (hex) 42: ifPhysAddress.4 (octet string) 00 (hex) 43: ifPhysAddress.5 (octet string) 00 (hex) 44: ifPhysAddress.6 (octet string) 00 (hex) 45: ifAdminStatus.1 (integer) up(1) 46: ifAdminStatus.2 (integer) up(1) 47: ifAdminStatus.3 (integer) down(2) 48: ifAdminStatus.
UC-7112-LX Plus Software User’s Manual Using SNMP Browser 90: ifInErrors.4 (counter) 0 91: ifInErrors.5 (counter) 0 92: ifInErrors.6 (counter) 0 93: ifInUnknownProtos.1 (counter) 0 94: ifInUnknownProtos.2 (counter) 0 95: ifInUnknownProtos.3 (counter) 0 96: ifInUnknownProtos.4 (counter) 0 97: ifInUnknownProtos.5 (counter) 0 98: ifInUnknownProtos.6 (counter) 0 99: ifOutOctets.1 (counter) 51987 100: ifOutOctets.2 (counter) 3832 101: ifOutOctets.3 (counter) 0 102: ifOutOctets.4 (counter) 0 103: ifOutOctets.
UC-7112-LX Plus Software User’s Manual Using SNMP Browser 141: atIfIndex.1.192.168.27.139 (integer) 1 142: atIfIndex.2.192.168.4.127 (integer) 2 143: atPhysAddress.1.192.168.27.139 (octet string) 00.90.E8.10.02.41 (hex) 144: atPhysAddress.2.192.168.4.127 (octet string) 00.90.E8.10.02.40 (hex) 145: atNetAddress.1.192.168.27.139 (ipaddress) 192.168.27.139 146: atNetAddress.2.192.168.4.127 (ipaddress) 192.168.4.127 147: ipForwarding.0 (integer) forwarding(1) 148: ipDefaultTTL.
UC-7112-LX Plus Software User’s Manual Using SNMP Browser 192: ipRouteProto.192.168.4.0 (integer) local(2) 193: ipRouteProto.192.168.27.0 (integer) local(2) 194: ipRouteAge.192.168.4.0 (integer) 0 195: ipRouteAge.192.168.27.0 (integer) 0 196: ipRouteMask.192.168.4.0 (ipaddress) 255.255.255.0 197: ipRouteMask.192.168.27.0 (ipaddress) 255.255.255.0 198: ipRouteMetric5.192.168.4.0 (integer) -1 199: ipRouteMetric5.192.168.27.0 (integer) -1 200: ipRouteInfo.192.168.4.
UC-7112-LX Plus Software User’s Manual Using SNMP Browser 243: tcpAttemptFails.0 (counter) 0 244: tcpEstabResets.0 (counter) 0 245: tcpCurrEstab.0 (gauge) 0 246: tcpInSegs.0 (counter) 0 247: tcpOutSegs.0 (counter) 0 248: tcpRetransSegs.0 (counter) 0 249: tcpConnState.192.168.27.139.1024.0.0.0.0.0 (integer) listen(2) 250: tcpConnState.192.168.4.127.1024.0.0.0.0.0 (integer) listen(2) 251: tcpConnState.192.168.27.139.1025.0.0.0.0.0 (integer) listen(2) 252: tcpConnState.192.168.4.127.1025.0.0.0.0.
UC-7112-LX Plus Software User’s Manual Using SNMP Browser 294: tcpConnLocalPort.192.168.4.127.2049.0.0.0.0.0 (integer) 2049 295: tcpConnLocalPort.192.168.27.139.1026.0.0.0.0.0 (integer) 1026 296: tcpConnLocalPort.192.168.4.127.1026.0.0.0.0.0 (integer) 1026 297: tcpConnLocalPort.192.168.27.139.9.0.0.0.0.0 (integer) 9 298: tcpConnLocalPort.192.168.4.127.9.0.0.0.0.0 (integer) 9 299: tcpConnLocalPort.192.168.27.139.111.0.0.0.0.0 (integer) 111 300: tcpConnLocalPort.192.168.4.127.111.0.0.0.0.
UC-7112-LX Plus Software User’s Manual Using SNMP Browser 345: tcpConnRemPort.192.168.27.139.22.0.0.0.0.0 (integer) 0 346: tcpConnRemPort.192.168.4.127.22.0.0.0.0.0 (integer) 0 347: tcpConnRemPort.192.168.27.139.23.0.0.0.0.0 (integer) 0 348: tcpConnRemPort.192.168.4.127.23.0.0.0.0.0 (integer) 0 349: tcpInErrs.0 (counter) 6 350: tcpOutRsts.0 (counter) 37224 351: udpInDatagrams.0 (counter) 434 352: udpNoPorts.0 (counter) 8 353: udpInErrors.0 (counter) 0 354: udpOutDatagrams.
UC-7112-LX Plus Software User’s Manual Using SNMP Browser 396: rs232PortType.1 (integer) rs232(2) 397: rs232PortType.2 (integer) rs232(2) 398: rs232PortType.3 (integer) rs232(2) 399: rs232PortType.4 (integer) rs232(2) 400: rs232PortInSigNumber.1 (integer) 3 401: rs232PortInSigNumber.2 (integer) 3 402: rs232PortInSigNumber.3 (integer) 3 403: rs232PortInSigNumber.4 (integer) 3 404: rs232PortOutSigNumber.1 (integer) 2 405: rs232PortOutSigNumber.2 (integer) 2 406: rs232PortOutSigNumber.
UC-7112-LX Plus Software User’s Manual Using SNMP Browser 447: rs232InSigName.4.2 (integer) cts(2) 448: rs232InSigName.1.3 (integer) dsr(3) 449: rs232InSigName.2.3 (integer) dsr(3) 450: rs232InSigName.3.3 (integer) dsr(3) 451: rs232InSigName.4.3 (integer) dsr(3) 452: rs232InSigName.1.6 (integer) dcd(6) 453: rs232InSigName.2.6 (integer) dcd(6) 454: rs232InSigName.3.6 (integer) dcd(6) 455: rs232InSigName.4.6 (integer) dcd(6) 456: rs232InSigState.1.2 (integer) off(3) 457: rs232InSigState.2.
UC-7112-LX Plus Software User’s Manual Using SNMP Browser 498: snmpInTooBigs.0 (counter) 0 499: snmpInNoSuchNames.0 (counter) 0 500: snmpInBadValues.0 (counter) 0 501: snmpInReadOnlys.0 (counter) 0 502: snmpInGenErrs.0 (counter) 0 503: snmpInTotalReqVars.0 (counter) 503 504: snmpInTotalSetVars.0 (counter) 0 505: snmpInGetRequests.0 (counter) 0 506: snmpInGetNexts.0 (counter) 506 507: snmpInSetRequests.0 (counter) 0 508: snmpInGetResponses.0 (counter) 0 509: snmpInTraps.0 (counter) 0 510: snmpOutTooBigs.