USR IOT USR-G809 User manual

User Manual of OpenCPU
www.pusr.com
- 1 -
Your Trustworthy Industrial IoT Partner
Content
1. Brief introduction of USR-G809....................................................................................................................- 2 -
1.1. Hardware specification.......................................................................................................................- 2 -
1.2. Interface............................................................................................................................................- 4 -
1.3. Hardware resources...........................................................................................................................- 4 -
1.3.1. The description of indicator lights..............................................................................................- 4 -
1.3.2. LED pin definitions....................................................................................................................- 5 -
1.3.3. Terminal definitions..................................................................................................................- 5 -
1.3.4. Digital_IO definitions.................................................................................................................- 6 -
1.3.5. LTE module pin definitions........................................................................................................- 6 -
1.3.6. UART........................................................................................................................................- 6 -
2. Environment preparation............................................................................................................................- 6 -
3. SDK Configuration ......................................................................................................................................- 7 -
3.1. Configuration file ...............................................................................................................................- 7 -
3.1.1. Use the configuration file provided by USR .................................................................................- 7 -
3.1.2. Custom configurations ..............................................................................................................- 7 -
4. Firmware compilation.................................................................................................................................- 8 -
5. Firmware flashing ......................................................................................................................................- 8 -
5.1. Firmware flashing via uboot...............................................................................................................- 8 -
6. SDK Introduction ......................................................................................................................................- 11 -
6.1. OpenWrt Source Code Directory Introduction: .................................................................................- 11 -
6.2. SDK Introduction of USR-G809 .........................................................................................................- 11 -
6.3. Introduction of USR demo program:.................................................................................................- 13 -
6.3.1. DTU demo program.................................................................................................................- 13 -
6.3.2. Dialnet dialing demo program................................................................................................- 17 -
6.3.3. USB mounting........................................................................................................................ - 24 -
6.3.4. Instruction of digital_io program(package/USR/utils/usr_digital_io)........................................- 26 -
6.4. Explanation of modifications based on OpenWrt..............................................................................- 29 -
6.4.1. target/linux/ramips/image/mt7620.mk ..................................................................................- 29 -
6.4.2. Explanation of modifications of dts file ...................................................................................- 29 -
7. How to add apackage (using libusrdtu as an example) ............................................................................. - 30 -
7.1. Analysis of file structure....................................................................................................................- 31 -

User Manual of OpenCPU
www.pusr.com
- 2 -
Your Trustworthy Industrial IoT Partner
1. Brief introduction of USR-G809
USR-G809 is an industrial 4G router gateway that integrates 4G LTE, DIDO, serial, Ethernet ports (4LAN and
1WAN), and other interfaces. It combines 4G router, serial server, and IO control, making it a fully featured LTE router
designed specifically for mission-critical IIoT applications.
1.1. Hardware specification
Hardware Specifications
Cellular
Interface
Antenna
2 x SMA-K
Note: North America models: 2 x SMA 4G antenna connectors.
SIM card
1 x (3 V & 1.8 V) Standard 2FF SIM, drawer-type sim card slots
Ethernet
1 x WAN port 10/100 Mbps, compliance with IEEE 802.3, supports auto MDI/MDIX,1.5KV network
isolation transformer protection
4 x LAN ports, 10/100 Mbps, compliance with IEEE 802.3, IEEE 802.3u standards, supports auto
MDI/MDIX,1.5KV network isolation transformer protection
Indicators
LED
PWR: red, always on after powered on
Work: green, blinking when the router is ready and working properly
WLAN: green, always solid on when Wi-Fi is enabled and working
properly
USR: user defined.
Net indicator:
Red always on after connected to 2G network
Green always on after connected to 3G network
Orange always on after connected to 4G network
Signal strength:3 solid bars, strongest signal
Terminal block
Pinout
V+,V- : 2 cores terminal power supply socket, built-in power supply
phase-reversal protection
GND: ground terminal
Tx/B:RS-232/RS485 pin(setup by software)
Rx/A:RS-232/RS485 pin(setup by software)
DI:2 x Digital input, passive switch
DO:2 x Digital open collector output, max output 36 V, 300 mA
COM: common terminal, use in conjunction with DOs
Wi-Fi Interface
Standards & Frequency
IEEE 802.11b/g/n,2.4GHz, AP mode
Data speed
IEEE 802.11b/g, maximum 54Mbps.IEEE 802.11n, maximum 150Mbps
Antenna
2 x RP-SMA-K
Transmission distance
80 meters by line of sight. Actual transmission distance depends on
environment of the site.
Power Supply
Adaptor
DC 12V/1A
Connector
DC Power Jack Barrel Type Female 5.5*2.1mm Round socket or industrial
terminal block, reverse polarity protection
Input voltage
DC 9~36V

