(this is a crosspost from the RAK Wireless forum, I’ll update with links to answers once I have a solution)
I am successfully running the UDP TTN-gateway on a Raspberry Pi 4 with the RAK PiHat and a RAK5146 concentrator card. I’m able to process up- and downlink messages, and after a few weeks of monkeying with it, everything Just Works. Proof here:
*** Packet Forwarder ***
Version: 2.1.0
*** SX1302 HAL library version info ***
Version: 2.1.0;
***
INFO: Little endian host
INFO: found configuration file global_conf.json, parsing it
INFO: global_conf.json does contain a JSON object named SX130x_conf, parsing SX1302 parameters
INFO: com_type SPI, com_path /dev/spidev0.0, lorawan_public 1, clksrc 0, full_duplex 0
INFO: antenna_gain 0 dBi
INFO: Configuring legacy timestamp
INFO: Configuring Tx Gain LUT for rf_chain 0 with 16 indexes for sx1250
INFO: radio 0 enabled (type SX1250), center frequency 904300000, RSSI offset -215.399994, tx enabled 1, single input mode 0
INFO: radio 1 enabled (type SX1250), center frequency 905000000, RSSI offset -215.399994, tx enabled 0, single input mode 0
INFO: Lora multi-SF channel 0> radio 0, IF -400000 Hz, 125 kHz bw, SF 5 to 12
INFO: Lora multi-SF channel 1> radio 0, IF -200000 Hz, 125 kHz bw, SF 5 to 12
INFO: Lora multi-SF channel 2> radio 0, IF 0 Hz, 125 kHz bw, SF 5 to 12
INFO: Lora multi-SF channel 3> radio 0, IF 200000 Hz, 125 kHz bw, SF 5 to 12
INFO: Lora multi-SF channel 4> radio 1, IF -300000 Hz, 125 kHz bw, SF 5 to 12
INFO: Lora multi-SF channel 5> radio 1, IF -100000 Hz, 125 kHz bw, SF 5 to 12
INFO: Lora multi-SF channel 6> radio 1, IF 100000 Hz, 125 kHz bw, SF 5 to 12
INFO: Lora multi-SF channel 7> radio 1, IF 300000 Hz, 125 kHz bw, SF 5 to 12
INFO: Lora std channel> radio 0, IF 300000 Hz, 500000 Hz bw, SF 8, Explicit header
INFO: FSK channel 8 disabled
INFO: global_conf.json does contain a JSON object named gateway_conf, parsing gateway parameters
INFO: gateway MAC address is configured to AA555A0000000000
INFO: server hostname or IP address is configured to "nam1.cloud.thethings.network"
INFO: upstream port is configured to "1700"
INFO: downstream port is configured to "1700"
INFO: downstream keep-alive interval is configured to 10 seconds
INFO: statistics display interval is configured to 30 seconds
INFO: upstream PUSH_DATA time-out is configured to 100 ms
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
INFO: GPS serial port path is configured to "/dev/ttyUSB0"
INFO: Reference latitude is configured to 0.000000 deg
INFO: Reference longitude is configured to 0.000000 deg
INFO: Reference altitude is configured to 0 meters
INFO: Beaconing period is configured to 0 seconds
INFO: Beaconing signal will be emitted at 869525000 Hz
INFO: Beaconing datarate is set to SF9
INFO: Beaconing modulation bandwidth is set to 125000Hz
INFO: Beaconing TX power is set to 14dBm
INFO: Beaconing information descriptor is set to 0
INFO: global_conf.json does contain a JSON object named debug_conf, parsing debug parameters
INFO: got 2 debug reference payload
INFO: reference payload ID 0 is 0xCAFE1234
INFO: reference payload ID 1 is 0xCAFE2345
INFO: setting debug log file name to loragw_hal.log
INFO: found configuration file local_conf.json, parsing it
INFO: local_conf.json does contain a JSON object named gateway_conf, parsing gateway parameters
INFO: gateway MAC address is configured to E45F01FFFE02212C
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
This is uart for GPS.
INFO: [main] TTY port /dev/ttyUSB0 open for GPS synchronization
CoreCell reset through GPIO17...
Opening SPI communication interface
Note: chip version is 0x12 (v1.2)
INFO: using legacy timestamp
INFO: LoRa Service modem: configuring preamble size to 8 symbols
ARB: dual demodulation disabled for all SF
INFO: [main] concentrator started, packet can now be received
INFO: concentrator EUI: 0x0016c001ff195717
INFO: [down] PULL_ACK received in 18 ms
INFO: [down] PULL_ACK received in 22 ms
This is all built from the repo at https://github.com/RAKWireless/rak_common_for_gateway
Now, for various reasons, I’d like to upgrade to TTN v3 and run the basicstation code. I’ve pulled the code from here https://github.com/lorabasics/basicstation, followed the instructions, and have compiled and installed it mainly following this well-written guide: https ://www.beyondlogic.org/lorawan-upgrading-to-basic-station-and-the-things-network-v3-stack/.
But, it doesn’t work.
Here’s the station config:
{
"radio_conf": { /* Actual channel plan is controlled by the server */
"lorawan_public": true, /* is default */
"clksrc": 1, /* radio_1 provides clock to concentrator */
"device": "/dev/spidev0.0", /* default SPI device is platform specific */
"pps": true,
"radio_0": {
/* freq/enable provided by LNS - only hardware-specific settings are listed here */
"type": "SX1257",
"rssi_offset": -215.4,
"tx_enable": true
},
"radio_1": {
"type": "SX1257",
"rssi_offset": -215.4,
"tx_enable": false
}
/* chan_multiSF_X, chan_Lora_std, chan_FSK provided by LNS */
},
"station_conf": {
"log_file": "stderr",
"log_level": "DEBUG",
"log_size": 10e6,
"log_rotate": 3
}
}
Which leads to this output when I run ‘station’:
pi@rak-gateway:~/TTN $ LORAGW_SPI_SPEED=2000000 ~/src/basicstation/build-rpi-std/bin/station
2022-02-27 02:14:57.608 [SYS:INFO] Logging : stderr (maxsize=10000000, rotate=3)
2022-02-27 02:14:57.608 [SYS:INFO] Station Ver : 2.0.6(rpi/std) 2022-02-27 01:49:05
2022-02-27 02:14:57.608 [SYS:INFO] Package Ver : (null)
2022-02-27 02:14:57.608 [SYS:INFO] mbedTLS Ver : 2.28.0
2022-02-27 02:14:57.608 [SYS:INFO] proto EUI : 0:e45f:102:212c (/sys/class/net/eth0/address)
2022-02-27 02:14:57.608 [SYS:INFO] prefix EUI : ::1 (builtin)
2022-02-27 02:14:57.609 [SYS:INFO] Station EUI : e45f:1ff:fe02:212c
2022-02-27 02:14:57.609 [SYS:INFO] Station home: ./ (builtin)
2022-02-27 02:14:57.609 [SYS:INFO] Station temp: /var/tmp/ (builtin)
2022-02-27 02:14:57.609 [SYS:WARN] Station in NO-CUPS mode
2022-02-27 02:14:57.810 [TCE:INFO] Starting TC engine
2022-02-27 02:14:57.814 [AIO:INFO] ./tc.trust:
cert. version : 3
serial number : 82:10:CF:B0:D2:40:E3:59:44:63:E0:BB:63:82:8B:00
issuer name : C=US, O=Internet Security Research Group, CN=ISRG Root X1
subject name : C=US, O=Internet Security Research Group, CN=ISRG Root X1
issued on : 2015-06-04 11:04:38
expires on : 2035-06-04 11:04:38
signed using : RSA with SHA-256
RSA key size : 4096 bits
basic constraints : CA=true
key usage : Key Cert Sign, CRL Sig2022-02-27 02:14:57.814 [TCE:INFO] Connecting to INFOS: wss://nam1.cloud.thethings.network:8887
2022-02-27 02:14:58.374 [TCE:INFO] Infos: e45f:1ff:fe02:212c muxs-::0 wss://nam1.cloud.thethings.network:8887/traffic/eui-E45F01FFFE02212C
2022-02-27 02:14:58.374 [AIO:DEBU] [3] ws_close reason=1000
2022-02-27 02:14:58.374 [AIO:DEBU] Echoing close - reason=1000
2022-02-27 02:14:58.375 [AIO:ERRO] Recv failed: SSL - The peer notified us that the connection is going to be closed
2022-02-27 02:14:58.375 [AIO:DEBU] [3] WS connection shutdown...
2022-02-27 02:14:58.376 [AIO:INFO] ./tc.trust:
cert. version : 3
serial number : 82:10:CF:B0:D2:40:E3:59:44:63:E0:BB:63:82:8B:00
issuer name : C=US, O=Internet Security Research Group, CN=ISRG Root X1
subject name : C=US, O=Internet Security Research Group, CN=ISRG Root X1
issued on : 2015-06-04 11:04:38
expires on : 2035-06-04 11:04:38
signed using : RSA with SHA-256
RSA key size : 4096 bits
basic constraints : CA=true
key usage : Key Cert Sign, CRL Sig2022-02-27 02:14:58.376 [TCE:VERB] Connecting to MUXS...
2022-02-27 02:14:59.153 [TCE:VERB] Connected to MUXS.
2022-02-27 02:14:59.163 [RAL:INFO] Lora gateway library version: Version: 5.0.1;
2022-02-27 02:14:59.168 [RAL:INFO] [LGW lgw1] clksrc=1 lorawan_public=1
2022-02-27 02:14:59.168 [RAL:INFO] RX/TX RF0: 904.3MHz rssi_offset=-215.4 type=2 tx_notch_freq=0
2022-02-27 02:14:59.169 [RAL:INFO] RX RF1: 905.0MHz rssi_offset=-215.4 type=2 tx_notch_freq=0
2022-02-27 02:14:59.169 [RAL:INFO] [mSF] 0: 903.9MHz rf=0 freq=-400.0 datarate=0
2022-02-27 02:14:59.169 [RAL:INFO] [mSF] 1: 904.1MHz rf=0 freq=-200.0 datarate=0
2022-02-27 02:14:59.169 [RAL:INFO] [mSF] 2: 904.3MHz rf=0 freq= +0.0 datarate=0
2022-02-27 02:14:59.169 [RAL:INFO] [mSF] 3: 904.5MHz rf=0 freq=+200.0 datarate=0
2022-02-27 02:14:59.169 [RAL:INFO] [mSF] 4: 904.7MHz rf=1 freq=-300.0 datarate=0
2022-02-27 02:14:59.169 [RAL:INFO] [mSF] 5: 904.9MHz rf=1 freq=-100.0 datarate=0
2022-02-27 02:14:59.169 [RAL:INFO] [mSF] 6: 905.1MHz rf=1 freq=+100.0 datarate=0
2022-02-27 02:14:59.169 [RAL:INFO] [mSF] 7: 905.3MHz rf=1 freq=+300.0 datarate=0
2022-02-27 02:14:59.169 [RAL:INFO] [STD] 8: 904.6MHz rf=0 freq=+300.0 datarate=4 bw=1
2022-02-27 02:14:59.169 [RAL:INFO] channel 9 disabled
2022-02-27 02:14:59.169 [RAL:INFO] SX130x LBT not enabled
2022-02-27 02:14:59.169 [RAL:INFO] Station device: /dev/spidev0.0 (PPS capture enabled)
2022-02-27 02:14:59.169 [HAL:INFO] [lgw_spi_open:101] Setting SPI speed to 2000000
2022-02-27 02:14:59.170 [HAL:INFO] [lgw_spi_open:135] Note: SPI port opened and configured ok
2022-02-27 02:14:59.170 [HAL:ERRO] [lgw_start:742] FAIL TO CONNECT BOARD
2022-02-27 02:14:59.170 [RAL:ERRO] Concentrator start failed: lgw_start
2022-02-27 02:14:59.170 [RAL:ERRO] ral_config failed with status 0x08
2022-02-27 02:14:59.170 [any:ERRO] Closing connection to muxs - error in s2e_onMsg
2022-02-27 02:14:59.170 [AIO:DEBU] [3] ws_close reason=1000
2022-02-27 02:14:59.170 [AIO:DEBU] Echoing close - reason=1000
2022-02-27 02:14:59.187 [AIO:DEBU] [3|WS] Server sent close: reason=1000
2022-02-27 02:14:59.187 [AIO:DEBU] [3] WS connection shutdown...
2022-02-27 02:14:59.187 [TCE:VERB] Connection to MUXS closed in state -1
2022-02-27 02:14:59.187 [TCE:INFO] INFOS reconnect backoff 10s (retry 1)
What I’m seeing is that the station software can’t find SOMETHING (the 1302?) over SPI. Clearly, I’ve set the SPI BUS speed to 2MHz, but that doesn’t seem to be doing the trick. Given that it works with the packet-forwarder, I’m confident my hardware is working.
There are a couple of things in the station.conf
I’ve tried fiddling with, but I think I’m out of my depth at this point. If anyone has gotten a RPi with a RAK5146 in SPI mode working with TTN v3, please let me know how you did it.
Thank you!
John Gorkos