Forward join-accept message loop

Hello,

I’m trying the Thing Stack on the localhost following this guide: Configuration | The Things Stack for LoRaWAN.

Things stack open-source on localhost

Creating gateway works as expected. I’m using RakWireless USB Gateway device: wisgate-developer-base.

localhost_gateway01

After creating application and a device with settings as shown below,
localhost_device01

I updated the sample OTAA code for Arduino MKR1310 with the DevUI and the AppKey from the screenshot as shown above. Followed the same process for second device Rak113100 and uploaded the OTAA example code.

https://github.com/RAKWireless/WisBlock/blob/master/examples/RAK11300/communications/LoRa/LoRaWAN/LoRaWAN_OTAA_ABP/LoRaWAN_OTAA_ABP.ino

Failed_OTAA
OTAA Accept join-request and Forward join-accept message runs in loop and doesn’t complete. RSSI values are about -40 and the device was more than 5meters away from gateway.


Same test with nam1.cloud.thethings.network

Then, I created TTN account to try same gateway and devices with the cloud based service.
After updating the udp packet forwarder docker-compose and the global_conf.json file Gateway is online
ttn_mygw01

So no issues connect the gateway to TTN nam1 service and then same code runs fine without any issues.
ttn_dev01_success


Logs

Previous logs from the localhost host docker instances. I do not see any error messages.

