DUSUN DSGW-210 IoT Edge Computer Gateway User Guide

June 9, 2024
Dusun

DUSUN DSGW-210 IoT Edge Computer Gateway

DUSUN-DSGW-210-IoT-Edge-Computer-Gateway-FEA

Product Information

Hangzhou Roombanker Technology Co., Ltd. presents the IoT Edge Computer Gateway Model Name: DSGW-210. This product is designed to serve as an IoT gateway between devices and the cloud. The gateway provides a secure and reliable connection to the cloud, making it easy to manage and control devices remotely.

Introduction
This Quick Start Guide explains the basics: how to connect and set up your target on the network; how to install the SDK; and how to build the firmware images.
The Linux Software Developer’s Kit (SDK) is an embedded hardware and software suite that enables Linux developers to create applications on Dusun’s DSGW-210 gateway.
Base on the 4.4 Linux kernel, and leveraging existing open source software, the SDK simplifies the process of adding custom applications. Device drivers, GNU toolchain, Pre defined configuration profiles, and sample applications are all in included.

Gateway Information

The DSGW-210 IoT Edge Computer Gateway is equipped with an ARM Cortex-A53 quad-core processor, 1GB DDR3 RAM, and 8GB eMMC flash memory. It also has a built-in Wi-Fi module, two Ethernet ports, and a USB 2.0 port for external devices.

Basic Information
The gateway supports various protocols such as MQTT, CoAP, and HTTP. It also features a web-based management interface that allows users to configure and manage the gateway remotely.

  • SOC: RK3328
    • Quad-core ARM Cortex-A53
    • Mali-450MP2 GPU
  • Power Supply: DC-5V
  • LTE module: BG96 (LET CAT-1)
  • Wi-Fi module: 6221A (Wi-Fi chip: RTL8821CS)
  • Zigbee: EFR32MG1B232F256GM32
  • Z-wave: ZGM130S037HGN
  • Bluetooth: EFR32BG21A020F768IM32
  • eMMC: 8GB
  • SDRAM: 2BG

Interface
The DSGW-210 IoT Edge Computer Gateway has the following interfaces :DUSUN-DSGW-210-IoT-Edge-Computer-Gateway- \(1\)

  • 2 Ethernet ports
  • 1 USB 2.0 port
  • Built-in Wi-Fi module

Target Setup

The DSGW-210 IoT Edge Computer Gateway can be set up as a target device for IoT development projects. This section describes how to connect the gateway into your host computer and network.

Connecting a gateway – Power

  1. Make sure that the power adapter is 5V/3A.
  2. Select the appropriate power plug adaptor for your geographical location. Insert it into the slot on the Universal Power Supply; then plug the power supply into an outlet.
  3. Connect the output plug of the power supply to the gateway

Connecting a gateway – USB port

  1. Connect one end of the USB cable to the USB port on the laptop or desktop
  2. Connect the other end of USB cable to the USB port on the gateway.DUSUN-DSGW-210-IoT-Edge-Computer-Gateway- \(2\)

Connecting a PCBA board – Serial Port
If you want to debug the gateway, you can open the shell, Connect the PC to the PCBA board via Serial to USB tool.
PIN in board for serial connection: TP1100: RX TP1101: TXDUSUN-DSGW-210
-IoT-Edge-Computer-Gateway- \(3\)

Compile the Environment to Build

To start building IoT applications for the DSGW-210 IoT Edge Computer Gateway, you need to set up the development environment by following these steps:

Please use ubuntu 18.04 .iso image to setup your build environment. You can use a virtual machine or a physical PC to install ubuntu 18.04.

  • Virtual Machine
    It is recommended that novice users use virtual machines, install ubuntu 18.04 to the virtual machine, and leave enough disk space (at least 100G) for the virtual machine.

  • Ubuntu PC Compile the Environment to
    The use of physical machine compilation users can use a ubuntu PC.

