Arm-based Computer Linux User’s Manual
for Debian 9
Version 5.0, November 2020
www.moxa.com/product
© 2020 Moxa Inc. All rights reserved.
Arm-based Computer Linux User’s Manual
Moxa China (Shanghai office)
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
© 2020 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
-free: 800-820-5036
+86-21-5258-9955
+49-89-3 70 03 99-0
+49-89-3 70 03 99-99
+91-80-4172-9088
+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
69BConnecting through the Serial Console ........................................................................................... 2-2
70BConnecting via the SSH Console .................................................................................................... 2-4
User Account Management ................................................................................................................... 2-6
71B 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
72B Configuring Ethernet Interfaces ..................................................................................................... 2-7
System Administration ........................................................................................................................ 2-8
74BQuerying the Firmware Version ..................................................................................................... 2-8
75BAdjusting the Time ...................................................................................................................... 2-8
76BSetting 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
77BT Changing the Serial Terminal Settings............................................................................................ 3-2
USB Port ............................................................................................................................................ 3-3
USB Automount .......................................................................................................................... 3-3
CAN Bus Interface .............................................................................................................................. 3-4
Configuring the Socket CAN Interface ............................................................................................ 3-4
CAN Bus Programming Guide ........................................................................................................ 3-4
Configuring the Real COM Mode ............................................................................................................ 3-6
Mapping TTY Ports ....................................................................................................................... 3-7
Mapping TTY Ports (automatic) ..................................................................................................... 3-7
Mapping TTY Ports (manual) ......................................................................................................... 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 Process ........................................................................................................................... 4-4
Dial-up Commands ...................................................................................................................... 4-4
Cellular Module ........................................................................................................................... 4-6
Configuring a 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...................................................................................................................... 4-11
Configuring the Bluetooth Connection .................................................................................................. 4-17
Paring Devices .......................................................................................................................... 4-18
Connecting Devices ................................................................................................................... 4-19
5. Security ............................................................................................................................................. 5-1
Sudo Mechanism ................................................................................................................................ 5-2
6. System Boot Up, Recovery, and Update ............................................................................................. 6-1
Set-to-default Functions ...................................................................................................................... 6-2
Set-to-default ............................................................................................................................. 6-2
Firmware Update Using a TFTP Server ................................................................................................... 6-2
Preparing the TFTP Server ............................................................................................................ 6-2
Updating the Firmware ................................................................................................................. 6-3
Firmware Update via APT ..................................................................................................................... 6-4
Creating a Customized Firmware Image ................................................................................................ 6-4
Boot-up Option ................................................................................................................................... 6-4
Changing the Default Boot-up Option ............................................................................................. 6-4
Preparing a Bootable SD Card ....................................................................................................... 6-6
7. Programmer’s Guide ......................................................................................................................... 7-1
Building an Application ........................................................................................................................ 7-2
Introduction................................................................................................................................ 7-2
Native Compilation ...................................................................................................................... 7-2
Cross Compilation ....................................................................................................................... 7-2
Example Program—hello............................................................................................................... 7-3
Example Makefile ........................................................................................................................ 7-5
Standard APIs .................................................................................................................................... 7-5
Cryptodev .................................................................................................................................. 7-5
Watchdog Timer (WDT) ................................................................................................................ 7-6
Real-time Clock (RTC) .................................................................................................................. 7-8
Modbus ...................................................................................................................................... 7-9
ECO Mode for Power Consumption ........................................................................................................ 7-9
Using mx-power-mgmt ................................................................................................................ 7-9
Scheduled Awakening Mode ........................................................................................................ 7-10
Conservation Mode .................................................................................................................... 7-10
Setting the SYS LEDs Using mx-power-mgmt................................................................................ 7-11
Wake-up From Conservation Mode .............................................................................................. 7-11
MCU Firmware Upgrade .............................................................................................................. 7-12
Checking the MCU mode ............................................................................................................ 7-12
Viewing the Utility and MCU Firmware Version .............................................................................. 7-12
User-defined Actions .................................................................................................................. 7-12
Moxa Platform Libraries ..................................................................................................................... 7-13
Error Numbers .......................................................................................................................... 7-13
Platform Information ................................................................................................................. 7-14
Buzzer ..................................................................................................................................... 7-15
Digital I/O ................................................................................................................................ 7-16
UART ....................................................................................................................................... 7-18
LED ......................................................................................................................................... 7-21
Push Button .............................................................................................................................. 7-22
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 and Chapter 4 of the manual. Before referring to sections in these chapters,
confirm that the hardware specification of your computer model supports the functions/settings covered
therein.
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 (Moxa Industrial Linux/Debian 9 preinstalled)
• UC-8100A-ME-T Series
• UC-8200 Series
• UC-8410A Series (Moxa Industrial Linux/Debian 9 preinstalled)
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 via 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 Debian 9 UM Getting Started
ATTENTION
For security reasons, we recommend that you disable the default user account and create your own user
accounts.
These steps apply to the Linux PC you are using to connect 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,
69BConnecting 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.
Baudrate 115200 bps
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.
152BLinux Users
Serial Console Port Settings
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.
Arm-based computer. Do NOT
Arm-based Computer Linux Debian 9 UM Getting Started
These steps apply to the Windows PC you are us
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.
153BWindows 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.
ing to connect to the Arm-based computer. Do NOT apply
Arm-based computer itself.
to set up a serial
Arm-based Computer Linux Debian 9 UM Getting Started
These steps apply to the Linux PC you are using to connect to the
. 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.
70BConnecting via 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 2 192.168.4.127
154BLinux Users
Arm-based computer itself. Before you run the ssh command, be sure to configure the IP
Use the ssh command from a Linux computer to access the 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
range of 192.168.3.0/24 for LAN1 and
Arm-based Computer Linux Debian 9 UM Getting Started
ATTENTION
Rekey SSH regularly
In order to secure your system, we suggest doing a regular SSH
moxa@Moxa:~$ sudo /etc/init.d/ssh restart
For more information about SSH, refer to the following link.
https://wiki.debian.org/SSH
These steps apply to the Windows PC you are using to connect to the
hen prompted for a passphrase, leave the passphrase empty and press enter.
-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
155BWindows Users
Arm-based computer itself.
Arm-based computer. Do NOT apply
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 download PuTTY
Arm-based Computer Linux Debian 9 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 the default account.
root@Moxa:# passwd –l moxa
root@Moxa:# passwd –u moxa
User Account Management
71BSwitching to the Root Account
You can switch to root account using the sudo -i (or sudo su) command . 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
‘sudo su –c’ to run the command instead of using >, <, >>, <<, etc.
: The single quotes enclosing 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 the 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 that the moxa user cannot log in.
To unlock the user moxa:
Arm-based Computer Linux Debian 9 UM Getting Started
moxa@Moxa:~$ cd /etc/network/
moxa@Moxa:/etc/network/~$
# interfaces(5) file used by ifup(8) and ifdown(8)
Network Settings
72BConfiguring 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.
156BModifying 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
157BSetting 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 Debian 9 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/DateTime
158BSetting 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
74BQuerying the Firmware Version
To check the Arm-based computer’s firmware version, type:
Add the –a option to create a full build version:
75BAdjusting 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
Arm-based Computer Linux Debian 9 UM Getting Started
moxa@Moxa:~$ TZ=EST5EDT
moxa@Moxa:~$ export TZ
76BSetting the Time Zone
There are two ways to configure the Moxa embedded computer’s time zone. One is using the TZ variable.
The other is using the /etc/localtime file.
159BUUsing 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 time zone 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
+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
+9 JST Japan
+9.5 ACT Central Australia
+11 SST Central Pacific
+12 NST New Zealand
-11 MIT Samoa
-10 HST Hawaii
-9 AST Alaska
-8 PST Pacific Standard Time
Arm-based Computer Linux Debian 9 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
-5 EST Eastern Standard Time
-5 IET Indiana East
-3.5 CNT Newfoundland
-3 AGT Eastern South America
-3 BET Eastern South America
-1 CAT Azores
160BUsing the localtime File
The local time zone 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 option. 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 Serial Terminal Settings
USB Port
USB Automount
CAN Bus Interface
Configuring the Socket CAN Interface
CAN Bus Programming Guide
Configuring the Real COM Mode
Mapping TTY Ports
Mapping TTY Ports (automatic)
Mapping TTY Ports (manual)
Removing Mapped TTY Ports
Arm-based Computer Linux Debian 9 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 RS-232; use the
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
For example, to set Port 0 to the 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 operation
77BTChanging the Serial Terminal Settings
The stty command is used to view and modify the serial terminal settings. The details are given below.
161BDisplaying All Settings
Use the following command to display all serial terminal 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
162BConfiguring Serial Settings
The following example changes the baudrate to 115200.
Arm-based Computer Linux Debian 9 UM Advanced Configuration of Peripherals
moxa@Moxa:~$ sudo stty -a -F /dev/ttyM0
Detailed information on the stty
http://www.gnu.org/software/coreutils/manual/coreutils.html
moxa@Moxa:~$ mount | grep media
ATTENTION
Remember to type the
Check the settings to confirm that the baudrate has 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:
sync command before you disconnect the USB mass storage device to prevent loss
Arm-based Computer Linux Debian 9 UM Advanced Configuration of Peripherals
# ip link
can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT
group default qlen 10 link/can
# ip link set can0 up type can bitrate 12500
ioctl(s, SIOCGIFINDEX, &ifr);
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.
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
CAN Bus Programming Guide
CAN Write
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);
Arm-based Computer Linux Debian 9 UM Advanced Configuration of Peripherals
addr.can_family = AF_CAN;
perror("Error in can raw socket read");
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;
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) {
Arm-based Computer Linux Debian 9 UM Advanced Configuration of Peripherals
}
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*
Configuring the Real COM Mode
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
.
Arm-based Computer Linux Debian 9 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
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.
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 (manual)
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 [IP Address]
Example:
mxdelsvr is:
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 Process
Dial-up Commands
Cellular Module
Configuring a NB-IoT/Cat. M1 Connection (UC-2114 and UC-2116 only)
GPS
Configuring the Wi-Fi Connection
Configuring WPA2
Configuring the Bluetooth Connection
Paring Devices
Connecting Devices