DSGW-010C SDK Quick Start Guide V1.0发表时间:2022-08-20 10:37
SDK Quick Start Guide Product Name: IoT Edge Computer Gateway Model Name: DSGW-010C
Revision History
Approvals
1 IntroductionThis 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-010C 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, Predefined configuration profiles, and sample applications are all in included.
2 Gateway Information2.1 Basic informationSOC: PX30 Quad-core ARM Cortex-A53 2GB on-board RAM 32GB eMMC Base on the LoRa Concentrator Engine: Semtech SX1302 TX power up to 27dBm, RX sensitivity down to -139dBm @SF12, BW125kHz LoRa Frequency band support: RU864, IN865, EU868, US915, AU915, KR920, AS923. Support Wi-Fi 2.4G/5G IEEE 802.11b/g/n/ac Support BLE5.0 Support GPS,GLONASS,Galileo and QZSS Support IP66 waterproof housing
2.2Interface
3 Target SetupThis section describes how to connect the gateway into your host computer and network. Connecting a gateway - Power 3.1 Make sure that the power adapter is 5V/3A. 3.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 Connect one end of the USB cable to the USB port on the laptop or desktop Connect the other end of USB cable to the USB port on the gateway.
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. Green: GND Blue: RX Brown: TX
4 Compile the Environment to BuildPlease 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. 4.1 Virtual MachineIt 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.
4.2 Ubuntu PC Compile the Environment to BuildThe use of physical machine compilation users can use a ubuntu PC.
5 SDK Acquisition and Preparation5.1 Download the source code from the Dusun FTPThe source package name will be px30_sdk.tar.gz, get it from Dusun FTP.
5.2 Code Compression Package CheckThe 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 px30_sdk.tar.gz
5.3 The Source Compression Package is UnzippedCopy the source code to the corresponding directory and unzip the source code compression package. $ sudo -i $ mkdir workdir $ cd workdir $ tar -zxvf /path/to/ px30_sdk.tar.gz $ cd px30_linux_src
$ git reset --hard
6 Code Compilation6.1 Getting started, global Compilation6.1.1 Initialize Compilation Environment Variables (select file system)You can build buildroot, ubuntu or debian rootfs image. Select it in "./mk.sh".
6.1.2 Prepare the Root File System baseThis section is for building ubuntu or debian file system. Compile Ubuntu Download the root file system image rootfs-ubuntu16_xubuntu_v1.1.img Copy the root file system to the specified path, then run command ./mk.sh $ mkdir output $ mv ../rootfs-ubuntu16_xubuntu_v1.1.img ./outputThe build will take a long time, please wait patiently. Then the image would be placed in ./output/update-ubuntu.img The update-ubuntu.img can be used to update firmware in gateway
Compile buildroot Compile the buildroot image by command mk.sh -b $ ./mk.sh -bThe build will take a long time, please wait patiently. Then the image would be placed in ./output/update.img The update.img can be used to update firmware in gateway
6.1.3 Run The Image on the boardConnect the PX30 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:
6.2 Compiled Each Image Part Separately6.2.1 The build system and the image structureThe 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. 6.2.2 Build Uboot only$ ./mk.sh -u
6.2.3 Build Linux Kernel Only$ ./mk.sh -k
6.2.4 Build Recovery File System Only$ ./mk.sh -r
7 More about buildroot systemIf 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 7.1 Test hardware componentsThe following testing are done under the buildroot system. 7.1.1 Test Wi-Fi as APThe "ds_conf_ap.sh" script is for setting up Wi-Fi AP, SSID is "dsap", password is "12345678".
7.1.2 Test I2C# i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: 60 -- -- -- -- -- -- -- -- -- ---- -- -- -- -- 70: -- -- -- -- -- -- -- -- # Test of i2c function in gateway
8 Wireless development (Zigbee, Z-Wave, BLE, LoRaWAN)Please use the ubuntu system to do the following steps. The code will be compiled on the board, not on host. root@linaro-alip:~# apt-get update root@linaro-alip:~# apt-get install libncurses5-dev root@linaro-alip:~# apt-get install libreadline-dev root@linaro-alip:~# apt-get install libssl-dev root@linaro-alip:~# apt-get install libjson-c-dev Prepare some library on the board scp SDK 8.1 BLEroot@linaro-alip:~# ./export_zigbee_zwave_ble_gpio.sh root@linaro-alip:~# BLE interface is /dev/ttyUSB1. Download "rk3328_ble_test.tar.gz" from Dusun FTP, and copy it to board, under /root. root@linaro-alip:~# tar xvzf rk3328_ble_test.tar.gz root@linaro-alip:~# cd bletest/test/ root@linaro-alip:~/bletest/test#
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. root@linaro-alip:~/bletest/test# make <========== wait for build OK, and you get ./build/test root@linaro-alip:~/bletest/test# ./build/test /dev/ttyUSB1 115200 -C
杭州市大关路 189 Tel:86 -571-86769027/8 8.2 LoRaWANChoose 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. root@linaro-alip:~# tar xvzf sx1302_hal_0210.tar.gz root@linaro-alip:~# cd sx1302_hal/
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. root@linaro-alip:~/sx1302_hal# make all <========== wait for build OK, and you get ./packet_forwarder/ root@linaro-alip:~/sx1302_hal/packet_forwarder# ./lora_pkt_fwd
8.3 GPSAcquire the GPS data from gps program, the default serial port is ttyS3, baud rate 9600
9 Image Upgrade9.1 Upgrade ToolUpgrade tool:AndroidTool_Release_v2.69 9.2 Go into Upgrade ModeConnect the OTG port to the burning computer USB port, it's also act as 5V power supply
Press "Ctrl+C" when uboot is booting up, to enter uboot:
uboot "rbrom" comand to reboot the board into maskrom mode, for a complete "update.img" upgrade.
"rockusb 0 mmc 0" command to reboot board to loader mode, for a partial firmware upgrade or a complete "update.img" upgrade.
9.3 The Entire Package of Firmware "update.img" Upgrade9.4 Upgrade the Firmware Separately
声明:此篇为东胜物联原创文章,转载请标明出处链接:https://www.hzdusun.com/h-nd-45.html
|