User Manual of OpenCPU
www.pusr.com
- 3 -
Your Trustworthy Industrial IoT Partner
Working power
Average 522mA/12V, Maximum 811mA/12V
Serial Interface
RS485/RS232(alternative)
industrial terminal block.
Note:RS232 default.
Baud rate(bps)
1200,2400,4800,9600,19200,38400,57600,115200,230400
Data bits
8
Stop bits
1,2
Parity
NONE,ODD,EVEN
Physical
Characteristics
Housing
Metal shell,IP30
Dimensions
125.0*103.0*45.0mm (L*W*H, antenna pedestal, terminal block and DIN
Rail are not included)
Installation method
Ear mounting, DIN-Rail mounting
EMC
Static IEC61000-4-2, level 3
Pulsed Electric Field IEC61000-4-4, level 3
Surge IEC61000-4-5, level 3
Operating temperature
-20℃~+70℃
Storage temperature
-40℃~+125℃
Operating humidity
5%~95%RH(non-condensing)
Others
Reload
Pinhole button, restore factory defaults/firmware resume/firmware
upgrading with USB
TBD
Debug interface (TTL Level)
USB
Firmware upgrading
TF
TF card slot
Ground protection
Screw
Embedded Watchdog
Device runs self-detection, auto recovers from malfunctions
Certificate
CE
1.2. Download SDK
SDK download: https://github.com/JinanUSR-IOT/openwrt

User Manual of OpenCPU
www.pusr.com
- 4 -
Your Trustworthy Industrial IoT Partner
1.3. Interface
1.4. Hardware resources
1>The main control chip is MT7620A, with 128M memory and 32M storage.
2>It has 1*100M WAN port, 4*100M LAN ports, and supports 5G WIFI (reserved) compatible
with MT7612E and mainstream 4G modules.
1.4.1. The description of indicator lights
Item
Description
PWR
Power indicator, always on red after powered on.
WORK
Work indicator, 1 sec blink after booting.
WLAN
Wi-Fi indicator, always on green when Wi-Fi is enabled and working properly.
USR
User-defined indicator, can be set via the webpage(socket, VPN...).

User Manual of OpenCPU
www.pusr.com
- 5 -
Your Trustworthy Industrial IoT Partner
NET
Always on after connecting to the network. Two colors indicate 4G network, green indicates 3G
and red indicates 2G.
SIG(1-3)
Signal strength indicator, the more lights on, the stronger the signal.
1.4.2. LED pin definitions
1.4.3. Terminal definitions
Terminal interface
Description
V+,V-
Power interface, built-in anti-reverse protect
GND
Ground terminal
Tx/B
R5232 or RS485, can be set via webpage
Rx/A
R5232 or RS485, can be set via webpage
D11, DI2, D01, D02
DI/DO terminal interface
COM
Do loop terminal

User Manual of OpenCPU
www.pusr.com
- 6 -
Your Trustworthy Industrial IoT Partner
1.4.4. Digital_IO definitions
1.4.5. LTE module pin definitions
1.4.6. UART
Level
3.3V
Band rate
57600
Data bits
8
Parity
None
Stop bit
1
Flow control
None
2. Environment preparation
1>Install aLinux environment, such as the Ubuntu system, switch to the root user, and install software
package dependencies.
apt-get install g++
apt-get install libncurses5-dev
apt-get install zlib1g-dev
apt-get install bison
apt-get install flex
apt-get install unzip
apt-get install autoconf
apt-get install gawk
apt-get install make
apt-get install gettext
apt-get install gcc
apt-get install binutils
apt-get install patch