SDK Acquisition and Preparation

  1. Download the source code from the Dusun FTP
    The source package name will be 3328-linux-*.tar.gz, get it from Dusun FTP.

  2. Code Compression Package Check
    The next step can be taken only after generating the MD5 value of the source compression package and comparing the MD5 value of the MD5 .txt text to confirm that the MD5 value is the same, and if the MD5 value is not the same, the energy code pack is damaged, please download it again.
    $ md5sum rk3328-linux-*.tar.gz

  3. The Source Compression Package is Unzipped
    Copy the source code to the corresponding directory and unzip the source code compression package.

    • $ sudo -i
    • $ mkdir workdir
    • $ cd workdir
    • $ tar -zxvf /path/to/rk3328-linux-*.tar.gz
    • $ cd rk3328-linux

Code Compilation

Getting started, global Compilation

  1. Initialize Compilation Environment Variables (select file system)
    You can build buildroot, ubuntu or debian rootfs image. Select it in “./build.sh init”.DUSUN-DSGW-210-IoT-Edge-Computer-Gateway-
\(4\)
    We strongly recommend you to build and run the system with buildroot rootfs to get familiar with the hardware and build environment, when you get started. After you tried buildroot system, you can try ubuntu and debian system.

  2. Prepare the Root File System base
    This section is for building ubuntu or debian file system. If you want to build the buildroot file system, skip this section.
    Compile Ubuntu
    Download the root file system compression package ubuntu.tar.gz The Root file system compresses the package directory: Unzip the compression package
    $ tar -zxvf ubuntu.tar.gz // you get ubuntu.img
    Copy the root file system to the specified path
    $ cd workdir/rk3328-linux
    $ mkdir ubuntu
    $ cp /path/to/ubuntu.img ./ubuntu/
    Compile Debian
    Download the root file system compression package debian.tar.gz Unzip the compression package
    $ tar -zxvf debian.tar.gz // you get linaro-rootfs.img
    Copy the root file system to the specified path
    $ cd workdir/rk3328-linux
    $ mkdir debian
    $ cp ./linaro-rootfs.img ./debian/

  3. Start Compiling
    $ ./build.sh
    Build a complete directory of firmware files: rockdev/update.img and other separate images, update.img includes all firmware for full upgrade.

  4. Run The Image on the board
    Connect the RK3328 board serial port to the PC via a USB to UART Bridge. Use Putty or other Terminal software as your console tool,
    SERIAL CONSOLE SETTINGS:

    • 115200/8N1
    • Baud: 115200
    • Data Bits: 8
    • Parity Bit: No
    • Stop Bit: 1
      Power UP the board, you can see the boot log on console:DUSUN-DSGW-210-IoT-
Edge-Computer-Gateway- \(5\)

Compiled Each Image Part Separately

  1. The build system and the image structure
    The update.img is composed of several parts. Main parts are uboot.img, boot.img, recovery.img, rootfs.img. uboot.img contains bootloader uboot boot.img contains the device tree .dtb image, Linux kernel image recovery.img: The system can boot up to recovery mode, recovery.img is the rootfs used in recovery mode. rootfs.img: The normal rootfs image. In normal mode, system boot and mount this rootfs image. You may need to build the images separately, especially when you focus on single module (e.g. uboot or kernel driver) development. Then you can build only that part of image and update that partition in flash.

  2. Build Uboot only
    $ ./build.sh uboot

  3. Build Linux Kernel Only
    $ ./build.sh kernel

  4. Build Recovery File System Only
    $ ./build.sh recovery

  5. Build File System Only
    $ ./build.sh rootfs

  6. Final Image Packaging
    $ ./build.sh updateimg

