Arm-based Computer Linux
User’s Manual for Debian 9
Version 4.1, September 2019
www.moxa.com/product
© 2019 Moxa Inc. All rights reserved.
Arm-based Computer Linux
Moxa China (Shanghai office)
User’s Manual for Debian 9
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
© 2019 Moxa Inc. All rights reserved.
Trademarks
The MOXA logo is a registered trademark of Moxa Inc.
All other trademarks or registered marks in this manual belong to their respective manufacturers.
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 correct such errors, and these changes are incorporated into new editions of the publication.
Technical Support Contact Information
www.moxa.com/support
-free: 1-888-669-2872
+1-714-528-6777
+1-714-528-6778
+49-89-3 70 03 99-0
+49-89-3 70 03 99-99
+91-80-4172-9088
+91-80-4132-1045
-free: 800-820-5036
+86-21-5258-9955
+86-21-5258-5505
+886-2-8919-1230
-Pacific
+886-2-8919-1231
Table of Contents
1. Introduction ...................................................................................................................................... 1-1
2. Getting Started.................................................................................................................................. 2-1
Connecting to the Arm-based Computer ................................................................................................ 2-2
Connecting through the Serial Console ........................................................................................... 2-2
Connecting Through the SSH Console ............................................................................................ 2-4
User Account Management ................................................................................................................... 2-6
Switching to the Root Account ...................................................................................................... 2-6
Creating and Deleting User Accounts ............................................................................................. 2-6
Disabling the Default User Account ................................................................................................ 2-6
Network Settings ................................................................................................................................ 2-7
Configuring Ethernet Interfaces ..................................................................................................... 2-7
System Administration ........................................................................................................................ 2-8
Querying the Firmware Version ..................................................................................................... 2-8
Adjusting the Time ...................................................................................................................... 2-8
Setting the Time Zone ................................................................................................................. 2-9
Determining Available Drive Space ...................................................................................................... 2-10
Shutting Down the Device .................................................................................................................. 2-10
3. Advanced Configuration of Peripherals ............................................................................................. 3-1
Serial Ports ........................................................................................................................................ 3-2
Changing the Terminal Settings .................................................................................................... 3-2
USB Port ............................................................................................................................................ 3-3
USB Automount .......................................................................................................................... 3-3
CAN Bus Interface .............................................................................................................................. 3-3
Configuring the Socket CAN Interface ............................................................................................ 3-3
CAN Bus Programming Guide ........................................................................................................ 3-4
Real COM Mode Configuration .............................................................................................................. 3-6
Mapping TTY Ports ....................................................................................................................... 3-6
Mapping tty Ports (automatic) ....................................................................................................... 3-7
Mapping tty Ports Manually ........................................................................................................... 3-7
Removing Mapped TTY Ports ......................................................................................................... 3-7
4. Configuring of Wireless Connectivity................................................................................................. 4-1
Configuring the Cellular Connection ...................................................................................................... 4-2
Using Cell_mgmt ......................................................................................................................... 4-2
Dial-Up Step-by-Step ................................................................................................................... 4-4
Dial-Up ...................................................................................................................................... 4-4
Cellular Module ........................................................................................................................... 4-6
Configuring the NB-IoT/Cat. M1 Connection (UC-2114 and UC-2116 only) .......................................... 4-9
GPS ......................................................................................................................................... 4-10
Configuring the Wi-Fi Connection ........................................................................................................ 4-11
Configuring WPA2 Settings ......................................................................................................... 4-11
5. Security ............................................................................................................................................. 5-1
Sudo Mechanism ................................................................................................................................ 5-2
Cybersecurity—Moxa Security Utility ..................................................................................................... 5-3
Installing the Moxa Security Utility ................................................................................................ 5-3
Uninstalling the Moxa Security Utility ............................................................................................. 5-3
Utilizing the Moxa Security Utility .................................................................................................. 5-3
6. Firmware Update and System Recovery ............................................................................................ 6-1
Firmware Update and Set-to-Default Functions ....................................................................................... 6-2
Set-to-Default ............................................................................................................................. 6-2
Firmware Update Using a TFTP Server............................................................................................ 6-2
7. Programmer’s Guide ......................................................................................................................... 7-1
Linux Toolchain .................................................................................................................................. 7-2
Introduction................................................................................................................................ 7-2
Native Compilation ...................................................................................................................... 7-2
Cross Compilation ....................................................................................................................... 7-3
Example program—hello .............................................................................................................. 7-4
Example Makefile ........................................................................................................................ 7-5
Standard APIs .................................................................................................................................... 7-6
Cryptodev .................................................................................................................................. 7-6
WDT (Watch Dog Timer) .............................................................................................................. 7-6
RTC (Real-time Clock) .................................................................................................................. 7-8
Modbus ...................................................................................................................................... 7-9
Moxa Platform Libraries ..................................................................................................................... 7-10
Error Numbers .......................................................................................................................... 7-10
Platform Information ................................................................................................................. 7-11
Buzzer ..................................................................................................................................... 7-12
Digital I/O ................................................................................................................................ 7-13
UART ....................................................................................................................................... 7-15
LED ......................................................................................................................................... 7-18
Push Button .............................................................................................................................. 7-19
1
1. Introduction
This user manual is applicable to Moxa’s Arm-based computers listed below and covers the complete set of
instructions applicable to all the supported models. Detailed instructions on configuring advanced settings
are covered in Chapter 3 & Chapter 4 of the manual. Before referring to sections in chapters 3 & 4, make
sure that the hardware specification of your computer model supports the functions/settings covered in
these sections.
Moxa’s Arm-based Computing Platforms:
• UC-2100 Series
• UC-2100-W Series
• UC-3100 Series
• UC-5100 Series
• UC-8100 Series (firmware V3.0.0 and higher)
• UC-8100-ME-T Series (Model with Moxa Industrial Linux preinstalled)
• UC-8100A-ME-T Series
• UC-8200 Series
Moxa Industrial Linux
Moxa Industrial Linux (MIL) is the optimized Linux distribution for Industrial applications and users, which is
released and maintained by Moxa.
The MIL is based on Debian and integrated with several feature sets designed for strengthening and
accelerating user’s application development as well as ensuring the reliability of system deployment.
Furthermore, the major versions of MIL comply with Moxa’s Superior long term support (SLTS) policy. Moxa
will maintain each version of the MIL for 10 years from its launch date. The extended support (ES) may also
be purchased by request for additional maintenance. This makes MIL an optimal choice as a Linux operating
system for industrial applications.
2
2. Getting Started
In this chapter, we describe how to configure the basic settings Moxa’s Arm-based computers.
The following topics are covered in this chapter:
Connecting to the Arm-based Computer
Connecting through the Serial Console
Connecting Through the SSH Console
User Account Management
Switching to the Root Account
Creating and Deleting User Accounts
Disabling the Default User Account
Network Settings
Configuring Ethernet Interfaces
System Administration
Querying the Firmware Version
Adjusting the Time
Setting the Time Zone
Determining Available Drive Space
Shutting Down the Device
Arm-based Computer Linux UM Getting Started
ATTENTION
For security reasons, we recommend that you disabl
These steps apply to the Linux
. Do NOT apply these
steps to the
user@PC1:~# yum -y install minicom
user@PC2:~# apt-get install minicom
Connecting to the Arm-based Computer
You will need another computer to connect to the Arm-based computer and log on to the command line
interface. There are two ways to connect: through serial console cable or through Ethernet cable. Refer to
the Hardware Manual to see how to set up the physical connections.
The default login username and password are:
Username: moxa
Password: moxa
The username and password are the same for all serial console and SSH remote log in actions. Root account
login is disabled until you manually create a password for the account. The user moxa is in the sudo group
so you can operate system level commands with this user using the
see the Sudo Mechanism section in chapter 5.
sudo command. For additional details,
e the default user account and create your own user
Connecting through the Serial Console
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 two IP addresses in order to connect to
the Arm-based computer. To connect through the serial console, configure your PC’s terminal software using
the following settings.
Serial Console Port Settings
Baudrate 115200 bps
Parity None
Data bits 8
Stop bits 1
Terminal VT100
Below we show how to use the terminal software to connect to the Arm-based computer in a Linux
environment and in a Windows environment.
Linux Users
Arm-based computer itself.
Take the following steps to connect to the Arm-based computer from your Linux PC.
1. Install minicom from the package repository of your operating system.
For Centos and Fedora:
For Ubuntu and Debian:
2. Use the minicom –s command to enter the configuration menu and set up the serial port settings.
PC you are using to connect to the Arm-based computer
Arm-based Computer Linux UM Getting Started
These steps apply to the Windows PC you are using to connect to the
3. Select Serial port setup.
4. Select A to change the serial device. Note that you need to know which device node is connected to the
Arm-based computer.
5. Select E to configure the port settings according to the Serial Console Port Settings table provided.
6. Select Save setup as dfl (from the main configuration menu) to use default values.
7. Select Exit from minicom (from the configuration menu) to leave the configuration menu.
8. Execute minicom after completing the above configurations.
Windows Users
Take the following steps to connect to the Arm-based computer from your Windows PC.
1. Download PuTTY http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
connection with the Arm-based computer in a Windows environment. The figure below shows a simple
example of the configuration that is required.
Arm-based computer. Do NOT apply
Arm-based computer itself.
to set up a serial
Arm-based Computer Linux UM Getting Started
. Do NOT apply these
steps to the
address of your notebook/PC's Ethernet interface in the
user@PC1:~ ssh moxa@192.168.3.127
The authenticity of host ‘192.168.3.127’ can’t be established.
Are you sure you want to continue connection (yes/no)? yes_
2. Once the connection is established, the following window will open.
3. Select the Serial connection type and choose settings that are similar to the Minicom settings.
Connecting Through the SSH Console
The Arm-based computer supports SSH connections over an Ethernet network. Use the following default IP
addresses to connect to the Arm-based computer.
Port Default IP
LAN 1 192.168.3.127
LAN 2 192.168.4.127
Linux Users
e steps apply to the Linux PC you are using to connect to the Arm-based computer
Arm-based computer itself. Before you run the ssh command, be sure to configure the IP
range of 192.168.3.0/24 for LAN1 and
Use the ssh command from a Linux computer to access the Arm-based computer’s LAN1 port.
Type yes to complete the connection.
RSA key fingerprint is 8b:ee:ff:84:41:25:fc:cd:2a:f2:92:8f:cb:1f:6b:2f.
Arm-based Computer Linux UM Getting Started
ATTENTION
Rekey SSH regularly
In order to secure your syst
When prompted for a passphrase, leave the passphrase empty and press enter.
moxa@Moxa:~$ sudo /etc/init.d/ssh restart
For more information about SSH, refer to the following link.
https://wiki.debian.org/SSH
em, we suggest doing a regular SSH-rekey, as shown in the following steps:
moxa@Moxa:~$ sudo rm –rf
ssh_host_ed25519_key2 ssh_host_ecdsa_key ssh_host_rsa_key
ssh_host_ed25519_key.pub ssh_host_ecdsa_key.pub ssh_host_rsa_key.pub
moxa@Moxa:~$ sudo ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
moxa@Moxa:~$ sudo ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
moxa@Moxa:~$ sudo ssh-keygen -t ecdsa –f /etc/ssh/ssh_host_ecdsa_key
Windows Users
Take the following steps from your Windows PC.
Click on the link http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
(free software) to set up an SSH console for the Arm-based computer in a Windows environment. The
following figure shows a simple example of the configuration that is required.
to the Windows PC you are using to connect to the Arm-based computer. Do NOT apply
Arm-based computer itself.
to download PuTTY
Arm-based Computer Linux UM Getting Started
Click the following link for more information on the sudo command.
https://wiki.debian.org/sudo
moxa@Moxa:~# sudo useradd -m -G sudo -s /bin/bash test1
moxa@Moxa:~# sudo passwd test1
passwd: password updated successfully
moxa@Moxa:# sudo userdel test1
ATTENTION
You should first create a user account before you disable
root@Moxa:# passwd –l moxa
root@Moxa:# passwd –u moxa
User Account Management
Switching to the Root Account
You can switch to root using sudo -i (or sudo su ). For security reasons, do not operate the all
commands from the
root account.
ight get the permission denied message when using pipe or redirect behavior with a non-root
ust use ‘sudo su –c’ to run the command instead of using >, <, >>, <<, etc.
: The single quotes around the full command are required.
Creating and Deleting User Accounts
You can use the useradd and userdel commands to create and delete user accounts. Be sure to
reference the main page of these commands to set relevant access privileges for the account. Following
example shows how to create a
home directory at
To change the password for test1, use the passwd option along with the new password. Retype the
password to confirm the change.
/home/test1:
Enter new UNIX password:
Retype new UNIX password:
To delete user test1, use the userdel command.
test1 user in the sudo group whose default login shell is bash and has
Disabling the Default User Account
Use the passwd command to lock the default user account so the user moxa cannot log in.
To unlock the user moxa:
the default account.
Arm-based Computer Linux UM Getting Started
moxa@Moxa:~$ cd /etc/network/
moxa@Moxa:/etc/network/~$
# interfaces(5) file used by ifup(8) and ifdown(8)
Network Settings
Configuring Ethernet Interfaces
After the first login, you can configure the Arm-based computer’s network settings to fit your application
better. Note that it is more convenient to manipulate the network interface settings from the serial console
than from an SSH login because an SSH connection can disconnect when there are network issues and the
connection must be reestablished.
Modifying Network Settings via the Serial Console
In this section, we use the serial console to configure the Arm-based computer’s network settings. Follow
the instructions in the Connecting to the Arm-based Computer section under Getting Started , to access the
Console Utility of the target computer via the serial Console port, and then type
change directories.
Type sudo vi interfaces to edit the network configuration file in the vi editor. You can configure the
Arm-based computer’s Ethernet ports to use either static or dynamic (DHCP) IP addresses.
cd /etc/network to
Setting a Static IP address
To set a static IP address for the Arm-based computer, use the iface command to modify the default
gateway, address, network, netmask, and broadcast parameters of the Ethernet interface.
auto eth0 eth1 lo
iface lo inet loopback
# embedded ethernet LAN1
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.3.127
network 192.168.3.0
netmask 255.255.255.0
broadcast 192.168.3.255
# embedded ethernet LAN2
iface eth1 inet static
address 192.168.4.127
network 192.168.4.0
netmask 255.255.255.0
Arm-based Computer Linux UM Getting Started
# embedded ethernet LAN1
iface eth0 inet dhcp
moxa@Moxa:~$ kversion
UC-2112-LX version 1.1
moxa@Moxa:~$ kversion -a
UC-2112-LX version 1.1 Build 18031118
moxa@Moxa:~$ sudo date 071123192014
Mon Jul 11 23:19:00 UTC 2014
moxa@Moxa:~$ sudo hwclock –w
2018-07-31 02:09:00.628145+0000
Click the following links for more information on
https://www.debian.org/doc/manuals/system
https://wiki.debian.org/Dat
Setting Dynamic IP Addresses:
To configure one or both LAN ports to request an IP address dynamically use the dhcp option in place of the
static in the iface command as follows:
Default Setting for LAN1 Dynamic Setting using DHCP
iface eth0 inet static
address 192.168.3.127
network: 192.168.3.0
netmask 255.255.255.0
broadcast 192.168.3.255
iface eth0 inet dhcp
System Administration
Querying the Firmware Version
To check the Arm-based computer’s firmware version, type:
Add the –a option to create a full build version:
Adjusting the Time
The Arm-based computer has two time settings. One is the system time, and the other is the RTC (Real
Time Clock) time kept by the Arm-based computer’s hardware. Use the
current system time or set a new system time. Use the
or set a new RTC time.
Use the
MM = Month
DD = Date
hhmm = hour and minute
Use the following command to set the RTC time to system time:
date MMDDhhmmYYYY command to set the system time :
date command to query the
hwclock command to query the current RTC time
moxa@Moxa:~$ sudo hwclock
date and time:
-administrator/ch-sysadmin-time.html
eTime
Arm-based Computer Linux UM Getting Started
moxa@Moxa:~$ TZ=EST5EDT
moxa@Moxa:~$ export TZ
Setting the Time Zone
There are two ways to configure the Moxa embedded computer’s timezone . One is using the TZ variable.
The other is using the /etc/localtime file.
Using the TZ Variable
The format of the TZ environment variable looks like this:
TZ=<Value>HH[:MM[:SS]][daylight[HH[:MM[:SS]]][,start date[/starttime], enddate[/endtime]]]
Here are some possible settings for the North American Eastern time zone:
1.
TZ=EST5EDT
2. TZ=EST0EDT
3. TZ=EST0
In the first case, the reference time is GMT and the stored time values are correct worldwide. A simple
change of the TZ variable can print the local time correctly in any time zone.
In the second case, the reference time is Eastern Standard Time and the only conversion performed is for
Daylight Saving Time. Therefore, there is no need to adjust the hardware clock for Daylight Saving Time
twice per year.
In the third case, the reference time is always the time reported. You can use this option if the hardware
clock on your machine automatically adjusts for Daylight Saving Time or you would like to manually adjust
the hardware time twice a year.
You must include the TZ setting in the /etc/rc.local file. T he timezone setting will be activated when
you restart the computer.
The following table lists other possible values for the TZ environment variable:
Hours From Greenwich Mean Time (GMT) Value Description
0 GMT Greenwich Mean Time
+1 ECT European Central Time
+2 EET European Eastern Time
+2 ART
+3 EAT Saudi Arabia
+3.5 MET Iran
+4 NET
+5 PLT West Asia
+5.5 IST India
+6 BST Central Asia
+7 VST Bangkok
+8 CTT China
+9 JST Japan
+9.5 ACT Central Australia
+10 AET Eastern Australia
+11 SST Central Pacific
+12 NST New Zealand
-11 MIT Samoa
-10 HST Hawaii
-9 AST Alaska
-8 PST Pacific Standard Time
-7 PNT Arizona
Arm-based Computer Linux UM Getting Started
tmpfs 50M 0 50M 0% /run/shm
moxa@Moxa:~$ sudo shutdown -h now
Hours From Greenwich Mean Time (GMT) Value Description
-7 MST Mountain Standard Time
-6 CST Central Standard Time
-5 EST Eastern Standard Time
-5 IET Indiana East
-4 PRT Atlantic Standard Time
-3.5 CNT Newfoundland
-3 AGT Eastern South America
-3 BET Eastern South America
-1 CAT Azores
Using the Localtime File
The local timezone is stored in the /etc/localtime and is used by GNU Library for C (glibc) if no value
has been set for the TZ environment variable. This file is either a copy of the
or a symbolic link to it. The Arm-based computer does not provide
should find a suitable time zone information file and write over the original local time file in the Arm-based
computer.
/usr/share/zoneinfo/ files. You
/usr/share/zoneinfo/ file
Determining Available Drive Space
To determine the amount of available drive space, use the df command with the –h tag. The system will
return the amount of drive space broken down by file system. Here is an example:
Filesystem Size Used Avail Use% Mounted on
devtmpfs 803M 238M 524M 32% /
/dev/root 803M 238M 524M 32% /
tmpfs 25M 188K 25M 1% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 10M 0 10M 0% /dev
Shutting Down the Device
To shut down the device, disconnect the power source to the computer. When the computer is powered off,
main components such as the CPU, RAM, and storage devices are powered off, although an internal clock
may retain battery power.
You can use the Linux command
However, main components such as the CPU, RAM, and storage devices will continue to be powered after
you run this command.
shutdown to close all software running on the device and halt the system.
3
3. Advanced Configuration of Peripherals
In this chapter, we include more information on the Arm-based computer’s peripherals, such as the serial
interface, storage, diagnostic LEDs, and the cellular module. The instructions in this chapter cover all
functions supported in Moxa’s Arm-based computers. Before referring to the sections in this chapter, make
sure that they are applicable to and are supported by the hardware specification of your Arm-based
computer.
The following topics are covered in this chapter:
Serial Ports
Changing the Terminal Settings
USB Port
USB Automount
CAN Bus Interface
Configuring the Socket CAN Interface
CAN Bus Programming Guide
Real COM Mode Configuration
Mapping TTY Ports
Mapping tty Ports (automatic)
Mapping tty Ports Manually
Removing Mapped TTY Ports
Arm-based Computer Linux UM Advanced Configuration of Peripherals
root@Moxa:/home/moxa# mx-uart-ctl -p 0
Current uart mode is RS422/RS485-4W interface.
moxa@Moxa:~$ sudo stty -a -F /dev/ttyM0
moxa@Moxa:~$ sudo stty 115200 -F /dev/ttyM0
Serial Ports
The serial ports support RS-232, RS-422, and RS-485 2-wire operation modes with flexible baudrate
settings. The default operation mode is set to RS-232; use the
operation mode.
Usage: mx-uart-ctl -p <#port_number> -m <#uart_mode>
Port number: n = 0,1,2,...
uart mode: As in the following table
Interface-no Operation Mode
None Display current setting
0 RS-232
1 RS-485 2-wire
2 RS-422 / RS-485 4-wire
For example, to set Port 0 to RS-485 4-wire mode, use the following command:
Current uart mode is RS232 interface.
root@Moxa:/home/moxa# mx-uart-ctl -p 0 -m 2
Set OK.
mx-uart-ctl command to change the
Changing the Terminal Settings
The stty command is used to manipulate the terminal settings. You can view and modify the serial
terminal settings with this command. Details are given below.
Displaying All Settings
The following text shows how to display all settings.
speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
Configuring Serial Settings
The following example changes the baudrate to 115200.
Arm-based Computer Linux UM Advanced Configuration of Peripherals
moxa@Moxa:~$ sudo stty -a -F /dev/ttyM0
Detailed information on the stty
http://www.gnu.org/software/coreutils/ma
moxa@Moxa:~$ mount | grep media
ATTENTION
Remember to type the
# ip link
can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT
group default qlen 10 link/can
After running this command, the baudrate will be changed to 115200.
speed 115200 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
USB Port
The Arm-based computers are provided with a USB port for storage expansion.
USB Automount
The Arm-based computers support hot plug function for connecting USB mass storage devices. However, by
default, the
command to view details about all partitions.
xit from the /media/* directory when you disconnect the storage device. If you stay in /media/usb*, the
unmount process will fail. If that happens, type #umount /media/usb* to unmount the device
automount utility (udev) only supports auto-mounting of one partition. Use the mount
.
utility is available at the following link:
nual/coreutils.html
sync command before you disconnect the USB mass storage device to prevent loss
CAN Bus Interface
The CAN ports on Moxa’s Arm-based computers support CAN 2.0A/B standard.
Configuring the Socket CAN Interface
The CAN ports are initialized by default. If any additional configuration is needed, use the ip link command
to check the CAN device.
To check the CAN device status, use the ip link command.
Arm-based Computer Linux UM Advanced Configuration of Peripherals
# ip link set can0 up type can bitrate 12500
CAN Bus Programming Guide
CAN Write
To configure the CAN device, use # ip link set can0 down to turn off the device first
# ip link
can0: <NOARP,ECHO> mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default
Here’s an example with bitrate 12500:
The following code is an example of the SocketCAN API, which sends packets using the raw interface.
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <net/if.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <linux/can.h>
#include <linux/can/raw.h>
int main(void)
{
int s;
int nbytes;
struct sockaddr_can addr;
struct can_frame frame;
struct ifreq ifr;
char *ifname = "can1";
if((s = socket(PF_CAN, SOCK_RAW, CAN_RAW)) < 0) {
perror("Error while opening socket");
return -1;
}
strcpy(ifr.ifr_name, ifname);
ioctl(s, SIOCGIFINDEX, &ifr);
addr.can_family = AF_CAN;
addr.can_ifindex = ifr.ifr_ifindex;
printf("%s at index %d\n", ifname, ifr.ifr_ifindex);
if(bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
perror("Error in socket bind");
return -2;
}
frame.can_id = 0x123;
frame.can_dlc = 2;
frame.data[0] = 0x11;
frame.data[1] = 0x22;
nbytes = write(s, &frame, sizeof(struct can_frame));
printf("Wrote %d bytes\n", nbytes);
return 0;
Arm-based Computer Linux UM Advanced Configuration of Peripherals
CAN Read
The following sample code illustrates how to read the data.
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <net/if.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <linux/can.h>
#include <linux/can/raw.h>
Int main(void)
{
int i;
int s;
int nbytes;
struct sockaddr_can addr;
struct can_frame frame;
struct ifreq ifr;
char *ifname = "can0";
if((s = socket(PF_CAN, SOCK_RAW, CAN_RAW)) < 0) {
perror("Error while opening socket");
return -1;
}
strcpy(ifr.ifr_name, ifname);
ioctl(s, SIOCGIFINDEX, &ifr);
addr.can_family = AF_CAN;
addr.can_ifindex = ifr.ifr_ifindex;
printf("%s at index %d\n", ifname, ifr.ifr_ifindex);
if(bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
perror("Error in socket bind");
return -2;
}
nbytes = read(s, &frame, sizeof(struct can_frame));
if (nbytes < 0) {
perror("Error in can raw socket read");
return 1;
}
if (nbytes < sizeof(struct can_frame)) {
fprintf(stderr, "read: incomplete CAN frame\n");
return 1;
}
printf(" %5s %03x [%d] ", ifname, frame.can_id, frame.can_dlc);
for (i = 0; i < frame.can_dlc; i++)
printf(" %02x", frame.data[i]);
printf("\n");
return 0;
After you use the SocketCAN API, the SocketCAN information is written to the paths:
/proc/sys/net/ipv4/conf/can* and /proc/sys/net/ipv4/neigh/can*
Arm-based Computer Linux UM Advanced Configuration of Peripherals
Real COM Mode Configuration
UC-8100, UC-8100-ME-T, and UC-8100A-ME-T Series do not support Real COM mode.
You can use Moxa’s NPort Series serial device drivers to extend the number of serial interfaces (ports) on
your Arm-based Moxa computer. The NPort comes equipped with COM drivers that work with Windows
systems and TTY drivers for Linux systems. The driver establishes a transparent connection between the
host and serial device by mapping the IP Port of the NPort’s serial port to a local COM/TTY port on the host
computer.
Real COM Mode also supports up to 4 simultaneous connections, so that multiple hosts can collect data from
the same serial device at the same time.
One of the major conveniences of using Real COM Mode is that Real COM Mode allows users to continue
using RS-232/422/485 serial communications software that was written for pure serial communications
applications. The driver intercepts data sent to the host’s COM port, packs it into a TCP/IP packet, and then
redirects it through the host’s Ethernet card. At the other end of the connection, the NPort accepts the
Ethernet frame, unpacks the TCP/IP packet, and then sends it transparently to the appropriate serial device
attached to one of the NPort’s serial ports.
The Real COM driver is installed on the Arm-based computer by default. You will be able to view the driver
related files in the /usr/lib/npreal2/driver folder.
> mxaddsvr (Add Server, mapping tty port) > mxdelsvr (Delete Server,
unmapping tty port)
> mxloadsvr (Reload Server) > mxmknod (Create device node/tty port)
> mxrmnod (Remove device node/tty port)
> mxuninst (Remove tty port and driver files)
At this point, you will be ready to map the NPort serial port to the system tty port. For a list of supported
NPort devices and their revision history, click https://www.moxa.com/en/support/search?psid=50278
Mapping TTY Ports
Make sure that you set the operation mode of the desired NPort serial port to Real COM mode. After logging
in as a super user, enter the directory /usr/lib/npreal2/driver and then execute mxaddsvr to map the target
NPort serial port to the host tty ports. The syntax of mxaddsvr command is as follows:
mxaddsvr [NPort IP Address] [Total Ports] ([Data port] [Cmd port])
The mxaddsvr command performs the following actions:
1. Modifies the npreal2d.cf.
2. Creates tty ports in the /dev directory with major & minor number configured in npreal2d.cf.
3. Restarts the driver.
.
Arm-based Computer Linux UM Advanced Configuration of Peripherals
# cd /usr/lib/npreal2/driver
# ./mxaddsvr 192.168.3.4 16
# cd /usr/lib/npreal2/driver
# ./mxaddsvr 192.168.3.4 16 4001 966
# cd /usr/lib/npreal2/driver
# ./mxdelsvr 192.168.3.4
Mapping tty Ports (automatic)
To map tty ports automatically, execute the mxaddsvr command with just the IP address and the number of
ports, as shown in the following example:
In this example, 16 tty ports will be added, all with IP 192.168.3.4 consisting of data ports from 950 to 965
and command ports from 966 to 981.
Mapping tty Ports Manually
To map tty ports manually, execute the mxaddsvr command and specify the data and command ports as
shown in the following example:
In this example, 16 tty ports will be added, all with IP 192.168.3.4, with data ports from 4001 to 4016 and
command ports from 966 to 981.
Removing Mapped TTY Ports
After logging in as root, enter the directory /usr/lib/npreal2/driver and then execute the mxdelsvr command
to delete a server. The syntax of mxdelsvr is:
mxdelsvr [IP Address]
Example:
The following actions are performed when the mxdelsvr command is executed:
1. Modify npreal2d.cf.
2. Remove the relevant tty ports from the /dev directory.
3. Restart the driver.
If the IP address is not provided in the command line, the program will list the installed servers and total
ports on the screen. You will need to choose a server from the list for deletion.
4
4. Configuring of Wireless Connectivity
The instructions in this chapter cover all wireless functions supported in Moxa’s Arm-based computers.
Before referring to the sections in this chapter, make sure that they are applicable to and are supported by
the hardware specification of your Arm-based computer platform.
The following topics are covered in this chapter:
Configuring the Cellular Connection
Using Cell_mgmt
Dial-Up Step-by-Step
Dial-Up
Cellular Module
Configuring the NB-IoT/Cat. M1 Connection (UC-2114 and UC-2116 only)
GPS
Configuring the Wi-Fi Connection
Configuring WPA2 Settings