User Manual of OpenCPU
www.pusr.com
- 7 -
Your Trustworthy Industrial IoT Partner
apt-get install bzip2
apt-get install libz-dev
apt-get install asciidoc
apt-get install subversion
Note: Make sure to confirm that the software packages are installed successfully. After all installations are compl
eted, exit the root user and switch back to aregular user.
2>Create an "openwrt" folder and take out the G809 source code from Git. After downloading the code,
enter the root directory of the source code.
git clone https://github.com/USR-IOT/openwrt.git
3>Execute the following command to update the installation package.
./scripts/feeds update -a
./scripts/feeds install -a
After the updating installation package, the next step is to configure the SDK.
3. SDK Configuration
3.1. Configuration file
3.1.1. Use the configuration file provided by USR
Copy package/USR/configs/USR-G809.config into the root directory of the SDK, and rename it
as .config.
Alternatively, you can load the package package/USR/configs/USR-G809.config by selecting Load in
make menuconfig.
This will automatically load the configurations of USR into make menuconfig.Save and exit.
3.1.2. Custom configurations
Open the graphical configuration interface by running “make menuconfig”.
1>Select the CPU model:
Target System -> MediaTek Ralink MIPS
2>Select the CPU sub-model:
Subtarget -> MT7620 based boards
3>Select the specific router model:
Target profile -> USR USR-G809 32M
4>Select the pre-installed software:
Utilities -> Choose software provided by OpenWrt
Utilities -> USR Applications, choose demo software provided by USR
Save and exit.

User Manual of OpenCPU
www.pusr.com
- 8 -
Your Trustworthy Industrial IoT Partner
4. Firmware compilation
Run make V=s to compile.
Note: After the first successful compilation, you can add "-jxx" after "make" to specify xx threads for simultan
eous compilation, such as "make -j32 V=s".
The compiled bin file is located in the directory: bin/targets/ramips/mt7620/.
The complete firmware file is: openwrt-ramips-mt7620-usr_usr-g809-squashfs-sysupgrade.bin.
total 15M
-rw-r--r-- 1 1000 1000 2.0K Mar 15 13:36 config.buildinfo
-rw-r--r-- 1 1000 1000 288 Mar 15 13:36 feeds.buildinfo
-rw-r--r-- 1 1000 1000 7.0M Mar 15 13:37 openwrt-ramips-mt7620-usr_usr-g809-initramfs-
kernel.bin
-rw-r--r-- 1 1000 1000 4.9K Mar 15 13:37 openwrt-ramips-mt7620-usr_usr-g809.manifest
-rw-r--r-- 1 1000 1000 7.3M Mar 15 13:37 openwrt-ramips-mt7620-usr_usr-g809-squashfs-
sysupgrade.bin
drwxr-xr-x 1 1000 1000 12K Mar 15 13:37 packages
-rw-r--r-- 1 1000 1000 1.4K Mar 15 13:37 profiles.json
-rw-r--r-- 1 1000 1000 686 Mar 15 13:37 sha256sums
-rw-r--r-- 1 1000 1000 20 Mar 15 13:36 version.buildinfo
5. Firmware flashing
5.1. Firmware flashing via uboot
1> Configure the IP address of the computer, either statically or through DHCP. For static IP, use the following
configuration as areference:

User Manual of OpenCPU
www.pusr.com
- 9 -
Your Trustworthy Industrial IoT Partner
2>To use tftpd32 to open the TFTP service and access the firmware directory.
3> Connect the USR-G809 to the computer via an Ethernet cable, either directly or through the same LAN.
4>Use aUSB-TTL serial cable (supporting 3v3) to connect to the debug serial port of the device. Power on
the device and quickly enter the number "2" on the keyboard, then enter "y". Next, modify the device IP to anothe
rIP in the same network segment as the computer, modify the server IP to the IP address of the computer, and
enter the Linux Kernel filename as the name of the firmware. Finally, press enter and wait for the flashing
process to complete.
5>Wait for the system to start up and then access the built-in web page through the LAN port of the G809.
The default username and password are both "root". See the image below for reference:

