Rpi Gateway prevents nodes from exchanging keys

Hello

I recently started discovering LoRa. I have 2 Adafruit RFM9X LoRa modules. I created an application for each of them in ttn_v3 and can successfully transmit data from the nodes to ttn_v3. On the map I see that there are two gateways which are receiving my signal. They are in the neighbor towns, approx 2km and 3km away from me. So far so good :slight_smile:

Then I have started my own gateway. It is a IOT Gateway HAT for Raspberrypi. I have configured the gateway as best as I can. It connects also to the ttn_v3. Now there is a problem. As soon as I start my gateway, then my two nodes can’t connect to ttn anymore. I use the OTAA join process for them. So they aren’t able anymore to exchange the keys. And every join request ends up with: “EV_JOIN_TXCOMPLETE: no JoinAccept”. As soon as I stop my gateway with sudo systemctl stop iot-lora-gateway.service, then the two nodes can exchange again their’e keys.

In ttn under gateway I see this messages:

Receive join-request
Send join-request to cluster-local Join Server
Accept join-request
Join-request to cluster-local Join Server succeeded
Successfully processed join-request
Schedule join-accept for transmission on Gateway Server
Successfully scheduled join-accept for transmission on Gateway Server
Receive join-accept message
Forward join-accept message
Forward join-accept to Application server.

And for the same event on “Applications->End devices->Live data” I see the following:

Receive join-request
Send join-request to cluster-local Join Server
Join-request to cluster-local Join Server succeeded
Successfully processed join-request
Schedule join-accept for transmission on Gateway Server
Successfully scheduled join-accept for transmssion on Gateway Server
Receive join-accept message
Forward join-accept message
Forward join-accept to Application Server

I have configured the gateway according to this guide.

My global_conf.json file is attached to this post. The sensitive data are replaced by “xxxxxx…”. Maybe anyone can see If there is something wrong in my setup.

global_conf.json

