Skip to content

[ChirpStack] Installing on RPI3 IMST ic880a and performing basic configuration

Sébastien Jean edited this page Feb 14, 2023 · 4 revisions

Preamble

The following, based on ChirpStack documentation, describes how to get Chirpstack full GatewayOS (gateway bridge + udp bridge + network server + application server) running on a Raspberry Pi with a ic880a Lora hat.

Hardware used

  • RPi 3 model B rev 1.2 (cat /proc/device-tree/model to check)

  • iC880a gateway + unidentified backplane

  • wired connection, automatic IP via DHCP

  • HDMI display, keyboard, mouse (useless if configuration is done via ssh)

Chirpstack Gateway OS full installation

This step is pretty straightforward because it consists mainly in burning the ready to use image that can be downloaded from Chirsptack.

Image download

⚠️ At the time this document is written, Chirpstack has moved to V4. Unfortunately, it seems to have a regression leading to concentratord not starting properly due to configuration issues, under the same conditions

Image burn on SD

Chirpstack basic configuration

Gateway OS is built around a specific Linux distribution, with no graphical environment, no system update via apt, ... Default keyboard configuration is QWERTY, not modifiable. The best way to open a terminal for configuration is then SSH.

SSH login

  • ssh admin@xxxx where xxxx is RPi IP address (here 192.168.1.161)
    • password is admin