stack_1     | INFO      Finished unary call     {"duration": 0.02, "grpc.method": "HandleJoin", "grpc.service": "ttn.lorawan.v3.NsJs", "namespace": "grpc", "peer.address": "pipe", "request_id": "01GA0B9FPJXVSS3D00NFX9EP6J"}
stack_1     | INFO      Finished unary call     {"duration": 0.2146, "grpc.method": "HandleUplink", "grpc.service": "ttn.lorawan.v3.GsNs", "namespace": "grpc", "peer.address": "pipe", "request_id": "01GA0B9FP52KTXV8KMZ5AWCJHA"}
stack_1     | INFO      Finished unary call     {"duration": 0.001, "grpc.method": "ScheduleDownlink", "grpc.service": "ttn.lorawan.v3.NsGs", "namespace": "grpc", "peer.address": "pipe", "request_id": "01GA0B9HHBB68TMD88MHW9PPZX"}
stack_1     | INFO      Finished unary call     {"duration": 0.0176, "grpc.method": "HandleUplink", "grpc.service": "ttn.lorawan.v3.NsAs", "namespace": "grpc", "peer.address": "pipe", "request_id": "01GA0B9HHTHQ36240X0KD8M9TB"}
stack_1     | INFO      Finished unary call     {"auth.token_id": "NDNBHTXBO3PFGRQ2ORCGD66O6ZYXP7ZKJVFZOPI", "auth.token_type": "AccessToken", "auth.user_id": "admin", "duration": 0.0371, "grpc.method": "Get", "grpc.request.application_id": "app01", "grpc.request.device_id": "eui-79739dd7cae90dcf", "grpc.service": "ttn.lorawan.v3.NsEndDeviceRegistry", "namespace": "grpc", "peer.address": "pipe", "peer.real_ip": "192.168.0.102", "request_id": "01GA0B9HKCEADWB383WT3H0YMV"}
stack_1     | INFO      Finished unary call     {"auth.token_id": "NDNBHTXBO3PFGRQ2ORCGD66O6ZYXP7ZKJVFZOPI", "auth.token_type": "AccessToken", "auth.user_id": "admin", "duration": 0.0345, "grpc.method": "Get", "grpc.request.application_id": "app01", "grpc.request.device_id": "eui-79739dd7cae90dcf", "grpc.service": "ttn.lorawan.v3.AsEndDeviceRegistry", "namespace": "grpc", "peer.address": "pipe", "peer.real_ip": "192.168.0.102", "request_id": "01GA0B9HKF23HF10M81C9H1G6S"}
stack_1     | INFO      Request handled {"auth.token_id": "NDNBHTXBO3PFGRQ2ORCGD66O6ZYXP7ZKJVFZOPI", "auth.token_type": "AccessToken", "duration": 0.0371, "http.method": "GET", "http.path": "/api/v3/as/applications/app01/devices/eui-79739dd7cae90dcf", "http.status": 200, "namespace": "web", "peer.address": "192.168.0.102:47200", "request_id": "01GA0B9HKF23HF10M81C9H1G6S"}
stack_1     | INFO      Request handled {"auth.token_id": "NDNBHTXBO3PFGRQ2ORCGD66O6ZYXP7ZKJVFZOPI", "auth.token_type": "AccessToken", "duration": 0.0411, "http.method": "GET", "http.path": "/api/v3/ns/applications/app01/devices/eui-79739dd7cae90dcf", "http.status": 200, "namespace": "web", "peer.address": "192.168.0.102:47200", "request_id": "01GA0B9HKCEADWB383WT3H0YMV"}
stack_1     | INFO      Finished unary call     {"duration": 0.0066, "grpc.method": "BatchUpdateLastSeen", "grpc.service": "ttn.lorawan.v3.EndDeviceRegistry", "namespace": "grpc", "peer.address": "pipe", "request_id": "01GA0B9NH2802N369MCDP6VJKG"}
stack_1     | INFO      Finished unary call     {"duration": 0.0173, "grpc.method": "HandleJoin", "grpc.service": "ttn.lorawan.v3.NsJs", "namespace": "grpc", "peer.address": "pipe", "request_id": "01GA0BAKYMT33KNJYXZVH7XBP1"}
stack_1     | INFO      Finished unary call     {"duration": 0.2156, "grpc.method": "HandleUplink", "grpc.service": "ttn.lorawan.v3.GsNs", "namespace": "grpc", "peer.address": "pipe", "request_id": "01GA0BAKYC076XVHHRGWGX6QAH"}
stack_1     | INFO      Finished unary call     {"duration": 0.0006, "grpc.method": "ScheduleDownlink", "grpc.service": "ttn.lorawan.v3.NsGs", "namespace": "grpc", "peer.address": "pipe", "request_id": "01GA0BANR4HDH93WRT40S9JZ39"}
stack_1     | INFO      Finished unary call     {"duration": 0.0047, "grpc.method": "HandleUplink", "grpc.service": "ttn.lorawan.v3.NsAs", "namespace": "grpc", "peer.address": "pipe", "request_id": "01GA0BANRB2HQX2QR10PNYNHXM"}
stack_1     | INFO      Finished unary call     {"auth.token_id": "NDNBHTXBO3PFGRQ2ORCGD66O6ZYXP7ZKJVFZOPI", "auth.token_type": "AccessToken", "auth.user_id": "admin", "duration": 0.0246, "grpc.method": "Get", "grpc.request.application_id": "app01", "grpc.request.device_id": "eui-79739dd7cae90dcf", "grpc.service": "ttn.lorawan.v3.NsEndDeviceRegistry", "namespace": "grpc", "peer.address": "pipe", "peer.real_ip": "192.168.0.102", "request_id": "01GA0BANSBDA2XJ5JFR027E6ZG"}
stack_1     | INFO      Request handled {"auth.token_id": "NDNBHTXBO3PFGRQ2ORCGD66O6ZYXP7ZKJVFZOPI", "auth.token_type": "AccessToken", "duration": 0.0277, "http.method": "GET", "http.path": "/api/v3/ns/applications/app01/devices/eui-79739dd7cae90dcf", "http.status": 200, "namespace": "web", "peer.address": "192.168.0.102:47200", "request_id": "01GA0BANSBDA2XJ5JFR027E6ZG"}
stack_1     | INFO      Finished unary call     {"auth.token_id": "NDNBHTXBO3PFGRQ2ORCGD66O6ZYXP7ZKJVFZOPI", "auth.token_type": "AccessToken", "auth.user_id": "admin", "duration": 0.0248, "grpc.method": "Get", "grpc.request.application_id": "app01", "grpc.request.device_id": "eui-79739dd7cae90dcf", "grpc.service": "ttn.lorawan.v3.AsEndDeviceRegistry", "namespace": "grpc", "peer.address": "pipe", "peer.real_ip": "192.168.0.102", "request_id": "01GA0BANSER4N36PXNEPCQGAV5"}
stack_1     | INFO      Request handled {"auth.token_id": "NDNBHTXBO3PFGRQ2ORCGD66O6ZYXP7ZKJVFZOPI", "auth.token_type": "AccessToken", "duration": 0.0271, "http.method": "GET", "http.path": "/api/v3/as/applications/app01/devices/eui-79739dd7cae90dcf", "http.status": 200, "namespace": "web", "peer.address": "192.168.0.102:47200", "request_id": "01GA0BANSER4N36PXNEPCQGAV5"}
stack_1     | INFO      Finished unary call     {"duration": 0.0094, "grpc.method": "BatchUpdateLastSeen", "grpc.service": "ttn.lorawan.v3.EndDeviceRegistry", "namespace": "grpc", "peer.address": "pipe", "request_id": "01GA0BAWK399T3FYFXQFPDV1PE"}