User Manual of OpenCPU
www.pusr.com
- 11 -
Your Trustworthy Industrial IoT Partner
6. SDK Introduction
6.1. OpenWrt Source Code Directory Introduction:
The above image shows the directory structure of OpenWrt. The top row shows the original directories, whi
le the second row shows the directories generated during the compilation process.
Tools--During the compilation process, certain tools are required. The "tools" directory contains commands
for obtaining and compiling these tools. It contains various Makefiles, some of which may include patches. Each
Makefile includes the line "$(eval $(call HostBuild))", indicating that the tool is being compiled for use on the host.
Toolchain--This directory contains commands for obtaining kernel headers,C library, bin-utils, compiler,
debugger.
Target--This directory contains the kernel configuration files and other platform-specific files.
Package--This directory contains the “Makefiles” for each software package. OpenWrt defines aset
of “Makefile”templates, and each software package refers to this template to define its own information,
such as the version number, download address, compilation method, installation address, and so on.
Include--The OpenWrt Makefiles are stored in this directory.
Scripts--There are some Perl scripts in this directory that are used for software package management.
Dl--This directory contains the downloaded source code for each package.
Build_dir--This directory contains the build output for each package.
Staging_dir--This is the final installation directory. The tools and toolchain will be installed here, and the
rootfs will also be placed here.
Feeds—-This directory contains the package feeds for OpenWrt.
Bin--After compilation, the firmware and “ipk” files will be placed in this directory.
6.2. SDK Introduction of USR-G809
This SDK is based on the official OpenWrt v22.03.03 and adds the USR's programs in the package/USR

User Manual of OpenCPU
www.pusr.com
- 12 -
Your Trustworthy Industrial IoT Partner
directory. The specific functions of each feature can be found in 有人 demo 程序说明.GobiNet, qmi_wwan_q and
quectel-CM are open source drivers and dial-up tools from Quectel, please refer to the Quectel official documen
tation for more details. The following are the source code directories for reference:
package/USR/
├── configs
│├── USR-G809.config
│└── USR-G809.config.old
├── kernel
│├── GobiNet
││├── Makefile
││└── src
││└── ...
│└── qmi_wwan_q
│├── Makefile
│└── src
│└── ...
├── libs
│└── libusrdtu
│├── files
││├── usr_dtu
││└── usr_dtu_service
│├── Makefile
│└── src
│├── example
││└── dtu_demo.c
│├── libusrdtu.so
│├── Makefile
│└── usrdtu.h
├── README.md
└── utils
├── quectel-CM
│├── Makefile
│└── src
│└── ...
├── usr_dialnet
│├── files
││├── cellular_config
││└── usr_dialnet_service
│├── Makefile
│└── src
│├── gpio_opt.c
│├── gpio_opt.h
│├── Makefile
│└── usr_dialnet.c
└── usr_digital_io

User Manual of OpenCPU
www.pusr.com
- 13 -
Your Trustworthy Industrial IoT Partner
├── files
│└── usr_digital_io.sh
└── Makefile
6.3. Introduction of USR demo program:
6.3.1. DTU demo program
6.3.1.1. Function
The DTU connects an external MCU through an internal extended serial port (ttyS0), and the MCU provides a
external serial port for serial data exchange. The system hardware watchdog function is also implemented.
6.3.1.2. Hardware source
Name
Options
Default
Baud rate
1200/2400/4800/9600/19200/38400/57600/115200/230400
115200
Data bits
8
8
Stop bit(s)
1/2
1
Parity
0: NONE
1: ODD
3: EVEN
NONE
Packaging time
10~60000ms
10ms
Packaging length
5~1500 bytes
1000
Serial mode
0: RS232
1: RS485
RS232
Flow control
0: NFC
NFC
6.3.1.3. Demo code introduction
1>The demo code is located in package/USR/libs/libusrdtu, which provides a binary library for serial port
operations and a TCP client interaction example. It can be enabled by configuring
CONFIG_PACKAGE_libusrdtu=y and CONFIG_PACKAGE_dtu_demo=y.
2>The configuration file is: usr_dtu
Network parameters:
Name
Item
Description
Server address
sa_server
Support IP address
Server port
sa_port

User Manual of OpenCPU
www.pusr.com
- 14 -
Your Trustworthy Industrial IoT Partner
Enable or forbidden
sa_enable
ON: enable
OFF: forbidden
Source code directory
libusrdtu/
├── files #
including configuration file and startup scripts
│├── usr_dtu #
configuration file
│└── usr_dtu_service #
startup scripts
├── Makefile #
for OpenWrt compilation
└── src #
source file and
Makefile
├── example #
│└── dtu_demo.c #dtu
main program
├── libusrdtu.so #dtu
library file
├── Makefile #Makefile
└── usrdtu.h #
header file
/* serial port
parameter structure
*/
typedef struct _uci_param
{
unsigned int baud; /*
baud rate
*/
unsigned char parity_type; /*
parity
*/
unsigned char data_bits; /*
data bits
*/
unsigned char stop_bits; /*
stop bit
*/
unsigned char flow_type; /*
flow control
*/
unsigned char mode_type; /*
serial port mode
*/
unsigned int pack_period; /*
packaging time
*/
unsigned int pack_length; /*
packaging length
*/
const char *devname; /*
internal extended serial port
(/dev/ttyS0)*/
const char *hello_msg; /*
initialization
,
string
*/
} DTU_PARAM;
The library functions can be referred to the function comment description in the usrdtu.h file. The following a
re brief descriptions of the relevant APIs:
/*********
* @brief:
serial port handle initialization, non-blocking
* @param: dtu_config: DTU
configuration
* @return:
file descriptor
,
if failed, return
-1;
* @modification: none
*********/
int usrdtu_create(DTU_PARAM dtu_config);
/*********
* @brief:destroy
serial
* @param: fd_serial:
descriptor of serial file
, created by usrdtu_create()
* @return:
If failed,return
-1;

User Manual of OpenCPU
www.pusr.com
- 15 -
Your Trustworthy Industrial IoT Partner
* @modification: none
*********/
int usrdtu_destroy(int fd_serial);
/*********
* @brief:
receive data, non-blocking
* @param: fd:
descriptor of serial file,
created by usrdtu_create()
* @param: data: buffer for storing data
* @param: len:
length of
buffer for storing data
* @return:
reading data length
,
if failed, return
-1
* @modification: none
**********/
int usrdtu_rceive_data(int fd, char *data, int len);
/*********
* @brief:
send data
* @param: fd:
descriptor of serial file,
created by usrdtu_create()
* @param: data: buffer for storing data
* @param: len:
length of
buffer for storing data
* @return:
sending data length
,
if failed, return
-1
* @modification: none
*********/
int usrdtu_send_data(int fd, char *buf, short len);
/***********
* @brief:
Serial port watchdog feeding
* @param: fd:
descriptor of serial file,
created by usrdtu_create()
* @return: None
* @modification: none
***********/
void usrdtu_dog(int fd);
The demo flow is roughly as follows:

User Manual of OpenCPU
www.pusr.com
- 17 -
Your Trustworthy Industrial IoT Partner
6.3.1.4. Function verification
1>Open the “NetAssist” on the computer and configure it as aTCP server.
2>Modify the DTU‘s parameter configuration file, turn on TCP, and configure the address and port to the server
's address and port.
3>Computer and USR-G809 are connected via USB to 232 serial cable,and open the “UartAssist”.
4>Restart the DTU_demo program: /etc/init.d/usr_dtu_service restart
5>Check whether the device is connected. users can use the "NetAssist" and "UartAssist" to send data to each
other.
6.3.2. Dialnet dialing demo program
6.3.2.1. Function Introduction
This is acellular module dial-up program that identifies the module type and executes different dial-
up procedures. The LED light displays the current network standard and signal strength after connecting to the in
ternet. It can automatically restore the connection when disconnected.
6.3.2.2. Hardware Resource Introduction
The G809 uses the Mini PCIe interface to connect to the cellular module. The code has been adapted to EC25
and G405tf modules, and can support 2G, 3G, and 4G networks.
6.3.2.3. Code instruction
The code is located in package/USR/utils/usr_dialnet. Directory structure is as following:
usr_dialnet
├── files
│ ├── cellular_config //configuration of dial-up software
│ └── usr_dialnet_service //Start script

