Gateway and Network Server Connecting, but joins are refused

Hi Folks,

I’ve been working on writing some documentation for connecting a device using OTAA with the Arduino LMIC libraries, however during my debugging it’s become apparent that I’m missing a connection in the setup somewhere.

The full history of what I’m up to is at https://github.com/brocaar/lora-app-server/issues/259, however the following is what I see in the loraserver logs when a device tries to join:

Aug 22 19:32:21 mbc-loranode1 loraserver[4761]: time="2018-08-22T19:32:21Z" level=info msg="backend/gateway: rx packet received"
Aug 22 19:32:21 mbc-loranode1 loraserver[4761]: time="2018-08-22T19:32:21Z" level=info msg="packet(s) collected" dev_eui=00415ee3b9a02d4a gw_count=1 gw_macs=<GWMAC> mtype=JoinRequest
Aug 22 19:32:21 mbc-loranode1 lora-app-server[4747]: time="2018-08-22T19:32:21Z" level=info msg="js: request received" message_type=JoinReq receiver_id=0000000000000000 sender_id=010203 transaction_id=3455401306
Aug 22 19:32:21 mbc-loranode1 lora-app-server[4747]: time="2018-08-22T19:32:21Z" level=info msg="device-keys updated" dev_eui=00415ee3b9a02d4a
Aug 22 19:32:21 mbc-loranode1 lora-app-server[4747]: time="2018-08-22T19:32:21Z" level=info msg="js: sending response" message_type=JoinAns receiver_id=010203 result_code=Success sender_id=0000000000000000 transaction_id=3455401306
Aug 22 19:32:21 mbc-loranode1 loraserver[4761]: time="2018-08-22T19:32:21Z" level=info msg="device-queue flushed" dev_eui=00415ee3b9a02d4a
Aug 22 19:32:21 mbc-loranode1 loraserver[4761]: time="2018-08-22T19:32:21Z" level=info msg="device-session saved" dev_addr=07ab7b1f dev_eui=00415ee3b9a02d4a
Aug 22 19:32:21 mbc-loranode1 loraserver[4761]: time="2018-08-22T19:32:21Z" level=info msg="device-activation created" dev_eui=00415ee3b9a02d4a id=16
Aug 22 19:32:21 mbc-loranode1 loraserver[4761]: time="2018-08-22T19:32:21Z" level=info msg="backend/gateway: publishing tx packet" qos=0 topic=gateway/<MAC>

In the UI under “Device -> Live LoRaWAN Frames” I see the join request/accept:

but the device doesn’t join, and is never activated.

One thing I have noticed is that the message queue is suspiciously quiet - I see the gateway traffic going in, along with the messages from the device, but I don’t see anything being sent that might constitute a “join” message:

{"mac":"c0ee40ffff2943ba","time":"2018-08-23T06:26:15Z","rxPacketsReceived":2,"rxPacketsReceivedOK":2,"txPacketsReceived":0,"txPacketsEmitted":0,"customData":null}
{"rxInfo":{"mac":"c0ee40ffff2943ba","time":"0001-01-01T00:00:00Z","timestamp":1776993643,"frequency":868500000,"channel":2,"rfChain":1,"crcStatus":1,"codeRate":"4/5","rssi":-52,"loRaSNR":7,"size":24,"dataRate":{"modulation":"LORA","spreadFactor":7,"bandwidth":125}},"phyPayload":"QAQpASaAgDMBh3jtzXbc1BDOwRp4yj4A"}

I’m sure I’m missing something obvious, hopefully someone here can point out what it is!

I have a similar problem with a commercial node.

When I put in next to the gateway the node can join easily the server and it starts sending uplinks just after that.

However when I put it far away in a closed room, i receive some join request on my server, I also checked the log and I have a join answer with a result_code = Success. But i don’t have any uplinks after after that. Just 4-5 consecutive join message on live event.

I have no clue why this is happening.

  • Make sure to subscribe to all gateway topics. mosquitto_sub -t "#" -v also prints the topic.
  • Have you configured MQTT ACLs? In that case make sure LoRa Server is allowed to publish to the gateway TX topic (and the client you are using to debug all messages can subscribe to all topics)

These are the parts where things could go wrong:

  • Between LoRa Server and the MQTT broker (MQTT acls)
  • Between the MQTT broker and the LoRa Gateway Bridge (MQTT acls)
  • Between the gateway and your device (rf related)
  • The device itself (the timing is really important and this doesn’t always work out-of-the-box when building your own device firmware, a spectrum analyzer could help here so you can see that the gateway actually transmitted the frame)

I was using RabbitMQ with ACL’s, but I’ve since switched back to Mosquitto to try and troubleshoot this.

One of the topics was misconfigured as

gateway/{{ .MAC }}tx

as opposed to

gateway/{{ .MAC }}/tx

so I’ve resolved that, and I can see the TX/RX messages being posted to the gateway topics but not to any device topics.

The lora-app-server shows the following in the logs on startup:

Aug 23 08:49:27 mbc-loranode1 lora-app-server[29671]: time="2018-08-23T08:49:27Z" level=info msg="handler/mqtt: connected to mqtt broker"
Aug 23 08:49:27 mbc-loranode1 lora-app-server[29671]: time="2018-08-23T08:49:27Z" level=info msg="handler/mqtt: subscribing to tx topic" qos=0 topic=application/+/device/+/tx

but I don’t see any data being sent over the application/+/device/+/tx queues

OK, back to RabbitMQ as I can get more visibility and I can see that the gateway, lora-app-server and lora-server are all connected correctly.

The topics exist, and the gateway at least is sending messages to it.

There are no errors in the logs for the app server or the network server that suggest there are any communications issues between the various components of LoraServer, and I can see the messages from the gateway in both the server logs and on the message queues, as well as the gateway showing as “connected” in the console.

I guess this means I’m down to looking at the device itself?

I had the same issue yesterday, using the latest version of Loraserver, I changed the Lorawan Mac version from 1.1.0 to 1.0.2 into the device profile menu and the join accept was properly received and device connected.

Amazing, that worked, thank you @genevois1965!

I’ve created https://github.com/brocaar/lora-app-server/pull/260 to get this added to the docs.

1 Like

Nice catch! Yes, the encryption scheme is different for LoRaWAN 1.0 and LoRaWAN 1.1, therefore you need to pick the right version or else it won’t work!

@Proffalken :+1: merged!

1 Like

Thanks @brocaar

Can you please specify encryption scheme for LoRaWAN 1.0 and LoRaWAN 1.1 version?

Provide guidance of LoRaWAN 1.1 version device encryption.

Thanks

This is all specified by the LoRa Alliance. Please see: https://lora-alliance.org/lorawan-for-developers

@brocaar Thank you

Found in LORAWAN 1.1 Specification