Help!


Regards.

The greater the distance the better and a brick wall - I would get the RSSI even more down than -40 to the -50 → -60 mark

What is the RSSI here?

@dexterac Please don’t double post, posting as detailed as possible is better, than two post.

1 Like

Hi @Johan_Scheepers In both the tests RSSI was in range of -45 to -40. While connecting to cloud TTN it worked without any issues.

In the localhost setup I’m using docker image version 3.20.2-arm64. Certificates are created with cfssl and these files have permissions for user and group 886:886. (sudo chown 886:886 ./cert.pem ./key.pem)

This is the ttn-lw-stack-docker.yml file

# Identity Server configuration
# Email configuration for "192.168.0.247"
is:
  email:
    sender-name: 'dex'
    sender-address: 'dex@email.com'
    network:
      name: 'Things Net'
      console-url: 'https://192.168.0.247/console'
      identity-server-url: 'https://192.168.0.247/oauth'

  # Web UI configuration for "192.168.0.247":
  oauth:
    ui:
      canonical-url: 'https://192.168.0.247/oauth'
      is:
        base-url: 'https://192.168.0.247/api/v3'

# HTTP server configuration
http:
  cookie:
    block-key: 'd60d57dd7b146cbfbad28369d832913a2bccd4ce2976c4616156f5ea37498449'                # generate 32 bytes (openssl rand -hex 32)
    hash-key: '6f2c5976d35e410e4077fd289b75501342c65fa0029776480c27e48cd40f845e4a4f9f2a8687aabb86b423844b9f421d2241d0ce2ac7217f2c1d38128526119a'                 # generate 64 bytes (openssl rand -hex 64)
  metrics:
    password: 'metrics'               
  pprof:
    password: 'pprof'                 

# If using custom certificates:
tls:
  source: file
  root-ca: /run/secrets/ca.pem
  certificate: /run/secrets/cert.pem
  key: /run/secrets/key.pem


# If Gateway Server enabled, defaults for "192.168.0.247":
gs:
  mqtt:
    public-address: '192.168.0.247:1882'
    public-tls-address: '192.168.0.247:8882'
  mqtt-v2:
    public-address: '192.168.0.247:1881'
    public-tls-address: '192.168.0.247:8881'

# If Gateway Configuration Server enabled, defaults for "192.168.0.247":
gcs:
  basic-station:
    default:
      lns-uri: 'wss://192.168.0.247:8887'
  the-things-gateway:
    default:
      mqtt-server: 'mqtts://192.168.0.247:8881'

# Web UI configuration for "192.168.0.247":
console:
  ui:
    canonical-url: 'https://192.168.0.247/console'
    is:
      base-url: 'https://192.168.0.247/api/v3'
    gs:
      base-url: 'https://192.168.0.247/api/v3'
    gcs:
      base-url: 'https://192.168.0.247/api/v3'
    ns:
      base-url: 'https://192.168.0.247/api/v3'
    as:
      base-url: 'https://192.168.0.247/api/v3'
    js:
      base-url: 'https://192.168.0.247/api/v3'
    qrg:
      base-url: 'https://192.168.0.247/api/v3'
    edtc:
      base-url: 'https://192.168.0.247/api/v3'

  oauth:
    authorize-url: 'https://192.168.0.247/oauth/authorize'
    token-url: 'https://192.168.0.247/oauth/token'
    logout-url: 'https://192.168.0.247/oauth/logout'
    client-id: 'console'
    client-secret: 'console'          # choose or generate a secret