{
“SX1301_conf”: {
“lorawan_public”: true,
“clksrc”: 1,
“antenna_gain”: 0,
“radio_0”: {
“enable”: true,
“type”: “SX1257”,
“freq”: 867500000,
“rssi_offset”: -166,
“tx_enable”: true,
“tx_freq_min”: 863000000,
“tx_freq_max”: 870000000
},
“radio_1”: {
“enable”: true,
“type”: “SX1257”,
“freq”: 868500000,
“rssi_offset”: -166,
“tx_enable”: false
},
“chan_multiSF_0”: {
“enable”: true,
“radio”: 1,
“if”: -400000
},
“chan_multiSF_1”: {
“enable”: true,
“radio”: 1,
“if”: -200000
},
“chan_multiSF_2”: {
“enable”: true,
“radio”: 1,
“if”: 0
},
“chan_multiSF_3”: {
“enable”: true,
“radio”: 0,
“if”: -400000
},
“chan_multiSF_4”: {
“enable”: true,
“radio”: 0,
“if”: -200000
},
“chan_multiSF_5”: {
“enable”: true,
“radio”: 0,
“if”: 0
},
“chan_multiSF_6”: {
“enable”: true,
“radio”: 0,
“if”: 200000
},
“chan_multiSF_7”: {
“enable”: true,
“radio”: 0,
“if”: 400000
},
“chan_Lora_std”: {
“enable”: true,
“radio”: 1,
“if”: -200000,
“bandwidth”: 250000,
“spread_factor”: 7
},
“chan_FSK”: {
“enable”: true,
“radio”: 1,
“if”: 300000,
“bandwidth”: 125000,
“datarate”: 50000
},
“tx_lut_0”: {
“pa_gain”: 0,
“mix_gain”: 8,
“rf_power”: -6,
“dig_gain”: 0
},
“tx_lut_1”: {
“pa_gain”: 0,
“mix_gain”: 10,
“rf_power”: -3,
“dig_gain”: 0
},
“tx_lut_2”: {
“pa_gain”: 0,
“mix_gain”: 12,
“rf_power”: 0,
“dig_gain”: 0
},
“tx_lut_3”: {
“pa_gain”: 1,
“mix_gain”: 8,
“rf_power”: 3,
“dig_gain”: 0
},
“tx_lut_4”: {
“pa_gain”: 1,
“mix_gain”: 10,
“rf_power”: 6,
“dig_gain”: 0
},
“tx_lut_5”: {
“pa_gain”: 1,
“mix_gain”: 12,
“rf_power”: 10,
“dig_gain”: 0
},
“tx_lut_6”: {
“pa_gain”: 1,
“mix_gain”: 13,
“rf_power”: 11,
“dig_gain”: 0
},
“tx_lut_7”: {
“pa_gain”: 2,
“mix_gain”: 9,
“rf_power”: 12,
“dig_gain”: 0
},
“tx_lut_8”: {
“pa_gain”: 1,
“mix_gain”: 15,
“rf_power”: 13,
“dig_gain”: 0
},
“tx_lut_9”: {
“pa_gain”: 2,
“mix_gain”: 10,
“rf_power”: 14,
“dig_gain”: 0
},
“tx_lut_10”: {
“pa_gain”: 2,
“mix_gain”: 11,
“rf_power”: 16,
“dig_gain”: 0
},
“tx_lut_11”: {
“pa_gain”: 3,
“mix_gain”: 9,
“rf_power”: 20,
“dig_gain”: 0
},
“tx_lut_12”: {
“pa_gain”: 3,
“mix_gain”: 10,
“rf_power”: 23,
“dig_gain”: 0
},
“tx_lut_13”: {
“pa_gain”: 3,
“mix_gain”: 11,
“rf_power”: 25,
“dig_gain”: 0
},
“tx_lut_14”: {
“pa_gain”: 3,
“mix_gain”: 12,
“rf_power”: 26,
“dig_gain”: 0
},
“tx_lut_15”: {
“pa_gain”: 3,
“mix_gain”: 14,
“rf_power”: 27,
“dig_gain”: 0
}
},
“gateway_conf”: {
“gateway_ID”: “xxxxxxx”,
“gps”:true,
“beacon”: true,
“logger”: true,
“upstream”: true,
“downstream”: true,
“ghoststream”: false,
“radiostream”: true,
“statusstream”: true,
“servers”: [
{
“server_address”: “eu1.cloud.thethings.network”,
“gateway_ID”: “xxxxxxxx”,
“serv_port_up”: 1700,
“serv_port_down”: 1700,
“serv_max_stall”: 0,
“serv_enabled”: true
}
],
“keepalive_interval”: 10,
“stat_interval”: 30,
“push_timeout_ms”: 100,
“forward_crc_valid”: true,
“forward_crc_error”: false,
“forward_crc_disabled”: false,
“gps_tty_path”:"/dev/serial0",
“stat_format”: “semtech”,
“stat_damping”: 0,
“stat_file”: “stats.txt”,
“platform”: “TTN”,
“contact_email”: “xxx@xxxxxxxx.ch”,
“description”: “Gateway von MiracuruZRH”,
“fake_gps”: false,
“ref_latitude”: 47.30502781183416,
“ref_longitude”: 8.758851884436076,
“ref_altitude”: 470,
“serv_gw_key”: “NNSXS.xxxxxxxxxxxxxx.xxxxxxxxxxxxxx”
}
}

log from packet forwarder

root
00:14:47 *** Multi Protocol Packet Forwarder for Lora Gateway ***
Version: 3.0.20
00:14:47 *** Lora concentrator HAL library version info ***
Version: 5.0.1; Options: native;


