DSGW-023 SDK Quick Start Guide V1.0发表时间:2022-08-20 10:58
SDK Quick Start Guide Product Name: Smart Router Gateway Model Name: DSGW-023
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-023 gateway. Base on the MTK OpenWrt SDK V3.4, and leveraging existing open source software, the SDK simplifies the process of adding custom applications. Device drivers, toolchain, Pre-defined configuration profiles, and sample applications are all in included.
2 Gateway Information2.1 Basic informationSOC: MT7621A, Dual-core 880MHZ Wifi Radio: MT7603E (2.4G), MT7612EN (5G) Power Supply: DC-5V ZigBee: EFR32MG1B232F256GM32 Z-Wave: ZGM130S037HGN Bluetooth: EFR32BG21A020F768IM32 RAM: DDR2 256MB NAND Flash: 128MB 2.2 Interface
3 Target SetupThis section describes how to connect the gateway into your host computer and network. Connecting a gateway - Power Make sure that the power adapter is 5V/2A. 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. Connect the output plug of the power supply to the gateway Connecting a gateway – LAN port 1. Connect one end of the network cable to the Ethernet port on the laptop or desktop 2. Connect the other end of network cable to the LAN port on the gateway.
Figure3-1. Connecting a gateway via Ethernet port
Before you set up your development test bed, please connect the PCB serial port to your develop PC via USB-to-serial bridge. Serial port setting: Baud rate: 57600 Bits: 8 Stop Bits: 1 Hardware flow control: None
4 Compile the Environment to Build4.1 OpenWrt VersionThe Version Name: Barrier Breaker The Version No: MTK OpenWrt SDK V3.4 4.2 PC Compile the Environment to BuildCompilation environment: CentOS Linux 7 1. uboot compilation tool chain installation Unzip mips-2012.03.tar.bz2 to /opt, cd /opt tar xvjf <path_to>/ mips-2012.03.tar.bz2 You get /opt/mips-2012.03/ 2. Openwrt's compilation tool is automatically generated by SDK built, no additional installation is required 4.3 OpenWrt configuration and compilationGet the source code tarball from Dusun FTP server and uncompress it under your work directory. 1. Configure compilation options There is already a default configuration in the SDK, which satisfies the basic functions of routing. Customers can also customize the configuration according to their own needs. Command: cd <work_dir>/openwrt-sdk/ make menuconfig
MTK Properties are MTK private drivers/APPs components:
We need to select two wifi radio chip mt7603e and mt7612e drivers: MTK Properties => drivers =>
Select LcCI configuration:
Change DDR ram size in kernel config: make kernel_menuconfig Machine selection => DRAM Size (128M) Exit and save the configuration.
2. Build the image Just use command 'make V=99', the image built will take a long time. The target image will be under ./bin/ramips/ Image name is openwrt-ramips-mt7621-mt7621-squashfs-sysupgrade.bin
5 Network interfacesLogin into the gateway device, using command 'ifconfig', you can get all network interfaces. Interface eth1 connects to WAN port (Blue RJ45 port), eth0 is LAN port, it's connected to an internal switch on SoC, all LAN ports are connected to eth0。 Interface ra0 is 2.4G radio, rai0 is 5G radio.
6 Use 'reg' command to control MT7621 registersPlease login into the gateway device via console tool like Putty. Set the base address reg s 0 Read reg r <reg_offset_addr> Write reg w <reg_offset_addr> <value>
7 Openwrt restore to factory setting
Command: umount /dev/mtdblock6; firstboot Press 'y' to confirm and then reboot system.
8 Add APP component in OpenwrtPlease take openwrt-sdk/package/dusun/dstest/ as an example, it's simple and clear. If you want to add a new user lever application into openwrt SDK, just follow the example dstest. After code is ready, you still need to add it to config file by "make menuconfig", and select 'dstest':
9 GPIOSome GPIOs are multiplexed, they can be used by some of the SoC components. It's controlled by GPIO_MODE registers.
Take RGMII2 pins as an example, RGMII2_MODE register actually can control 12 pins:
If set GPIO_MODE bit 15 (RGMII2_MODE) to 1, these 12 pins are used as GPIO (which means RGMII2 function cannot work anymore).
You can still use 'reg' to set GPIO Set pin to GPIO mode Use 'reg s 0; reg r 60' to read GPIO_MODE Default RGMII2 setting is RGMII2 mode, i.e. bit15 == 0
Set bit15 to 1: "reg w 60 0x48258" After set, read back to check if it's OK: 'reg r 60' Set GPIO input or output GPIO has 3 groups, below X=0/1/2, every register controls 32 GPIOs GPIO control registers: GPIO_CTRL_X: GPIO direction (input or output) control register GPIO_POL_X: GPIO polarity control, used when GPIO as interrupt source GPIO_DATA_X: GPIO value, when GPIO is used as input GPIO_DSET_X: When GPIO is output, set 1 is set GPIO value=1 (write only, set bit to 0 has no effect) GPIO_DCLR_X: When GPIO is output, set 1 is set GPIO value=0 (write only, set bit to 0 has no effect)
Example: Control GPIO22 as GPIO output, GPIO22 is in range 0~31, so use GPIO_XXX_0 to control it. Read GPIO_CTRL_0: reg r 600
If bit22 == 1, means GPIO22 is set to GPIO output Set GPIO_DSET_0 bit22 to 1, then GPIO Pin 22 is high. Command: reg w 630 0x4000000
10 uboot build and upgrade1. uboot configuration and build
On development PC: cd Uboot make You get uboot.img 2. uboot upgrade Setup tftp server on the development PC, and put uboot.img under tftp root directory.
Make sure connect the board to PC via serial port, reset board and press '9' when current uboot is booting up. Follow the steps in the console:
The uboot.img will be downloaded to the board and upgraded, then automatically reset to boot new uboot:
11 System firmware upgradePut the image on any server which supports ssh/scp service. scp user@serverip:~/openwrt-ramips-mt7621-mt7621-squashfs-sysupgrade.bin /tmp/ sysupgrade -v /tmp/openwrt-ramips-mt7621-mt7621-squashfs-sysupgrade.bin
12 Wi-Fi APJust connect WAN port to up layer router or switch, the AP can work. Default password is 123456, LAN address is 192.168.66.*
ra0 RTWIFI SoftAP ESSID:"mt7603e" Mode:Managed Channel=1 Access Point: 00:0C:43:26:60:08 Bit Rate=300 Mb/s rai0 RTWIFI SoftAP ESSID:"mt7612e" Mode:Managed Channel=52 Access Point: DC:4B:DD:1D:97:3F Bit Rate=400 Mb/s After your station connects to AP, you can use browser to access http://192.168.66.1 to the openwrt admin web page. Use root/root to login web page. 13 Zigbee testBefore build and compile Zigbee test app, you need to setup cross compile toolchain. For example, your openwrt SDK source code is ~/work_dir/openwrt-sdk, Add below function in your .bashrc function mtk_toolchain { export STAGING_DIR="~/work_dir/openwrt-sdk/staging_dir" export PATH=$PATH:~/work_dir/openwrt-sdk/staging_dir/toolchainmipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/ } then source ~/.bashrc mtk_toolchain cd work_dir/Z3GatewayHost_EFR32MG12P433F1024GM48/ make You get work_dir/Z3GatewayHost_EFR32MG12P433F1024GM48/build/exe/Z3GatewayHost_EFR32 MG12P433F1024GM48 scp the executable file to board and run it as below: ./Z3GatewayHost_EFR32MG12P433F1024GM48 -n1 -p /dev/ttyS1 -b115200
For more information about Zigbee, please visit https://silabs.com 14 OthersFor more information, please visit openwrt official website. For more information about wifi development, please check MTKWiFiSoftAPSoftwareProgrammingGuidev42.1276024433.pdf
声明:此篇为东胜物联原创文章,转载请标明出处链接:https://www.hzdusun.com/h-nd-47.html
|