# If Application Server enabled, defaults for "192.168.0.247":
as:
  mqtt:
    public-address: '192.168.0.247:1883'
    public-tls-address: '192.168.0.247:8883'
  webhooks:
    downlink:
      public-address: '192.168.0.247:1885/api/v3'

# If Device Claiming Server enabled, defaults for "192.168.0.247":
dcs:
  oauth:
    authorize-url: 'https://192.168.0.247/oauth/authorize'
    token-url: 'https://192.168.0.247/oauth/token'
    logout-url: 'https://192.168.0.247/oauth/logout'
    client-id: 'device-claiming'
    client-secret: 'device-claiming'          # choose or generate a secret
  ui:
    canonical-url: 'https://192.168.0.247/claim'
    as:
      base-url: 'https://192.168.0.247/api/v3'
    dcs:
      base-url: 'https://192.168.0.247/api/v3'
    is:
      base-url: 'https://192.168.0.247/api/v3'
    ns:
      base-url: 'https://192.168.0.247/api/v3'

RSSI changed

I moved the node much further and now with RSSI between -50 to -60 the issue still remains the same

    "rssi": -56,
   "channel_rssi": -56,
{
  "name": "ns.down.join.schedule.attempt",
  "time": "2022-08-09T20:07:26.359300344Z",
  "identifiers": [
    {
      "device_ids": {
        "device_id": "eui-79739dd7cae90dcf",
        "application_ids": {
          "application_id": "app01"
        },
        "dev_eui": "79739DD7CAE90DCF",
        "join_eui": "0000000000000000"
      }
    }
  ],
  "data": {
    "@type": "type.googleapis.com/ttn.lorawan.v3.DownlinkMessage",
    "raw_payload": "ILvnN4mYQp2sNBjR79AeXM8=",
    "payload": {
      "m_hdr": {
        "m_type": "JOIN_ACCEPT"
      },
      "join_accept_payload": {
        "join_nonce": "000000",
        "net_id": "000000",
        "dev_addr": "012121F8",
        "dl_settings": {
          "rx2_dr": 8
        },
        "rx_delay": 5
      }
    },
    "request": {
      "downlink_paths": [
        {
          "uplink_token": "ChIKEAoEZ3cwMRIIBO9a9gNIok4Q+L+EURoMCPz8ypcGEKPpk+8BIMDBk4v5BA=="
        }
      ],
      "rx1_delay": 5,
      "rx1_data_rate": {
        "lora": {
          "bandwidth": 500000,
          "spreading_factor": 10
        }
      },
      "rx1_frequency": "925100000",
      "rx2_data_rate": {
        "lora": {
          "bandwidth": 500000,
          "spreading_factor": 12
        }
      },
      "rx2_frequency": "923300000",
      "priority": "HIGHEST",
      "frequency_plan_id": "US_902_928_FSB_2"
    },
    "correlation_ids": [
      "gs:conn:01GA23B0D4PSK5TWPFFX0RHNAK",
      "gs:up:host:01GA23B0DT5FF46F081MPNB1DK",
      "gs:uplink:01GA23G5JP667PQZKF4NNS1ACP",
      "ns:downlink:01GA23G7CQZTFNG8G86T5YN11R",
      "ns:transmission:01GA23G7CQ7CHNVBP0N7Z0D04M",
      "ns:uplink:01GA23G5JRZHANAEAQBE52C1W0",
      "rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01GA23G5JQF4X579JY1RRG3ENH"
    ]
  },
  "correlation_ids": [
    "gs:conn:01GA23B0D4PSK5TWPFFX0RHNAK",
    "gs:up:host:01GA23B0DT5FF46F081MPNB1DK",
    "gs:uplink:01GA23G5JP667PQZKF4NNS1ACP",
    "ns:downlink:01GA23G7CQZTFNG8G86T5YN11R",
    "ns:transmission:01GA23G7CQ7CHNVBP0N7Z0D04M",
    "ns:uplink:01GA23G5JRZHANAEAQBE52C1W0",
    "rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01GA23G5JQF4X579JY1RRG3ENH"
  ],
  "origin": "d71b89d6ca68",
  "visibility": {
    "rights": [
      "RIGHT_APPLICATION_TRAFFIC_READ"
    ]
  },
  "unique_id": "01GA23G7CQE3X3Z4Q78NKZ2E1T"
}