MacBook-Air-749:~ sebastienjean$ ssh [email protected]
[email protected]'s password: 
   ________    _           _____ __             __     _     
  / ____/ /_  (_)________ / ___// /_____ ______/ /__  (_)___ 
 / /   / __ \/ / ___/ __ \\__ \/ __/ __ `/ ___/ //_/ / / __ \
/ /___/ / / / / /  / /_/ /__/ / /_/ /_/ / /__/ ,< _ / / /_/ /
\____/_/ /_/_/_/  / .___/____/\__/\__,_/\___/_/|_(_)_/\____/ 
                 /_/

Documentation and copyright information:
> www.chirpstack.io

Commands:
> sudo gateway-config  - configure the gateway
> sudo monit summary   - display service monitor

raspberrypi3:~$ 

Solve hardware address issues

⚠️ The following issue no longer seem to occur on recent Chirpstack GatewayOS images.

RPI3 does not have MAC chip, the hardware address is often generated at boot time using an OUI (B8:27:EB) and CPU serial number (unique hardware information)

Chirpstack GatewayOs image seems to use UBoot bootloader and this one does not configure hardware address properly (using VPU revision number instead of CPU serial number), leading to have always the same address for all equivalent RPI3 (B8:27:EB:51:09:50).

To check if issue occurs (here, for eth0), just type ifconfig in a terminal:

raspberrypi3:/etc$ ifconfig
eth0      Link encap:Ethernet  HWaddr B8:27:EB:51:09:50  
          inet addr:192.168.1.161  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::ba27:ebff:fed2:5db4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5623 errors:0 dropped:1041 overruns:0 frame:0
          TX packets:822 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:545463 (532.6 KiB)  TX bytes:110899 (108.2 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:86519 errors:0 dropped:0 overruns:0 frame:0
          TX packets:86519 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:16350876 (15.5 MiB)  TX bytes:16350876 (15.5 MiB)

wlan0     Link encap:Ethernet  HWaddr B8:27:EB:87:08:E1  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

In order to change permanently this address for a correct one, first find the true address by booting on a Raspbian and using ifconfig from a terminal, and then add a line to setup hardware address in /etc/network/interfaces file as following:

  • edit the file using builtin text editor
raspberrypi3:/etc$ sudo nano /etc/network/interfaces
  • locate the section where the network interface to be used is set up, and add a hwaddress line
# Wired or wireless interfaces
auto eth0
iface eth0 inet dhcp
hwaddress ether B8:27:EB:D2:5D:B4
iface eth1 inet dhcp
  • reboot (using sudo reboot) and check again with ifconfig
eth0      Link encap:Ethernet  HWaddr B8:27:EB:D2:5D:B4
          inet addr:192.168.1.161  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::ba27:ebff:fed2:5db4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5623 errors:0 dropped:1041 overruns:0 frame:0
          TX packets:822 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:545463 (532.6 KiB)  TX bytes:110899 (108.2 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:86519 errors:0 dropped:0 overruns:0 frame:0
          TX packets:86519 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:16350876 (15.5 MiB)  TX bytes:16350876 (15.5 MiB)

wlan0     Link encap:Ethernet  HWaddr B8:27:EB:87:08:E1  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Shield configuration

From a terminal, start gateway configuration:

raspberrypi3:/etc$ sudo gateway-config

Then, enter item 1 (Setup LoRa Concentrator Shield)

gateway-config-main

Select shield used (here IMST-ic880a)

gateway-config-concentrator-main

Select frenquency band (no really choice here)

gateway-config-concentrator-band

After that, select OK every time warned about file overwriting

Set 17 as GPIO used for shield reset

gateway-config-concentrator-gpio

After that, shield is reset and orange led blinks once.

Then, from main menu enter first item 2 (Edit Chirpstack concentratord config)

gateway-config-main

Select item 1 (General configuration), that opens concentratord global configuration file located at /etc/chirpstack-concentratord/sx1301/global.toml , and check that gateway id and reset pin are correctly set up.

Items 2 and 3 may not require special attention, refer to official documentation if any further trouble is experienced

gateway-config-concentrator-config-main

Gateway Bridge configuration

From gateway configuration terminal tool, enter item 3 (Edit Chirpstack Gateway Bridge config)

gateway-config-main

Then, edit gateway-bridge configuration file (located at /etc/chirpstack-gateway-bridge/chirpstack-gateway-bridge.toml)

gateway-bridge-config-main

By default, backend is concentratord and any incoming LoRa frame will be sent to local MQTT broker:

# Gateway backend configuration.
[backend]
# Backend type.
type="concentratord"
...
# Generic MQTT authentication.
[integration.mqtt.auth.generic]
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://127.0.0.1:1883"

This is the expected behaviour here, since all Chirpstack components (concentrator, Gateway bridge, NS, AS) run on same host and communicate with each other locally.

Network and application server installation check

networking services

Running services and established connections can be seen by typing netstat - an in a terminal.

raspberrypi3:~$ netstat -an 
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      
tcp        0      0 0.0.0.0:1883            0.0.0.0:*               LISTEN      
tcp        0      0 0.0.0.0:2812            0.0.0.0:*               LISTEN      
...

The above 4 lines show that Redis (port 6379), Postgresql (port 5432), MQTT (port 1883) and Monit (port 2812) seem to be running properly. Each of these 4 services is part of Chirpstack.

NMAP, run from a machine on the same LAN (e.g. the one used to connect to wateway through SSH), can detect running services:

MacBook-Air-749:~ sebastienjean$ nmap -sV -Pn 192.168.1.161
Host discovery disabled (-Pn). All addresses will be marked 'up' and scan times will be slower.
Starting Nmap 7.91 ( https://nmap.org ) at 2021-05-23 13:39 CEST
Nmap scan report for raspberrypi3 (192.168.1.161)
Host is up (1.2s latency).
Not shown: 995 closed ports
PORT     STATE SERVICE      VERSION
22/tcp   open  ssh          Dropbear sshd 2019.78 (protocol 2.0)
111/tcp  open  rpcbind      2-4 (RPC #100000)
8000/tcp open  http-alt?
8001/tcp open  vcom-tunnel?
8080/tcp open  http         Golang net/http server (Go-IPFS json-rpc or InfluxDB API)

Ports 8000 and 8001 are respectively used by Chirpstack NetWork Server (NS) and Application Server (AS) to expose their API and communicate with others Chirpstack components (see official documentation). Port 8080 is AS web interface.

Monit

Monit is tool used to start/stop/restart and monitor given services.

Typing sudo monit summary in a terminal helps checking if installation is correct and components are running:

raspberrypi3:~$ sudo monit summary
Monit 5.26.0 uptime: 42m
┌─────────────────────────────────┬────────────────────────────┬───────────────┐
│ Service Name                    │ Status                     │ Type          │
├─────────────────────────────────┼────────────────────────────┼───────────────┤
│ raspberrypi3                    │ OK                         │ System        │
├─────────────────────────────────┼────────────────────────────┼───────────────┤
│ chirpstack-network-server       │ OK                         │ Process       │
├─────────────────────────────────┼────────────────────────────┼───────────────┤
│ chirpstack-gateway-bridge       │ OK                         │ Process       │
├─────────────────────────────────┼────────────────────────────┼───────────────┤
│ chirpstack-concentratord        │ OK                         │ Process       │
├─────────────────────────────────┼────────────────────────────┼───────────────┤
│ chirpstack-application-server   │ OK                         │ Process       │
└─────────────────────────────────┴────────────────────────────┴───────────────┘

If some services are not running, it may be caused by configuration file issues. In that case, check log with sudo tail /var/log/messages.

Application Server web interface

From a web browser, try to reach Application Server web interface:

AS-web-interface

(default login is admin / admin).

Clone this wiki locally