Running Basic Station on Conduit
Code base and documentation
- Basic Station Code
- Documentation
- MTCDT station.conf
- MTCAP station.conf
- MTCAP2 station.conf
- MTAC-003 EU868 station.conf
- MTAC-003 US915 station.conf
- MTCAP3 EU868 station.conf
- MTCAP3 US915 station.conf
- MTCAP3 AU915 station.conf
Note: TC_TIMEOUT was included in early versions of station.conf examples. The value was set to “2s” which is too low for some cellular networks causing the MUXS connection to timeout after receiving the LNS URI configuration. This setting has been removed from the examples as it should not be needed, the default values will work for all networks. There is no benefit of a low timeout value other than for testing the timeout code is functioning.
Hardware Requirements
To use basic station an MTCAP or MTCDT with MTAC-LORA-H mCard is required. The Basic Station does not support the MTAC-LORA-1.0 USB cards.
mPower 5.3 includes UI configuration and basic station packages
Configuration Requirements
- Internet Access through Ethernet, Cellular or WiFi
- DNS access to resolve host names
- Updated system time using GPS or SNTP
Connecting to Actility
TLS certs and keys will be downloaded from Actility when Basic Station connects. These files need to be stored in persistent FLASH to be restored after reboot. The firmware mPower 6.3.2 or greater is needed to persist these files. There is a known issue with mPower 6.3.1 where some of these files were being overwritten on reboot.
Connecting to TTN
TTN Basic Station Instructions for Conduit
Logging
The JSON station configuration file has options to enable logging files, level and rotation
https://doc.sm.tc/station/conf.html#logging-setup
The following settings can be used for maximum debugging and rely on the system logrotate process to correctly rotate and gzip files. The Basic Station built-in rotate mechanism does not keep a chronological record over multiple rotate files or compress rotated logs.
“log_file”: “/var/log/lora-station.log”,
“log_level”: “XDEBUG”,
“log_size”: 1000000,
“log_rotate”: 0,
GPS PPS Settings
On MTCDT, MTCAP and MTCAP3 units without GPS hardware can disable PPS sync to reduce log messages for failed timesync with PPS.
{
“SX1301_conf”: {
“lorawan_public”: true,
“clksrc”: 0,
“pps”: false,
Beaconing Settings
Beaconing parameters should come from the LNS. Since the gateway is configured at the LNS for a specific channel plan, the LNS should be setting the gateway beacon.
TTN supports basic station beaconing since 2022.
https://www.thethingsnetwork.org/forum/t/upgrade-to-the-things-network-v3-21-2-completed/58810
Beacon settings can be provided by the LNS in the router_config message.
The bcning
field is either None
or a BCNCONF object with the following layout:
{
"DR" : INT
"layout": [INT,INT,INT]
"freqs": [ INT, .. ]
}
The layout
field specifies the octet offsets for insertion of the message fields Time
and GwSpecific
, followed by the length of the beacom PDU.
// Pack parameters into a BEACON pdu with the following layout:// | 0-n | 4 | 2 | 1 | 3 | 3 | 0-n | 2 | bytes – all fields little endian// | RFU | epoch_secs | CRC | infoDesc | lat | lon | RFU | CRC |//void s2e_make_beacon (uint8_t* layout, sL_t epoch_secs, int infodesc, double lat, double lon, uint8_t* pdu) {int time_off = layout[0];int infodesc_off = layout[1];int bcn_len = layout[2];
Beacon Frame Format is found in the LoRaWAN 1.0.4 Specification
Layout settings for each spreading factor:
- SF8 – [ 1, 7, 19 ]
- SF9 – [ 2, 8, 17 ]
- SF10 – [ 3, 9, 19 ]
- SF11 – [ 4, 10, 21 ]
- SF12 – [ 5, 11, 23 ]
Credentials
Select LNS or CUPS depending on server requirements. The LNS protocol will downlink the channel plan from a server. The CUPS protocol and redirect the station process to a network server end-point.
Connecting to TTN Community v3
https://nam1.cloud.thethings.network/console
https://eu1.cloud.thethings.network/console
https://au1.cloud.thethings.network/console
https://www.thethingsindustries.com/docs/gateways/lora-basics-station/cups/
https://thethingsindustries.com/docs/gateways/multitechconduit/lbs/
Certificate Information
https://www.thethingsindustries.com/docs/reference/root-certificates/
CUPS
https://nam1.cloud.thethings.network:443 https://eu1.cloud.thethings.network:443 https://au1.cloud.thethings.network:443
Use the following command to view the certificate used by the server.
openssl s_client -showcerts -servername eu1.cloud.thethings.industries -connect eu1.cloud.thethings.industries:443
Using CUPS requires creating two API keys for your gateway. The LNS lbs-lns-secret key will be sent to the gateway over the CUPS protocol. The CUPS key will authenticate the gateway when negotiating the CUPS connection.
URI
Set the URI field to point to a network, in this example a TTI private instance is used.
Connecting to TTN Community
Replace “nam1” with “au1”, “eu1” for the desired region.
wss://nam1.cloud.thethings.network:8887
Station Conf
The default station configuration can be used as the network will configure the channels based on the selected channel plan in the TTI configuration.
Server Certificate
TTN Community certificates
https://www.thethingsindustries.com/docs/reference/root-certificates/
Replace “nam1” with “au1” or “eu1” for the desired region.
openssl s_client -showcerts -servername nam1.cloud.thethings.network -connect nam1.cloud.thethings.network:8887
Use the second certificate output by the open ssl command
Gateway Certificate
If a TLS client cert is required to connect to the server provide a certificate. Otherwise leave this field blank for connecting to TTN v3.
Gateway Key
The Gateway Key can be used to populate the authorization header field or be a TLS client key depending on connection method. The Gateway Key needs to be formatted correctly to be used. In The Things Industries v3 GUI, create an API Key with Link as Gateway permissions and copy the key to the text box preceded by “Authorization: ”
Creating the Gateway key for LNS
Authorization: NNSXS.XXXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
TTN Community gateway key
Currently the TTN Community servers to not authenticate the gateway key. Any value can be set, the file needs have proper contents to allow parsing by the basic station daemon.
Authorization: NNSXS.XXXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Click Save and Apply and the station will be started.
Duty-cycle, listen-before-talk (LBT/CCA), and dwell-time
Basic Station enables LBT for AS923-1 by default, see ccaEnabled is set in the region configuration.
https://github.com/lorabasics/basicstation/blob/ba4f85d80a438a5c2b659e568cd2d0f0de08e5a7/src/s2e.c#L1011
See region name “AS923-1 (CCA)” in the logs and LBT is enabled for 8 channels. If the gateway does not have FPGA v33 or v35 installed the concentrator fails to start with the LBT settings.
2024-06-18 03:44:29.475 [AIO:XDEB] [4|WS] < {"msgtype":"router_config","NetID":null,"JoinEui":null,"region":"AS923","hwspec":"sx1301/1","freq_range":[920000000,923400000],"DRs":[[12,125,0],[11,125,0],[10,125,0], [9,125,0],[8,125,0],[7,125,0],[7,250,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],"sx1301_conf":[{"radio_0":{"enable":true,"freq":923000000},"radio_1":{"enable":true,"freq":9221000 00},"chan_multiSF_0":{"enable":true,"radio":0,"if":200000},"chan_multiSF_1":{"enable 2024-06-18 03:44:29.475 [AIO:XDEB] [4|WS] . ":true,"radio":0,"if":400000},"chan_multiSF_2":{"enable":true,"radio":1,"if":100000},"chan_multiSF_3":{"enable":true,"radio":1,"if":300000},"chan_multiSF_4":{"enable": true,"radio":0,"if":-400000},"chan_multiSF_5":{"enable":true,"radio":0,"if":-200000},"chan_multiSF_6":{"enable":true,"radio":0,"if":0},"chan_multiSF_7":{"enable":true,"radio":1,"if":-100000},"chan_Lora_std":{"en able":true,"radio":1,"if":0,"bandwidth":250000,"spread_factor":7},"chan_FSK":{"enabl 2024-06-18 03:44:29.475 [AIO:XDEB] [4|WS] . e":true,"radio":1,"if":-300000,"datarate":50000}}],"MuxTime":1718682269.2040114,"bcning":{"DR":3,"layout":[2,8,17],"freqs":[923400000]}} ... 2024-06-18 03:44:29.215 [S2E:INFO] Configuring for region: AS923-1 (CCA) -- 920.0MHz..923.4MHz ... 2024-06-18 03:44:29.216 [S2E:INFO] Dev/test settings: nocca=0 nodc=0 nodwell=0 ... 2024-06-18 03:44:29.694 [S00:INFO] SX130x LBT enabled: rssi_target=-80 rssi_offset=0 2024-06-18 03:44:29.694 [S00:INFO] 0: freq=923.2MHz scan=5000us 2024-06-18 03:44:29.696 [S00:INFO] 1: freq=923.4MHz scan=5000us 2024-06-18 03:44:29.697 [S00:INFO] 2: freq=922.2MHz scan=5000us 2024-06-18 03:44:29.699 [S00:INFO] 3: freq=922.4MHz scan=5000us 2024-06-18 03:44:29.700 [S00:INFO] 4: freq=922.6MHz scan=5000us 2024-06-18 03:44:29.700 [S00:INFO] 5: freq=922.8MHz scan=5000us 2024-06-18 03:44:29.701 [S00:INFO] 6: freq=923.0MHz scan=5000us 2024-06-18 03:44:29.701 [S00:INFO] 7: freq=922.0MHz scan=5000us INFO: FPGA supported features: [TX filter] [Spectral Scan] 2024-06-18 03:44:30.291 [S00:ERRO] Concentrator start failed: lgw_start
The network can send nocca, nodc, and nodwell settings in the router config, The basic station source repo does not enable them for production builds.
We have changed the in mPower 6.3.4 to allow these settings from the LNS or in the configuration file.
In mPower 6.3.4 we added the option to set nocca=0 nodc=0 nodwell=0 in the station.conf. This will override the default cca settings in the region and settings sent from the LNS router_config message.
Add nocca to the station_conf section of the Station Config. The options for nodc and nodwell can be set as well.
"station_conf": { "TC_TIMEOUT": "20s", "euiprefix": "::0", "log_file": "/var/log/lora-station.log", "log_level": "XDEBUG", "log_rotate": 0, "log_size": 1000000, "routerid": "", "nocca": true }
Now the station will start with nocca enabled and LBT settings will not be used.
2024-06-27 12:40:42.697 [S2E:INFO] Dev/test settings: nocca=1 nodc=0 nodwell=0
Troubleshooting
If there are issues and the station needs to be run manually, you can ssh into the gateway and issue these commands to see output. The station.conf logging feature can also be used to get messages to find any issue details.
$ /etc/init.d/lora-networks-server stop $ cd /var/run/lora/1 $ sudo ./station
With persistent config enabled, additional files are downloaded when the station connects to the server. The station process is run within the /var/config directory so files maintained by the station will be saved.
$ /etc/init.d/lora-networks-server stop $ cd /var/config/lora/1 $ sudo ./station
Installation on MTCDT/MTCAP
Install the Basic Station from downloads.
$ sudo -s # wget http://www.multitech.net/downloads/lora-basic-station_2.0.3-r1.0_arm926ejste.ipk # opkg install lora-basic-station_2.0.3-r1.0_arm926ejste.ipk
The /opt/lora/station binary will be installed.
Basic Station to Packet Forwarder
This example python script shows how to send a channel configuration to the connection basic station gateway. It is useful for getting started and ensuring the gateway is functioning.
Basic Station Examples
TTI Configuration
The Things Industries provide private server instances that Basic Station can connect to. Visit TTI for details.
tc.uri
wss://<ORG>.<REGION>.cloud.thethings.industries:8887
wss://multitech.eu1.cloud.thethings.industries:8887
tc.key – Gateway Token
The tc.key file needs to be formatted correctly to be used and can be created with this command. In The Things Industries v3 GUI, create an API Key with Link as Gateway permissions and copy the key to the tc.key file.
echo -en "Authorization: NNSXS.XXXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\r\n" > tc.key
tc.trust
Use the following command to view the certificate used by the server.
openssl s_client -showcerts -servername multitech.eu1.cloud.thethings.industries -connect multitech.eu1.cloud.thethings.industries:8887
Configuration files
- Adjust the station.conf file for the desired frequencies, see examples.Download station.confUse the routerid and euiprefix fields to assign the Gateway EUI.
See Basic Station Doc for EUI. - Configure tc.uri to point to the network server web socket port
ws://192.168.52.72:6090
- For secure web sockets use wss and provide tc.key or tc.trust and tc.crt files
wss://192.168.52.72:6090
Running the Basic Station
root@mtcdt:/opt/lora$ sudo ./station 2020-02-26 16:56:02.698 [SYS:WARN] Ignoring field: region 2020-02-26 16:56:02.700 [SYS:INFO] Logging : stderr (maxsize=10000000, rotate=3) 2020-02-26 16:56:02.700 [SYS:INFO] Station Ver : 2.0.3(mlinux/std) 2020-01-24 16:54:44 2020-02-26 16:56:02.700 [SYS:INFO] Package Ver : (null) 2020-02-26 16:56:02.701 [SYS:INFO] proto EUI : ::1 (station.conf) 2020-02-26 16:56:02.701 [SYS:INFO] prefix EUI : ::0 (station.conf) 2020-02-26 16:56:02.701 [SYS:INFO] Station EUI : ::1 2020-02-26 16:56:02.701 [SYS:INFO] Station home: ./ (builtin) 2020-02-26 16:56:02.701 [SYS:INFO] Station temp: /var/tmp/ (builtin) 2020-02-26 16:56:02.701 [SYS:WARN] Station in NO-CUPS mode 2020-02-26 16:56:02.903 [TCE:INFO] Starting TC engine 2020-02-26 16:56:02.908 [TCE:INFO] Connecting to INFOS: ws://192.168.52.72:6090 2020-02-26 16:56:02.912 [TCE:INFO] Infos: ::1 muxs-::0 ws://192.168.52.72:6092/router-::1 2020-02-26 16:56:02.912 [AIO:DEBU] [3] ws_close reason=1000 2020-02-26 16:56:02.913 [AIO:DEBU] [3] Server sent close: reason=1000 2020-02-26 16:56:02.913 [AIO:DEBU] [3] WS connection shutdown... 2020-02-26 16:56:02.916 [TCE:VERB] Connecting to MUXS... 2020-02-26 16:56:02.917 [TCE:VERB] Connected to MUXS. INFO: FPGA supported features: [TX filter] [Spectral Scan] [LBT] 2020-02-26 16:56:03.219 [S2E:WARN] Unknown field in router_config - ignored: bcning (0x1EE5E245) 2020-02-26 16:56:03.219 [S2E:WARN] Unknown field in router_config - ignored: config (0xF7A3E35F) 2020-02-26 16:56:03.219 [S2E:WARN] Unknown field in router_config - ignored: protocol (0xFD309030) 2020-02-26 16:56:03.220 [S2E:WARN] Unknown field in router_config - ignored: regionid (0xE6FFB211) 2020-02-26 16:56:03.220 [S2E:WARN] Unknown field in router_config - ignored: upchannels (0x7FCAA9EB) 2020-02-26 23:08:46.995 [RAL:WARN] Ignoring unsupported/unknown field: lbt_conf 2020-02-26 23:08:47.049 [RAL:INFO] Lora gateway library version: Version: 5.0.1-mts-1; 2020-02-26 23:08:47.049 [RAL:DEBU] SX1301 txlut table (2 entries) 2020-02-26 23:08:47.049 [RAL:VERB] SX1301 txlut 0: dig_gain=0 pa_gain=0 dac_gain=3 mix_gain=11 rf_power=-6 2020-02-26 23:08:47.049 [RAL:VERB] SX1301 txlut 1: dig_gain=0 pa_gain=0 dac_gain=3 mix_gain=13 rf_power=-3 2020-02-26 23:08:47.049 [RAL:VERB] SX1301 rxrfchain 0: enable=1 freq=868475000 rssi_offset=-162.000000 type=2 tx_enable=1 tx_notch_freq=0 2020-02-26 23:08:47.049 [RAL:VERB] SX1301 rxrfchain 1: enable=1 freq=869287500 rssi_offset=-162.000000 type=2 tx_enable=0 tx_notch_freq=0 2020-02-26 23:08:47.049 [RAL:VERB] SX1301 ifchain 0: enable=1 rf_chain=0 freq=-375000 bandwidth=0 datarate=0 sync_word=0/0 2020-02-26 23:08:47.050 [RAL:VERB] SX1301 ifchain 1: enable=1 rf_chain=0 freq=-175000 bandwidth=0 datarate=0 sync_word=0/0 2020-02-26 23:08:47.050 [RAL:VERB] SX1301 ifchain 2: enable=1 rf_chain=0 freq=25000 bandwidth=0 datarate=0 sync_word=0/0 2020-02-26 23:08:47.050 [RAL:VERB] SX1301 ifchain 3: enable=1 rf_chain=0 freq=375000 bandwidth=0 datarate=0 sync_word=0/0 2020-02-26 23:08:47.050 [RAL:VERB] SX1301 ifchain 4: enable=1 rf_chain=1 freq=-237500 bandwidth=0 datarate=0 sync_word=0/0 2020-02-26 23:08:47.050 [RAL:VERB] SX1301 ifchain 5: enable=1 rf_chain=1 freq=237500 bandwidth=0 datarate=0 sync_word=0/0 2020-02-26 23:08:47.050 [RAL:VERB] SX1301 ifchain 6: enable=0 rf_chain=1 freq=200000 bandwidth=0 datarate=0 sync_word=0/0 2020-02-26 23:08:47.050 [RAL:VERB] SX1301 ifchain 7: enable=0 rf_chain=1 freq=400000 bandwidth=0 datarate=0 sync_word=0/0 2020-02-26 23:08:47.050 [RAL:VERB] SX1301 ifchain 8: enable=0 rf_chain=0 freq=-200000 bandwidth=2 datarate=2 sync_word=0/0 2020-02-26 23:08:47.051 [RAL:VERB] SX1301 ifchain 9: enable=0 rf_chain=0 freq=300000 bandwidth=3 datarate=50000 sync_word=0/0 2020-02-26 23:08:47.051 [RAL:VERB] SX1301 LBT not enabled 2020-02-26 23:08:47.051 [RAL:INFO] Station device: /dev/spidev0.0 (PPS capture enabled) 2020-02-26 23:08:50.049 [S2E:INFO] Configuring for region: EU863 -- 863.0MHz..870.0MHz 2020-02-26 23:08:50.049 [S2E:VERB] DR0 SF12/BW125 2020-02-26 23:08:50.049 [S2E:VERB] DR1 SF11/BW125 2020-02-26 23:08:50.049 [S2E:VERB] DR2 SF10/BW125 2020-02-26 23:08:50.049 [S2E:VERB] DR3 SF9/BW125 2020-02-26 23:08:50.049 [S2E:VERB] DR4 SF8/BW125 2020-02-26 23:08:50.049 [S2E:VERB] DR5 SF7/BW125 2020-02-26 23:08:50.049 [S2E:VERB] DR6 SF7/BW250 2020-02-26 23:08:50.049 [S2E:VERB] DR7 FSK 2020-02-26 23:08:50.049 [S2E:VERB] DR8 undefined 2020-02-26 23:08:50.049 [S2E:VERB] DR9 undefined 2020-02-26 23:08:50.049 [S2E:VERB] DR10 undefined 2020-02-26 23:08:50.049 [S2E:VERB] DR11 undefined 2020-02-26 23:08:50.050 [S2E:VERB] DR12 undefined 2020-02-26 23:08:50.050 [S2E:VERB] DR13 undefined 2020-02-26 23:08:50.050 [S2E:VERB] DR14 undefined 2020-02-26 23:08:50.050 [S2E:VERB] DR15 undefined 2020-02-26 23:08:50.050 [S2E:VERB] TX power: 16.0 dBm EIRP 2020-02-26 23:08:50.050 [S2E:VERB] 27.0 dBm EIRP for 869.4MHz..869.65MHz 2020-02-26 23:08:50.050 [S2E:VERB] JoinEui list: 0 entries 2020-02-26 23:08:50.050 [S2E:VERB] NetID filter: FFFFFFFF-FFFFFFFF-FFFFFFFF-FFFFFFFF 2020-02-26 23:08:50.050 [S2E:VERB] Dev/test settings: nocca=0 nodc=0 nodwell=0