Home

UC-8410/8416/8418/8430 LX User`s Manual

image

Contents

1. Other dmesg dump kernel log message zcat Dump gz file context free display system memory usage date print or set the system date and time env run a program in a modified environment clear clear the terminal screen reboot reboot or power off on the server B 2 UC 8410 8416 8418 8430 System Commands halt halt the server du estimate file space usage gzip gunzip compress or expand files hostname show system s host namebasename return filename or directory portion of pathname dirname Convert a full pathname to just a path expr evaluate arguments as an expression false Do nothing returning a non zero false exit status true Do nothing successfully fdisk Partition table manipulator for Linux hwclock A tool for accessing the Hardware Clock id Print the user identity klogd Kernel log daemon logger a shell command interface to the syslog system log module md5sum compute and check MD5 message digest mesg control write access to your terminal mktemp make temporary file name nohup No Hang Up reset terminal initialization stty change and print terminal line settings syslogd Linux system logging utilities uname Print system information print information about the machine and operating system it is running on uptime Determine how long the system has been running xargs build and execute co
2. Example 2 Connecting to a PPP server over a hard wired link If a username and password are not required use the following command note that noipdefault is optional pppd connect chat v noipdefault dev ttyMO 19200 crtscts If a username and password is required use the following command note that noipdefault is optional and root is both the username and password pppd connect chat v user root password root noipdefault dev ttyMO 19200 crtscts How to check the connection Once you ve set up a PPP connection there are some steps you can take to test the connection First type sbin ifconfig 4 11 UC 8410 8416 8418 8430 Managing Communication The folder ifconfig may be located elsewhere depending on your distribution You should be able to see all of the network interfaces that are UP pppO should be one of them and you should recognize the first IP address as your own In addition the P t P address or point to point address is 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 255 255 255 Mask 255 0 0 0 UP LOOPBACK RUNNING MTU 2000 Metric 1 RX packets O errors O dropped O overrun O pppO Link encap Point to Point Protocol inet addr 192 76 32 3 P t P 129 67 1 165 Mask 255 255 255 0 UP POINTOPOINT RUNNING MTU 1500 Metric 1 RX packets 33 errors 0 dropped 0 overrun
3. Device File on Linux dev dsp vplay qvwrS s speed t seconds b bits filenamel S Stereo default is mono S speed Sets the speed default is 11025 kHz If the speed is less than 300 it will be multiplied by 1000 4 24 UC 8410 8416 8418 8430 Managing Communication t seconds Sets the recording or playback time in seconds default is no time limit b bits Sets the sample size bits sample Possible values are 8 and 16 default 8 W record a MICROSOFT WAVE file r records raw data without header q quiet mode Example Use the following commands to play a WAVE file root Moxa root vplay tmp test wav Playing WAVE 16 bit Speed 44100 Hz 16 bits Stereo root Moxa root Recording a WAVE file vrec vrec can be used to record a wave file It supports playing mono wave files at a 11025 22050 or 44100 HZ sampling rate and with 8 or 16 bits Device File on Linux dev dsp vplay qvwrS s speed t seconds b bits filenamel S Stereo default is mono S speed Sets the speed default is 11025 kHz If the speed is less than 300 it will be multiplied by 1000 t seconds Sets the recording or playback time in seconds default is no time limit b bits Sets sample size bits sample Possible values are 8 and 16 default is 8 W record a MICROSOFT WAVE file r records raw data without a header q quiet
4. HyperTerminal File Edit view Cal Transfer Help Dae 53m Please input the select 0 Local IP fiddress 192 168 1 2 bootp my ip Setting to 192 168 1 2 Unlock from 0x50fe0000 0x51000000 Erase from 0x50fe0000 0x51000000 Program from OxOffd0000 O0xOfffOO00 at O0x50fe0000 Lock from 0x50fe0000 0x51000000 bootp my ip mask Setting to 255 0 0 0 Server IP fiddress 192 168 1 1 bootp server ip Setting to 192 168 1 1 Unlock from 0x50fe0000 0x51000000 Erase from 0x50fe0000 0x51000000 Program from 0xO0ffd0000 OxOfffOO00 at Oxo0fe0000 Lock from 0x50fe0000 0x51000000 lt lt lt TFTP Menu gt gt gt 0 Change IP Setting 1 Show Current IP Setting z Quit this menu Please input the select vT100 115200 8 N 1 4 Select z Quit to command line to exit the IP setting option Next select 2 Firmware Upgrade and then 0 Load from LAN to continue UC 8410 HyperTerminal DER Fie Edit view Call Transfer Help De 55 285 Y 0 Change IP Setting 1 Show Current IP Setting z Quit this menu Main Menu gt gt gt HOXA Boot Loader Version 1 1 4 CPU Endian BE Make date Oct 7 2008 18 17 25 Module Type UC8400 Serial number 246 MAC Address NPE PORT1 00 90 e9 09 38 45 PORT2 00 90 e9 09 38 46 MAC Address RLTK PORT3 00 90 e9 09 38 47 01 Network Configuration 11 Format User Disk 21 Firmware Upgrade z Quit to command line Load method select 0 Load f
5. 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 ethO 192 168 1 1 to change the IP address of LAN1 to 192 168 1 1 root Moxa ifconfig eth0 192 168 1 1 root Moxa etc network Test Program Developing Hello c 1 Connect the UC 8410 8416 8418 8430 8430 to a Linux PC 2 Install the Tool Chain GNU Cross Compiler amp glibc A 3 Set the cross compiler and glibc environment variables 4 Code and compile the program t 5 Download the program to the UC 8410 8416 8418 8430 8430 via ga FTP or NFS cs 6 Debug the program 2 If bugs are found return to Step 4 3 If no bugs are found continue with Step 7 7 Back up the user directory distribute the program to additional UC 8410 8416 8418 8430 8430 units if needed Cross Compiler I nstalling the Tool Chain Linux The PC must have the Linux operating system pre installed before installing the UC 8410 8416 8418 8430 8430 GNU Tool Chain Redhat 7 3 8 0 Fedora core and compatible versions are 2 6 UC 8410 8416 8418 8430 Getting Started recommended The Tool Chain requires about 100 MB of hard disk space on your PC The UC 8410 8416 8418 8430 8430 Tool Chain software is located on the UC 8410 8416 8418 8430 8430 CD To install the Tool Chain insert the CD into your PC and then
6. Address c TFTP file id diz SEV File and Folder Tasks DIZ File Nap tftpd32 exe 1 KB QJ Make a new folder a Publish this Folder to the TFTPD32 HLP VENDINFO DIZ Web Help File DIZ File EZ Share this Folder x 33 KB 4KB Other Places sa Sys TW C E My Documents Shared Documents 3 My Computer amp My Network Places Details TFTP File Folder Date Modified Today September 02 2009 2 44 PM 5 Next connect LAN1 of the embedded computer to your PC using a cross over Ethernet cable The LAN1 port is located on the rear panel of the embedded computer LAN 1 Port A 6 UC 8410 8416 8418 8430 Firmware Upgrade Procedure 6 Press and hold down the DEL key on your PC and power on the embedded computer at the same time You will be guided to the boot loader utility menu as show below UC 8410 HyperTerminal File Edit view Call Transfer Help Da 55 028 E RTC Init Found MU860 module and init ok Found NAND Flash SAMSUNG K9F5608U0D Found Realtek 8100C and init ok Init DIO OK Enable Battery LED Press DEL FOR SVSTEM RECOVERV lt lt lt Main Menu gt gt gt MOXA Boot Loader Version 1 1 4 CPU Endian BE Make date Oct 7 2008 18 17 25 Module Type UC8400 Serial number 246 MAC fiddress NPE PORT1 00 90 e9 09 38 45 PORT2 00 90 e9 09 38 46 MAC fiddress RLTK PORT3 00 90 e9 09 38 47 01 Network Configuration 11 Format User Disk 21 Firmware Upgrade z Quit to command l
7. Output If you receive O zero it means the function is working If you receive any other number then there is something wrong with this function int swtd disable int fd UC 8410 8416 8418 8430 Programmer s Guide Description Call this function if you would like the AP to stop using the Watchdog Input int fd the file handle from swtd open return value Output If you receive 0 zero it means the function is working If you receive any other number then there is something wrong with this function int swtd get int fd int mode unsigned long time Description Get current setting values mode 1 for user application enable sWatchDog need to do ack O for user application disable sWatchdog does not need to do ack time The time period to ack sWatchDog Input int fd the file handle from swtd open return value int mode the function will return the status enable or disable unsigned long time the function will return the current time period Output If you receive O zero it means the function is working If you receive any other number then there is something wrong with this function int swtd ack int fd Description Acknowledge sWatchDog When the user application enable sWatchDog it need to call this function periodically with user predefined time in the application program Input int fd the file handle from swtd open return value Output If you receive O zero
8. execute hello exe to generate hello release and hello debug which are described below hello release an XP platform execution file created specifically to run on the UC 8410 8416 8418 8430 hello debug an XP platform GDB debug server execution file see Chapter 5 for details about the GDB debug tool ATTENTION Be sure to type the make command from within the tmp example hello directory since the UC 8410 8416 8418 8430 s tool chain puts a specially designed Makefile in that directory This special Makefile uses the xscale linux gcc compiler to compile the hello c source code for the Xscale environment If you type the make command from any other directory Linux will use the x86 compiler for example cc or gcc Refer to Chapter 5 to see a Make file example Uploading and Running the Hello Program Use the following command to upload hello release to the UC 8410 8416 8418 8430 8430 via FTP From the PC type ftp 192 168 3 127 Use the bin command to set the transfer mode to binary mode and then put command to initiate the file transfer ftp gt cd home ftp gt bin ftp gt put hello release From the UC 8410 8416 8418 8430 type chmod x home hello release home hello release The word Hello will be printed on the screen root Moxa home hello release Hello 2 8 3 Managing Embedded Linux This chapter includes information about version control deployment updates and peripherals
9. f1 iface a f2 Siface a f3 inet a f4 static then i expr 0 while do if i gt 5 then break fi i expr i 1 read f1 f2 4 17 UC 8410 8416 8418 8430 Managing Communication case fl in address IPADDR f2 P netmask NETMASK f2 P broadcast BROADCAST f2 P esac done break fi done etc network interfaces get the ip address of the specified interface mname module up 1 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 SoIFS if FOUND no then modprobe mname fi start ifcfg_vpn if d dev net then mkdir dev net fi if N 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 brO brctl addif br0 iface the bridge receives data from any port and forwards it to other ports 4 18 UC 8410 8416 8418 8430 Managing Communication i expr 0 while do generate a tap0 interface on tun openvpn mktun dev tap i connect tap device to the bridge brctl addif br0 tap i null ip address of tap device ifconfig tap i 0 0 0 0 promisc up i expr i 1 if i ge maxtap t
10. 18 0k 1 6M 1 dev dev ram0 499 0k 34 0k 440 0k 7 var dev mtdblock3 15 8M 2 6M 13 1M 17 tmp dev mtdblock3 15 8M 2 6M 13 1M 17 home dev mtdblock3 15 8M 2 6M LS DU 17a Sue dev raml 38 7M AL SE OE 36 7M 0 mnt ramdisk root Moxa cd mnt ramdisk rootfMoxa mnt ramdisk The following instructions give the steps required to save the firmware file to the UC 8410 8416 8418 8430 s RAM disk and then upgrade the firmware 1 Type the following commands to enable the RAM disk upramdisk cd mnt ramdisk 2 Type the following commands to use the UC 8410 8416 8418 8430 s built in FTP client to transfer the firmware file FWR uc8400 Va b c Build YYMMDDHH hfm from the PC to the UC 8410 8416 8418 8430 mnt ramdisk ftp destination PC s IP Login Name xxxx Login Password xxxx ftp bin ftp get FWR uc8400 Va b c Build YYMMDDHH hfm root Moxa mnt ramdisk ftp 192 168 3 193 Commecitec ino 192 108 30 193 192 168 55 L93 c 220 TYPSoft FTP Server 1 10 ready Name 192 INKS Sia LOS SIOOKIE TOOT 331 Password required for root Password 250 User zo logger ano Remote system type is UNIX Using binary mode to transfer files ftp gt cd newsw 250 CWD command successful C ftproot newsw is current directory igo boun 200 Type set to I io Ls 200 Port command successful 150 Opening data connection for directory list drw rw rw JL ES Ein 0 Wow SO 10 03 drw rw rw JL GCI ajo O Ne
11. 8418 8430 LX Install an ipk package via an ipk file Upload the ipk package to the Moxa embedded computer a Praten Moxa scp mnt cdrom utility_tools ipkg_packages libphp5_1 0_xscale ipk 192 168 3 127 tmp 4 23 UC 8410 8416 8418 8430 Managing Communication Install the uploaded package pond ooo Pu Moxa ipkg cl install tmp libphp5_1 0_xscale ipk List the installed packages 192168 3 127 PUCtY Moxa ipkg cl list installed Remove a package 192 dup 3 127 Putty Moxa ipkg cl remove libphp5 Audio Playing and Recording The UC 8430 platform comes with audio line in and line out ports We provide the audio playback utility vplay and the audio recording utility vrec with this platform Volume Control mixer Use the following commands to control the input and output volume The volume range is from O to 100 Device File on Linux dev mixer root Moxa root mixer vol 100 Usage mixer vol lt value gt Use the following commands to set the maximum volume root Moxa root mixer vol 100 Setting the mixer vol to 100 100 Example Use the following commands to set the left right channel volume at 70 80 root Moxa root mixer vol 70 80 Setting the mixer vol to 70 80 Playing a WAVE File vplay vplay can be used for playing a wave file It supports playing mono or stereo wave files at a 11025 22050 or 44100 HZ sampling rate with 8 or 16 bits
12. B modify the remote address in the configuration file etc openvpn tapO br conf etc openvpn tapO br conf point to the peer remote 192 168 8 173 dev tap0 secret etc openvpn secrouter key cipher DES EDE3 CBC auth MD5 tun mtu 1500 tun mtu extra 64 ping 40 up etc openvpn tap0 br sh Next modify the routing table in the etc openvpn tapO br sh script file bin sh etc openvpn tapO br sh value after net is the subnet behind the remote peer route add net 192 168 2 0 netmask 255 255 255 0 dev brO 4 20 UC 8410 8416 8418 8430 Managing Communication 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 After configuring the remote peer we can load the bridge into kernel reconfigure eth1 and enable IP forwarding on both OpenVPN machine etc openvpn openvpn bridge start Next start both OpenVPN peers openvpn config etc openvpn tap0 br conf amp If you see the line Peer Connection Initiated with 192 168 8 173 5000 on each machine the connection between OpenVPN machines has been established successfully on UDP port 5000 Note You can create link symbols to enable the etc openvpn openvpn bridge script at boot time ln s etc openvpn openvpn bridge etc rc d rc3 d S32vpn br ln s etc openvpn openvpn bridge etc rc d rc6 d K32vpn br 5
13. Embedded Linux To remove the daemon use the following command to remove the run file from etc rc d rc3 d rm f etc rc d rc3 d S60tcps2 Setting the System Time There are two ways to support the timezone configuration on a Moxa embedded computer One is using the TZ variable The other is using etc localtime TZ variable If you would like to use TZ variable link to the following URL for all configurations and settings http www mkssoftware com docs man5 timezone 5 asp etc timezone The local timezone is stored in etc localtime and is used by GNU Library for C glibc if the TZ environment variable is not set This file is either a copy of usr share zoneinfo tree or a symbolic link to it The UC 8410 8416 8418 8430 8430 does not provide usr share zoneinfo files so you need to copy a time zone information file to the UC 8410 8416 8418 8430 8430 and write over the original local time file 1 The usr share zoneinfo folder on a PC that is running standard Linux contains several time zone information files 2 Copy the time zone file that you want to use to the UC 8410 8416 8418 8430 8430 to overwrite the original etc localtime file 3 Type a date to check if the new time zone appears Adjusting the System Time Setting the Time Manually The UC 8410 8416 8418 8430 8430 has two time settings One is the system time and the other is the RTC Real Time Clock time kept by the UC 8410 8416 8418 8430 s har
14. On each OpenVPN machine check the routing table by typing the command route Destination Gateway Genmsk Flags Metric Ref Use Iface 192 168 4 0 255 255 255 0 U 0 0 0 bro 192 168 2 0 255 255 255 0 U 0 0 0 bro 192 168 8 0 255 255 255 0 U 0 0 0 etho Interface eth1 is connected to the bridging interface brO to which device tapO also connects whereas the virtual device tun sits on top of tapO This ensures that all traffic from internal networks connected to interface eth1 that come to this bridge write to the TAP TUN device that the OpenVPN program monitors Once the OpenVPN program detects traffic on the virtual device it sends the traffic to its peer 6 To create an indirect connection to Host B from Host A add the following routing item route add net 192 168 4 0 netmask 255 255 255 0 dev ethO To create an indirect connection to Host A from Host B add the following routing item route add net 192 168 2 0 netmask 255 255 255 0 dev ethO 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 To shut down OpenVPN programs type the command etc openvpn openvpn bridge stop Setup 2 Ethernet Bridging for Private Networks on the S
15. The following topics are covered in this chapter O System Version Information O Firmware Upgrade Upgrading the Firmware Loading Factory Defaults O Enabling and Disabling Daemons Setting the Run Level O Setting the System Time gt TZ variable gt etc timezone O Adjusting the System Time gt Setting the Time Manually gt NTP Client gt Updating the Time Automatically O Cron Daemon to Execute Scheduled Commands O Connecting Peripherals USB Mass Storage CF Mass Storage UC 8410 8416 8418 8430 Managing Embedded Linux System Version I nformation To determine the hardware capability of your UC 8410 8416 8418 8430 8430 and what kind of software functions are supported check which version of the firmware your UC 8410 8416 8418 8430 8430 is running Contact Moxa to determine the hardware version You will need the Production S N Serial number which is located on the UC 8410 8416 8418 8430 s bottom label To check the kernel version type kversion root Moxa kversion UC 8410 8416 8418 8430 version 1 0 root Moxa root Moxa kversion a UC 8410 8416 8418 8430 version 1 0 Build 08091716 root Moxa Firmware Upgrade Upgrading the Firmware The UC 8410 8416 8418 8430 s kernel and root file system are combined into one firmware file which can be downloaded from Moxa s website www moxa com The name of the file has the form FWR uc8400 Va b c Build YYMMDD
16. UC 8410 8416 8418 8430 8430 GNU Tool Chain We have confirmed that the following Linux distributions can be used to install the tool chain Redhat 7 3 8 0 9 0 Fefora core 1 2 3 4 5 Debian 4 0 32 bits platform The Tool Chain will need about 836 MB of hard disk space on your PC The UC 8410 8416 8418 8430 8430 Tool Chain is located on the UC 8410 8416 8418 8430 8430 CD To install the Tool Chain insert the CD into your PC and then issue the following commands mount dev cdrom mnt cdrom sh mnt cdrom tool chain linux arm linux 2 1 sh Wait for a few minutes while the Tool Chain is installed automatically on your Linux PC Once the host environment has been installed add the directory opt montavista pro devkit arm xscale be bin to your path and the directory opt montavista pro devkit arm xscale be man to your manual path You can do this temporarily for the current login session by issuing the following commands export PATH usr local arm linux bin PATH export MANPATH usr local arm linux man MANPATH 5 2 UC 8410 8416 8418 8430 Programmer s Guide Alternatively you can add the same commands to HOME bash profile to cause it to take effect for all login sessions initiated by this user Obtaining help Use the Linux man utility to obtain help on many of the utilities provided by the tool chain For example to get help on the arm linux gcc compiler issue the command iman arm linux gcc Cross Compiling Applicat
17. UC8400 Serial number 246 MAC Address NPE PORT1 00 90 e9 09 38 45 PORT2 00 90 e9 09 38 46 MAC Address RLTK PORT3 00 90 e9 09 38 47 0 Network Configuration 1 Format User Disk 2 Firmware Upgrade z Quit to command line Load method select 0 Load from LAN 1 Load from serial with Xmodem Abort select Please select item Please input load file name Default file name xxx hfm User Input file name FWR UC8410 V1 0 Build 08111003 hfm Connected 0 04 51 vr100 115200 8 N 1 File size 11003180 6598144 Bytes sent 1099690 Bytes sec 9 It will take several minutes for the firmware files to be written to your embedded computer Do not power off your computer UC 8410 HyperTerminal File Edit View Call Transfer Help De 33 me Y Program from 0x008000c4 0x009400c at 0x500a0000 file headerlength 0x68 file header version 0x11 file filename root file system file filelength 0x9476acl file checksum 0x4b9eb7b21 file flashstart 0x50280000 file flashend 0x50fe00001 file flashlength 0xd600001 file DRAMstartaddr 0x0 file mtdno 0x21 file version 0x1000000 fis erase f 0x50280000 1 0xd60000 96363636 666666 A xxx Writing Flash Now xxx xxx Please Do Not Power Off Device FE JE JE JE CM X JE JE JE M X JE JE JE X JE JE JE X JE JE JE JE X JE JE JE X X JE JE JE X JE JE 0 JE Erase from 0x90280000 0x90fe 000 fis write f 0x50280000 b 0x936e8
18. amp user chown change file owner chgrp change file group chroot runs a command with a specified root directory sync sync file system save system file buffer to hardware mv move file pwd display active file directly df list active file system space mkdir make new directory rmdir delete directory find search for files in a directory hierarchy head output the first part of files mkfifo creates a FIFO special character file or special block file with the specified name mknod creates a FIFO special character file or special block file with the specified name touch change file timestamps which Locate a program file in the user s path Editor vi text editor cat dump file context grep Search string on file egrep search string on file of Extended regular expressions fgrep Search file s for lines that match a fixed string cut Get string on file find Find file where are there more dump file by one page test test if file exists or not sleep Sleep seconds usleep suspend execution for microsecond intervals echo echo string sed Steam editor UC 8410 8416 8418 8430 System Commands awk pattern directed scanning and processing language expand Converts all tabs to spaces tail Print the last 10 lines of each FILE to standard output tar
19. cd etc rc d rootfMoxa etc rc df vi re local 3 Next use vi editor to edit your application program We use the sample program tcps2 release and set it to run in the background bin sh Add you want to run daemon root tcps2 release amp 4 The following daemons will be enabled after you reboot the system root Moxa ps ef Pib Uses VSZ STAT COMMAND root LS aaa 181 SW lt kthreadd SW lt ksoftirqd 0 SW lt events 0 SW lt khelper SW lt kblockd 0 SW lt kseriod SW pdflush SW pdflush SW kswapd0 SW aio 0 SW mtdblockd SW ixp400 eth time SW ixp400 eth time 1 2 EOOE Si EOL 4 root SEO 30 roor SS OE 52 AoT DS TOWNE 54 root 55 ADE SS Toor ERE OE GSS LOOL 0 Ga TOGE 0 666 root 0 SW rpciod 0 No BOOT O SW lt khubd 0 0 0 ae Xe e See o e Kex gt el e e DW Ethmac Recovery TIZ Foot SW scsi eh 0 TES FOGE TOS root SWN jffs2 gcd mta4 809 root 0 SW ixp400 etn0 Sis roor 0 SW ixp400 ethl1 SW usb storage 3 6 UC 8410 8416 8418 8430 Managing Embedded Linux BAS exe 13450 Sie jog 1300 838 root 2428 S 843 root LSO 19 867 root SS S SMS GOCE VA IS SHS woot LAIZ S 878 nobody 70G 879 nobody SOS 880 nobody TIAS 881 nobody 106 882 nobody 7390 8 Sis DONE 1264 S 896 root ALIS IR root Moxa bin inetd bin portmap bin sh login bin snmpd c public bin ss
20. design the RISC architecture and modern semiconductor technology provide this computer with a powerful computing engine and communication functions but without generating a lot of heat The built in 16 MB NOR Flash ROM can be used to store the operating system and 256 MB of SDRAM gives you enough memory to run your application software directly on the UC 8410 8416 8418 8430 Moreover the 32 MB NAND Flash provides the capacity for data storage In addition the network capability provided by the 3 LAN ports built into the RISC CPU combined with the ability to control connected serial devices makes the UC 8410 8416 8418 8430 8430 an ideal communication platform for data acquisition and industrial control applications The UC 8410 8416 8418 8430 s pre installed open source Linux operating system can run software written for desktop PCs provided the software is ported to the computer with a GNU cross compiler The process is easy straightforward and your programmer will not need to modify the source code The OS device drivers e g Ethernet SRAM watchdog and Buzzer control and your own applications can all be stored in the NOR Flash memory Software Architecture The Linux operating system that comes pre installed on the UC 8410 8416 8418 8430 8430 follows the standard Linux architecture making it easy to run programs that follow the POSIX standard Program porting is done with the GNU Tool Chain provided by Moxa In addition to Standard POSI
21. else if i 3 set low to high event printf Please keyin the DIN number scanf d amp i printf Please input the DIN duration this minimun value must be over d MIN DURATION scanf lu amp duration retval set din event i lowtohighevent DIN EVENT LOW TO HIGH duration else if i 4 clear event printf Please keyin the DIN number scanf d amp i retval set din event i NULL DIN EVENT CLEAR 0 else if i 5 set high data printf Please keyin the DOUT number scanf d amp i retval set_dout_state i 1 else if i 6 set low data printf Please keyin the DOUT number scanf d amp 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 3 0 j MAX DOUT PORT j retval get din event j amp i amp duration switch i case DIN_EVENT_HIGH_TO_LOW printf htl 1u duration break case DIN EVENT LOW TO HIGH printf lth 1u duration break case DIN EVENT CLEAR UC 8410 8416 8418 8430 Programmer s Guide printf clr 1u duration break default printf err break printf Nn else printf Select error please select again n switch retval case DIO ERROR PORT printf DIO error portin break case DIO ERROR MODE printf DIO er
22. for firmware upgrade or recovery You will need the following items to use this utility 1 The embedded computer that you would like to upgrade or recover 2 A PCor a laptop computer 3 A console port cable for connecting through HyperTerminal 4 Across over Ethernet cable for upgrading the firmware through a TFTP server and LAN port 5 The firmware for the embedded computer Target Site Server Site Console Port f Ly HyperTerminal Lg p 4 LAN Port E TFTP 4 Embedded Laptop Computers PC There are three steps in the recovery process A Configure HyperTerminal for the console port B Download and installation of the TFTP program C Download the firmware and upgrade through HyperTerminal If you are familiar with Moxa embedded computers and the firmware upgrade procedure you may skip to Step C However we suggest that you go through all three steps to ensure the firmware upgrades properly A Configure HyperTerminal for the Console Port 1 Unscrew the cover on the back of the UC 8410 series embedded computer 2 Connect the console port with a console port cable to your PC i Console Port Screw Screw Cover UC 8410 8416 8418 8430 Firmware Upgrade Procedure 3 Connect your embedded computer to the power source The power input is located on the rear panel Power Input 4 Launch a serial communication tool to access your embedded computer We suggest that you use HyperTerminal which is built int
23. gov tw 9 Dee ISS os ias 20718 ecaa estais eese Se 220 1501 oras SST 4S 84256 sec root Moxa hwclock w root Moxa date hwclock Thu Dec 9 10 59 11 CST 2004 Thu Dec 9 10 59 12 2004 0 844076 seconds rootfMoxa ATTENTI ON Before using the NTP client utility check your IP and DNS settings to make sure that an Internet connection is available Refer to Chapter 2 for instructions on how to configure the Ethernet interface and see Chapter 4 for DNS setting information Updating the Time Automatically In this subsection we show how to use a shell script to update the time automatically Example shell script to update the system time periodically bin sh ntpdate time nist gov You can use the time server s ip address or domain name directly If you use domain name you must enable the domain client on the system by updating 3 9 UC 8410 8416 8418 8430 Managing Embedded Linux etc resolv conf file hwclock w sleep 100 Updates every 100 seconds The min time is 100 seconds Change 100 to a larger number to update RTC less often Save the shell script using any file name E g fixtime 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 chmod 755 fixtime to change the shell script mode Next use vi editor to edit the file etc inittab Add the following line to the bottom of the file
24. include lt signal h gt include lt string h gt include sys stat h include sys ioctl h include lt sys select h gt include lt sys time h gt include lt moxadevice h gt static void mydelay unsigned long msec struct timeval time time tv_sec msec 1000 time tv_usec msec 1000 1000 select 1 NULL NULL NULL amp time 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 5 7 UC 8410 8416 8418 8430 Programmer s Guide int swtd ack swtdfd swtd disable swtdfd main int argc char argv pid t sonpid Signal SIGUSR1 stop swatchdog swtdfd swtd open if swtdfd lt 0 printf Open sWatchDog device fail exit 1 if sonpid fork 0 do swatchdog do user application main function end user application kill sonpid SIGUSR1 swtd close swtdfd exit 1 The makefile is shown below all Na xscale linux gcc o xxxx xxxx c lmoxalib Digital I O Digital Output channels can be set to high or low The channels are controlled by the function call set dout state The Digital Input channels can be used to detect the state change of the digital input signal The DI channels can also be used to detect whether or not the state of a digital signal changes during a fixed perio
25. information you will get a speed equal to 0 SRAM 1 Introduction The UC 8410 8416 8418 8430 8430 provides 256 KB of embedded SRAM As there is a system battery inside the computer the SRAM can work and be used to keep data even when the system is crashed This means that the data stored on the SRAM will not be lost after the UC 8410 8416 8418 8430 8430 is powered off 2 How the SRAM works UC 8410 8416 8418 8430 Programmer s Guide The SRAM device can be programmed through the file dev sram This means that you can read from or write to dev sram to store data on the embedded SRAM The following example illustrates how to do this RK KK kk kk kk kk kk kk I kk kk kk kk kk kk kk kk kk ck ck ck ck kckck ck k ck k ck k ck ck ck ck ckck ckok ko History Versoin Author Date Comment 1 0 Jared Wu 09 11 2008 Write a pattern to SRAM COKCKCKCKCk kk kk kk kk kk kk kk Ck Ck Ck Ck Ck Ck kk kk kk kk kk kk c kk ck ck ok ckckckckckckckck ck ck ck ok ckok ko ke kf include lt sys types h gt include lt sys stat h gt include stdio h include stdlib h include lt string h gt include fcntl h include lt linux kd h gt define SRAM SIZE0x00040000 256 Kbytes static char sram bufl1 SRAM SIZE sram buf2 SRAM SIZE int main int argc char argv int fd len unsigned long ms 0 char pattern 9 if argc gt 2 printf Usage s pattern n exit 0 if argc patter
26. interface auto eth0 ethl eth2 lo iface lo inet loopback embedded ethernet LAN1 iface ethO inet static teieloberexsis 19 1 99 5 S ob network 192 168 3 0 IMSS LIDIA oscila ssa 3L9 2 US 95 2 965 embedded ethernet LAN2 iface ethl inet static address 192 168 4 127 network 192 168 4 0 netmask 255 255 255 0 broadcast 192 168 4 255 embedded ethernet LAN3 iface eth2 inet static axelohaSisisy 1 92 1 98 55 ILA network 192 168 5 0 Dynamic IP Addresses By default the UC 8410 8416 8418 8430 is configured for static IP addresses To configure LAN ports to request an IP address dynamically replace static with dhcp and then delete the address network netmask and broadcast lines UC 8410 8416 8418 8430 Getting Started Default Setting for LAN1 Dynamic Setting using DHCP iface ethO inet static iface ethO inet dhcp address 192 168 3 127 network 192 168 3 0 netmask 255 255 255 0 broadcast 192 168 3 255 Please note that the default value for LAN1 of the UC 8430 is DHCP Auto ethO ethl lo iface lo inet loopback iface eth0 inet dhcp iface ethl inet dhcp After the boot settings of the LAN interface have been modified issue the following command to activate the LAN settings immediately etc init d networking restart ATTENTION After changing the IP settings use the networking restart command to activate the new IP address Modifying Network Settings over the Network
27. issue the following commands mount dev cdrom mnt cdrom mnt cdrom tool chain Linux arm linux_2 3 sh The Tool Chain will be installed automatically on your Linux PC within a few minutes Before compiling the program be sure to set the following path first since the Tool Chain files including the compiler link library and include files are located in this directory PATH usr local arm linux bin PATH Setting the path allows you to run the compiler from any directory ATTENTI ON If you have an older version of Linux Tool Chain on your Moxa embedded computer such as the W300 Series 1A240 241 and UC 7112 LX Plus and would like to install the new Linux Tool Chain for the UC 8410 8416 8418 8430 the old Linux Tool Chain files will be immediately overwritten and the programs compiled by this new Tool Chain may not work on your old models We strongly suggest you rename the directory of the old Linux Tool Chain before installing the new one if you would like to use the old Linux Tool Chain for other embedded computers Checking the Flash Memory Space The UC 8410 8416 8418 8430 8430 uses a specially designed root file system Only tmp etc home usr local bin usr local sbin usr local libexec and usr local lib directories are writable Others are read only The writable directories are mounted on dev mtdblock4 If the dev mtdblock4 is full you will not be able to save data to the Flash ROM Use the following command
28. networks or a local network to the Internet to create a Wide Area Network WAN NOTE Click on the following links for more information about ppp http tldp org HOWTO PPP HOWTO index html http axion physics ubc ca ppp linux html 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 Note that debug and defaultroute 192 1 1 17 are optional pppd connect chat v ATDT5551212 CONNECT ogin username word password dev ttyMO 115200 debug crtscts modem defaultroute If the PPP server does not prompt for the username and password the command should be entered as follows Replace username with the correct username and replace password with the correct password pppd connect chat v ATDT5551212 CONNECT user username password password dev ttyMO 115200 crtscts modem The pppd options are described below 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 argumen
29. ntp 2345 respawn etc init d fixtime Use the command Z init q to re init the kernel Cron Daemon to Execute Scheduled Commands Start Cron from the directory etc rc d rc local It will return immediately so you do not need to start it with an ampersand amp 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 the current minute Modify the file etc cron d crontab to set up your scheduled applications Crontab files have the following format mm h dom mon dow user command min hour date month week user command 0 59 0 23 1 31 1 12 0 6 0 is Sunday The following example demonstrates how to use Cron The following steps show how to use cron to update the system time and RTC time every day at 8 00 STEP1 Write a shell script named fixtime sh and save it to home bin sh ntpdate time nist gov hwclock w exit 0 STEP2 Change mode of fixtime sh chmod 755 fixtime sh STEP3 Modify etc cron d crontab file to run fixtime sh at 8 00 every day Add the following line to the end of crontab B x root home fixtime sh STEP4 Enable the cron daemon manually etc init d cron start STEP5 Enable cron when the system boots up Add the following line in the file etc init d rc local etc init d cro
30. or ioctl the device files If you complete the using you should close this file to release this device include stdio h include lt stdlib h gt include fcntl h include lt string h gt include moxacan ioctl h define PORT1 NAME dev can0 define PORT2_NAME dev canl int main int argc char argv int fdl fd2 i baudrate user_frame_t txframe rxframe fdl open PORT1 NAME O_RDWR LfoCdXdlise 0 y printf Open s fail n PORT1 NAM E return 1 fd2 open PORT2 NAME O_RDWR if fd2 0 printf Open s fail n PORT2 NAM E return b baudrate 100000 ioctl fd1 MOXACAN IOCTL SET BAUD RATE amp baudrate ioctl fd2 MOXACAN IOCTL SET BAUD RATE amp baudrate memset amp txframe 0 sizeof txframe memset amp txframe 0 sizeof rxframe txframe id 12 txframe data length MAX CAN DATA LENGTH txframe info USER EXTEND ID for i20 i MAX CAN DATA LENGTH i txframe data array i 0x30 1 i write fdl amp txframe sizeof txframe printf Write portl data return d n i printf Write data contexts are following n for i 0 i MAX CAN DATA LENGTH i printf c txframe data array i Print Mam usleep 1 i read fd2 amp rxframe sizeof rxframe printf Read port2 data retur
31. 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 8410 8416 8418 8430 without worrying about the amount of disk space that will be available The UC 8410 8416 8418 8430 8430 supports NFS protocol for client NOTE Click on the following links for more information about NFS http www tldp org HOWTO NFS HOWTO index html http nfs sourceforge net nfs howto client html http nfs sourceforge net nfs howto server html Setting up the UC 8410 8416 8418 8430 8430 as an NFS Client The following procedure is used to mount a remote NFS Server 1 Establish a mount point on the NFS Client site 2 Mount the remote directory to a local directory Steps 1 mkdir p home nfs public Step 2 mount t nfs NFS Server IP directory mount point Example mount t nfs 192 168 3 100 home public home nfs public Mail smtpclient is a minimal SMTP client that takes an email message body and passes it on to an SMTP server It is suitable for applications that use email to send alert messages or important logs to a specific user NOTE Click on the following link for more information about smtpclient http www engelschall com sw smtpclient To send an email message use the smtpclient utility which uses SMTP protocol Type smtpclient help to see the help message Example smtpclient s t
32. to calculate the amount of Available flash memory df h root Moxa df h Filesystem Used Available Use Mounted on rootfs 9 8M 3 5M 74 dev root 9 8M 3 5M 74 dev ram15 ORO 1 6M 1 dev dev ram0 18 0k 456 0k 4 var dev mtdblock4 1 9M 30 1M 6 tmp dev mtdblock4 4L Siu 30 1M 6 home dev mtdblock4 1 9M 305M Ge ete tmpfs 0 252 5M dev shm dev sdb1 57 9M 425 5M 12 var sdb rootfMoxa If there isn t enough Available space for your application you will need to delete some existing files To do this connect your PC to the UC 8410 8416 8418 8430 8430 with the console cable and then use the console utility to delete the files from the UC 8410 8416 8418 8430 s flash memory Compiling Hello c The CD contains several sample programs Here we use Hello c to show you how to compile and run your applications Type the following commands from your PC to copy the files used for this example from the CD to your computer s hard drive 2 7 UC 8410 8416 8418 8430 Getting Started cd tmp mkdir example cp r mnt cdrom example tmp example To compile the program go to the hello subdirectory and issue the following commands cd example hello make You should receive the following response root localhost hello make xscale linux gcc o hello release hello c xscale linux strip s hello release xscale linux gcc ggdb o hello debug hello c root localhost hello _ Next
33. xt mac xt mark xt multiport xt pkttype xt string xt tcpmss xt tcpudp xt u32 arp tables arpt mangle arptable filter ip tables ipt CLUSTERIP ipt ECN ipt NETMAP ipt SAME ipt TTL ipt addrtype ipt ecn ipt iprange ipt recent iptable filter iptable mangle iptable nat nf conntrack ipv4 nf nat nf nat ftp nf nat snmp basic ipt ah ipt MASQUERADE ipt tos ipt REDIRECT ipt ttl ipt REJECT ipt TOS ipt LOG ipt ULOG ipt owner NOTE The UC 8410 8416 8418 8430 8430 does NOT support IPV6 and ipchains NOTE The basic syntax to enable and load an IPTABLES module is as follows 1smod modprobe ip tables modprobe iptable filter Use Ismod to check if the ip tables module has already been loaded in the UC 8410 8416 8418 8430 Use modprobe to insert and enable the module Use the following command to load the modules iptable filter iptable mangle iptable nat modprobe iptable filter IPTABLES plays the role of packet filtering or NAT Take care when setting up the IPTABLES rules If the rules are not correct remote hosts that connect via a LAN or PPP may be denied access We recommend using the serial console to set up the IPTABLES Click on the following links for more information about iptables http www linuxguruz com iptables http www netfilter org documentation HOWTO packet filtering HOWTO html Since the IPTABLES command is very complex to illustrate the IPTABLES syntax we have divided our discussion
34. 0 1 0x9476ac Erase from 0x50280000 0x50be0000 Connected 0 07 32 VT100 115200 8 N 1 A 12 UC 8410 8416 8418 8430 Firmware Upgrade Procedure 10 When you see Update OK the firmware upgrade is finished At this point you may reboot the embedded computer to complete the firmware upgrade or recovery from the boot loader utility UC 8410 HyperTerminal 3 3 3 3 IE Y 3 9 3 9 9 Y 3 3 9 9 3 3 9 HE 9 3 9 Y 3 3 9 9 9 9 9 Erase from 0x50280000 0x50fe0000 fis write f 0450280000 b 0x936e80 1 0x9476ac Erase from 0x50280000 0x50be0000 Update OK lt lt lt Main Menu gt gt gt MOXA Boot Loader Version 1 1 4 CPU Endian BE Make date Oct 7 2008 18 17 25 Module Type UC8400 Serial number 246 MAC fiddress NPE PORT1 00 90 e9 09 38 45 PORT2 00 90 e9 09 38 46 MAC fiddress RLTK PORT3 00 90 e9 09 38 47 01 Network Configuration 11 Format User Disk 21 Firmware Upgrade z Quit to command line 11 If you cannot reboot your embedded computer after following all the steps above contact Moxa s technical support staff for further assistance A 13 System Commands Linux Normal Command Utility Collection File Manager cp copy file Is list file In make symbolic link file mount mount and check file system rm delete file chmod change file owner amp group
35. 1 Create the project file hello pro qmake project 2 Create the Makefile qmake 3 Compile Make 4 Execute hello Set up Qt development The qt libraries have been included in arm linux 2 3 sh You can launch the auto installed script to install the libraries The setup the QTDIR and PATH for cross compiling Debian export QTDIR usr local arm linux lib be qt lib Debian export PATH SQTDIR bin PATH Cross compile the Qt application and run with Dual display To enter the project folder Debian cd hello To create the project file hello pro Debian qmake project To create the Makefile Debian qmake To cross compile Debian make Upload the binary to target and run it with following command Run the Qt application with assigned input and VGA output root Moxa tmp export QWS MOUSE PROTO IntelliMouse dev input mouseO0 root Moxa tmp hello qws geometry 1024x768 display voyagerlib dev fb0 amp You can also run the second Qt application on another VGA output root Moxa tmp export QWS MOUSE PROTO IntelliMouse dev input mousel root Moxa tmp hello2 qws geometry 1024x768 display voyagerlib dev fbl amp 5 21 UC 8410 8416 8418 8430 Programmer s Guide NOTE Refer to the Qt embedded Web site http qt nokia com doc 4 6 index html for more details on Qt programming 5 22 A Firmware Upgrade Procedure Moxa provides a boot loader utility
36. 22 interface root Moxa UC 8410 8416 8418 8430 Programmer s Guide Example for setting the baudrate include lt moxadevice h gt include lt termios h gt struct termios term int fd speed fd open dev ttyMO O RDWR tcgetattr fd amp term term c cflag amp CBAUD CBAUDEX term c cflag B4000000 tcsetattr fd TCSANOW amp term speed 500000 ioctl fd MOXA SET SPECIAL BAUD RATE amp speed Example for getting the baudrate include lt moxadevice h gt include lt termios h gt struct termios term int fd speed fd open dev ttyMO O_RDWR tcgetattr fd amp term if term c cflag CBAUD CBAUDEX B4000000 follow the standard termios baud rate define else ioctl fd MOXA GET SPECIAL BAUD RATE amp speed Baudrate inaccuracy Divisor 921600 Target Baud Rate Only Integer part ENUM 8 921600 Target Divisor Round up or down Inaccuracy Target Baud Rate 921600 Divisor ENUM 8 Target Baud Rate 100 E g To calculate 500000 bps Divisor 1 ENUM 7 Inaccuracy 1 7 NOTE The I naccuracy should less than 2 for the device to work reliably Special Note 1 Ifthe 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 2 If you use stty to get the serial
37. 5 236 10 root Moxa etc etc nsswitch conf This file defines the sequence to resolve the IP address by using etc hosts file or etc resolv conf 4 2 UC 8410 8416 8418 8430 Managing Communication 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 Save your own homepage to the following directory home httpd htdocs Save your CGI page to the following directory home httpd cgi bin Before you modify the homepage use a browser such as Microsoft Internet Explorer or Mozilla Firefox from your PC to test if the Apache Web Server is working Type the LAN1 IP address in the browser s address box to open the homepage E g if the default IP address is still active type http host ip address in address box Mozilla Firefox REN ARE BAY GEG FAE TAD EO Qu d F D mneziceari o cl ge rix Lbs Ll Rei Google whot is jitter Linux we d G Search g Pogelark AD Check S It works O ADE UO To open the default CGI page type http host ip address cgi bin xxx cgi xxx is your cgi page in your browser s address box VES ME dim BU BFS ABG Q gt e Ly 1454093 168 27 120095 lenlgciaksr Qd gi Y A Google vta ic ie tire w QC Sex remet Chock e SI jj 24 1 El tri m Oz TP E ETO PIRLIS TETRA SOTD ETO 2 22 EA lt hte gt lt hea
38. ATTENTION The definitions here can allow users to login without a 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 Er B username hinet net password PPPOE user example if you want to use it you need to unmark it and modify it username hinet net s password i UserIDs that cannot use PPP at all Check your etc passwd and add any other accounts that should not be able to use pppd guest hostname ds master hostname Ns OOE hostname 357 support hostname une stats hostname EA 4 13 UC 8410 8416 8418 8430 Managing Communication 10 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 MAA MS la EIN Wait for up n milliseconds after the connect script finishes for a valid PPP packet from the peer At the end of this time or when a valid PPP packet is received from the peer pppd will commence negotiation by sending its first LCP packet The default value is 1000 1 second This wait period only applies if the connect or pty option is used connect delay lt n gt Load the pppoe plugin plugin lib rp pppoe so End of File Add one of two files etc ppp op
39. FFF code Read ONLY 0x00200000 13 375 MB Root file system OxOODFFFFF JFFS2 Read ONLY 0x00E00000 32 MB User root file system Ox01FCFFFF JFFS2 Read Write OxO1FCOO000 128 KB Boot Loader Ox01FDFFFF configuration and directory Read ONLY 256 KB SRAM Read Write 1 The default Moxa file system only enables the network It lets users recover the user file system when it fails 2 Theuser file system is a complete file system Users can create and delete directories and files including source code and executable files as needed 3 Users can create the user file system on the PC host or target platform and then copy it to the UC 8410 8416 8418 8430 Linux Tool Chain Introduction To ensure that an application will be able to run correctly when installed on the UC 8410 8416 8418 8430 you must ensure that it is compiled and linked to the same libraries that will be present on the UC 8410 8416 8418 8430 This is particularly true when the RISC XScale processor architecture of the UC 8410 8416 8418 8430 8430 differs from the CISC x86 processor architecture of the host system but it is also true if the processor architecture is the same The host tool chain that comes with the UC 8410 8416 8418 8430 8430 contains a suite of cross compilers and other tools as well as the libraries and headers that are necessary to compile applications for the UC 8410 8416 8418 8430 The host environment must be running Linux to install the
40. HH HHH HH HHH H HHH HH HHH HH HH HH HH HHH HH HH HH HHH HH HH HH H HHH HH HHHHHH Ho HHH HHHHHHHH HHHHHHH HHHHHHHHHHH HHHHHH For further information check http www moxa com Mount user file system root Moxa t the UC 8410 8416 8418 8430 To log in type the Login name and password as requested The default values are both root root root Login Password 2 2 UC 8410 8416 8418 8430 Getting Started Telnet Console If you know at least one of the IP addresses and netmasks you can use Telnet to connect to the UC 8410 8416 8418 8430 s console utility The default IP address and Netmask for each of the ports are given below Default I P 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 Please note that the LAN1 of the UC 8430 uses DHCP for both IP Address and Netmask Use a cross over Ethernet cable to connect directly from your PC to the UC 8410 8416 8418 8430 You should first modify your PC s IP address and netmask so that your PC is on the same subnet as one of the UC 8410 8416 8418 8430 s LAN ports For example if you connect to LAN 1 you can set your PC s IP address to 192 168 3 126 and netmask to 255 255 255 0 If you connect to LAN 2 you can set your PC s IP address to 192 168 4 126 and netmask to 255 255 255 0 To connect to a hub or switch connected to your local LAN use a straight through Ethernet c
41. HH hfm with a b c indicating the firmware version and YYMMDDHH indicating the build date To upgrade the firmware download the firmware file to a PC and then transfer the file to the UC 8410 8416 8418 8430 8430 unit via a serial console or Telnet console connection ATTENTI ON Upgrading the firmware will erase all data on the Flash ROM If you are using the ramdisk to store code for your applications beware that updating the firmware will erase all of the data on the Flash ROM You should back up your application files and data before updating the firmware Since different Flash disks have different sizes it s 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 root Moxa df h Filesystem Used Available Use Mounted on rootfs 9 8M 3 5M 74 dev root 9 8M 3 5M 74 dev ram15 1 Oe 1 6M 1 dev dev ram0 18 0k 456 0k 4 var dev mtdblock4 1 9M 30 1M 6 tmp dev mtdblock4 iL Siu 30 1M 6 home dev mtdblock4 1 9M 30 1M 6 etc tmpfs 0 ASA o SM dev shm dev sdb1 57 9M 425 5M 12 var sdb root Moxa 3 2 UC 8410 8416 8418 8430 Managing Embedded Linux root Moxa upramdisk root Moxa df h Filesystem Size Used Available Use Mounted on dev mtdblock2 14 0M 11 2M 2 8M 80 dev ram15 dE
42. O TX packets 42 errors O dropped 0 overrun O Now type ping z z z z where z z z z is the address of your name server This should work Here s what the response could look like waddington p ping 129 67 1 165 PING 129 67 1 165 129 67 1 165 56 data bytes 64 bytes from 129 67 1 165 icmp seq 0 ttl 225 time 268 ms 64 bytes from 129 67 1 165 icmp seq 1 ttl 225 time 247 ms 64 bytes from 129 67 1 165 icmp seq 2 ttl 225 time 266 ms me 129 67 1 165 ping statistics 3 packets transmitted 3 packets received 0 packet loss round trip min avg max 247 260 268 ms waddington Try typing netstat nr You should see three routes similar to the following Kernel routing table Destination Gateway Genmask Flags Metric Ref Use iface 129 67 1 165 0 0 0 0 255 255 255 255 UH 0 0 6 pppO 127 0 0 0 0 0 0 0 255 0 0 0 U 0 0 O lo 0 0 0 0 129 67 1 165 0 0 0 0 UG 0 0 6298 pppO If your output looks similar but does not have the destination 0 0 0 0 line which refers to the default route used for connections you may have run pppd without the defaultroute option At this point you can try using Telnet ftp or finger bearing in mind that you will need to use numeric IP addresses unless you ve set up etc resolv conf correctly Setting up a Machine for Incoming PPP Connections This first example applies to u
43. Software Moxa Linux API device control Linux Tool Chain GCC V4 2 1 C C PC Cross Compiler Glibc V2 2 5 POSIX standard C Library GDB V6 3 source level debug server Software Encryption Lock BI NEncryptor Encryption tool for binary files based on patented Moxa technology 1 4 2 Getting Started In this chapter we explain how to connect the UC 8410 8416 8418 8430 turn on the power and then get started with programming and using other functions The following topics are covered in this chapter O Powering on the O Connecting the UC 8410 8416 8418 8430 8430 to a PC Serial Console Telnet Console SSH Console O Configuring the Ethernet I nterface Modifying Network Settings with the Serial Console Modifying Network Settings over the Network O Test Program Developing Hello c Installing the Tool Chain Linux Checking the Flash Memory Space Compiling Hello c Uploading and Running the Hello Program UC 8410 8416 8418 8430 Getting Started Powering on the UC 8410 8416 8418 8430 Connect the SG wire to the Shielded Contact located in the upper left corner of the UC 8410 8416 8418 8430 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 ATTENTI ON After connecting the UC 8410 8416 8418 8430 8430 to the power supply it will take
44. T 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 You can set the ack time from a minimum of 50 msec to a maximum of 60 seconds How the WDT works The sWatchDog is enabled when the system boots up The kernel will auto ack it The user application can also enable ack When the user does not ack it will let the system reboot Kernel boot User application running and enable user ack The user API The user application must use include moxadevic h and link libmoxalib a A makefile example is shown below all xscale linux gcc o xxxx xxxx c lmoxalib int swtd open void Description If you would like to activate Watchdog for the AP you must call this function Input None Output The return value is file handle If there is an error it will return a negative value You can get the error using the function errno int swtd enable int fd unsigned long time Description Enable the application sWatchDog You must do an ack after this process Input int fd 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 reboot automatically The minimum time is 50 msec and the maximum time is 60 seconds The time unit is msec
45. The GNU version of the tar archiving utility tr Translate squeeze and or delete characters WC Print byte word and line counts count the number of bytes whitespace separated words and newlines in each given FILE or standard input if non are given or for a FILE of Network arp manipulate the system ARP cache ping ping to test network route routing table manager netstat display network status ifconfig set network IP address tftp IPVA Trivial File Transfer Protocol client telnet Connects the local host with a remote host using the Telnet interface ftp file transfer protocol ifdown ifup bring a network interface up or take a network interface down ip show manipulate routing devices policy routing and tunnels tcpsvd TCP IP service daemon wget The non interactive network downloader Process kill kill process ps display now running process fuser identify processes using files or sockets killall sends a signal to all processes running any of the specified commands nice renice run a program with modified scheduling priority alter priority of running processes pidof find the process ID of a running program run parts run scripts or programs in a directory start stop deamon start and stop system daemon programs top display Linux tasks Modules insmod insert a module into the kernel Ismod shows which kernel modules are currently loaded modprobe intelligently adds or removes a module from the Linux kernel rmmod remove module from kernel
46. UC 8410 8416 8418 8430 LX User s Manual Third Edition August 2010 WWW moxa com pr t MOXA 2010 Moxa Inc All rights reserved Reproduction without permission is prohibited UC 8410 8416 8418 8430 LX User s Manual The software described in this manual is furnished under a license agreement and may be used only in accordance with the terms of that agreement Copyright Notice Copyright 2010 Moxa Inc All rights reserved Reproduction without permission is prohibited 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 Disclaimer Information in this document is subject to change without notice and does not represent a commitment on the part of Moxa Moxa provides this document as is without warranty of any kind either expressed or implied including but not limited to its particular purpose Moxa reserves the right to make improvements and or changes to this manual or to the products and or the programs described in this manual at any time Information provided in this manual is intended to be accurate and reliable However Moxa assumes no responsibility for its use or for any infringements on the rights of third parties that may result from its use This product might include unintentional technical or typographical errors Changes are periodically made to the information herein to cor
47. X APIs device drivers for the buzzer SRAM and watchdog controls and UART are also included in the Linux OS AP User Application Daemon Apache Telnet FTPD SNMP API Application Interface POSIX Socket Secure Socket Protocol Stack TCP IP UDP CMP ARP HTTP SNMP SMTP Device Driver PCMCIA CF WLAN USB UART RTC LCM Keypad Microkernel Hardware RS 232 422 485 Ethernet PCMCIA CompactFlash USB The UC 8410 8416 8418 8430 s built in Flash ROM is divided into Boot Loader Linux Kernel Root File System and User Root File System partitions In order to prevent user applications from crashing the Root File System the UC 8410 8416 8418 8430 8430 uses a specially designed Root File System with Protected Configuration for emergency use This Root File System comes with serial and Ethernet communication capability for users to load the Factory Default Image file The user directory saves the user s settings and application To improve system reliability the UC 8410 8416 8418 8430 8430 has a built in mechanism that prevents the system from crashing When the Linux kernel boots up the kernel will mount the root file system for read only UC 8410 8416 8418 8430 I ntroduction and then enable services and daemons During this time the kernel will start searching for system configuration parameters via rc or inittab Normally the kernel uses the Root File System to boot up the system The Root File System is pro
48. able 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 cs Telnet 192 168 27 129 Moxa Embedded Linux Professional Edition Moxa login root Password HHHH HHHH HHH HEHEHE Hitt Hu dit HHHH Hitt Hitt HHHH HHHH Hitt Hitt Hitt Hitt Hitt Hitt Hu Hitt Hitt Hitt Hu Hu Hitt HHHH Tit H HH dH iit Hit Hit Hit dH HH HH HH HHH Hu HHHH H itt Hi HHH HH HH HH Hu HHHH Wo HHH HH tH 4 HH HH Hu Hitt THHHEHHE HH 411 Ho HH Hit HHH HHRHH Hu Hu Hitt HE HHH HH Ht HHH HHH Hu HHH Hu Hu Hu Hu HHH Hu Hu Hu Hitt Hit Ht Hu H Hitt Hu HHHHHH HHHHHH HHHHHHHH HEHEHE HHHHHHHHHHH HHHHHH For further information check http www moxa com Mount user file system root 3Moxa it You can proceed with configuring network settings of the target computer when you reach the bash command shell Configuration instructions are given in the next section 2 3 UC 8410 8416 8418 8430 Getting Started ATTENTI ON Serial Console Reminder Remember to choose VT100 as the terminal type Use cable CBL 4PINDB9F 100 which comes with the UC 8410 8416 8418 8430 to connect to the serial console port Telnet Reminder When connecting to the UC 8410 8416 8418 8430 8430 over a LAN you must configure your PC s Ethernet IP address to be on the same subnet as the UC 8410 8416 8418 8430 8430 you wish to connect to If you do n
49. about 16 seconds for the operating system to boot up The green Ready LED will not turn on until the operating system is ready Connecting the UC 8410 8416 8418 8430 8430 to a PC There are two ways to connect the UC 8410 8416 8418 8430 8430 to a PC directly through the serial console port or by Telnet over the network For the UC 8430 you can connect the display with the display cable Once you turn on the power you will be able to access the computer and conduct additional configurations Serial Console The serial console port gives users a convenient way of connecting to the UC 8410 8416 8418 8430 s console utility This method is particularly useful when using the computer for the first time The signal is transmitted over a direct serial connection so you do not need to know either of its 3 IP addresses in order to connect to Use the serial console port settings shown below Baudrate 115200 bps Parity None Data bits 8 Stop bits 1 Flow Control None Terminal VT100 Once the connection is established the following window will open Moxa Embedded Linux Professional Edition Moxa login root Password HHHH HHHH HHHHHH HHHHHHH HHHHHH HH HHH HHHH HHH HHH HHHH HHHH HHH HHH HHH HHH HHH HHH HH HHH HHH HHHH HH HH HHH HHHH HHHH H HH HHH HHH HHH HH HH HH HH HH H HH HHH HH HHHH H HH HH HHH OHH HH HU HH HHHH HHH HH OHH OH OHH OHH HH HHH HHH H HH HH OHHH HHH HHHHH H HH HH HHH HH H
50. acket IP address Destination NAT DNAT changes the first destination packet IP address MASQUERADE a special form for SNAT If one host can connect to internet then other computers that connect to this host can connect to the Internet when it the computer does not have an actual IP address REDI RECT a special form of DNAT that re sends packets to a local host independent of the destination IP address C Mangle Table includes two chains PREROUTING chain pre processes packets before the routing process OUTPUT chain processes packets after the routing process It has three extensions TTL MARK TOS The following figure shows the IPTABLES hierarchy Incoming Packets Mangle Table PREROUTI NG Chain NAT Table PREROUTI NG Chain Local Host Packets Mangle Table INPUT Chain Filter Table INPUT Chain Local Process Mangle Table OUTPUT Chain NAT Table OUTPUT Chain Filter Table OUTPUT Chain Other Host Packets Mangle Table FORWARD Chain Filter Table FORWARD Chain Mangle Table POSTROUTI NG Chain NAT Table POSTROUTI NG Chain Outgoing Packets 4 5 UC 8410 8416 8418 8430 Managing Communication The UC 8410 8416 8418 8430 8430 supports the following sub modules Be sure to use the module that matches your application nf conntrack nf conntrack ftp x tables xt CLASSIFY xt MARK xt NFLOG xt NFQUEUE xt TCPMSS xt esp xt length xt limit
51. ame Subnet 1 Set up four machines as shown in the following diagram 4 21 UC 8410 8416 8418 8430 Managing Communication local net LAN2 192 168 2 173 LANI 192 168 2 171 LANI 192 168 8 173 Intern et LANI 192 168 8 174 LAN1 192 168 2 172 LAN2 192 168 2 174 local net 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 tapO br conf and etc openvpn tapO br conf Setup 3 Routed IP 1 Setup four machines as shown in the following diagram local net LAN2 192 168 2 173 LANI 192 168 2 171 LANI 192 168 8 173 Internet LANI 192 168 8 174 LAN1 192 168 4 172 LAN2 192 168 4 174 local net 2 On machine OpenVPN A modify the remote address in the 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 Next modify the routing table in the etc openvpn tun sh script file 4 22 UC 8410 8416 8418 8430 Managing Communication 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 On machine OpenVPN B modify the remote address in the configu
52. at used to encrypt your program In either case the encrypted program fails immediately This mechanism also allows computers with an encryption key installed to bypass programs that are not encrypted This is handy in the development phase since you can develop your programs and test them cleanly on the target computer Qt embedded The UC 8430 offers the QT library which helps programmers design the UI framework See the following for details QT programming development flow chart 1 QT Programming 3 Cross compiling 4 Upload to target and tact 2 QT Program Testing X86 Write the QT program to run the in thetarget environment A basic QT program is shown below include lt QtGui gt include lt QApplication gt include lt QLabel gt int main int argc char argv QApplication app argc argv QLabel label new QLabel Hl hello font color red QT font H1 OWidget window label 5setWindowTitle Hello label gt setAlignment Qt AlignCenter label resize 200 100 label show window resize 320 240 window show 5 20 UC 8410 8416 8418 8430 Programmer s Guide window setWindowTitle QApplication translate toplevel Top level widget return app exec Compile and Test the QT Program on an X86 Machine Install the QT developing package apt get install build essential libqt4 dev libqt4 dev tools qt4 designer Compile the programs
53. blielnSincak alieyy Cue NOSL MIS db cs odi 192 dis sod 2 7 can E ls SSiceloulasoverel RSA key Eng erp rin folo gere pani E feld Lnd UTI S 75g stel Riel O ZOO Ls Soy ak c Are you sure you want to continue connection yes no yes 2 4 UC 8410 8416 8418 8430 Getting Started NOTE SSH provides better security compared to Telnet for accessing the UC 8410 8416 8418 8430 s console utility over the network Configuring the Ethernet I nterface The network settings of the UC 8410 8416 8418 8430 8430 can be modified with the serial console or online over the network Modifying Network Settings with the Serial Console In this section we use the serial console to configure network settings of the target computer 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 directory root Moxa cd etc network rootG8Moxa etc network i Type vi interfaces to edit the network configuration file with vi editor You can configure the UC 8410 8416 8418 8430 s Ethernet ports for static or dynamic DHCP IP addresses Static I P addresses As shown below 3 network addresses need to be modified address network netmask and broadcast The default IP addresses are 192 168 3 127 for LAN1 192 168 4 127 for LAN2 and 192 168 5 127 for LAN3 with default netmasks of 255 255 255 0 We always want the loopback
54. conncccnnnnnncnnnnnnnnnnnnnnnnnnnnnnnnnnnnnrnnnnrnrannnnnnrs 2 6 Test Program Developing Hell0 C 0 corn truntun rra esses e shes ness es shes nennen 2 6 Installing the Tool Chain LINUX emn heme hehehe nhe ntes ten tenere 2 6 Checking the Flash Memory SpaCe cece ese he ehe memes hee e eh e eere rre ere eren 2 7 Conipiling Hello c 3 3 ertt aa eR dra ASA 2 7 Uploading and Running the Hello Program sssssssssssss m II Im heme enhn hern retener enn 2 8 3 Managing Embedded LiNUX ococmocncnocncnncncnonannnrncnnrnnnnrncnnrnnnn ran narrar nen ran ran aai uia sa sa usus usu sad ausa u ausu nana 3 1 System Version Information esee ehe e hehe he iste iste iste is e is esi ressent nne nn 3 2 Rirmware Upgrader eth oo 3 2 Upgrading the FIFIm WAare eee certet ero eee yere eor ee ee est e ess ee ree RR Ee SR eT te Yea e rS 3 2 Loading Factory Default e e RR IRR M REM hb santana MK E M MERE ME 3 4 Enabling and Disabling Daemons Ee ERR ENTRE ME PERSE MENS MEER ad 3 5 Setting the Run Level 0 eene mese esiste is tesis esie esie esiste is ess esiste is ess esses enean 3 7 Setting the Systemi Elise 3 8 LEAN PP tt ia tdt tcs 3 8 PLE EIMEZ One So Soest AA ab tt td ee A dae cathe ut dede ea CAE Ea e a O 3 8 Adjusting the System MA ss 3 8 Setting the Time Manual Yes iii E EV MM ME MER MM MEER MAMMA VE AMA MA 3 8 NTP Client ni e eres ow seme deu tuos r HOP e HOP unten A ele A A usar rese a e ED 3 9 Upda
55. d gt title gt 500 1xterxal Server Error lt title ef bende bud yo lt hl nternal Server Errorzihl xpvThe server encountered an ixterxal error or aiscontiguration axd yas uxable to corplote mur regiext s p 4p 2lesze contact the server adeinietrator youScxamplc cow axd ixfora thor of the tine tic error occurrad and suytbise you elebt lave dnis that aay Lave caused the error lt p gt pore inforratiox about this error gay be available e server error dog p To open the default CGI test script report page type http host ip address cgi bin test cgi in your browser s address box 4 3 UC 8410 8416 8418 8430 Managing Communication Mosilla Firefox Se At E ATO HO IAD NAD Qe y http 192 158 27 129 gi bintestezi O P HELE ARNE Google whet is jitter linuxe GC Seah gA Pagefiant ho Check A lt DOCTYPE HTNL PUBLIC ETF DTD HTHL 2 0 EX gt lt htal gt lt head gt lt title gt 500 Internal Server Error lt title gt lt head gt body gt lt hl gt Internal Server Error lt lt p gt The server encountered an internal error or xigconfigurstlon and was unable to conplete your request lt p gt lt p gt Please contact the server administrator youBexaxple com and inforx of the tine the error occurred and anything you night have done that nay have caused the error lt fp gt lt p More inforxation about this error nay be available in the server error log p
56. d of Arbitration Field Field Data Field CRC Field Field Frame oO eo Mm oz 2 T bit Identifier 2 2 18 bitldentiter 32 3 9 0 0 8 Bytes 15 owcrc g B 7 lal 2 l 3 14 4 6 2 8 8 0 64 N 4 ARA t o Priority Data PDU Data 5 P Page Specific Field DP PS inr un PDU Source Format Address PF SA Define the structure for CAN programming as follows moxacan ioctl h ifndef MOXACAN IOCTL H define MOXACAN IOCTL H ifndef BIT define BIT x 1 x endif BIT define MAX CAN DATA LENGTH 8 typedef union _ attribute packed can data union unsigned char array MAX CAN DATA LENGTH struct byte struct unsigned char bytel unsigned char byte2 unsigned char byte3 unsigned char byte4 unsigned char byte5 unsigned char byte6 unsigned char byte unsigned char byte8 byte can data u typedef struct user frame struct int id 5 17 UC 8410 8416 8418 8430 Programmer s Guide int info RTR amp extend ID flag define USER RTR BIT 0 define USER EXTEND ID BIT 1 int data length can data u data user frame t ioctl command code define MOXACAN IOCTL SE BAUD RATE 0x100 define MOXACAN IOCTL GF BAUD RATE 0x101 endif MOXACAN IOCTL H Then we can include this header for CAN programming We can open dev can n to use the CAN device Then read write
57. d of time This can be done with the function call set din event Moxa provides 5 function calls to handle digital I O state changes and event handling Application Programming I nterface Return error code definitions define define define define define ms define DIO ERROR PORT 1 no such port DIO ERROR MODE 2 no such mode or state DIO ERROR CONTROL 3 open or ioctl fail DIO ERROR DURATION 4 The value of duration is not 0 or not in the range 40 lt duration lt 3600000 milliseconds 1 hour DIO ERROR DURATION 20MS 5 The value DIO OK O0 The definition of DIN and DOUT define DIO HIGH 1 define DIO LOW 0 int set dout state int doport int state 5 8 of duration must be a multiple of 20 UC 8410 8416 8418 8430 Programmer s Guide Description To set the DOUT port to high or low state Input int doport which DOUT port you want to set Port starts from 0 to 3 int state to set high or low state DIO HIGH 1 for high DIO LOW 0 for low Output none Return reference the error code int int int int int get din state int diport int state Description To get the DIN port state Input int diport get the current state of which DIN port Port numbering is from O to 3 int state save the current state Output state DIO HIGH 1 for high DIO LOW 0 for low Return reference the error code get dout s
58. dware 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 query the system time date Use the following command to query the RTC time hwclock Use the following command to set the system time date MMDDhhmmYYYY MM Month DD Date hhmm hour and minute YYYY Year Use the following command to set the RTC time hwclock w Write current system time to RTC The following figure illustrates how to update the system time and set the RTC time 3 8 UC 8410 8416 8418 8430 Managing Embedded Linux root Moxa date lea Ubi 23 23230331 CSE TEX root Moxa hwclock EXI 24s 2Se SOS sis 21000 O ASAS fskexeleYatels root Moxa date 070910002006 Sia weil S MOS OO Soe sar 2006 root Moxa hwclock w root Moxa date hwclock Sum voll Y LOsoileey CSE 0005 Sita will LOL 2005 0Lc 93547 Sesame root Moxa NTP Client The UC 8410 8416 8418 8430 8430 has a built in NTP Network Time Protocol client that is used to initialize a time request to a remote NTP server Use ntpdate lt NTP server gt to update the system time ntpdate time stdtime gov tw fhwclock w Visit for more information about NTP and NTP server addresses root Moxa date hwclock Sere wei L 004003565 Csr 200010 Sat Jan 1 00 00 37 2000 0 772941 seconds root Moxa ntpdate time stdtime
59. e Argument 3 mode will pass to the UART device driver and change it 2 Function MOXA GET OP MODE int ioctl fd MOXA GET OP MODE amp 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 If the baudrate you get from termios or from calling tcgetattr is B4000000 you must call ioctl with MOXA GET SPECIAL BAUD RATE to get the actual baudrate Setinterface The Serial Port Expansion Module has 8 serial ports labeled ttyMO to ttyM7 The ports support RS 232 RS 422 and RS 485 2 wire and 4 wire operation modes with baudrate settings up to 921600 bps The default operation mode is set to RS 232 You can use the setinterface command to change the serial port operation mode Usage setinterface device node interface no device node dev ttyMn n 0 1 2 interface no As shown in the following table interface no Operation Mode None Display current setting 0 RS 232 1 RS 485 2 wire 2 RS 422 3 RS 485 4 wire The following example sets dev ttyMO to RS 422 mode root Moxa setinterface dev ttyMO 2 root Moxa setinterface dev ttyMO Now setting is RS4
60. e neon e m AAE AA RARI EAA RR ARTISAN SACR MUR NR AI 4 23 Audio Playing and Recording eere eee rt e MR MM M MR EM MEM MR MM a 4 24 Volume eMe UU 4 24 Playing a WAVE Elle a 4 24 Recording WAVE THe 00 dai 4 25 5 Programmer s Guide oocccoonoconnnconnncnnnncnnnncnnnn cnn cnn enn n near ran enn enn rnnnennrnrnnnnrnnrnrnnrnrnnrnennnrnnancanans 5 1 Flash Memory Ma ii toed died whan caus A A A tds 5 2 Linux Tool Chain Introduction issssssssssssssss nnn nnn nen meses 5 2 Debugging With DB a edhe CR 5 3 Devi APh rade a AA RR A RA AA RA AAA AAA AAA AAA aii 5 4 RTC Real Need TT 5 4 BUZZER A aaa 5 4 WDT WatchDog Timer toii hn IR RR ERR MR RM REM ME MM M M MM MM MM MEM MEM M MA 5 5 O ee REM M 5 8 UAM ATE 5 12 Make File Example et RR ise eise inu MM se Me M MAMMA 5 16 Moxa CAN Programming Guide mrii an nene e neve id 5 17 LOTTO CEI OMA eee DP 5 17 Programming Guide ii uie udvdetegeiitdet tede e 5 17 Software Here qu CR REN 5 19 ieu m 5 20 Compile and Test the QT Program on an X86 Machine ssssssssssssssm m emen 5 21 Set up Qt development 0 0 0 esses esie esie esiste is esiste is ess ese essen 5 21 Cross compile the Qt application and run with Dual display cssssssmH 5 21 Upload the binary to target and run it with following command sssssss mm 5 21 A Firmware Upgrade Procedure ccscsccecseeeeeceeeeeeeeeeeeeeeeeeeeeaeee
61. e program Use the following steps 1 To debug a program called hello debug on the target use the command gdbserver 192 168 4 142 2000 hello debug This is where 2000 is the network port number on which the server waits for a connection from the client This can be any available port number on the target Following this are the name of the program to be debugged hello debug plus that program s arguments Output similar to the following will be sent to the console 5 3 UC 8410 8416 8418 8430 Programmer s Guide Process hello debug created pid 38 2 Usethe following command on the host to change to the directory that contains hello debug cd my work directory myfilesystem testprograms 3 Enter the following command ddd debugger xscale linux gdb hello debug amp 4 Enter the following command at the GDB DDD command prompt Target remote 192 168 4 99 2000 The command produces another line of output on the target console similar to the following Remote debugging using 192 168 4 99 2000 192 168 4 99 is the machine s IP address and 2000 is the port number You can now begin debugging in the host environment using the interface provided by DDD 5 Set a breakpoint on main by double clicking or entering b main on the command line Click the cont button Device API The UC 8410 8416 8418 8430 8430 supports control devices with the ioctl system API You will need to include lt moxadevice h gt and use the follow
62. eaeaeeaeaceaeaceaeaeeaeaeeaeaeeaeaeeaeaguasaeeaeaeeaeenaeeaes A 1 B System Commands iiiieie ied eussevessusunsuus ERURRSNVERRRURRSNURRSRURARUERORERERER NOR ono RSEN anden canario nano nano REN SUE SERPERRNUE B 1 Linux Normal Command Utility Collection 0 me meme eh he ness es nnns B 1 ES IIR M iii B 1 fe o Jai e S M METER acute dee AA A A EUR B 1 Network sentes la de oa Me te den Men Ln LL REAA B 2 Mie fe i e T E EP B 2 je ce M B 2 Otho se ouo OM n nU m Dm MD MO OD e m ue D DS CENE B 2 1 Introduction Welcome to the Moxa UC 8400 Series of RISC based communication platforms The UC 8410 8416 8418 8430 embedded computer comes with 8 RS 232 422 485 serial ports 3 Ethernet ports 4 digital input channels 4 digital output channels 12 digital input channles and 12 digital output channels for UC 8418 8 10 100 Mbps switch ports UC 8416 only a CompactFlash socket and 2 USB 2 0 ports In addition the UC 8430 comes with 2 VGA outputs making it the perfect solution for applications that require HMI for field site monitoring The UC 8410 8416 8418 8430 computer uses the Intel XScale IXP435 533 MHz RISC CPU This powerful computing engine supports several useful communication functions but will not generate too much heat The built in 16 MB NORFlash ROM can be used to store the operating system and 256 MB SDRAM gives you enough memory to run your applicatio
63. ected networks C Show icon in notification area when connected Notify me when this connection has limited or no connectivity d Next select Use the following I P address and enter the IP address and Subnet mask For example I P address 192 168 1 1 This IP address is only an example you may assign any IP address of your choice as long as it s on the same LAN as your PC Subnet mask 255 255 255 0 Internet Protocol TCP IP Properties General You can get IP settings assigned automatically if pour network supports this capability Otherwise you need to ask your network administrator for the appropriate IP settings Obtain an IP address automatically Use the following IP address IP address 192 168 1 1 Subnet mask 255 255 255 0 Default gateway Obtain DNS server address automatically Use the following DNS server addresses Altemate DNS server numm Preferred DNS server Co A 9 UC 8410 8416 8418 8430 Firmware Upgrade Procedure 3 Go back to the boot load utility menu and assign the local IP address and then enter the server IP address The local IP address is the IP address of the embedded computer Note that the local I P address must be on the same LAN as the server I P address For example if the server IP address is 192 168 1 1 you can choose a local IP address between 192 168 1 2 to 192 168 1 254 UC 8410
64. est f sender icompany com S IP address receiver icompany com lt mail body message 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 4 15 UC 8410 8416 8418 8430 Managing Communication SNMP NOTE The UC 8410 8416 8418 8430 8430 has the SNMP V1 Simple Network Management Protocol agent software built in It supports RFC1317 RS 232 like groups and RFC 1213 MIB II The following simple example allows you to use an SNMP browser on the host site to query the UC 8410 8416 8418 8430 which is the SNMP agent The UC 8410 8416 8418 8430 8430 will respond debian snmpwalk v 1 c public Cc 192 168 30 127 SNMPv2 MIB sysDescr 0 STRING Linux version 2 6 23 1 root UC8400 gcc version 4 2 1 1137 Wed Sep 17 16 17 45 EDT 2008 SNMPv2 MIB sysObjectl D O OID SNMPv2 SMI enterprises 8691 12 8410 8416 8418 DI SMAN EVENT MIB sysUpTimelnstance Timeticks 239600 0 39 56 00 SNMPv2 MIB sysContact 0 STRING Moxa Systems Co LDT SNMPv2 MIB sysName 0 STRING none SNMPv2 MIB sysLocation 0 STRING Unknown SNMPv2 MIB sysServices 0 INTEGER 6 IF MIB ifNumber O INTEGER 11 IF MIB iflndex 1 INTEGER 1 IF MIB i
65. flndex 2 INTEGER 2 IF MIB iflndex 3 INTEGER 3 IF MIB iflndex 4 INTEGER 4 IF MIB iflndex 5 INTEGER 5 IF MIB iflndex 6 INTEGER 6 IF MIB iflndex 7 INTEGER 7 IF MIB iflndex 8 INTEGER 8 IF MIB iflndex 9 INTEGER 9 IF MIB iflndex 10 INTEGER 10 IF MIB iflndex 11 INTEGER 11 IF MIB ifDescr 1 STRING ethO IF MIB ifDescr 2 STRING eth1 IF MIB ifDescr 3 STRING eth2 SNMP QUERY FINISHED Click on the following links for more information about MIB II and RS 232 like groups http www fags org rfcs rfc1213 html http www fags org rfcs rfc1317 html gt The UC 8410 8416 8418 8430 8430 does NOT support SNMP trap The following tables list the variables supported by the UC 8410 8416 8418 8430 OpenVPN OpenVPN provides two types of tunnels for users to implement VPNS Routed IP Tunnels and Bridged Ethernet Tunnels To begin with check to make sure that the system has a virtual device dev net tun If not issue the following command mknod dev net tun c 10 200 An Ethernet bridge is used to connect different Ethernet networks together The Ethernets are bundled into one bigger logical Ethernet Each Ethernet corresponds to one physical interface or port that is connected to the bridge On each OpenVPN machine you should generate a working directory such as etc openvpn where script files and key files reside Once established all operations will be performed in tha
66. hd f etc ssh sshd config usr bin httpd k start d etc apache bin reportip usr bin httpd start d etc apache usr bin httpd start d etc apache usr bin httpd start d etc apache usr bin httpd start d etc apache usr bin httpd start d etc apache root tcps2 release ps 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 root Moxa ect rce d rc3 d ls S20snmpd SSsossh S99showreadyled s25nfs server S99rmnologin rootfMoxa etc rc d rc3 d ed etc rc d init d Edit a shell script to execute root tcps2 release and save to tcps2 as an example ed etc rc d rc3 d 1n s etc rc d init d tcps2 S60tcps2 SxxRUNFILE stands for S start the run file while linux boots up xx a number between 00 99 Smaller numbers have a higher priority RUNFILE the file name root Moxa ect rc d rc3 d ls s20snmpd SHE Sela S99showreadyled s25nfs server S99rmnologin root Moxa ect rc d rc3 d4 ln s root tcps2 release S60tcps2 root8Moxa ect rc d rc3 d ls s20snmpd SISSSIN S99showreadyled S25nfs server S99rmnologin S60tcps2 rootfMoxa etc rc d rc3 d KxxRUNFILE stands for K start the run file while Linux shuts down or halts xx a number between 00 99 Smaller numbers have a higher priority RUNFILE the file name 3 7 UC 8410 8416 8418 8430 Managing
67. hen 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 gt ipf echo ip forwarding enabled to cat ipf stop echo shutdown openvpn bridge ifcfg vpn i expr 0 while do disconnect tap device from the bridge brctl delif br0 tap i openvpn rmtun dev tap i i expr i 1 if i ge maxtap then break fi done brctl delif br0 iface brctl delbr brO ifconfig br0 down ifconfig iface IPADDR netmask NETMASK broadcast BROADCAST killall TERM openvpn case 1 in start start A 4 19 UC 8410 8416 8418 8430 Managing Communication stop stop P restart stop start P echo Usage 0 start stop restart exit 1 3 On machine OpenVPN A modify the remote address in the configuration file etc openvpn tap0 br conf etc openvpn tap0 br conf point to the peer remote 192 168 8 174 dev tap0 secret etc openvpn secrouter key cipher DES EDE3 CBC auth MD5 tun mtu 1500 tun mtu extra 64 ping 40 up etc openvpn tap0 br sh Next modify the routing table in the etc openvpn tapO br sh script file bin sh etc openvpn tap0 br sh value after net is the subnet behind the remote peer route add net 192 168 4 0 netmask 255 255 255 0 dev brO On machine OpenVPN
68. hnical FAQs m E Mail this Page El Print this Page Request Support RMA Service prot S Drivers e Firmware 4 Libraries f MTSC Certification Software BO Learning Center ES E Utilities Warranty Policy Technical FAQs Request Support 2 Under Search for Software select the product line and then choose the specific product model Click on Search to continue Software Z S Drivers 7 Firmware 4c Libraries dare e d Packages e E Utilities E Search for Software Enter search query v utilities 3 In the software list select the firmware for your model Choose the appropriate OS and then click the download icon to start downloading the new firmware Note Check the filename it may differ from the filename shown below UC 8410 8416 8418 8430 Firmware Upgrade Procedure Search for Software E 3 Results for RISC based Embedded Computers UC 8410 Firmware Utilities Software Packages Drivers Libraries Items 1 to 10 displayed 4 Previous N Item Version OS Release date Download Moxa Device Manager Gateway 10 Windows Mar 27 2 LI var 2f 2 New XP x86 Tool chain for UCS400 Linux LX 1426X LX and EM2250 LX 5 2 6 x Apr 27 2 New ll The firmware for UC 8410 IUE Mar 31 2009 series New MAT 4 Putthe latest firmware icon in the same directory as the TFTP files File Edit View Favorites Tools Help Q ra amp 15 o Search Es Folders E
69. ine Please input the select VT100 115200 8 N 1 1 In the boot loader utility select 0 Network Configuration and then 0 Change IP Setting to configure IP addresses UC 8410 HyperTerminal File Edit View Call Transfer Help De 5308 Y Init DIO OK Enable Battery LED Press DEL FOR SYSTEM RECOVERY Main Menu gt gt gt MOXA Boot Loader Version 1 1 4 CPU Endian BE Make date Oct 7 2008 18 17 25 Module Type UC8400 Serial number 246 MAC Address NPE PORT1 00 90 e9 09 38 45 PORT2 00 90 e9 09 38 46 MAC Address RLTK PORT3 00 90 e9 09 38 47 01 Network Configuration 11 Format User Disk 2 Firmware Upgrade z Quit to command line lt lt lt TFTP Menu 0 Change IP Setting 11 Show Current IP Setting z Quit this menu Please input the select Local IP Address Connected 0 34 32 T100 115200 8 N 1 UC 8410 8416 8418 8430 Firmware Upgrade Procedure 2 You will need to enter the IP address of the embedded computer and your PC Follow the below to configure the IP addresses a From Start gt Settings select Network Connections Q Set Program Access and Defaults ES Windows Catalog o Windows Update e Programs Control Panel E Settings 2 amp Network Connections P Search gt Printers and Faxes Help and Support gll Taskbar and Start Menu Windows XP Professional 9j Turn Off Computer UC 7400 HyperTe
70. ing ioctl function int ioctl int d int request Input int d open device node return file handle int request argument in or out Use the desktop Linux s man page for detailed documentation man ioctl RTC Real Time Clock The device node is located at dev rtc The UC 8410 8416 8418 8430 8430 supports Linux standard simple RTC control You must include lt linux rtc h gt 1 Function RTC_RD_TIME int ioctl fd RTC RD TIME struct rtc time time Description read time information from the RTC It will return the value on argument 3 2 Function RTC SET TIME int ioctl fd RTC SET TIME struct rtc time time Description set RTC time Argument 3 will be passed to the RTC Buzzer The device node is located at dev console The UC 8410 8416 8418 8430 8430 supports Linux standard buzzer control with the UC 8410 8416 8418 8430 s buzzer running at a fixed frequency of 100 Hz You must include lt sys kd h gt 1 Function KDMKTONE ioctl fd KDMKTONE unsigned int arg Description The buzzer s behavior is determined by the argument arg The high word part of arg gives 5 4 UC 8410 8416 8418 8430 Programmer s Guide the length of time the buzzer will sound and the low word part gives the frequency The buzzer s on off behavior is controlled by software If you call the ioctl function you MUST set the frequency to 100 Hz If you use a different frequency the system could crash WD
71. ions and Libraries To compile a simple C application just use the cross compiler instead of the regular compiler xscale linux gcc o example Wall g 02 example c xscale linux strip s example xscale linux gcc ggdb o example debug example c Tools Available in the Host Environment Most of the cross compiler tools are the same as their native compiler counterparts but with an additional prefix that specifies the target system In the case of x86 environments the prefix is i386 linux and in the case of the UC 8410 8416 8418 8430 8430 XScale boards it is xscale linux For example the native C compiler is gcc and the cross C compiler for XScale in the UC 8410 8416 8418 8430 8430 is xscale linux gcc The following cross compiler tools are provided ar Manages archives static libraries as Assembler c g C compiler cpp C preprocessor gcc C compiler gdb Debugger Id Linker nm Lists symbols from object files objcopy Copies and translates object files objdump Displays information about object files ranlib Generates indexes to archives static libraries readelf Displays information about ELF files size Lists object file section sizes strings Prints strings of printable characters from files usually object files strip Removes symbols and sections from object files usually debugging information Debugging with GDB First use the option ggdb to compile th
72. it means the function is working If you receive any other number then there is something wrong with this function int swtd close int fd Description Close the file handle Input int fd the file handle from swtd open return value Output If you receive O zero it means the function is working If you receive any other number then there is something wrong with this function 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 This can cause a serious problem causing your system to reboot again and again 5 User application example Example 1 5 6 UC 8410 8416 8418 8430 Programmer s Guide include lt stdio h gt include lt stdlib h gt include lt string h gt include lt moxadevice h gt int main int argc char argv int fd fd swtd open if fd lt 0 printf Open sWatchDog device fail n exit 1 swtd enable fd 5000 enable it and set it 5 seconds while 1 do user application want to do swtd ack fd swtd close fd exit 0 The makefile is shown below all xscale linux gcc o xxxx xxxx c lmoxalib Example 2 include lt stdio h gt include lt stdlib h gt
73. l h ifdef DEBUG define dbg printf x printf x else define dbg_printf x endif define MIN DURATION 40 static char DataString 2 Low High Jj static void hightolowevent int diport printf NnDIN port d high to low n diport static void lowtohighevent int diport printf NnDIN port d low to high Nn diport int main int argc char argv int i j state retval unsigned long duration while 1 printf nSelect a number of menu other key to exit n set high to low event Ani get now data n set low to high event n set high data n set low data n quit n show event and duration Ani 1 2 3 4 clear event Ani 5 6 7 Choose UC 8410 8416 8418 8430 Programmer s Guide retval z0 scanf d amp i if i 1 set high to low event printf Please keyin the DIN number scanf d amp i printf Please input the DIN duration this minimun value must be over d MIN DURATION scanf 1u amp duration retval set din event i hightolowevent DIN EVENT HIGH TO LOW duration else if i 2 get now data printf DIN data for j 0 j 4 j get din state j amp state printf s DataString state printf Nn printf DOUT data for j 0 j MAX DOUT PORT j get dout state j amp state printf s DataString state printf Nn
74. lation ASCII Setup B Download and Installation of 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 have finished downloading extract the files to your PC File Edit View Favorites Tools Help Qs Q 27 JO Search Es Folders EJ cATFTP file_id diz TAN File and Folder Tasks DIZ File ie tftpd32 exe 1 KB P 29 Make a new folder 2 Publish this folder to the TFTPD32 HLP VENDINFO DIZ Web amp Help File DIZ File k Share this folder 33 KB 4KB Other Places se Sys TW C B My Documents O Shared Documents ij My Computer a My Network Places Details TFTP File Folder Date Modified Friday June 19 2009 2 43 PM UC 8410 8416 8418 8430 Firmware Upgrade Procedure C Download and Upgrade the Firmware through HyperTerminal 1 Connect to Moxa s website at http www moxa com and then select Software from the Support drop down menu My Moxa Partner Zone International Sites Contact Moxa m 7 MOXA search About Moxa Products Applications Support News amp Events Where to Buy Location Home gt gt Support gt gt Software Hi Please sign in Documentation S oft ware Tec
75. lication runs on As long as it is obtained from the computer it can be installed on the same hardware and under the same operating system resulting in a loss of the add on value created by the developer Users can deploy this data encryption method to develop the software for the applications The binary file associated with each of your applications needs to undergo an additional encryption process after you have developed it The process requires you to install an encryption key in the target computer 1 Choose an encryption key e g ABigKey and install it in the target computer by a pre utility program called setkey setkey ABigKey NOTE If you would like to clear the encryption key on the target computer use the following command setkey 2 Develop and compile your program on the development PC 3 Onthe development PC run the utility program binencryptor to encrypt your program with an encryption key binencryptor yourProgram ABigKey 4 Upload the encrypted program file to the target computer by FTP or NFS and test the program UC 8410 8416 8418 8430 Programmer s Guide The encryption key is a computer wise key This means that the computer has only one key installed Running the program setkey multiple times overrides the existing key To prove the effectiveness of this software protection mechanism prepare a target computer on which an encryption key has not been installed or install a key different from th
76. ll means the standard error messages will be dump to null device modprobe ip tables 2 dev null modprobe iptable filter 2 dev null modprobe iptable nat 2 dev null modprobe ip conntrack 2 dev null modprobe ip conntrack ftp 2 dev null modprobe iptable nat modprobe ip nat ftp 2 dev null Step 2 Define variables enable routing and erase default rules PATH bin sbin usr bin usr sbin usr local bin usr local sbin 4 9 UC 8410 8416 8418 8430 Managing Communication export PATH echo 1 proc sys net ipv4 ip forward sbin iptables F sbin iptables X sbin iptables Z sbin iptables F t nat sbin iptables X t nat sbin iptables Z t nat sbin iptables P INPUT ACCEPT sbin iptables P OUTPUT ACCEPT sbin iptables P FORWARD ACCEPT sbin iptables t nat P PREROUTING ACCEPT sbin iptables t nat P POSTROUTING ACCEPT sbin iptables t nat P OUTPUT ACCEPT 4 Step 3 Enable IP masquerade Dial up Service PPP 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 UC 8410 8416 8418 8430 s Ethernet port Since PPP is a peer to peer system the UC 8410 8416 8418 8430 8430 can also use PPP to link two
77. lt body gt lt fhtal gt Bg ss fecit TR ATTENTI ON When you develop your own CGI application make sure your CGI file is executable 1927 SI Pul by root Moxa usr www cgi bin ls al AEWRE aee ZO OE TOOT 0 Aug 24 1999 ore unes ie SK SEO Oj root 0 Nor 5 16216 E XE X il OO root 268 Dec 19 2002 printenv IrWXI Xr X Jl ESE root UST NX 241999 test cgi root Moxa usr www cgi bin IPTABLES IPTABLES is an administrative tool for setting up maintaining and inspecting the Linux kernel s I P 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 The UC 8410 8416 8418 8430 8430 supports 3 types of IPTABLES table Filter tables NAT tables and Mangle tables A Filter Table includes three chains INPUT chain OUTPUT chain FORWARD chain B NAT Table includes three chains PREROUTING chain transfers the destination IP address DNAT POSTROUTI NG chain works after the routing process and before the Ethernet device process to transfer the source IP address SNAT OUTPUT chain produces local packets sub tables 4 4 UC 8410 8416 8418 8430 Managing Communication Source NAT SNAT changes the first source p
78. m buf2 sizeof sram buf2 if len 0 printf Read from dev sram failin exit 0 if memcmp sram bufl sram buf2 SRAM SIZE 0 printf Memory compared fail n exit 0 printf The content is identical n close fd Make File Example The following Makefile file sample code is copied from the Hello example on the UC 8410 8416 8418 8430 s CD ROM CC xscale linux gcc CPP xscale linux gcc SOURCES hello c OBJS SOURCES c 0 all hello hello OBJS CC o 0 LDFLAGS LIBS clean rm f OBJS hello core gdb 5 16 UC 8410 8416 8418 8430 Programmer s Guide Moxa CAN Programming Guide I ntroduction CAN is a broadcast serial bus standard for connecting electronic control units ECUs Each node is able to send and receive messages but not simultaneously a message consisting primarily of an ID usually chosen to identify the message type sender and up to eight message bytes is transmitted serially onto the bus one bit after another This signal pattern codes the message in NRZ and is sensed by all nodes Moxa embedded computers provide the CAN bus interface for industrial CAN communication Users can use the file control interface to read write or control the CAN interface as a file for easy CAN programming Programming Guide The CAN data format looks like this Control ACK En
79. mmand lines from standard input yes yes prints the command line arguments separated by spaces and followed by a newline forever until it is killed tee Copy standard input to each FILE and also to standard output Special Moxa Utilities setkey set the software encryption key upgradehfm upgrade firmware utility libmoxalib a Moxa perporitary libraries upramdisk mount ramdisk downramdisk unmount ramdisk kversion show kernel version setinterface set dev ttyMn to RS232 RS485 2WIRES RS422 RS485 4WIRES B 3
80. mode Example Use the following commands to record a mono format WAVE file at a 22050 HZ sampling rate with 16 bits in 10 seconds root Moxa root vrec t 10 w s 22050 b 16 dev shm 22050 16 Mono wav Recording WAVE 16 bit Speed 22050 Hz 16 bits Mono root Moxa root NOTE The vrec does not support record the stereo format music 4 25 This chapter includes important information for programmers The following topics are covered in this chapter o o O o o o o o o o o O a Flash Memory Map Linux Tool Chain I ntroduction Debugging with GDB Device API RTC Real Time Clock Buzzer WDT Watch Dog Timer Digital 1 O UART SRAM Make File Example Moxa CAN Programming Guide gt Introduction gt Programming Guide Software Lock Qt embedded gt Compile and Test the QT Program on an X86 Machine gt Set up Qt development gt Cross compile the Qt application and run with Dual display gt Upload the binary to target and run it with following command 5 Programmer s Guide UC 8410 8416 8418 8430 Programmer s Guide Flash Memory Map NOTE Partition sizes are hard coded into the kernel binary To change partition sizes you will need to rebuild the kernel The flash memory map is shown in the following table Address Size Contents 0x00000000 640 KB Boot Loader Read 0x0005FFFF ONLY 0x00060000 1 875 MB Kernel object Ox001FF
81. n d n i printf Receive frame id d length dWn rxframe id 5 18 rxframe data length UC 8410 8416 8418 8430 Programmer s Guide printf Receive data contexts are following Nn for i 0 i MAX CAN DATA LENGTH i printf c rxframe data array i pfintf Nn close fd1 close fd2 return 0 Makefile CROSS_COMPILE xscale linux CC CROSS_COMPILE gcc LD S CROSS_COMPILE 1d STRIP CROSS_COMPILE strip STRIP CROSS_COMPILE strip s ARGET tcan ARGET1 canttrw all debug release debug S TARGET c TARGET1 c moxacan ioctl h CC ggdb o S TARGET debug TARGET c CC ggdb o S TARGET1 debug TARGET1 c release S TARGET c S TARGET1 c moxacan ioctl h CC o S TARGET release TARGET c CC o TARGET1 release TARGET1 c STRIP S TARGET release S TARGET1 release clean rm f o S TARGET debug S TARGET release TARGET1 debug TARGET1 release Note Only UC 8418 LX support CAN port communication Software Lock Software Lock is an innovative technology developed by the Moxa engineering team and can be used 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 that the app
82. n argv 1 0 printf pattern c n pattern fd open dev sram O_RDWR if fd 0 printf Open dev sram fail exit 0 Write the sram with patern memset Sram_bufl pattern sizeof sram bufl len write fd sram bufl sizeof sram_bufl if len 0 printf Write dev sram fail exit 0 printf The content is writtenin close fd RK IK kk kk kk kk kk kk I kk kk Kk kk kk kk kk kCkCkCk ck ck ck ck k ck k ck k ck k ck k ck k ck I ko History Versoin Author Date Comment 150 Jared Wu 09 11 2008 Read from the SRAM and compare with some pattern A include lt sys types h gt include lt sys stat h gt include lt stdio h gt include lt stdlib h gt include lt string h gt 5 15 UC 8410 8416 8418 8430 Programmer s Guide include lt fcntl h gt include lt linux kd h gt define SRAM_SIZE0x00040000 256 Kbytes static char sram_bufl SRAM_SIZE sram buf2 SRAM SIZE int main int argc char argv int fd len unsigned long ms 0 char pattern 9 TE rge 2 Y 4 printf Usage s pattern Wn exit 0 if argc Jj t pattern argv 1 0 printf pattern c n pattern fd open dev sram O_RDWR if fd lt 0 printf Open dev sram fail exit 0 Write the sram with pattern memset sram bufl pattern sizeof sram_bufl Read from sram and compare with pattern len read fd sra
83. n software directly on the UC 8410 8416 8418 8430 Moreover the 32 MB NAND Flash provides the capacity for data storage The UC 8410 8416 8418 8430 computer supports RS 232 422 485 serial ports digital I O and has three LAN ports making it ideal as a communication platform for industrial applications that require network redundancy Pre installed with the Linux 2 6 platform the UC 8410 8416 8418 8430 provides an open software operating system for software program development Software written for a desktop PC can be easily ported to the UC 8410 8416 8418 8430 platform by using a GNU cross compiler without needing to modify the code This makes the UC 8410 8416 8418 8430 an optimal solution for your industrial applications with the minimal cost and effort In addition to the standard model a wide temperature version 40 to 75 C of the UC 8410 8416 8418 8430 is also available for use in harsh industrial environments The following topics are covered in this chapter O Overview O Software Architecture gt Journaling Flash File System J FFS2 gt Software Features UC 8410 8416 8418 8430 I ntroduction Overview The UC 8410 8416 8418 8430 computer which features a RISC CPU RAM memory serial ports for connecting RS 232 422 485 devices and 3 10 100 Mbps Ethernet ports is designed for embedded applications The UC 8410 8416 8418 8430 uses an Intel XScale IXP435 533 Mhz RISC CPU Unlike the x86 CPU which uses a CISC
84. n start 3 10 UC 8410 8416 8418 8430 Managing Embedded Linux Connecting Peripherals USB Mass Storage The UC 8410 8416 8418 8430 8430 supports PNP plug n play and hot pluggability for connecting USB mass storage devices The UC 8410 8416 8418 8430 8430 has a built in auto mount utility that eases the mount procedure The connected USB mass storage device will be mounted automatically You can check the location of the USB disk by mount command The UC 8410 8416 8418 8430 8430 will be un mounted automatically with umount when the device is disconnected ATTENTI ON Remember to type the sync command before you disconnect the USB mass storage device If you don t issue the command you may lose some data Remember to exit the mount directory when you disconnect the USB mass storage device If you stay in mount directory the auto un mount process will fail If that happens type umount mount directory to un mount the USB device manually For example type umount mnt sdc The UC 8410 8416 8418 8430 8430 only supports certain types of flash disk USB Mass Storage devices Some USB flash disks and hard disks may not be compatible with the UC 8410 8416 8418 8430 Check compatibility issues before you purchase a USB device to connect to the UC 8410 8416 8418 8430 CF Mass Storage The UC 8410 8416 8418 8430 8430 Embedded Computer does not support CompactFlash hot swap and PnP Plug and Play function It is necessary to
85. o Windows XP Click Start gt Programs gt Accessories gt Communications and then select HyperTerminal Q Set Program Access and Defaults ee Windows Catalog E Windows Update Programs E Accessibility gt E Entertainment gt System Tools Address Book gj Calculator EX Command Prompt E Notepad E Documents gt Fr Startup R Internet Explorer Ww MSN gt fen Outlook Express Settings Search Z Remote Assistance Help and Support Run e Windows Media Player 3 Windows Messenger Y Windows Movie Maker Y Paint 9 Program Compatibility Wizard EY Synchronize HyperTerminal Network Connections 9 Network Setup Wizard I Realtek Sound Manager E sisRAID gt Tour Windows xP gt E Windows Explorer E New Connection Wizard Aj Remote Desktop Connection lt 2 wireless Network Setup Wizard e HyperTerminal gt Log Off Bruce Windows XP Professional Ei 3e vw Turn Off Computer Connection Description NP New Connection Enter a name and choose an icon for the connection Name UC 8410 Icon Ms iu 96 6 Click Cancel when the Connect To window opens Connect To B UC 8410 Enter details for the phone number that you want to dial Country region ed Sia Area code Phone number Connect using UC 8410 8416 8418 8430 Firmware Upgrade Procedure 7 Select File gt Properties fr
86. of the various rules into three categories Observe and erase chain rules Define policy rules and Append or delete rules Observe and erase chain rules Usage iptables t tables L n t tables Table to manipulate default filter example nat or filter L chain List List all rules in selected chains If no chain is selected all chains are listed n Numeric output of addresses and ports 4 6 UC 8410 8416 8418 8430 Managing Communication iptables t tables FXZ F Flush the selected chain all the chains in the table if none is listed X Delete the specified user defined chain Z Set the packet and byte counters in all chains to zero Examples iptables L n In this example since we do not use the t parameter the system uses the default filter table Three chains are included INPUT OUTPUT and FORWARD INPUT chains are accepted automatically and all connections are accepted without being filtered iptables F iptables X iptables Z Define policy for chain rules Usage iptables t tables P INPUT OUTPUT FORWARD PREROUTING OUTPUT POSTROUTING ACCEPT DROP P Set the policy for the chain to the given target INPUT For packets coming into the UC 8410 8416 8418 8430 OUTPUT For locally generated packets FORWARD For packets routed out through the UC 8410 8416 8418 8430 PREROUTING To alter packets as soon as they come in POSTROUTING To alter packe
87. om the main HyperTerminal screen UC 8410 HyperTerminal GN Edit View Call Transfer Help New Connection Open Save Save AS Page Setup Print Exit Alt F4 8 You can change the COM port number in the Properties window Click Configure for additional configuration options UC 8410 Properties Connect To Settings BD cus Country region ined States 1 Enter the area code without the long distance prefix Area code 2 Phone number Connect using x Use country region code and area c ode Redial on busy 9 Configure the Port Settings with following parameters Bits per second 115200 gt lt COM1 Properties Data bits 8 Parity None Port Settings Stop bit 1 Flow control None Bits per second Click OK to continue Data bits Parity Stop bits Flow control fs A 3 UC 8410 8416 8418 8430 Firmware Upgrade Procedure 10 Click the Settings tab and then select VT100 for Emulation Click OK to complete the configuration UC 8410 Properties Function arrow and ctrl keys act as Terminal keys O Windows keys Backspace key sends O Etl amp H O Del Ctl H Space Ctrl H Emulation v Terminal Setup Telnet terminal ID VT100 Backscroll buffer lines 500 C Play sound when connecting or disconnecting Input Trans
88. ot get connected on the first try re check the IP settings and then unplug and re plug the UC 8410 8416 8418 8430 s power cord SSH Console The UC 8410 8416 8418 8430 8430 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 8410 8416 8418 8430 8430 in a Windows environment The following figure shows a simple example of the configuration that is required PX PuITY Configuration Category B Session Basic options for your PuTTY session 4T idi Specify pour connection by host name or IP address Termina Keyboard Host Name or IP address Port Bel 192 158 27 122 IE Features Protocol E Window O Raw O Telnet O Rogn SSH Appearance Behaviour Translation Saved Sessions __ Selection Embedded Computer Load save or delete a stored session Colours Default Settings lesa E Connection 192 168 27 121 Data 192 168 27 127 Proxy 192 168 27 128 Save Telnet 195 226 66 181 mnm E Embedded Computer PLE Rlogin 5 SSH Kex E Close window on exit des O Always O Never Only on clean exit Tunnels Linux Users From a Linux machine use the ssh command to access the UC 8410 8416 8418 8430 s Console utility via SSH ssh 192 168 3 127 Select yes to complete the connection root bee_notebook root ssh 192 168 3 127 Ihe i
89. ow upgrade the file directory Format MTD device dev mtd5 MTD device dev mtd5 erase 128 Kibyte 20000 100 complete Wait to write file Completed 100 Now upgrade the new configuration file Upgrade the firmware is OK Rebooting Loading Factory Defaults Press the reset button for more than 5 seconds to force the system to load the factory default settings All files in the home etc usr local bin usr local sbin usr local lib usr local libexec and tmp directories will be deleted While pressing the reset button during the first 5 seconds the ready light will blink once each second If you continue pressing the button after 5 seconds have passed the ready light will turn off indicating that the factory defaults have been loaded 3 4 UC 8410 8416 8418 8430 Managing Embedded Linux ATTENTI ON Reset to default will erase all data stored in dev mtdblock4 If you have stored data in the writable partition you will need to back up these files before resetting the system to default On the UC 8410 8416 8418 8430 the directories tmp etc usr local bin usr local sbin usr local lib usr local libexec and home are mounted on dev mtdblock4 This means that all of the data stored in these directories will be destroyed after resetting to default Enabling and Disabling Daemons The following daemons are enabled when the UC 8410 8416 8418 8430 8430 boots up for the first time snmpd SNMP Agen
90. p tcp s 192 168 0 1 j ACCEPT Example 3 Accept TCP packets from Class C network 192 168 1 0 24 iptables A INPUT i eth0 p tcp s 192 168 1 0 24 j ACCEPT Example 4 Drop TCP packets from 192 168 1 25 iptables A INPUT i eth0 p tcp s 192 168 1 25 j DROP Example 5 Drop TCP packets addressed for port 21 modprobe xt tcpudp iptables A INPUT i eth0 p tcp dport 21 j DROP Example 6 Accept TCP packets from 192 168 0 24 to LAN1 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 the LAN1 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 modprobe xt mac iptables A INPUT i eth0 p all m mac mac source 01 02 03 04 05 06 j DROP NOTE In Example 8 remember to issue the command modprobe ipt mac first to load the module xt mac 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 Typically the UC 8410 8416 8418 8430 8430 connects several devices on a network and maps local inside network addresses to one or more global outside IP addresses and un maps the global IP addresses on incoming packets back into local IP addresses NOTE Click the following link for more information about iptable
91. r b Right click on Local Area Connection and then select Properties s Network Connections File Edit View Favorites Tools Advanced Help al Q a yo Search E Folders Ea Address S Network Connections LANorHigh Speed Internet Network Tasks ocal Area Connection Create a new Disable connection fQ Set up a home or small gtatus office network Repair Change Windows Firewall settings Disable this network Create Shortcut device Delet EN Repair this connection t Rename this connection View status of this connection Ej Change settings of this connection Bridge Connections Rename Other Places E Control Panel My Network Places E My Documents j My Computer Details Local Area Connection UC 8410 8416 8418 8430 Firmware Upgrade Procedure c Click the General tab and select Internet Protocol TCP IP and then click on Properties 4 Local Area Connection Properties General Authentication Advanced Connect using E SiS 900 PCI Fast Ethernet Adapter This connection uses the following items r2 ll Client for Microsoft Networks dal File and Printer Sharing for Microsoft Networks a QoS Packet Scheduler Internet Protocol TCP IP Uninstall Properties Description Transmission Control Protocol Internet Protocol The default wide area network protocol that provides communication across diverse interconn
92. ration file etc openvpn tun conf 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 174 192 168 2 173 up etc openvpn tun sh Next modify the routing table in the etc openvpn tun sh script file bin sh value after net is the subnet behind the remote peer route add net 192 168 2 0 netmask 255 255 255 0 gw 5 Note that the parameter ifconfig defines the first argument as the local internal interface and the second argument as the internal interface at the remote peer Note that 5 is the argument that the OpenVPN program passes to the script file Its value is 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 Flags Metric Ref Use Iface 192 168 4 174 255 255 255 255 UH 0 0 0 tunO 192 168 4 0 192 168 4 174 255 255 255 0 UG 0 0 0 tunO 192 168 2 0 255 255 255 0 U 0 0 0 eth1 192 168 8 0 255 255 255 0 U 0 0 0 etho Package Management ipkg ipkg is a very lightweight package management system It also allows for dynamic installation removal of packages on a running system Because the disk space is limited we provide the software as extension packages You can use ipkg cl to install or remove ipk packages on the UC 8410 8416
93. rect such errors and these changes are incorporated into new editions of the publication Technical Support Contact Information Moxa Americas Toll free 1 888 669 2872 Tel 1 714 528 6777 Fax 1 714 528 6778 Moxa Europe Tel 49 89 3 70 03 99 0 Fax 49 89 3 70 03 99 99 www moxa com su ort Moxa China Shanghai office Toll free 800 820 5036 Tel 86 21 5258 9955 Fax 86 10 6872 3958 Moxa Asia Pacific Tel 886 2 8919 1230 Fax 886 2 8919 1231 Table of Contents 1 PMtrOCUCTION RR 1 1 OVERVIEW Saak faac aed eme etat ta etate re ctae uer ahh D LAE CU S UI C e Rita E CEA LULA CU a LA iU nA dU Ua ecd 1 2 Software ATENISClU nt tee ea cea ea A E E E MR nit 1 2 Journaling Flash File System JFFS2 0ocoooccccccccccnccncnnoncnnnnnnnnn nono I he hehe hehehe ente hte nr rn eterna 1 3 S ftware Features A alba a aia va ata ate i 1 3 2 Getting Started AAA A 2 1 Powering on the UC 8410 8416 8418 8430 0c seen esse is ess esses nennen 2 2 Connecting the UC 8410 8416 8418 8430 8430 to a PC ieee sene esses hes enn 2 2 Serial Consoles io oiea aaa AAA EAT A ata vee ead ye shay r aE n Ean an A ADN 2 2 Telnet Console OR POS E EE A 2 3 A PAT 2 4 Configuring the Ethernet Interface ii ea 2 5 Modifying Network Settings with the Serial Console ooooococccccccoccncoconcnnnnnnnnnnnnnnnnnnnnnnnnnnnnn nn nn een 2 5 Modifying Network Settings over the Network o ocococccccccccnc
94. remove power source first before inserting or removing the CompactFlash card The UC 8410 8416 8418 8430 8430 CF card doesn t support PNP This means that user need to mount the CF card manually after inserting the CF mass storage You can mount the CF card manually with the command below Moxa mkdir home sda Moxa mount t ext2 dev sdal home sda You should umount the CF mass storage before you remove the CF card Moxa umount home sda 3 11 4 Managing Communication In this chapter we explain how to configure the UC 8410 8416 8418 8430 s various communication functions The following topics are covered in this chapter O Telnet FTP O DNS O Web Service Apache O IPTABLES O NAT gt NAT Example Enabling NAT at Bootup a Dial up Service PPP PPPoE a a NFS Network File System Client gt Setting up the UC 8410 8416 8418 8430 8430 as an NFS Client Mail SNMP OpenVPN Package Management ipkg Qaqagaga a Audio Playing and Recording gt Volume Control gt Playing a WAVE File gt Recording a WAVE file UC 8410 8416 8418 8430 Managing Communication Telnet FTP In addition to supporting Telnet client server and FTP client server the UC 8410 8416 8418 8430 8430 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 sho
95. rom LAN 1 Load from serial with Xmodem z Abort select Connected 0 02 15 vT100 115200 8 N 1 A 10 UC 8410 8416 8418 8430 Firmware Upgrade Procedure 5 To start the TFPF server double click on the tftpd32 icon to launch the TFTP server DER File Edit View Favorites Tools Help Q x Q B Pp Search ires E Address o C TFTP 3 A file_id diz FWR LIC8410 V1 0 Build 08 File and Folder Tasks DIZ File FH HFM File 1KB 746 KB 10 746 KB I Make a new folder Publish this folder to the TFTPD32 HLP Web r tftpd32 exe Help File P 33 KB E Share this folder VENDINFO DIZ DIZ File Other Places 4KB sa Sys TW C E My Documents O Shared Documents 3 My Computer amp My Network Places Details TFTP File Folder Date Modified Today September 02 2009 2 54 PM 6 When the TFTP server has been launched the following screen will appear TF TPD32 by Ph Jounin Base Directory fe ATFTPMttpd32d Show Dir d Server interfaces 122 168 11 y Current Action Listening on port 53 Settings Help A 11 UC 8410 8416 8418 8430 Firmware Upgrade Procedure 7 Go back to the boot loader utility menu and enter the file name of the firmware image UC 8410 HyperTerminal DEX Fie Edi View Call Transfer Help De 383 ma Please input the select lt lt lt Main Menu gt gt gt MOXA Boot Loader Version 1 1 4 CPU Endian BE Make date Oct 7 2008 18 17 25 Module Type
96. ror mode n break case DIO ERROR CONTROL printf DIO error control n break case DIO ERROR DURATION printf DIO error duratoinin 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 FNAME tdio CC2xscale linux gcc STRIP xscale linux strip release CC o FNAME FNAME c lmoxalib lpthread STRIP s FNAME debug CC DDEBUG o FNAME dbg FNAME cxx lmoxalib lpthread clean bin rm f FNAME FNAME dbg o Note For the UC 8418 8 additional digital input channels and 8 additional digital output channels are provided The port numbers for these go from 4 to 11 UART The normal tty device node is located at dev ttyMO ttyM7 and the modem tty device node is located at dev cumO cum7 The UC 8410 8416 8418 8430 8430 supports Linux standard termios control The Moxa UART Device API allows you to configure ttyMO to ttyM7 as RS 232 RS 422 4 wire RS 485 or 2 wire RS 485 The UC 8410 8416 8418 8430 8430 supports RS 232 RS 422 2 wire RS 485 and 4 wire RS485 5 12 UC 8410 8416 8418 8430 Programmer s Guide You must include lt moxadevice h gt define RS232 MODE 0 define RS485 2WIRE MODE 1 define RS422 MODE 2 define RS485 A4WIRE MODE 3 1 Function MOXA SET OP MODE int ioctl fd MOXA SET OP MODE amp mode Description Set the interface mod
97. s and NAT http www netfilter org documentation HOWTO NAT HOWTO html 4 8 UC 8410 8416 8418 8430 Managing Communication NAT Example The IP address of LAN1 is changed to 192 168 3 127 you will need to load the module ipt MASQUERADE IP Netmask 192 168 3 100 24 Gateway 192 168 3 127 PC1 Linux or Windows LANI 192 168 3 127 24 LAN2 192 168 4 127 24 PC Linux or Windows IP Netmask 192 168 4 100 24 Gateway 192 168 4 127 NAT Area Private IP echo 1 gt proc sys net ipv4 ip forward modprobe ip tables modprobe iptable filter modprobe ip conntrack modprobe iptable nat modprobe ipt MASQUERADE iptables t nat A POSTROUTING o eth0 j SNAT to source 192 168 3 127 Sh gi Ur Ur Mops or 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 UC 8410 8416 8418 8430 8430 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 sh EXIF eth0 This is an external interface for setting up a valid IP address EXNET 192 168 4 0 24 This is an internal network address Step 1 Insert modules Here 2 dev nu
98. sing a modem and requires authorization with a username and password pppd dev ttyMO 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 4 12 UC 8410 8416 8418 8430 Managing Communication wn 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 The following example does not check the username and password pppd dev ttyM0 115200 crtscts modem 192 168 16 1 192 168 16 2 PPPoE 1 Connect the UC 8410 8416 8418 8430 s LAN port to an ADSL modem with a cross over cable HUB or switch 2 Log in to the UC 8410 8416 8418 8430 8430 as the root user 3 Edit the file etc ppp chap secrets and add the following username lhinet net password Secrets for authentication using CHAP client server secret IP addresses PPPOE example if you want to use it you need to unmark it and modify it usernamethinet net me password B 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 4 Editthe file etc ppp pap secrets and add the following username lhinet net password support hostname stats hostname 4 OUTBOUND connections
99. t daemon telnetd Telnet Server Client daemon inetd Internet Daemons ftpd FTP Server Client daemon sshd Secure Shell Server daemon e httpd Apache WWW Server daemon 1 Type the command ps to list all processes currently running root Moxa cd etc root Moxa etc ps o PID USER VSZ STAT COMMAND root LSO asque 13 root SW kthreadd root SW lt ksoftirgd 0 root events 0 FOGE SW khelper root SW kblockd 0 root kseriod TOON SW pdflush iU 0 0 iU 0 0 0 Loot 0 SW pdf lush root 0 kswapd0 root 0 SW aio 0 root 0 SW mtdblockd 0 ixp400 eth time 0 0 0 0 0 0 0 0 0 ixp400 eth time TOGT root SW root DINES EthMac Recovery POOR KOGU SW lt khubd scsi eh 0 root TOGT usb storage root jffs2_gcd_mtd4 ixp400 eth0 BOO ixp400 eth1 root 1360 bin inetd root 125936 usr bin httpd k start d etc apache bin ISO bin portmap root 2412 bin sh login root 1360 bin snmpd c public root 3508 bin sshd f etc ssh sshd_config EGO rpciod 0 li UC 8410 8416 8418 8430 Managing Embedded Linux 1292 8 bin reportip 12560 usr bin httpd etc apache 12560 usr bin httpd etc apache 12560 usr bin httpd etc apache 12560 usr bin httpd etc apache 12560 usr bin httpd etc apache 2 To run a private daemon edit the file rc local as follows ed etc rc d vi rc local root Moxa
100. t directory 4 16 UC 8410 8416 8418 8430 Managing Communication Setup 1 Ethernet Bridging for Private Networks on Different Subnets 1 Setup four machines as shown in the following diagram local net Host A OpenVPN A LAN1 192 168 2 173 LAN1 192 168 2 171 LAN2 192 168 8 173 Internet LAN2 192 168 8 174 LAN1 192 168 4 172 LAN1 192 168 4 174 OpenVPN A local net Host A B represents one of the machines that belongs to OpenVPN A B The two remote subnets are configured for a different range of IP addresses When this setup is moved to a public network the external interfaces of the OpenVPN machines should be configured for static IPs or connect to another device such as a firewall or DSL box first openvpn genkey secret secrouter key Copy the file that is generated to the OpenVPN machine 2 The openvpn bridge script file located at etc openvpn reconfigures the interface eth1 as IP less creates logical bridge s and TAP interfaces loads modules and enables IP forwarding d Start bin sh iface ethl defines the internal interface maxtap expr 1 defines the number of tap devices I e of tunnels IPADDR NETMASK BROADCAST it is not a great idea but this system doesn t support etc sysconfig network scripts ifcfg ethl ifcfg vpn 1 while read f1 f2 f3 f4 r3 do if
101. t for the connect option The options for chat are given below 4 10 UC 8410 8416 8418 8430 Managing Communication vV verbose mode log what we do to syslog ow Double quotes don t wait for a prompt but instead do note that you must include a space after the second quotation mark ATDT5551212 Dial the modem and then CONNECT Wait for an answer Send a return null text followed by the usual return ogin username word password Log in with username and password Refer to the chat man page chat 8 for more information about the chat utility dev Specify the callout serial port 115200 The baudrate Debug Log status in syslog Crtscts Use hardware flow control between the computer and modem at 115200 this is a must Modem Indicates that this is a modem device pppd will hang up the phone before and after making the call Defaultroute Once the PPP link is established make it the default route if you have a PPP link to the Internet this is probably what you want 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
102. tate for a time between 176 ms and 200 ms Output none Return reference the error code get din event int diport int mode long int duration Description To retrieve the DIN event configuration including mode DIN EVENT HIGH TO LOW or DIN EVENT LOW TO HIGH and the value of duration Input int diport which DIN port you want to retrieve The port whose din event setting we wish to retrieve int mode save which event is set unsigned long duration the duration of the DIN port is kept in high or low state return to the current duration value of diport Output mode DIN EVENT HIGH TO LOW 1 from high to low 5 9 UC 8410 8416 8418 8430 Programmer s Guide DIN EVENT LOW TO HIGH 0 from low to high DIN EVENT CLEAR 1 clear this event duration The value of duration should be 0 or 40 duration lt 3600000 milliseconds Return reference the error code Special Note Do not forget to link to the library libmoxalib a for DI DO programming and also include the header file moxadevice h The DI DO library only can be used by one program at a time Examples Example 1 File Name tdio c Description The program indicates to connect DO1 to DI1 change the digital output state to high or low by manual input and then detect and count the state changed events from DI 1 include lt stdio h gt include lt stdlib h gt include lt moxadevice h gt include fcnt
103. tate int doport int state Description To get the DOUT port state Input int doport get the current state of which DOUT port int state save the current state Output state DIO HIGH 1 for high DIO LOW 0 for low Return reference the error code set din event int diport void func int diport int mode long int duration Description Set the event for DIN when the state is changed from high to low or from low to high Input int diport the port that will be used to detect the DIN event Port numbering is from O to 3 void func int diport Not NULL gt Returns the call back function When the event occurs the call back function will be invoked NULL gt Clears this event mode DIN EVENT HIGH TO LOW 1 from high to low DIN EVENT LOW TO HIGH 0 from low to high DIN EVENT CLEAR 1 clear this event unsigned long duration 0 detect the din event DIN EVENT HIGH TO LOW or DIN EVENT LOW TO HIGH gt without duration Not O gt detect the din event DIN_EVENT_HIGH_TO_LOW or DIN_EVENT_LOW_TO_HIGH with duration The value of duration must be a multiple of 20 milliseconds The range of duration is 0 or 40 lt duration lt 3600000 milliseconds The error of the measurement is 24 ms For example if the DIN duration is 200 ms this event will be generated when the DIN pin stays in the same s
104. tected and cannot be changed by the user providing a safe zone For more information about memory map and programming refer to Chapter 5 Programmer s Guide Journaling Flash File System J FFS2 The User Root File System in the flash memory is formatted with the J ournaling Flash File System JFFS2 The formatting process places a compressed file system in the flash memory transparent to the user The J ournaling Flash File System J FFS2 which was developed by Axis Communications in Sweden puts a file system directly on the flash instead of emulating a block device It is designed for use on flash ROM chips and recognizes the special write requirements of a flash ROM chip JFFS2 implements wear leveling to extend the life of the flash disk and stores the flash directory structure in the RAM A log structured file system is maintained at all times The system is always consistent even if it encounters crashes or improper power downs and does not require fsck file system check on boot up JFFS2 is the newest version of JFFS It provides improved wear leveling and garbage collection performance improved RAM footprint and response to system memory pressure improved concurrency and support for suspending flash erases marking of bad sectors with continued use of the remaining good sectors which enhances the write life of the devices native data compression inside the file system design and support for hard links The key feat
105. ting the Time Automatically 0 es enm e mh me e hes he nn esi he este nte inten 3 9 Cron Daemon to Execute Scheduled Commands semen memes 3 10 Gonnecting Peripherals iaa 3 11 USB Mass Storage d o IR MO MR ME M MEE ME ME M M MM VUA MM M EAM M EM ME 3 11 GF Mass Storage ssec eie A t ue eR e TAE ENT E TET 3 11 4 Managing Communication oocccnonncnnnncnnnncnnnncnnnncnnnncnnrn enn near near nen nn ees ease eee su siu u dadas auus auus nnn nnn 4 1 TSTMS TIP id uet erat eruta nate O d el ae ee a 4 2 DNS catarata ataca decenter ccr delet ed dede Lee Cen cd ARCA ptem PLA LLLA t erect etc cade M mene dena 4 2 WebService Ap ach 6 cscs eret EU EN UE NU NU UI QT I Nee T tr NI UTI 4 3 IPTABLES a Aa ae A Ai Aa a A a aa A AA A Tm all ADE 4 4 NA E PAE cla A A oL aval eru epp dled Pret etaed esa e dee NO Dodo DD MUT E PUR 4 8 NAT Example EI EE 4 9 E abling NAT at ce e iU eee PP EE 4 9 Dial p ServICe PPP te exter asas 4 10 PPPOE eu ciuteletefetetatetacateccteteteteteletutatutataloC ota tete stet ute totu nto or EA La Co LL ceca 4 13 NES Network File System Client et eeeece reno temere xmas xe tea Ru e AR Rt ER steel 4 15 Setting up the UC 8410 8416 8418 8430 8430 as an NFS Client sss 4 15 Mallizzibist etie eie iio ba Ug bd gs 4 15 clu O EE EE E EEEE E AAEE EEEE E E T O 4 16 OPENVPN E 4 16 Package Managemient IpKg ries ins o iaaa ann Aaaa e
106. tions ethO 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 ethO If you use LAN2 to connect to the ADSL modem then add etc ppp options eth1 The file context is shown below 102921 650 3 127 Purley name username hinet net mtu 1492 mru 1492 defaultroute noipdefault 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 Set up DNS If you are using DNS servers supplied by your ISP edit the file etc resolv conf by adding the following lines of code 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 Use the following command to create a pppoe connection pppd etho The ethO is what is connected to the ADSL modem LAN port The example above uses LANI To use LAN2 type pppd eth1 Type ifconfig pppO to check if the connection is OK or has failed If the connection is OK you will see information about the pppO setting for the IP address Use ping to test the IP If you want to disconnect it use the kill command to kill the pppd process 4 14 UC 8410 8416 8418 8430 Managing Communication NFS Network File System Client The Network File System NFS is used to mount a disk partition on a
107. ts as they are about to be sent out Examples iptables P INPUT DROP iptables P OUTPUT ACCEPT iptables P FORWARD ACCEPT modprobe iptable nat iptables t nat P PREROUTING ACCEPT iptables t nat P OUTPUT ACCEPT iptables t nat P POSTROUTING ACCEPT In this example the policy accepts outgoing packets and denies incoming packets Append or delete rules Usage iptables t table AI INPUT OUTPUT FORWARD io interface p tcp udp icmp all s IP network sport ports d IP network dport ports j ACCEPT DROP A Append one or more rules to the end of the selected chain l Insert one or more rules in the selected chain as the given rule number Name of an interface via which a packet is going to be received 0 Name of an interface via which a packet is going to be sent p The protocol of the rule or of the packet to check S Source address network name host name network IP address or plain IP address sport Source port number d Destination address 4 7 UC 8410 8416 8418 8430 Managing Communication dport Destination port number j Jump target Specifies the target of the rules i e how to handle matched packets For example ACCEPT the packet DROP the packet or LOG the packet Examples Example 1 Accept all packets from lo interface iptables A INPUT i lo j ACCEPT Example 2 Accept TCP packets from 192 168 0 1 iptables A INPUT i eth0
108. ures of JFFS2 are Targets the Flash ROM directly e Robustness e Consistency across power failures No integrity scan fsck is required at boot time after normal or abnormal shutdown Explicit wear leveling Transparent compression Although JFFS2 is a journaling file system this does not preclude the loss of data The file system will remain in a consistent state after power failures and will always be mountable However if the board is powered down during a write then the incomplete write will be rolled back on the next boot but writes that have already been completed will not be affected Additional information about J FFS2 is available on the following websites http sources redhat com jffs2 jffs2 pdf http developer axis com software jffs http www linux mtd infradead org Software Features Linux Kernel Version 2 6 23 Protocol Stack TCP UDP IPv4 SNMP V1 ICMP ARP HTTP CHAP PAP SSH 1 0 2 0 SSL DHCP NTP NFS Telnet FTP PPP PPPoE OpenVPN File System JFFS2 NFS Ext2 Ext3 System Utilities bash busybox tinylogin telnet ftp ssh scp telnetd telnet Server daemon ftpd FTP server daemon sshd secure shell server Apache web server daemon supporting PHP and XML 1 3 UC 8410 8416 8418 8430 I ntroduction openvpn virtual private network service manager pppd dial in out over serial port daemon snmpd snmpd agent daemon openssl open SSL Application Development
109. v 30 1003 rw rw rw JL Bus SES 12904012 Nov 29 10 24 FWR uc8400 Va b c Build YYMMDDHH hfm 226 Transfer complete ftp get FWR uc8400 Va b c Build YYMMDDHH hfm local FWR uc8400 Va b c Build YYMMDDHH hfm remote FWR uc8400 Va b c Build YYMMDDHH hfm 200 Port command successful 3 3 UC 8410 8416 8418 8430 Managing Embedded Linux 150 Opening data connection for FWR uc8400 Va b c Build YYMMDDHH hfm 226 Transfer complete 12904012 bytes received in 2 17 secs 5925 8 kB s ftp 3 Next use the upgradehfm command to upgrade the kernel and root file system upgradehfm FWR uc8400 Va b c Build YYMMDDHH hfm root Moxa mnt ramdisk upgradehfm FWR uc8400 Va b c Build YYMMDDHH hfm Moxa UC 8400 Upgrade firmware utility version 1 0 To check source firmware file context The source firmware file conext is OK This step will upgrade firmware All the data on flash will be destroyed Do you want to continue Y N Now upgrade the file redboot Format MID device dev mtd0 MTD device dev mtd0 erase 128 Kibyte 60000 100 complete Wait to write file Completed 100 Now upgrade the file kernel Format MTD device dev mtdl MTD device dev mtd1 erase 128 Kibyte 1a0000 100 complete Wait to write file Completed 100 Now upgrade the file root file system Format MTD device dev mtd2 MTD device dev mtd2 erase 128 Kibyte e00000 100 complete Wait to write file Completed 100 N
110. ws the default content of the file etc inetd conf The default is to enable the Telnet ftp server discard dgram udp wait root bin discard discard stream tcp nowait root bin discard telnet stream tcp nowait root bin telnetd ftp stream tcp nowait root bin ftpd 1 Disabling the Telnet ftp server Disable the daemon by typing in front of the first character of the row to comment out the line DNS The UC 8410 8416 8418 8430 8430 supports DNS client but not DNS server To set up DNS client you need to edit three configuration files etc hosts etc resolv conf and etc nsswitch conf etc hosts This is the first file that the Linux system reads to resolve the host name and IP address etc resolv conf This is the most important file that you need to edit when using DNS for the other programs For example before using ntpdate time nist gov to update the system time you will need to add the DNS server address to the file Ask your network administrator which DNS server address you should use The DNS server s IP address is specified with the nameserver command For example add the following line to etc resolv conf if the DNS server s IP address is 168 95 1 1 nameserver 168 95 1 1 qood sos A IS rootfMoxa etcf cat resolv conf resolv conf This file is the resolver configuration file See resolver 5 nameserver 192 168 1 16 nameserver 168 95 1 1 nameserver 140 115 1 31 nameserver 140 11

Download Pdf Manuals

image

Related Search

Related Contents

Leia - AGR - Agricultura de Precisão    MANUAL LIGHT PULSE  E-12、Day Tripper サドルバック取り付け説明書 ※注意事項※ ・この  Guía de inicio rápido del grabador digital TVR 12HD  Asahi Pentax ZX-5N Operating Manual  Technoline WS 9415 weather station  Epson GT-1500 User's Guide  Rosen G10 Owner`s manual  BEDIENUNGSANLEITUNG  

Copyright © All rights reserved.
Failed to retrieve file