UC-7112-LX Plus Software User’s Manual Second Edition, June 2008 www.moxa.com/product © 2008 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 © 2008 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)....................................................
NAT Example .......................................................................................................... 4-11 Enabling NAT at Bootup.......................................................................................... 4-11 Dial-up Service—PPP............................................................................................................ 4-12 PPPoE ...................................................................................................................................
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 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. Follow the instructions given in a previous section to access the Console Utility of the target computer via the serial console port, and then type #cd /etc/network to change directories. 2. Type #vi interfaces to edit the network configuration file with vi editor.
UC-7112-LX Plus Software User’s Manual Getting Started Installing a Secure Digital (SD) Memory Card The UC-7112-LX Plus has an internal SD socket for storage expansion. Moxa provides an SD flash disk for plug & play expansion that allows users to plug in a Secure Digital (SD) memory card compliant with the SD standard V1.0 for up to 1 GB of additional memory space. In this section, we explain how to install the SD card in the UC-7112-LX Plus.
UC-7112-LX Plus Software User’s Manual Getting Started Test Program—Developing Hello.c In this section, we use the standard “Hello” programming example to illustrate how to develop a program for the UC-7112-LX Plus. In general, program development involves the following seven steps. Step 1: Connect the UC-7112-LX Plus to a Linux PC. Step 2: Install the Tool Chain (GNU Cross Compiler & glibc). Step 3: Set the cross compiler and glibc environment variables. Step 4: Code and compile the program.
UC-7112-LX Plus Software User’s Manual Getting Started Checking the Flash Memory Space If the flash memory is full, you will not be able to save data to the Flash ROM. Use the following command to calculate the amount of “Available” flash memory: />df –h If there isn’t enough “Available” space for your application, you will need to delete some existing files.
UC-7112-LX Plus Software User’s Manual Getting Started hello-debug—an ARM platform GDB debug server execution file (see Chapter 5 for details about the GDB debug tool). NOTE Since Moxa’s tool chain places a specially designed Makefile in the directory /tmp/example/UC-7112-LX_Plus /hello, be sure to type the #make command from within that directory. This special Makefile uses the arm-linux-gcc compiler to compile the hello.c source code for the Moxa ART environment.
UC-7112-LX Plus Software User’s Manual Getting Started Testing Environment The tcps2 example demonstrates a simple application program that delivers transparent, bi-directional data transmission between the UC-7112-LX Plus’s serial and Ethernet ports. As illustrated in the following figure, the purpose of this application is to transfer data between PC 1 and the UC-7112-LX Plus through an RS-232 connection.
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 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.0k 458.0k /dev/mtdblock3 6.0M 488.0k 5.5M /dev/mtdblock3 6.0M 488.0k 5.5M /dev/mtdblock3 6.0M 488.0k 5.5M tmpfs 30.4M 0 30.4M root@Moxa:~# upramdisk root@Moxa:~# df -h Filesystem Size Used Available Use% /dev/mtdblock2 8.0M 6.0M 2.0M /dev/ram0 499.0k 16.0k 458.0k /dev/mtdblock3 6.0M 488.0k 5.5M /dev/mtdblock3 6.0M 488.
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-to-default button for more than 5 seconds. All files in the /home & /etc directories will be destroyed. Note that while pressing the reset-to-default 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. Backing Up the User Directory 1.
UC-7112-LX Plus Software User’s Manual Managing Embedded Linux Enabling and Disabling Daemons The following daemons are enabled when the UC-7112-LX Plus boots up for the first time. snmpd ..........SNMP Agent daemon telnetd ..........Telnet Server / Client daemon inetd .............Internet Daemons ftpd...............FTP Server / Client daemon sshd ..............Secure Shell Server daemon httpd ............Apache WWW Server daemon Type the command “ps –ef” to list all processes currently running. 192.168.
UC-7112-LX Plus Software User’s Manual Managing Embedded Linux 192.168.3.127 – PuTTY # !/bin/sh # Add you want to run daemon /root/tcps2-release &~ The enabled daemons will be available after you reboot the system. 192.168.3.
UC-7112-LX Plus Software User’s Manual Managing Embedded Linux xx: a number between 00-99. Smaller numbers have 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 S99rmnologin root@Moxa:/ect/rc.d/rc3.d# ln –s /root/tcps2-release S60tcps2 root@Moxa:/ect/rc.d/rc3.d# ls S19nfs-common S25nfs-user-server S99rmnologin S20snmpd S55ssh S99showreadyled S24pcmcia S60tcps2 root@Moxa:/etc/rc.d/rc3.
UC-7112-LX Plus Software User’s Manual Managing Embedded Linux The following figure illustrates how to update thesystem time and set the RTC time. 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:08 2004 -0.
UC-7112-LX Plus Software User’s Manual Managing Embedded Linux How to run the shell script automatically when the kernel boots up Copy the example shell script fixtime to directory /etc/init.d, and then use to change the shell script mode. Next, use vi editor to edit the file Add the following line to the bottom of the file: chmod 755 fixtime /etc/inittab. ntp : 2345 : respawn : /etc/init.d/fixtime Use the command #init q to re-init the kernel.
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 Managing Communications 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 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. POSTROUTING: To alter packets as they are about to be sent out.
UC-7112-LX Plus Software User’s Manual Managing Communications NAT NAT (Network Address Translation) protocol translates IP addresses used on one network to different IP addresses used on another network. One network is designated the inside network and the other is the outside network.
UC-7112-LX Plus Software User’s Manual Managing Communications # Step 1. Insert modules. # Here 2> /dev/null means the standard error messages will be dump to null device. insmod ip_tables 2> /dev/null insmod ip_nat_ftp 2> /dev/null insmod ip_nat_irc 2> /dev/null insmod ip_conntrack 2> /dev/null insmod ip_conntrack_ftp 2> /dev/null insmod ip_conntrack_irc 2> /dev/null # Step 2. Define variables, enable routing and erase default rules.
UC-7112-LX Plus Software User’s Manual Managing Communications connect ‘chat etc...’ This option gives the command to contact the PPP server. The ‘chat’ program is used to dial a remote computer. The entire command is enclosed in single quotes because pppd expects a one-word argument for the ‘connect’ option. The options for ‘chat’ are given below: -v verbose mode; log what we do to syslog “ “ Double quotes—don’t wait for a prompt, but instead do ...
UC-7112-LX Plus Software User’s Manual Managing Communications First, type: /sbin/ifconfig (The folder ifconfig may be located elsewhere, depending on your distribution.) You should be able to see all the network interfaces that are UP. ppp0 should be one of them, and you should recognize the first IP address as your own, and the “P-t-P address” (or point-to-point address) the address of your server. Here’s what it looks like on one machine: lo Link encap Local Loopback inet addr 127.0.0.1 Bcast 127.
UC-7112-LX Plus Software User’s Manual Managing Communications 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-secrets: * * ““ * The first star (*) lets everyone login. The second star (*) lets every host connect. The pair of double quotation marks (““) is to use the file /etc/passwd to check the password. The last star (*) is to let any IP connect.
UC-7112-LX Plus Software User’s Manual 5. 6. 7. Managing Communications “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. Edit the file /etc/ppp/options and add the following line: plugin pppoe 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.
UC-7112-LX Plus Software User’s Manual Managing Communications nameserver ip_addr_of_first_dns_server nameserver ip_addr_of_second_dns_server For example: nameserver 168..95.1.1 nameserver 139.175.10.20 8. Use the following command to create a pppoe connection: pppd eth0 The eth0 is what is connected to the ADSL modem LAN port. The example above uses LAN1. To use LAN2, type: pppd eth1 9. Type ifconfig ppp0 to check if the connection is OK or has failed.
UC-7112-LX Plus Software User’s Manual Managing Communications Example: smtpclient –s test –f sender@company.com < mail-body-message –S IP_address receiver@company.com -s: The mail subject. -f: Sender’s mail address -S: SMTP server IP address The last mail address receiver@company.com is the receiver’s e-mail address. mail-body-message is the mail content. The last line of the body of the message should contain ONLY the period ‘.’ character. You will need to add your hostname to the file /etc/hosts.
UC-7112-LX Plus Software User’s Manual Managing Communications Setup 1: Ethernet Bridging for Private Networks on Different Subnets 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 OpenVPN B local net Host A (B) represents one of the machines that belongs to OpenVPN A (B).
UC-7112-LX Plus Software User’s Manual Managing Communications 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 LINE in `lsmod` do TOK=`echo $LINE | cut -d’ ‘ -f1` if [ “$TOK” = “$mname” ]; then FOUND=“yes”; break; fi done IFS=$oIFS if [ “$FOUND” = “no” ]; then modprobe $mname fi } start() { ifcfg_vpn if [ ! \( -d “/dev/net” \) ]; then mkdir /dev/net fi if [ ! \( -r “/dev/n
UC-7112-LX Plus Software User’s Manual Managing Communications break fi done # null ip address of internal interface ifconfig $iface 0.0.0.0 promisc up # enable bridge ip ifconfig br0 $IPADDR netmask $NETMASK broadcast $BROADCAST ipf=/proc/sys/net/ipv4/ip_forward # enable IP forwarding echo 1 > $ipf echo “ip forwarding enabled to” cat $ipf } stop() { echo “shutdown openvpn bridge.
UC-7112-LX Plus Software User’s Manual Managing Communications cipher DES-EDE3-CBC auth MD5 tun-mtu 1500 tun-mtu-extra 64 ping 40 up /etc/openvpn/A-tap0-br.sh #----------------------------------Start-----------------------------#!/bin/sh # value after “-net” is the subnet behind the remote peer route add -net 192.168.4.0 netmask 255.255.255.0 dev br0 #---------------------------------- end ------------------------------ Create a configuration file named B-tap0-br.
UC-7112-LX Plus Software User’s Manual Managing Communications item: route add –net 192.168.2.0 netmask 255.255.255.0 dev eth0 Now ping Host B from Host A by typing: ping 192.168.4.174 A successful ping indicates that you have created a VPN system that only allows authorized users from one internal network to access users at the remote site. For this system, all data is transmitted by UDP packets on port 5000 between OpenVPN peers. 7.
UC-7112-LX Plus Software User’s Manual Managing Communications Setup 3: Routed IP 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 Create a configuration file named “A-tun.conf” and an executable script file named “A-tun.sh”. # point to the peer remote 192.168.8.
UC-7112-LX Plus Software User’s Manual Managing Communications the second argument of ifconfig in the configuration file. 3. Check the routing table after you run the OpenVPN programs, by typing the command: # route Destination Gateway Genmsk 192.168.4.174 * 255.255.255.255 192.168.4.0 192.168.4.174 255.255.255.0 192.168.2.0 * 255.255.255.0 192.168.8.0 * 255.255.255.
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 The buzzer’s on / off behavior is controlled by software. If you call the “ioctl” function, you MUST set the frequency at 100 Hz. If you use a different frequency, the system could crash. WDT (Watch Dog Timer) 1. Introduction The WDT works like a watch dog function. You can enable it or disable it. When the user enables WDT but the application does not acknowledge it, the system will reboot.
UC-7112-LX Plus Software User’s Manual Programmer’s Guide Output errno() returns the error code. A value of 0 (zero) indicates no error. int swtd_disable(int fd) Description Disable the application to ack sWatchDog. In this case, the kernel will be auto ack, so the user does not need ack periodically. Input int fd - the file handle from swtd_open() return value. Output errno() returns the error code. A value of 0 (zero) indicates no error.
UC-7112-LX Plus Software User’s Manual 4. Programmer’s Guide 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. This can cause a serious problem, causing your system to reboot again and again. 5.
UC-7112-LX Plus Software User’s Manual Programmer’s Guide static int swtdfd; static int stopflag=0; static void stop_swatchdog() { stopflag = 1; } static void do_swatchdog(void) { swtd_enable(swtdfd, 500); while ( stopflag == 0 ) { mydelay(250); swtd_ack(swtdfd); } swtd_disable(swtdfd); } int main(int argc, char *argv[]) { pid_t sonpid; signal(SIGUSR1, stop_swatchdog); swtdfd = swtd_open(); if ( swtdfd < 0 ) { printf(“Open sWatchDog device fail !\n”); exit(1); } if ( (sonpid=fork()) == 0 ) do_swatchdog();
UC-7112-LX Plus Software User’s Manual Programmer’s Guide int ioctl(fd, MOXA_GET_OP_MODE, &mode) Description Get the interface mode. Argument 3 mode will return the interface mode. There are two Moxa private ioctl commands for setting up special baudrates. Function: MOXA_SET_SPECIAL_BAUD_RATE Function: MOXA_GET_SPECIAL_BAUD_RATE If you use this ioctl to set a special baudrate, the termios cflag will be B4000000, in which case the B4000000 definition will be different.
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 System Commands busybox (V0.60.4): 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 System Commands 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 .
B Appendix B 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.