Lorawan gateway GW-01. Developers guide. Armbian.
You can build Armbian image for GW-01 from source. This gives you way to customize lorawan gateway.
To do that:
Clone Armbian OS project
$ cd build
There is image to write on microSD card.
Flashing image in microSD card
Remote access via SSH.
Look for orangepizero device on your DHCP server:
and connect to it via SSH:
User/pass to login: root/1234. Change password and add new user on first login. After that we are ready to configure spi interface and install all necessary libraries to get working lorawan gateway.
Enabling SPI on armbian on first booting
Check that spidev not exist in list of devices in filesystem
Add parameters to configuration file to enable SPI interface:
Change overlays param to:
overlays=usbhost2 usbhost3 spi-spidev spi-add-cs1
Add following at the end of file:
param_spidev_spi_bus=1
param_spidev_spi_cs=1
Exit and save file. Configure dts tree:
$ cd ~
$ dtc -I dtb -O dts -o sun8i-h3-spi-spidev.dts ./sun8i-h3-spi-spidev.dtbo
$ nano sun8i-h3-spi-spidev.dts
reg = <0x1>;
Exit and save file.
Then compile new dtbo file and replace old one with that:
$ dtc -I dts -O dtb -o sun8i-h3-spi-spidev.dtbo ./sun8i-h3-spi-spidev.dts
$ sudo rm /boot/dtb/overlay/sun8i-h3-spi-spidev.dtbo
$ sudo cp sun8i-h3-spi-spidev.dtbo /boot/dtb/overlay/
SX1301 reset script.
$ touch iC880-SPI_reset.sh
$ nano iC880-SPI_reset.sh
Installing lora_gateway
Download and modify the library
$ git clone https://github.com/Lora-net/lora_gateway.git
$ cd lora_gateway
$ nano libloragw/src/loragw_spi.native.c
Installing packet_forwarder
$ git clone https://github.com/Lora-net/packet_forwarder.git
$ cd packet_forwarder/
$ ./compile.sh
$ cp global_conf.json.PCB_E286.EU868.basic ../global_conf.json
$ nano global_conf.json
“gateway_conf”: {
“server_address”: “router.eu.thethings.network”,
“server_port_up”: 1700,
“server_port_down”: 1700,
}
$ sudo ./iC880-SPI_reset.sh
$ sudo chmod 777 /dev/spidev1.1
$ cd packet_forwarder/lora_pkt_fwd
$ ./lora_pkt_fwd
You should see something similar to:
….
INFO: global_conf.json does contain a JSON object named gateway_conf, parsing gateway parameters
INFO: gateway MAC address is configured to AA555A0000000005
INFO: server hostname or IP address is configured to “router.eu.thethings.network”
INFO: upstream port is configured to “1700”
INFO: downstream port is configured to “1700”
….
INFO: found local configuration file local_conf.json, parsing it
INFO: redefined parameters will overwrite global parameters
INFO: local_conf.json does not contain a JSON object named SX1301_conf
INFO: local_conf.json does contain a JSON object named gateway_conf, parsing gateway parameters
INFO: gateway MAC address is configured to AA555A0000000005
INFO: packets received with a valid CRC will be forwarded
INFO: packets received with a CRC error will NOT be forwarded
INFO: packets received with no CRC will NOT be forwarded
lgw_connect:532: INFO: no FPGA detected or version not supported (v0)
Note: success connecting the concentrator
…
Some useful links to work with GW-01: