-
Notifications
You must be signed in to change notification settings - Fork 0
Build TTN packet forwarder for Lite Gateway
IMST Lite Gateway = Raspberry Pi B+ with Concentrator iC880A-SPI
Install manual for Raspberry Pi 3 + IMST ic880a doesn’t cover Raspberry Pi B+. The binaries are built for ARM7 architecture, Raspberry Pi B+ is ARM6.
MacBook:$ ssh pi@xxx.xxx.xxx.xxx
password: raspberry
pi@LoRaGateway:~ $ ./enableWriteAccess.sh
From Install the TTN Packet Forwarder on a Raspberry Pi with an IMST ic880a board.
Build new binary on AWS Ubuntu instance. Any other Linux system will do.
ssh ubuntu@35.157.111.111 -i /Users/testuser/cert/myAWS.pem
ubuntu@:~$ sudo apt install gcc-arm-linux-gnueabi -y
Get the Go binary distribution and install it. From: Install go
ubuntu@ip:~$ wget https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz
ubuntu@ip:~$ sudo tar -C /usr/local -xzf go1.8.3.linux-amd64.tar.gz
Add path to /etc/profile (system-wide) or user:
ubuntu@ip:~$ vim .profile
export PATH=$PATH:/usr/local/go/bin
to add path immediately, execute on shell prompt:
ubuntu@ip:~$ export PATH=$PATH:/usr/local/go/bin
ubuntu@ip:~$ mkdir go
ubuntu@ip:~$ cd go
ubuntu@ip:~/go$ mkdir -p src/hello
ubuntu@ip:~/go$ vim src/hello/hello.go
package main
import "fmt"
func main() {
fmt.Printf("hello, world\n")
}
ubuntu@ip:~/go$ cd $HOME/go/src/hello
ubuntu@ip:~/go/src/hello$ go build
ubuntu@ip:~/go/src/hello$ ./hello
Get source and change directory
ubuntu@ip:~/go$ go get -u github.com/TheThingsNetwork/packet_forwarder
ubuntu@ip:~/go$ cd src/github.com/TheThingsNetwork/packet_forwarder
Set platform and debug options in library.cfg
$ vim lora_gateway/libloragw/library.cfg
PLATFORM=imst_rpi
Set path
$ export PATH=$PATH:$(go env GOPATH)/bin
Build for ARM6 architecture (Raspberry Pi B+) with IMST Board
$ make dev-deps
$ make deps
$ GOOS=linux GOARCH=arm GOARM=6 PLATFORM=imst_rpi CROSS_COMPILE=arm-linux-gnueabi- CC=arm-linux-gnueabi-gcc make build
New binary is now in directory release/
$ ls release/
packet-forwarder-linux-arm-imst_rpi-native
Copy this binary from AWS machine to gateway via local machine. You may scp from gateway —> you have to transfer the .pem to the gateway or use username/password (AWS requirers certificate). Write access on gateway is already enabled.
MacBook:$ scp -v -3 -i /Users/testuser/cert/myAWS.pem
ubuntu@35.157.111.111:/home/ubuntu/go/src/github.com/TheThingsNetwork/packet_forwarder/release/packet-forwarder-linux-arm-imst_rpi-native pi@192.168.1.53:/usr/bin/packet-forwarder
Enter password: raspberry
From Permanent installation with systemd
-
Create a configuration file in a permanent location:
$ mkdir /etc/ttn $ touch /etc/ttn/ttn.yml
-
Set up this configuration file:
$ /usr/bin/packet-forwarder configure /etc/ttn/ttn.yml
-
Add reset-pin to the config:
nano /etc/ttn/ttn.yml reset-pin: 5
-
Use the install-systemd.sh script, with the binary as a first argument and the config file as a second argument:
$ ./install-systemd.sh /usr/bin/packet-forwarder /etc/ttn/ttn.yml
-
Take care for bug in ExecStart line in ttn-pkt-fwd.service
pi@LoRaGateway:~ $ nano /etc/systemd/system/ttn-pkt-fwd.service
change
ExecStart=/usr/bin/packet-forwarder-linux-arm-imst_rpi-native start --config="/etc/ttn/ttn.yml
to (replace = with blank)
ExecStart=/usr/bin/packet-forwarder-linux-arm-imst_rpi-native start --config "/etc/ttn/ttn.yml
-
Reload the systemd daemon, and start the service:
sudo systemctl daemon-reload sudo systemctl enable ttn-pkt-fwd sudo systemctl start ttn-pkt-fwd