User Manual of OpenCPU
www.pusr.com
- 18 -
Your Trustworthy Industrial IoT Partner
├── Makefile
└── src
├── gpio_opt.c //gpio control
├── gpio_opt.h
├── Makefile
└── usr_dialnet.c //dial-up program
cellular_config
This includes the configuration of the APN parameters. The built-in webpage can write the configuration to the
file, and the usr_dialnet.c program reads the configuration file parameters when it starts.
usr_dialnet_service:
Auto-start script. In the OpenWrt system, the “init” process is replaced by “procd”, which acts as the parent
process and can monitor the status of the child process. Once the child process exits, it can attempt to restart the
process at some point in time.
gpio_opt.c
This program is used to control the input/output mode and output high/low level of GPIO.
usr_dialnet.c
Dial-up program which includes the main function. The flow chat is as the following picture:
Configure the reading function
Upon entering the main function, the program first reads the APN parameters from the configuration file,
which is stored in the /etc/config directory. The program uses uci (Unified Configuration Interface) for
reading and writing.

User Manual of OpenCPU
www.pusr.com
- 19 -
Your Trustworthy Industrial IoT Partner
{
char tmp_buf[128];
memset(tmp_buf, 0, strlen(tmp_buf));
shell_get_for_single("uci get cbi_file.APN.name", tmp_buf, sizeof(tmp_buf));
if (0 == strlen(tmp_buf))
{
return 0;
}
else
{
memcpy(modem.apn.name, tmp_buf, strlen(tmp_buf));
memset(tmp_buf, 0, strlen(tmp_buf));
shell_get_for_single("uci get cbi_file.APN.usr", tmp_buf, sizeof(tmp_buf));
if (0 == strlen(tmp_buf))
{
return 0;
}
memcpy(modem.apn.user, tmp_buf, strlen(tmp_buf));
memset(tmp_buf, 0, strlen(tmp_buf));
shell_get_for_single("uci get cbi_file.APN.paw", tmp_buf, sizeof(tmp_buf));
if (0 == strlen(tmp_buf))
{
return 0;
}
memcpy(modem.apn.psw, tmp_buf, strlen(tmp_buf));
memset(tmp_buf, 0, strlen(tmp_buf));
// shell_get_for_single("uci get cbi_file.APN.auth", tmp_buf, sizeof(tmp_buf));
// if (0 == strlen(tmp_buf))
// {
// return 0;
// }
memcpy(modem.apn.auth, "1", strlen("1"));
}
}
Next, the program initializes the network standard and signal strength LED by setting the corresponding
GPIO pins to output mode and setting them to ahigh level (turning off the LED).
/*
LED of cellular network standards
*/
void module_net_led_control(int net_value)
{
switch (net_value)
{
case LTE_MODE_2G: // 2G
dialnet_setval(LED_MODE0, LED_ON);
Other manuals for USR-G809
1
Table of contents
Other USR IOT Gateway manuals
Popular Gateway manuals by other brands

ZyXEL Communications
ZyXEL Communications P-660HW-Tx v3 Series quick start guide

Pioneer
Pioneer NXS-GW operating instructions

IFM Electronic
IFM Electronic AC1376 operating instructions

Cisco
Cisco 545 Serial Installation and upgrade guide

ZyXEL Communications
ZyXEL Communications NBG-510S user guide

ICP DAS USA
ICP DAS USA GW-7828 user manual