image

You will need to investigate what went wrong with your local docker image.

Which container should I look for errors?

While running docker-compose up these are the logs displayed on the console

stack_1     | INFO      Finished unary call     {"duration": 0.02, "grpc.method": "HandleJoin", "grpc.service": "ttn.lorawan.v3.NsJs", "namespace": "grpc", "peer.address": "pipe", "request_id": "01GA0B9FPJXVSS3D00NFX9EP6J"}
stack_1     | INFO      Finished unary call     {"duration": 0.2146, "grpc.method": "HandleUplink", "grpc.service": "ttn.lorawan.v3.GsNs", "namespace": "grpc", "peer.address": "pipe", "request_id": "01GA0B9FP52KTXV8KMZ5AWCJHA"}
stack_1     | INFO      Finished unary call     {"duration": 0.001, "grpc.method": "ScheduleDownlink", "grpc.service": "ttn.lorawan.v3.NsGs", "namespace": "grpc", "peer.address": "pipe", "request_id": "01GA0B9HHBB68TMD88MHW9PPZX"}
stack_1     | INFO      Finished unary call     {"duration": 0.0176, "grpc.method": "HandleUplink", "grpc.service": "ttn.lorawan.v3.NsAs", "namespace": "grpc", "peer.address": "pipe", "request_id": "01GA0B9HHTHQ36240X0KD8M9TB"}
stack_1     | INFO      Finished unary call     {"auth.token_id": "NDNBHTXBO3PFGRQ2ORCGD66O6ZYXP7ZKJVFZOPI", "auth.token_type": "AccessToken", "auth.user_id": "admin", "duration": 0.0371, "grpc.method": "Get", "grpc.request.application_id": "app01", "grpc.request.device_id": "eui-79739dd7cae90dcf", "grpc.service": "ttn.lorawan.v3.NsEndDeviceRegistry", "namespace": "grpc", "peer.address": "pipe", "peer.real_ip": "192.168.0.102", "request_id": "01GA0B9HKCEADWB383WT3H0YMV"}
stack_1     | INFO      Finished unary call     {"auth.token_id": "NDNBHTXBO3PFGRQ2ORCGD66O6ZYXP7ZKJVFZOPI", "auth.token_type": "AccessToken", "auth.user_id": "admin", "duration": 0.0345, "grpc.method": "Get", "grpc.request.application_id": "app01", "grpc.request.device_id": "eui-79739dd7cae90dcf", "grpc.service": "ttn.lorawan.v3.AsEndDeviceRegistry", "namespace": "grpc", "peer.address": "pipe", "peer.real_ip": "192.168.0.102", "request_id": "01GA0B9HKF23HF10M81C9H1G6S"}
stack_1     | INFO      Request handled {"auth.token_id": "NDNBHTXBO3PFGRQ2ORCGD66O6ZYXP7ZKJVFZOPI", "auth.token_type": "AccessToken", "duration": 0.0371, "http.method": "GET", "http.path": "/api/v3/as/applications/app01/devices/eui-79739dd7cae90dcf", "http.status": 200, "namespace": "web", "peer.address": "192.168.0.102:47200", "request_id": "01GA0B9HKF23HF10M81C9H1G6S"}
stack_1     | INFO      Request handled {"auth.token_id": "NDNBHTXBO3PFGRQ2ORCGD66O6ZYXP7ZKJVFZOPI", "auth.token_type": "AccessToken", "duration": 0.0411, "http.method": "GET", "http.path": "/api/v3/ns/applications/app01/devices/eui-79739dd7cae90dcf", "http.status": 200, "namespace": "web", "peer.address": "192.168.0.102:47200", "request_id": "01GA0B9HKCEADWB383WT3H0YMV"}
stack_1     | INFO      Finished unary call     {"duration": 0.0066, "grpc.method": "BatchUpdateLastSeen", "grpc.service": "ttn.lorawan.v3.EndDeviceRegistry", "namespace": "grpc", "peer.address": "pipe", "request_id": "01GA0B9NH2802N369MCDP6VJKG"}
stack_1     | INFO      Finished unary call     {"duration": 0.0173, "grpc.method": "HandleJoin", "grpc.service": "ttn.lorawan.v3.NsJs", "namespace": "grpc", "peer.address": "pipe", "request_id": "01GA0BAKYMT33KNJYXZVH7XBP1"}
stack_1     | INFO      Finished unary call     {"duration": 0.2156, "grpc.method": "HandleUplink", "grpc.service": "ttn.lorawan.v3.GsNs", "namespace": "grpc", "peer.address": "pipe", "request_id": "01GA0BAKYC076XVHHRGWGX6QAH"}
stack_1     | INFO      Finished unary call     {"duration": 0.0006, "grpc.method": "ScheduleDownlink", "grpc.service": "ttn.lorawan.v3.NsGs", "namespace": "grpc", "peer.address": "pipe", "request_id": "01GA0BANR4HDH93WRT40S9JZ39"}
stack_1     | INFO      Finished unary call     {"duration": 0.0047, "grpc.method": "HandleUplink", "grpc.service": "ttn.lorawan.v3.NsAs", "namespace": "grpc", "peer.address": "pipe", "request_id": "01GA0BANRB2HQX2QR10PNYNHXM"}
stack_1     | INFO      Finished unary call     {"auth.token_id": "NDNBHTXBO3PFGRQ2ORCGD66O6ZYXP7ZKJVFZOPI", "auth.token_type": "AccessToken", "auth.user_id": "admin", "duration": 0.0246, "grpc.method": "Get", "grpc.request.application_id": "app01", "grpc.request.device_id": "eui-79739dd7cae90dcf", "grpc.service": "ttn.lorawan.v3.NsEndDeviceRegistry", "namespace": "grpc", "peer.address": "pipe", "peer.real_ip": "192.168.0.102", "request_id": "01GA0BANSBDA2XJ5JFR027E6ZG"}
stack_1     | INFO      Request handled {"auth.token_id": "NDNBHTXBO3PFGRQ2ORCGD66O6ZYXP7ZKJVFZOPI", "auth.token_type": "AccessToken", "duration": 0.0277, "http.method": "GET", "http.path": "/api/v3/ns/applications/app01/devices/eui-79739dd7cae90dcf", "http.status": 200, "namespace": "web", "peer.address": "192.168.0.102:47200", "request_id": "01GA0BANSBDA2XJ5JFR027E6ZG"}
stack_1     | INFO      Finished unary call     {"auth.token_id": "NDNBHTXBO3PFGRQ2ORCGD66O6ZYXP7ZKJVFZOPI", "auth.token_type": "AccessToken", "auth.user_id": "admin", "duration": 0.0248, "grpc.method": "Get", "grpc.request.application_id": "app01", "grpc.request.device_id": "eui-79739dd7cae90dcf", "grpc.service": "ttn.lorawan.v3.AsEndDeviceRegistry", "namespace": "grpc", "peer.address": "pipe", "peer.real_ip": "192.168.0.102", "request_id": "01GA0BANSER4N36PXNEPCQGAV5"}
stack_1     | INFO      Request handled {"auth.token_id": "NDNBHTXBO3PFGRQ2ORCGD66O6ZYXP7ZKJVFZOPI", "auth.token_type": "AccessToken", "duration": 0.0271, "http.method": "GET", "http.path": "/api/v3/as/applications/app01/devices/eui-79739dd7cae90dcf", "http.status": 200, "namespace": "web", "peer.address": "192.168.0.102:47200", "request_id": "01GA0BANSER4N36PXNEPCQGAV5"}

Issue resolved.


This project : GitHub - xoseperez/the-things-stack-docker at b650dbf2673318c5e78d71b17a2a07ab50736e91 helped resolve the issue.

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