00:14:47 INFO: Little endian host
00:14:47 INFO: found global configuration file /opt/iotloragateway/global_conf.json, parsing it
00:14:47 INFO: /opt/iotloragateway/global_conf.json does contain a JSON object named SX1301_conf, parsing SX1301 parameters
00:14:47 INFO: lorawan_public 1, clksrc 1
00:14:47 INFO: no configuration for LBT
00:14:47 INFO: antenna_gain 0 dBi
00:14:47 INFO: Configuring TX LUT with 16 indexes
00:14:47 INFO: radio 0 enabled (type SX1257), center frequency 867500000, RSSI offset -166.000000, tx enabled 1
00:14:47 INFO: radio 1 enabled (type SX1257), center frequency 868500000, RSSI offset -166.000000, tx enabled 0
00:14:47 INFO: Lora multi-SF channel 0> radio 1, IF -400000 Hz, 125 kHz bw, SF 7 to 12
00:14:47 INFO: Lora multi-SF channel 1> radio 1, IF -200000 Hz, 125 kHz bw, SF 7 to 12
00:14:47 INFO: Lora multi-SF channel 2> radio 1, IF 0 Hz, 125 kHz bw, SF 7 to 12
00:14:47 INFO: Lora multi-SF channel 3> radio 0, IF -400000 Hz, 125 kHz bw, SF 7 to 12
00:14:47 INFO: Lora multi-SF channel 4> radio 0, IF -200000 Hz, 125 kHz bw, SF 7 to 12
00:14:47 INFO: Lora multi-SF channel 5> radio 0, IF 0 Hz, 125 kHz bw, SF 7 to 12
00:14:47 INFO: Lora multi-SF channel 6> radio 0, IF 200000 Hz, 125 kHz bw, SF 7 to 12
00:14:47 INFO: Lora multi-SF channel 7> radio 0, IF 400000 Hz, 125 kHz bw, SF 7 to 12
00:14:47 INFO: Lora std channel> radio 1, IF -200000 Hz, 250000 Hz bw, SF 7
00:14:47 INFO: FSK channel> radio 1, IF 300000 Hz, 125000 Hz bw, 50000 bps datarate
00:14:47 INFO: /opt/iotloragateway/global_conf.json does contain a JSON object named gateway_conf, parsing gateway parameters
00:14:47 INFO: gateway MAC address is configured to A0F3C2D1A03357E2
00:14:47 INFO: Found 1 servers in array.
00:14:47 INFO: Server 0 configured to “eu1.cloud.thethings.network”
00:14:47 INFO: format is configured to “semtech”
00:14:47 INFO: filename for statistical performance is configured to “stats.txt”
00:14:47 INFO: Damping for statistical info is configured to 95%
00:14:47 INFO: downstream keep-alive interval is configured to 10 seconds
00:14:47 INFO: statistics display interval is configured to 30 seconds
00:14:47 INFO: upstream PUSH_DATA time-out is configured to 100 ms
00:14:47 INFO: packets received with a valid CRC will be forwarded
00:14:47 INFO: packets received with a CRC error will NOT be forwarded
00:14:47 INFO: packets received with no CRC will NOT be forwarded
00:14:47 INFO: GPS serial port path is configured to “/dev/serial0”
00:14:47 INFO: Reference latitude is configured to 47.305028 deg
00:14:47 INFO: Reference longitude is configured to 8.758852 deg
00:14:47 INFO: Reference altitude is configured to 470 meters
00:14:47 INFO: GPS is enabled
00:14:47 INFO: Using real GPS if available.
00:14:47 INFO: Upstream data is enabled
00:14:47 INFO: Downstream data is enabled
00:14:47 INFO: Ghoststream data is disabled
00:14:47 INFO: Radiostream data is enabled
00:14:47 INFO: Statusstream data is enabled
00:14:47 INFO: Beacon is enabled
00:14:47 INFO: Packet logger is disabled
00:14:47 INFO: Flush output after statistic is disabled
00:14:47 INFO: Flush after each line of output is disabled
00:14:47 INFO: Watchdog is disabled
00:14:47 INFO: Platform configured to “ttn”
00:14:47 INFO: Contact email configured to “xxxx@xxxxxxxxxx.ch”
00:14:47 INFO: Description configured to “Gateway von MiracuruZRH”
00:14:47 INFO: [main] TTY port /dev/serial0 open for GPS synchronization
00:14:47 INFO: [Transports] Initializing protocol for 1 servers
00:14:47 INFO: Successfully contacted server eu1.cloud.thethings.network
00:14:47 INFO: [main] Starting the concentrator
00:14:50 INFO: [main] concentrator started, radio packets can now be received.
00:14:50 INFO: [up] Thread activated for all servers.
00:14:50 INFO: JIT thread activated.
00:14:50 INFO: Disabling GPS mode for concentrator’s counter…
00:14:50 INFO: Validation thread activated.
00:14:50 INFO: host/sx1301 time offset=(1635372888s:272043µs) - drift=-334189397µs
00:14:50 INFO: Enabling GPS mode for concentrator’s counter.
00:14:50 WARNING: [gps] GPS out of sync, keeping previous time reference
00:14:50 WARNING: [gps] GPS out of sync, keeping previous time reference
INFO: tx_start_delay=1495 (1495.500000) - (1497, bw_delay=1.500000, notch_delay=0.000000)
src/mp_pkt_fwd.c:1671:thread_jit(): lgw_send done: count_us=20231116
INFO: tx_start_delay=1495 (1495.500000) - (1497, bw_delay=1.500000, notch_delay=0.000000)
src/mp_pkt_fwd.c:1671:thread_jit(): lgw_send done: count_us=29648292

