DA-710 Series Linux User’s Manual Second Edition, August 2012 www.moxa.com/product © 2012 Moxa Inc. All rights reserved.
DA-710 Series Linux 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 © 2012 Moxa Inc. All rights reserved. Trademarks The MOXA logo is a registered trademark of Moxa Inc. All other trademarks or registered marks in this manual belong to their respective manufacturers.
Table of Contents 1. Introduction ...................................................................................................................................... 1-1 Overview ........................................................................................................................................... 1-2 Software Specifications........................................................................................................................ 1-2 Software Components .................
1 1. Introduction Thank you for purchasing the Moxa DA-710 Series of x86 ready-to-run embedded computers. This manual introduces the software configuration and management of the DA-710-LX, which runs the Linux operating system. For hardware installation, connector interfaces, setup, and upgrading the BIOS, please refer to the “DA-710 Series Hardware User’s Manual.” Linux is an open, scalable operating system that allows you to build a wide range of innovative, small footprint devices.
DA-710 Series Linux Introduction Overview The Moxa DA-710 Series of x86-based rackmount embedded computers are designed for industrial data acquisition applications. Their state-of-the-art two expansion module design gives users a versatile combination of up to 16 RS-232/422/485 serial ports, or up to 4+8 Ethernet ports. This friendly design gives users the advantage of being able to swap out modules quickly and easily. Additional expansion modules will be available soon.
DA-710 Series Linux Introduction Software Components The DA-710-LX pre-installed Debian Lenny 5.0 Linux distribution has the following software components: acpi-support-base 0.109-11 scripts for handling base ACPI events such as the power button acpid 1.0.8-1lenny1 Utilities for using ACPI power management adduser 3.110 add and remove users and groups apache2 2.2.9-10+lenny4 Apache HTTP Server metapackage apache2-mpm-prefork 2.2.
DA-710 Series Linux Introduction findutils 4.4.0-2 utilities for finding files--find, xargs ftp 0.17-18 The FTP client g++ 4:4.3.2-2 The GNU C++ compiler g++-4.3 4.3.2-1.1 The GNU C++ compiler gcc 4:4.3.2-2 The GNU C compiler gcc-4.2-base 4.2.4-6 The GNU Compiler Collection (base package) gcc-4.3 4.3.2-1.1 The GNU C compiler gcc-4.3-base 4.3.2-1.1 The GNU Compiler Collection (base package) gdb 6.8-3 The GNU Debugger gettext-base 0.
DA-710 Series Linux libgc1c2 Introduction 1:6.8-1.1 conservative garbage collector for C and C++ libgcc1 1:4.3.2-1.1 GCC support library libgcrypt11 1.4.1-1 LGPL Crypto library - runtime library libgdbm3 1.8.3-3 GNU dbm database routines (runtime version) libgmp3c2 2:4.2.2+dfsg-3 Multiprecision arithmetic library libgnutls26 2.4.2-6+lenny1 the GNU TLS library - runtime library libgomp1 4.3.2-1.1 GCC OpenMP (GOMP) support library libgpg-error0 1.
DA-710 Series Linux Introduction libslang2 2.1.3-3 The S-Lang programming library - runtime version libsnmp-base 5.4.1~dfsg-12 SNMP (Simple Network Management Protocol) MIBs and libsnmp15 5.4.1~dfsg-12 SNMP (Simple Network Management Protocol) library libsqlite3-0 3.5.9-6 SQLite 3 shared library libss2 1.41.3-1 command-line interface parsing library libssl0.9.8 0.9.8g-15+lenny1 SSL shared libraries libstdc++6 4.3.2-1.1 The GNU Standard C++ Library v3 libstdc++6-4.3-dev 4.3.2-1.
DA-710 Series Linux Introduction threading mysql-common 5.0.51a-24+lenny2 MySQL database common files ncurses-base 5.7+20081213-1 basic terminal type definitions ncurses-bin 5.7+20081213-1 terminal-related programs and man pages ncurses-term 5.7+20081213-1 additional terminal type definitions net-tools 1.60-22 The NET-3 networking toolkit netbase 4.34 Basic TCP/IP networking system netcat-traditional 1.10-38 TCP/IP swiss army knife nfs-common 1:1.1.
DA-710 Series Linux Introduction sysvinit-utils 2.86.ds1-61 System-V-like utilities tar 1.20-1 GNU version of the tar archiving utility tasksel 2.78 Tool for selecting tasks for installation on Debian systems tasksel-data 2.78 Official tasks used for installation of Debian systems tcpd 7.6.q-16 Wietse Venema's TCP wrapper utilities tcpdump 3.9.8-4 A powerful tool for network monitoring and data acquisition telnet 0.17-36 The telnet client telnetd 0.17-36 The telnet server tftpd 0.
2 2. Software Configuration In this chapter, we explain how to operate a DA-710-LX computer directly or from a PC near you. There are three ways to connect to the DA-710-LX computer: through VGA monitor, by using Telnet over the network, or by using an SSH console from a Windows or Linux machine. This chapter describes basic Linux operating system configurations. The advanced network management and configuration will be described in the next chapter “Managing Communications.
DA-710 Series Linux Software Configuration Starting from a VGA Console Connect the display monitor to the DA-710-LX VGA connector, and then power it up 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, a login screen will appear on your monitor. To log in, type the login name and password as requested. The default values are both root. Login: root Password: root login as: root root@192.168.3.
DA-710 Series Linux Software Configuration Connecting from a Telnet Console The DA-710-LX computer comes with four basic Gigabit Ethernet ports named LAN1 to LAN4. The default IP addresses and netmasks of the network interfaces are as follows: Default IP Address Netmask LAN 1 192.168.3.127 255.255.255.0 LAN 2 192.168.4.127 255.255.255.0 LAN 3 192.168.5.127 255.255.255.0 LAN 4 192.168.6.127 255.255.255.
DA-710 Series Linux Software Configuration Connecting from an SSH Console The DA-710-LX computer supports an SSH Console to offer users with better security over the network compared to Telnet. 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 DA-710-LX in a Windows environment. The following screen shows an example of the configuration that is required.
DA-710 Series Linux Software Configuration Adjusting the System Time The DA-710-LX has two time settings. One is the system time, and the other is provided by an RTC (Real Time Clock) built into the DA-710- LX’s hardware. Setting the Time Manually 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. Use the following command to set the system time.
DA-710 Series Linux Software Configuration ATTENTION Before using the NTP client utility, check your IP address and network settings to make sure an Internet connection is available. Updating the Time Automatically This section describes how to use a shell script to update the time automatically. Example shell script for updating the system time periodically #!/bin/sh ntpdate time.stdtime.gov.tw # You can use the time server’s ip address or domain # name directly.
DA-710 Series Linux Software Configuration Enabling and Disabling Daemons The following daemons are enabled when the DA-710-LX boots up for the first time. • snmpd SNMP Agent Daemon • elnetd 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.
DA-710 Series Linux Software Configuration To run a private daemon, you can edit the file rc.local as follows: 1. Because the root file system is mounted in Read-only mode, you need to re-mount it with write permission. MOXA:~# mount -o remount,rw /dev/hda1 / 2. Type cd /etc/ to change directories. MOXA:~# cd /etc/ 3. Type vi rc.local to edit the configuration file with vi editor. MOXA:/etc/# vi rc.local 4. Next, add the application daemon that you want to run.
DA-710 Series Linux Software Configuration Setting the Run-Level To set the Linux run-level and execution priority of a program, use the following command (because the root file system is mounted in Read-only mode, we need to re-mount it with write permission). MOXA:~# mount -o remount,rw /dev/hda1 / Edit a shell script to execute /root/tcps2-release and save to tcps2 as an example. #cd /etc/rc2.d #ln –s /etc/root/tcps2 S60tcps2 or #ln –s /etc/root/tcps2 k30tcps2 MOXA:~# cd /etc/rc2.d MOXA:/etc/rc2.
DA-710 Series Linux Software Configuration Cron—Daemon for Executing Scheduled Commands The Cron daemon will search /etc/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. When executing commands, output is mailed to the owner of the crontab (or to the user named in the MAILTO environment variable in the crontab, if such a user exists).
DA-710 Series Linux Software Configuration Inserting a USB Storage Device into the Computer Since mounting USB storage devices manually can be difficult, a Debian package named usbmount to mount the USB drivers automatically. usbmount relies on udev to mount USB storage devices automatically at certain mount points. The USB storage devices will be mounted on /media/usb0, /media/usb1, etc.
DA-710 Series Linux Software Configuration Inserting a CompactFlash Card into the Computer The CompactFlash card is treated as a local disk drive in the DA-710-LX computer. It is identified as a block device at /dev/hdb. You can add one line to /etc/fstab to force the CompactFlash card to mount automatically at boot time. ATTENTION The DA-710 Series Embedded Computer does not support the CompactFlash hot swap function.
DA-710 Series Linux Software Configuration APT—Installing and Removing Packages APT is the Debian tool used to install and remove packages. Before installing a package, you need to configure the apt source file, /etc/apt/sources.list, which is located in the read-only partition. 1. Mount the root file system with write permission. MOXA:~# mount -o remount,rw /dev/hda1 / 2. Next, configure the /etc/apt/sources.list using vi editor. MOXA:~# vi /etc/apt/sources.list # # deb cdrom:[Debian GNU/Linux 5.0.
DA-710 Series Linux MOXA:~# df -h Filesystem rootfs udev /dev/hda1 tmpfs tmpfs none /dev/hda2 MOXA:~# Software Configuration Size 772M 10M 772M 502M 502M 502M 133M Used Avail 397M 335M 68K 10M 397M 335M 0 502M 0 502M 19M 483M 73M 53M Use% Mounted on 55% / 1% /dev 55% / 0% /lib/init/rw 0% /dev/shm 4% /tmp 59% /home ATTENTION You can free up the cache space with the command # apt-get clean.
3 3. Managing Communications The DA-710-LX ready-to-run embedded computer is a network-centric platform designed to serve as a front-end for data acquisition and industrial control applications. This chapter describes how to configure the various communication functions supported by the Linux operating system.
DA-710 Series Linux Managing Communications Changing the Network Settings The DA-710-LX computer has four basic Gigabit Ethernet ports named LAN1 to LAN4. The LAN Port Expansion Module supports an additional four 10/100 Mbps Ethernet ports named LAN5 to LAN8. The default IP addresses and netmasks of the network interfaces are as follows: Default IP Address Netmask LAN 1 192.168.3.127 255.255.255.0 LAN 2 192.168.4.127 255.255.255.0 LAN 3 192.168.5.127 255.255.255.0 LAN 4 192.168.6.127 255.255.
DA-710 Series Linux Managing Communications Dynamic IP Address using DHCP To configure one or both LAN ports to request an IP address dynamically, replace static with dhcp and then delete the rest of the lines. # The primary network interface allow-hotplug eth0 iface eth0 inet dhcp After modifying the boot settings of the LAN interface, issue the following command to activate the LAN settings immediately. # /etc/init.d/networking restart MOXA:~# /etc/init.
DA-710 Series Linux Managing Communications # PCI device 0x10ec:0x8139 (8139too) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:90:e8:00:d3:21", ATTR{type}=="1", KERNEL=="eth*", NAME="eth6" # PCI device 0x10ec:0x8139 (8139too) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:90:e8:00:d3:22", ATTR{type}=="1", KERNEL=="eth*", NAME="eth7" # PCI device 0x10ec:0x8139 (8139too) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:90:e8:00:d3:23", ATTR{type}=="
DA-710 Series Linux Managing Communications Configuring Multiple Serial Ports for Expansion Modules This section explains how to configure the serial port interface when you have inserted one or more serial expansion modules on your DA-710’s expansion PCI slots. In the following case, we will insert three DA-SP08-DB expansion modules. Follow the steps below. 1. Make sure the DA-710 computer is turned off. 2. Insert the three modules on the rear panel of the DA-710. 3. Turn on the DA-710 computer. 4.
DA-710 Series Linux Managing Communications 7. To change the order of device nodes and module names, you can write a rule in /etc/udev/rules.d/96-moxa.rules.
DA-710 Series Linux Managing Communications For example, use the following commands to set /dev/ttyM0 to RS-422: MOXA:~# setinterface /dev/ttyM0 2 MOXA:~# setinterface /dev/ttyM0 Now setting is RS422 interface. MOXA:~# Telnet/FTP Server In addition to supporting Telnet client/server and FTP client/server, the DA-710-LX also supports SSH and sftp client/server. To enable or disable the Telnet/ftp server, you need to edit the file /etc/inetd.conf. 1. Mount the root file system with write permission.
DA-710 Series Linux Managing Communications DNS Client The DA-710-LX supports DNS client (but not DNS server). To set up DNS client, you need to edit three configuration files: /etc/hostname, /etc/resolv.conf, and /etc/nsswitch.conf. /etc/hostname 1. Mount the root file system with write permission. MOXA:~# mount -o remount,rw /dev/hda1 / 2. Edit /etc/hostname: MOXA:~# vi /etc/hostname MOXA 3.
DA-710 Series Linux Managing Communications /etc/nsswitch.conf This file defines the sequence of files, /etc/hosts or /etc/resolv.conf, to be read to resolve the IP address. The hosts line in /etc/nsswitch.conf means use /etc/host first and DNS service to resolve the address. # # # # # /etc/nsswitch.conf Example configuration of GNU Name Service Switch functionality.
DA-710 Series Linux Managing Communications Disabling the CGI Function The CGI function is enabled by default. If you want to disable the function, modify the file /etc/apache2/sites-available/default. 1. Mount the root file system with write permission. MOXA:~# mount -o remount,rw /dev/hda1 / 2. Type # vi /etc/apache2/sites-available/default to edit the configuration file.
DA-710 Series Linux ... ... Managing Communications AllowOverride None ScriptAlias /cgi-bin/ /media/usb0/www/cgi-bin/ AllowOverride None Options ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all ... ... ... ... DocumentRoot /media/usb0/www Options FollowSymLinks AllowOverride None ... ...
DA-710 Series Linux 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. A rule (such as a jump to a user-defined chain in the same table) is called a target.
DA-710 Series Linux Managing Communications IPTABLES Hierarchy The following figure shows the IPTABLES hierarchy. IPTABLES Modules The DA-710-LX supports the following sub-modules. Be sure to use the module that matches your application. arptable_filter.ko arp_tables.ko arpt_mangle.ko ip_conntrack_amanda.ko ip_conntrack_ftp.ko ip_conntrack_h323.ko ip_conntrack_irc.ko ip_conntrack.ko ip_conntrack_netbios_ns.ko ip_conntrack_netlink.ko ip_conntrack_pptp.ko ip_conntrack_proto_sctp.
DA-710 Series Linux Managing Communications ipt_TOS.ko ipt_ttl.ko ipt_TTL.ko ipt_ULOG.ko The basic syntax to enable and load an IPTABLES module is as follows: # lsmod # modprobe ip_tables # modprobe iptable_filter #modprobe iptable_mangle #modprobe iptable_nat Use lsmod to check if the ip_tables module has already been loaded in the DA-710-LX. Use modprobe to insert and enable the module. Use iptables, iptables-restore, iptables-save to maintain the database.
DA-710 Series Linux 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 DA-710-I-LX. OUTPUT: For locally-generated packets. FORWARD: For packets routed out through the DA-710-I-LX. PREROUTING: To alter packets as soon as they come in. POSTROUTING: To alter packets as they are about to be sent out.
DA-710 Series Linux Managing Communications Example 5: Drop TCP packets addressed for port 21. # iptables –A INPUT –i eth0 –p tcp --dport 21 –j DROP Example 6: Accept TCP packets from 192.168.0.24 to DA-710-I-LX’s port 137, 138, 139 # iptables –A INPUT –i eth0 –p tcp –s 192.168.0.24 --dport 137:139 –j ACCEPT Example 7: Log TCP packets that visit DA-710-I-LX’s port 25. # iptables –A INPUT –i eth0 –p tcp --dport 25 –j LOG Example 8: Drop all packets from MAC address 01:02:03:04:05:06.
DA-710 Series Linux Managing Communications #ehco 1 > /proc/sys/net/ipv4/ip_forward #modprobe ipt_MASQUERADE #iptables –t nat –A POSTROUTING –o eth0 –j MASQUERADE Enabling NAT at Bootup In most real world situations, you will want to use a simple shell script to enable NAT when the DA-710-LX 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.
DA-710 Series Linux Managing Communications PPP (Point to Point Protocol) PPP (Point to Point Protocol) is used to run IP (Internet Protocol) and other network protocols over a serial link. PPP can be used for direct serial connections (using a null-modem cable) over a Telnet link, and links established using a modem over a telephone line. Modem/PPP access is almost identical to connecting directly to a network through the DA-710-LX’s Ethernet port.
DA-710 Series Linux 192.1.1.17 Managing Communications 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.
DA-710 Series Linux Managing Communications Try typing: #netstat -nr This should show three routes similar to the following: Kernel routing table Destination Gateway Genmask iface 129.67.1.165 0.0.0.0 255.255.255.255 ppp0 127.0.0.0 0.0.0.0 255.0.0.0 0.0.0.0 129.67.1.165 0.0.0.0 ppp0 Flags Metric Ref Use UH 0 0 6 U UG 0 0 0 0 0 lo 6298 If your output looks similar but does not have the “destination 0.0.0.
DA-710 Series Linux Managing Communications # Keep modem up even if connection fails persist crtscts modem 192.168.16.1:192.168.16.2 debug -detach Configure the chat script /etc/ppp/ppp-ttyM0.chat SAY '' 'Auto Answer ON\n' ATS0=1 Start the pppd dial-in service. # pppd call dialin ATTENTION If you hope to have auto dial-in service, you can respawn the dial-in service in /etc/inittab.
DA-710 Series Linux Managing Communications 4. Edit the file /etc/ppp/pap-secrets and add the following: “username@hinet.net” * “password” * # ATTENTION: The definitions here can allow users to login without a # password if you don't use the login option of pppd! The mgetty Debian # package already provides this option; make sure you don't change that. # INBOUND connections # Every regular user can use PPP and has to use passwords from /etc/passwd * hostname "" * "username@hinet.
DA-710 Series Linux Managing Communications 6. If you use LAN1 to connect to the ADSL modem, add file /etc/ppp/options.eth0. If you use LAN2 to connect to the ADSL modem, then add /etc/ppp/options.eth1, etc. name username@hinet.net mtu 1492 mru 1492 defaultroute noipdefault ~ ~ "/etc/ppp/options.eth0" 5 lines, 67 characters Type your username (the one you set in the /etc/ppp/pap-secrets and /etc/ppp/chap-secrets files) after the name option. You may add other options as desired. 7. Set up DNS.
DA-710 Series Linux Managing Communications NFS (Network File System) Client 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 DA-710-LX without worrying about the amount of disk space that will be available. The DA-710-LX supports only NFS client protocol. ATTENTION Click on the following links for more information about NFS.
DA-710 Series Linux Managing Communications SNMPv2-MIB::sysORID.9 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance SNMPv2-MIB::sysORDescr.1 = STRING: The MIB module to describe generic objects fo r network interface sub-layers SNMPv2-MIB::sysORDescr.2 = STRING: The MIB module for SNMPv2 entities SNMPv2-MIB::sysORDescr.3 = STRING: The MIB module for managing TCP implementatio ... SNMPv2-MIB::snmpOutBadValues.0 = Counter32: 0 SNMPv2-MIB::snmpOutGenErrs.0 = Counter32: 0 SNMPv2-MIB::snmpOutGetRequests.
DA-710 Series Linux Managing Communications Ethernet Bridging for Private Networks on Different Subnets 1. Set up four machines, as shown in the following diagram. Host A represents the machine that belongs to OpenVPN A, and Host B represents the machine that belongs to OpenVPN B. The two remote subnets are configured for a different range of IP addresses.
DA-710 Series Linux Managing Communications And then configure the bridge interface in /etc/openvpn/bridge. #!/bin/bash # Create global variables # Define Bridge Interface br="br0" # Define list of TAP interfaces to be bridged, # for example tap="tap0 tap1 tap2". tap="tap0" # Define physical ethernet interface to be bridged # with TAP interface(s) above. eth="eth1" eth_ip="192.168.8.173" eth_netmask="255.255.255.0" eth_broadcast="192.168.8.255" #gw="192.168.8.174" ...
DA-710 Series Linux Managing Communications #gw="192.168.8.173" ... Start the bridge script file to configure the bridge interface. # /etc/openvpn/bridge restart ATTENTION Select cipher and authentication algorithms by specifying cipher and auth. To see which algorithms are available, type: # openvpn --show-ciphers # openvpn --show-auths 8. Start both OpenVPN peers on machine OpenVPN A and OpenVPN B. # openvpn --config /etc/openvpn/tap0-br.conf& If you see the line Peer Connection Initiated with 192.
DA-710 Series Linux Managing Communications Ethernet Bridging for Private Networks on the Same Subnet 1. Set up four machines, as shown in the following diagram. 2. The configuration procedure is almost the same as for the previous example. The only difference is that you will need to comment out the parameter up in /etc/openvpn/tap0-br.conf of OpenVPN A and /etc/openvpn/tap0-br.conf of OpenVPN B. # point to the peer remote 192.168.8.174 dev tap0 secret /etc/openvpn/secrouter.
DA-710 Series Linux Managing Communications 2. On machine OpenVPN A, modify the remote address in configuration file /etc/openvpn/tun.conf. # point to the peer remote 192.168.8.174 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.2.173 192.168.4.174 up /etc/openvpn/tun.sh 3. Next, modify the routing table in script file /etc/openvpn/tun.sh.
4 4.
DA-710 Series Linux Programmer Guide Device API The DA-710 supports control devices with the ioctl system API. The interface is shown as below. int ioctl(int d, int request,…); Input: open device node return file handle argument in or out Refer to desktop Linux’s man page for detailed documentation: #man ioctl RTC (Real Time Clock) The device node is located at /dev/rtc. The DA-710 supports standard Linux simple RTC control. You must include . 1.
DA-710 Series Linux Programmer Guide Example to set the baudrate #include “moxadevice.h” #include struct termios term; int fd, speed; fd = open(“/dev/ttyM0”, O_RDWR); tcgetattr(fd, &term); term.c_cflag &= ~(CBAUD | CBAUDEX); term.c_cflag |= B4000000; tcsetattr(fd, TCSANOW, &term); speed = 500000; ioctl(fd, MOXA_SET_SPECIAL_BAUD_RATE, &speed); Example to get the baudrate #include “moxadevice.h” #include
DA-710 Series Linux Programmer Guide IMPORTANT! If the target baudrate is not a special baudrate (e.g. 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600), the termios cflag will be set to the same flag. If you use stty to get the serial information, you will get speed equal to 0 for the special baudrate. Digital I/O Digital Output channels can be set to high or low. The channels are controlled by the function call set_dout_state( ).
DA-710 Series Linux Programmer Guide Function int set_din_event(int diport, void (*func)(int diport), int mode, long int duration) Description Set the DIN event when the state is changed from high to low or from low to high. Input The port that will be used to detect the DIN event. Port numbering is from 0 to 3. This value depends on your device. <(*func) (int diport)> Not NULL: Returns the call back function. When the event occurs, the call back function will be invoked.
DA-710 Series Linux Programmer Guide Example: DIO Program Source Code File Name: tdio.c Description: This program connects DO1 to DI1, changes the digital output state to high or low by manual input, then detects and counts the state changed events from DI1. #include #include #ifdef NO_MOXADEVICE_HEADER #include "moxadevice.h" #else #include #endif #include
DA-710 Series Linux Programmer Guide 8.
DA-710 Series Linux Programmer Guide retval=set_dout_state(i, 1); } else if ( i == 6 ) { // set low data printf("Please keyin the DOUT number : "); scanf("%d", &i); retval=set_dout_state(i, 0); } else if ( i == 7 ) { // quit break; } else if ( i == 8 ) { // show event and duration printf("Event:\n"); for ( j=0; j
DA-710 Series Linux Programmer Guide printf("DIO error control\n"); break; case DIO_ERROR_DURATION: printf("DIO error duratoin\n"); case DIO_ERROR_DURATION_20MS: printf("DIO error! The duratoin is not a multiple of 20 ms\n"); break; } } return 0; } DIO Program Make File Example include ../compile.mk CC=$(PREFIX)gcc STRIP=$(PREFIX)strip AR=$(PREFIX)ar LNAME=moxalib all: release release: $(MOXALIB_OBJ) $(AR) rcs lib$(LNAME).a $(MOXALIB_OBJ) %.o:%.c $(CC) -c $< install: lib$(LNAME).a cp -a lib$(LNAME).
DA-710 Series Linux Programmer Guide Programmable LEDs The DA-685 provides 8 user-programmable LED indicators on its front panel. The following section explains how to configure these LEDs. 1. The kernel module that controls the programmable LEDs is named moxa_pled.ko. Use the lsmod command to verify the module is loaded; do not include the module’s file suffix (*.ko) in the search. The computer should return the output below: MOXA: ~# lsmod | grep moxa_pled moxa_pled 2464 0 If the moxa_pled.
5 5. System Recovery The DA-710-LX is installed with the Embedded Linux operating system, which is located in the Flash DOM (CompactFlash card) shipped with the DA-710-LX computer. Although it rarely happens, you may find on occasion that operating system files and/or the disk file system are damaged. This chapter describes how to recover the Linux operating system.
DA-710 Series Linux System Recovery Recovery Environment The recovery environment includes the DA-710-LX embedded computer and a bootable USB disk with the recovery programs and system image file. DA-710-LX Bootable USB DISK (recovery programs and system image file included) USB Port Recovery Procedure Step 1: Format an Empty USB Disk. a. Prepare a USB disk that has at least a 256 MB capacity. b. Format your USB disk with the HP USB Disk Format Tool.
DA-710 Series Linux Step 2: System Recovery Create a Linux Bootable USB Disk. a. You can find the firmware directory in the Recovery CD shipped with the DA-710-LX computer. b. Configure Windows Explorer to show hidden files (including protected operating system files). c. Copy all files in the firmware directory to the root directory of your USB disk. d. Open a DOS prompt and type M:\syslinux.exe M: to create a bootable Linux disk. In this example, M: is the USB Disk drive number.
DA-710 Series Linux Step 3: System Recovery Set up the BIOS to Boot from a USB Disk. a. Insert the USB disk. b. Power on and press DEL to enter the bios setup menu. c. Select Advanced Hard Disk Boot Priority and then press Enter. d. From the setup menu, use “↑” or “↓” to select the USB device e. Press “+” to move the selection up to the first priority, and press Esc to exit the setup menu. f. Make sure the first boot device is Hard Disk. If not, press Enter to change it. g.
DA-710 Series Linux Step 4: System Recovery Recover the Linux system from a USB Disk. a. If the BIOS setup is correct, it will boot from the USB disk. Follow the steps below to set up recovery parameters. Welcome to PING (Partition Image Is Not Ghost)! This tool can be used to both backup a Ghost-like image of your hard disk and to restore your hard disk from such an image. Please, be aware that if you choose to restore your hard disk.
DA-710 Series Linux System Recovery d. Choose restore image from Local disk partition. PING (Partition Image Is Not Ghost)! Where do you want to save/restore your image to/from? Network share Local disk partition e. Choose ### Choose THIS if you want a restoration ### Choose the partition to backup Note that you cannot restore a partition to itself. So every partition but one (the destination) can be checked. Use SPACE to SELECT an entry.
DA-710 Series Linux System Recovery g. Enter “\” to choose the root directory of the restoration image. Enter root directory containing your data (eg. \mydir\PartImage) \ h. Choose DA710_V1.0_Build_08031316 for the restoration image. Action and Available images for restoration … Choose Create_New_Image if you want a ghost-like images of your partitions. Choose Backup_Local_Hard_Driver if prefer a zip archive. DA710_V1.
DA-710 Series Linux System Recovery ATTENTION DO NOT turn off the power during system recovery, as the system may crash. Step 5: Set up the BIOS back to boot from DOM or CompactFlash Disk. a. Power on and press DEL to enter the bios setup menu. b. Select Advanced Hard Disk Boot Priority and then press Enter. c. From the setup menu, use “↑” or “↓” to select the DOM or CompactFlash device. d. Press “+” to move the selection up to the first priority, and press Esc to exit the setup menu. e.