This command making rockdev/*.img scatter firmware packaging builds in the directory update.img

More about buildroot system

If you use buildroot rootfs, some Dusun test scripts/tools are already installed in the final buildroot rootfs. You can refer to buildroot/dusun_rootfs/add_ds_rootfs.sh

Test hardware components
The following testing are done under the buildroot system.

  1. Test Wi-Fi as AP
    The “ds_conf_ap.sh” script is for setting up Wi-Fi AP, SSID is “dsap”, password is “12345678”.DUSUN-DSGW-210-IoT-Edge-Computer-Gateway-
\(6\) DUSUN-DSGW-210-IoT-Edge-Computer-Gateway-
\(7\)

  2. Test BG96
    bg96_dial.sh is used for BG96 dial.DUSUN-DSGW-210-IoT-Edge-Computer-Gateway-
\(8\) DUSUN-DSGW-210-IoT-Edge-Computer-Gateway-
\(9\)

You need to configure APN, username/password for BG96, in quectel-chat-connect and quectel-ppp file. Before you run the test.

# cat /etc/ppp/peers/quectel-chat-connectDUSUN-DSGW-210-IoT-Edge-
Computer-Gateway- \(10\)

# cat /etc/ppp/peers/quectel-pppDUSUN-DSGW-210-IoT-Edge-Computer-Gateway-
\(11\)

  • Test LEDDUSUN-DSGW-210-IoT-Edge-Computer-Gateway- \(12\)
  • Test I2CDUSUN-DSGW-210-IoT-Edge-Computer-Gateway- \(13\)
    Actually LED controlled is I2C interface.

How to make menuconfig in buildroot
Normal mode buildroot rootfs config file: buildroot/configs/rockchip_rk3328_defconfig Recovery mode buildroot rootfs config file: buildroot/configs/rockchip_rk3328_recovery_defconfigDUSUN-
DSGW-210-IoT-Edge-Computer-Gateway- \(14\)

If you want to change buildroot configure, here are the steps:DUSUN-DSGW-210
-IoT-Edge-Computer-Gateway- \(15\)

How to add an application in buildroot source tree

  1. Make directory buildroot/dusun_package/
  2. Put APP source code files and Makefile to buildroot/dusun_package/< your_app > your_app.h your_app.c Makefile
  3. Make directory buildroot/package/< your_app > Config.in your_app.mk
  4. Add Config.in sourcing in buildroot/package/Config.inDUSUN-DSGW-210-IoT-Edge-Computer-Gateway- \(16\)
  5. Make menuconfig to select your APP, and save the configure file as 5.2.
  6. “./build.sh rootfs” to rebuild rootfs Please refer to buildroot/dusun_package/dsled/, it’s a useful example.

Switch to ubuntu or debian system
If you have built a buildroot system image, and want to switch to ubuntu or debian image. You don’t need to clean the make and do a clean rebuild. Just do the following steps:

  1. “./build.sh init” to select ubuntu or debian
  2. “./build.sh rootfs” to rebuild ubuntu or debian rootfs
  3. “./build.sh” to build a the final update.img

Be careful, the dusun tools and scripts are default copied to buildroot rootfs, not to ubuntu or debian rootfs. If you want to copy them to ubuntu or debian rootfs, you can modify the buildroot/dusun_rootfs/add_ds_rootfs.sh. For the APPs, you can copy the code to the board and build it on the target board ubuntu or debian system, since it has gcc and other toolchains.

Wireless development (Zigbee, Z-Wave, BLE, LoRaWAN)

Please build a debian system to do the following steps. The code will be compiled on the board, not on host.DUSUN-DSGW-210-IoT-Edge-Computer-Gateway-
\(17\)

  1. Prepare some library on the board
  2. scp SDK “buildroot/dusun_rootfs/target_scripts/export_zigbee_zwave_ble_gpio.sh” from host to board, under /rootDUSUN-DSGW-210-IoT-Edge-Computer-Gateway- \(18\)
  3. Power on wireless modules on board.

Zigbee
Zigbee interface is /dev/ttyUSB0. Download “Z3GatewayHost_EFR32MG12P433F1024GM48.tar.gz” from Dusun FTP, and copy it to board, under /root.DUSUN-DSGW-210-IoT-Edge-Computer-Gateway-
\(21\)

Then build Z3Gateway and run. For more information about Z3Gateway, please visit https://docs.silabs.com/ for more information.

Z-Wave
Z-Wave interface is /dev/ttyS1. Download ” rk3328_zwave_test.tar.gz ” from Dusun FTP, and copy it to board, under /root.DUSUN-DSGW-210-IoT-Edge-
Computer-Gateway- \(20\)

Unzip it and you can get ./zipgatewayDUSUN-DSGW-210-IoT-Edge-Computer-
Gateway- \(21\)DUSUN-DSGW-210-IoT-Edge-Computer-
Gateway- \(22\)

Now build a zwave simple test tool and run: In “my_serialapi_test”, press ‘a’ to include zwave device, ‘r’ to exclude device, ‘d’ to reset to default, ‘i’ to get devices list and ‘q’ to quit. The Zipgateway is siliabs software, “my_serialapi_test” is just a very simple tool. For more information about Zipgateway, please visit https://docs.silabs.com/ for more information.

Z-Wave region
If for default Dusun built, Z-Wave frequency can be configured in /etc/config/dusun/zwave/region Default is 0x00: EU

0x01 – US 0x02 – ANZ 0x03 – HK 0x04 – Malaysia
0x05 – India 0x06 – Israel 0x07 – Russia 0x08 – China
0x20 – Japan 0x21 – Korea  

BLE
BLE interface is /dev/ttyUSB1. Download “rk3328_ble_test.tar.gz” from Dusun FTP, and copy it to board, under /root.DUSUN-DSGW-210-IoT-Edge-Computer-
Gateway- \(23\)

Unzip it and you can get ./bletest build ble test tool and run: More information about the BLE test tool, please visit https://docs.silabs.com/ for more information.DUSUN-DSGW-210-IoT-Edge-Computer-Gateway-
\(24\)

LoRaWAN
Choose the correct interface for LoRaWAN, for example /dev/spidev32766.0. The configuration file for it is in ./sx1302_hal/packet_forwarder/global_conf.json. Download “sx1302_hal_0210.tar.gz” from Dusun FTP, and copy it to board, under /root .DUSUN-DSGW-210-IoT-Edge-Computer-Gateway- \(25\)

Untar it and you can get ./sx1302_hal build LoRaWAN sample code sx1302_hal and run: More information about the LoRaWAN code, please visit https://www.semtech.com/products/wireless-rf/lora-core/sx1302 for more information.DUSUN-DSGW-210-IoT-Edge-Computer-Gateway-
\(26\)

Image Upgrade

  1. Upgrade Tool
    Upgrade tool:AndroidTool_Release_v2.69

  2. Go into Upgrade Mode

  3. Connect the OTG port to the burning computer USB port, it’s also act as 5V power supply

  4. Press “Ctrl+C” when uboot is booting up, to enter uboot:DUSUN-DSGW-210-IoT-Edge-Computer-Gateway- \(27\)

  5. uboot “rbrom” comand to reboot the board into maskrom mode, for a complete “update.img” upgrade.DUSUN-DSGW-210-IoT-Edge-Computer-Gateway- \(28\)

  6. “rockusb 0 mmc 0” command to reboot board to loader mode, for a partial firmware upgrade or a complete “update.img” upgrade.DUSUN-DSGW-210-IoT-Edge-Computer-Gateway- \(29\) DUSUN-DSGW-210-IoT-Edge-Computer-Gateway- \(30\)

  7. The Entire Package of Firmware “update.img” Upgrade

  8. Upgrade the Firmware SeparatelyDUSUN-DSGW-210-IoT-Edge-Computer-Gateway- \(31\)

Power management configuration

The battery management chip Dusun used is BQ25895 Methods to optimize CPU power consumption is listed,

  • Adjust cpufreq parameter.DUSUN-DSGW-210-IoT-Edge-Computer-Gateway- \(32\)

  • Close some cpu, limit the highest frequency of cpuDUSUN-DSGW-210-IoT-Edge-Computer-Gateway- \(33\)

  • SoC with ARM Big-Little architecture can bind the tasks with high loading to little cores through CPUSET since the energy efficiency of the little core is better.
    Note: SoC with SMP architecture can also bind the tasks to some cpu so that other cpus can enter low power consumption mode, but maybe it will make cpu easy to run with high frequency, which will increase the power consumption. DUSUN-DSGW-210-IoT-Edge-Computer-Gateway-
\(34\)

  • Limit the cpu bandwidth of the tasks with high loading through CPUCTL (need to enable the macro CONFIG_CFS_BANDWIDTH).DUSUN-DSGW-210-IoT-Edge-Computer-Gateway- \(35\)

Floor 8, building A, Wantong center, Hangzhou 310004, china
Tel: 86-571-86769027/8 8810480
Website: www.dusuniot.com
www.dusunremotes.com
www.dusunlock.com

Revision History

Specification Sect. Update Description By
Rev Date
1.0 2021-08-06   New version release
1.1 2022-04-05   Add Power management
1.2 2022-06-06   Add serial connection

Approvals

Organization Name Title Date
     

References

Read User Manual Online (PDF format)

Read User Manual Online (PDF format)  >>

Download This Manual (PDF format)

Download this manual  >>

Related Manuals