2021-10-27 22:15:20 GMT

[UPSTREAM]

RF packets received by concentrator: 2

CRC_OK: 100.00%, CRC_FAIL: 0.00%, NO_CRC: 0.00%

RF packets forwarded: 2 (46 bytes)

PUSH_DATA datagrams sent: 2 (544 bytes)

PUSH_DATA acknowledged: 100.00%

[DOWNSTREAM]

PULL_DATA sent: 3 (100.00% acknowledged)

PULL_RESP(onse) datagrams received: 2 (418 bytes)

RF packets sent to concentrator: 2 (66 bytes)

TX errors: 0

TX rejected (collision packet): 0.00% (req:2, rej:0)

TX rejected (collision beacon): 0.00% (req:2, rej:0)

TX rejected (too late): 0.00% (req:2, rej:0)

TX rejected (too early): 0.00% (req:2, rej:0)

[BEACON]

Packets queued: 0

Packets sent so far: 0

Packets rejected: 0

[JIT]

INFO: JIT queue contains 0 packets.

INFO: JIT queue contains 0 beacons.

[GPS] ###Processing: global_conf.json…

Valid gps time reference (age: 0 sec)

System GPS coordinates: latitude 47.30510, longitude 8.75909, altitude 452 m

[PERFORMANCE]

Upstream radio packet quality: 100.00%.

Upstream datagram acknowledgment quality for server “eu1.cloud.thethings.network” is 100.00%.

Downstream heart beat acknowledgment quality for server “eu1.cloud.thethings.network” is 100.00%.

Downstream datagram content quality for server “eu1.cloud.thethings.network” is 100.00%.

Downstream radio transmission quality for server “eu1.cloud.thethings.network” is 100.00%.

Downstream beacon transmission quality: 0.00%.

[ CONNECTIONS ]

Semtech status report send.

END

00:15:50 INFO: Disabling GPS mode for concentrator’s counter…
00:15:50 INFO: host/sx1301 time offset=(1635372888s:278724µs) - drift=6681µs
00:15:50 INFO: Enabling GPS mode for concentrator’s counter.

I further data or infos are needed, please let me know.

The funny thing is, once my nodes are connected to ttn, then I can start my gateway and It receives the data and forward’s it to the ttn without problems.

And one more thing. I have created an API key for the gateway which I have then entered in the configuration file with “serv_gw_key”: “NNSXS.xxxxxxxxxxxxxx.xxxxxxxxxxxxxx”
I tried it also instead to have the key here that I give a path with a .txt file where the key is stored in.
So I have noticed that also when the complete entry “serv_gw_key” is missing the gateway connects successfully to ttn_v3.

Would be much appreciated if someone could help me to get the gateway running correctly.

It sounds like your gateway is operating improperly, or perhaps in being too close to the nodes it is receiving corrupted data or corrupted the replies by overloading their receivers.

A join requires transmitting back to a node, and the network would select the closest gateway (suddenly yours) to do that.

After join there are also now some configuration messages sent down which need to be correctly responded to, but for the most part traffic is in the uplink direction, and unlike a downlink where only one gateway can be chosen, for uplink all gateways in range are used, so your message gets through if any of the more distant but still in range gateways receive it correctly, even if yours messes it up somehow.

First thing to do would be to probably try with the nodes a hundred meters or so from your gateway. If it still doesn’t work, there’s probably something wrong with your gateway hardware or software configuration that needs attention.

Also have the TTN gateway raw traffic view open in a window while you try your tests.

Have many thanks for your reply @cslorabox.
Indeed I have the nodes very close to the gateway (only about 1.5m) because
I’m still in development mode of the nodes and in my small flat there are not much more options. Sounds like this is the problem. Then I setup my nodes and start them a few 100m away as suggested.

May I ask one more thing? I’m not sure how you mean “Also have the TTN gateway raw traffic view open in a window while you try your tests.” Is the “Live data” on the ttn website meant. Or on the raspberry terminal to check the logfile of the packet forwarder like tail -f /var/log/LoRa-Gateway.log or am I complete out track with my guessing :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.