Wisblock RAK11310 lorawan otaa failed to join

After a while I tried lorawan-otaa-abp example for rak11310. I set proper devui and appkey and it fails to join network. I found that when I comment out TimersInit function in timers_init , it will join, but of course will not start sending any packets. Also when TimersInit is not commented out, I can see on chirpstack app server that join request was accepted.

Is there anytthing I am doing wrong?

If you are using example code that comes with the BSP, it has a bug (caused by a change in the BSP itself).

The example in our WisBlock repo RAK11310 LoRaWAN_OTAA_ABP has the bug fixed.

I’m running into same issue while connecting to Chirpstack. It works fine with ThingsStack while using same code and updating global_conf.json to point to "server_address":"nam1.cloud.thethings.network"

=====================================
Welcome to RAK11300 LoRaWan!!!
Type: OTAA
Region: US915
=====================================
OTAA join failed!
Check your EUI's and Keys's!
Check if a Gateway is in range!

My setup:

  1. WisGate Developer Base RAK7371
    1.1 : Running udp-packet-forwarder using this repo : https://github.com/RAKWireless/basicstation
    1.2 : cat docker-compose.yml
    version: '3.6'
    networks:
      loranet:
        external: true
    services:
      udp-packet-forwarder:
        build:
          dockerfile: Dockerfile
          context: '.'
        image: us_udpforwarder:1.0
        container_name: us_udpforwarder
        hostname: us_udpforwarder
        restart: always
        logging:
          options:
            max-size: "10m"
            max-file: "3"
        privileged: true
        environment:
          MODEL: "RAK7371"
          MODULE: "RAK5146"
          CONCENTRATOR: "SX1303"
          HAS_GPS: "0"
          INTERFACE: "USB"
          SERVER_HOST: "192.168.0.247"
          SERVER_PORT: "1700"
          RADIO_DEV: "/dev/ttyACM0"
          GATEWAY_EUI_NIC: "usb0"
          BAND: "us_902_928"
          GPS_LATITUDE: "0.0"
          GPS_LONGITUDE: "0.0"
        networks:
          loranet:      
    

1.3: cat global_conf.json

{
  "SX130x_conf": {
      "com_type": "USB",
      "com_path": "/dev/ttyACM0",
      "lorawan_public": true,
      "clksrc": 0,
      "antenna_gain": 0,
      "full_duplex": false,
      "fine_timestamp": {
          "enable": false,
          "mode": "all_sf"
      },
      "radio_0": {
          "enable": true,
          "type": "SX1250",
          "freq": 904300000,
          "rssi_offset": -215.4,
          "rssi_tcomp": {"coeff_a": 0, "coeff_b": 0, "coeff_c": 20.41, "coeff_d": 2162.56, "coeff_e": 0},
          "tx_enable": true,
          "tx_freq_min": 923000000,
          "tx_freq_max": 928000000,
          "tx_gain_lut":[
              {"rf_power": 12, "pa_gain": 1, "pwr_idx": 6},
              {"rf_power": 13, "pa_gain": 1, "pwr_idx": 7},
              {"rf_power": 14, "pa_gain": 1, "pwr_idx": 8},
              {"rf_power": 15, "pa_gain": 1, "pwr_idx": 9},
              {"rf_power": 16, "pa_gain": 1, "pwr_idx": 10},
              {"rf_power": 17, "pa_gain": 1, "pwr_idx": 11},
              {"rf_power": 18, "pa_gain": 1, "pwr_idx": 12},
              {"rf_power": 19, "pa_gain": 1, "pwr_idx": 13},
              {"rf_power": 20, "pa_gain": 1, "pwr_idx": 14},
              {"rf_power": 21, "pa_gain": 1, "pwr_idx": 15},
              {"rf_power": 22, "pa_gain": 1, "pwr_idx": 16},
              {"rf_power": 23, "pa_gain": 1, "pwr_idx": 17},
              {"rf_power": 24, "pa_gain": 1, "pwr_idx": 18},
              {"rf_power": 25, "pa_gain": 1, "pwr_idx": 19},
              {"rf_power": 26, "pa_gain": 1, "pwr_idx": 21},
              {"rf_power": 27, "pa_gain": 1, "pwr_idx": 22}
          ]
      },
      "radio_1": {
          "enable": true,
          "type": "SX1250",
          "freq": 905000000,
          "rssi_offset": -215.4,
          "rssi_tcomp": {"coeff_a": 0, "coeff_b": 0, "coeff_c": 20.41, "coeff_d": 2162.56, "coeff_e": 0},
          "tx_enable": false
      },
      "chan_multiSF_All": {"spreading_factor_enable": [ 5, 6, 7, 8, 9, 10, 11, 12 ]},
      "chan_multiSF_0": {"enable": true, "radio": 0, "if": -400000},
      "chan_multiSF_1": {"enable": true, "radio": 0, "if": -200000},
      "chan_multiSF_2": {"enable": true, "radio": 0, "if":  0},
      "chan_multiSF_3": {"enable": true, "radio": 0, "if":  200000},
      "chan_multiSF_4": {"enable": true, "radio": 1, "if": -300000},
      "chan_multiSF_5": {"enable": true, "radio": 1, "if": -100000},
      "chan_multiSF_6": {"enable": true, "radio": 1, "if":  100000},
      "chan_multiSF_7": {"enable": true, "radio": 1, "if":  300000},
      "chan_Lora_std":  {"enable": true, "radio": 0, "if":  300000, "bandwidth": 500000, "spread_factor": 8,
                         "implicit_hdr": false, "implicit_payload_length": 17, "implicit_crc_en": false, "implicit_coderate": 1},
      "chan_FSK":       {"enable": false, "radio": 1, "if":  300000, "bandwidth": 125000, "datarate": 50000}
  },
  "gateway_conf": {
      "server_address": "192.168.0.247",
      "serv_port_up": 1700,
      "serv_port_down": 1700,
      "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/ttyAMA0",
      "ref_latitude": 0.0,
      "ref_longitude": 0.0,
      "ref_altitude": 5000,
      "beacon_period": 0,
      "beacon_freq_hz": 923300000,
      "beacon_freq_nb": 8,
      "beacon_freq_step": 600000,
      "beacon_datarate": 12,
      "beacon_bw_hz": 500000,
      "beacon_power": 27
  },
  
  "debug_conf": {
      "ref_payload":[
          {"id": "0xCAFE1234"},
          {"id": "0xCAFE2345"}
      ],
      "log_file": "/app/loragw_hal.log"
  }
}
  1. Chirpstack using : https://github.com/chirpstack/chirpstack-docker
    2.1: Update chirpstack-gateway-bridge.toml
    cat configuration/chirpstack-gateway-bridge/chirpstack-gateway-bridge.toml 
    # See https://www.chirpstack.io/gateway-bridge/install/config/ for a full
    # configuration example and documentation.
    
    [integration.mqtt.auth.generic]
    servers=["tcp://mosquitto:1883"]
    username=""
    password=""
    
    [integration.mqtt]
    event_topic_template="us915_1/gateway/{{ .GatewayID }}/event/{{ .EventType }}"
    state_topic_template="us915_1/gateway/{{ .GatewayID }}/state/{{ .StateType }}"
    command_topic_template="us915_1/gateway/{{ .GatewayID }}/command/#"
    
  2. Used this updated code: LoRaWAN_OTAA_ABP
    3.1 Updated line 20 with LORAMAC_REGION_US915
    3.2 Update OTAA keys with data from Chirpstack after creating device.
    uint8_t nodeDeviceEUI[8] = {0xCE, 0x25, 0x44, 0x75, 0x12, 0x78, 0x66, 0x70};
    uint8_t nodeAppEUI[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
    uint8_t nodeAppKey[16] = {0xD4, 0x3F, 0x28, 0x4E, 0xD8, 0x52, 0x81, 0xB7, 0x31, 0x49, 0x32, 0x43, 0x38, 0x08, 0x26, 0xB3};
    

Further looking at Chirpstack logs I see these error messages:

Aug 07 20:38:45.469  INFO chirpstack::gateway::backend::mqtt: Message received from gateway region_name="us915_1" topic="us915_1/gateway/0242acfffe130002/event/stats" qos=0
Aug 07 20:38:45.476  INFO stats{gateway_id=0242acfffe130002}: chirpstack::storage::gateway: Gateway state and location updated gateway_id=0242acfffe130002
Aug 07 20:38:45.477  INFO stats{gateway_id=0242acfffe130002}: chirpstack::storage::metrics: Metrics saved name=gw:0242acfffe130002 aggregation=HOUR
Aug 07 20:38:45.479  INFO stats{gateway_id=0242acfffe130002}: chirpstack::storage::metrics: Metrics saved name=gw:0242acfffe130002 aggregation=DAY
Aug 07 20:38:45.480  INFO stats{gateway_id=0242acfffe130002}: chirpstack::storage::metrics: Metrics saved name=gw:0242acfffe130002 aggregation=MONTH
Aug 07 20:39:15.510  INFO chirpstack::gateway::backend::mqtt: Message received from gateway region_name="us915_1" topic="us915_1/gateway/0242acfffe130002/event/stats" qos=0
Aug 07 20:39:15.523  INFO stats{gateway_id=0242acfffe130002}: chirpstack::storage::gateway: Gateway state and location updated gateway_id=0242acfffe130002
Aug 07 20:39:15.525  INFO stats{gateway_id=0242acfffe130002}: chirpstack::storage::metrics: Metrics saved name=gw:0242acfffe130002 aggregation=HOUR
Aug 07 20:39:15.526  INFO stats{gateway_id=0242acfffe130002}: chirpstack::storage::metrics: Metrics saved name=gw:0242acfffe130002 aggregation=DAY
Aug 07 20:39:15.528  INFO stats{gateway_id=0242acfffe130002}: chirpstack::storage::metrics: Metrics saved name=gw:0242acfffe130002 aggregation=MONTH
Aug 07 20:39:20.615  INFO chirpstack::gateway::backend::mqtt: Message received from gateway region_name="us915_1" topic="us915_1/gateway/0242acfffe130002/event/up" qos=0
Aug 07 20:39:20.819  INFO up{deduplication_id=b8b11b56-7a9a-4ee7-86f1-40e8b774a2e0}: chirpstack::uplink: Uplink received m_type="JoinRequest"
Aug 07 20:39:20.847  INFO up{deduplication_id=b8b11b56-7a9a-4ee7-86f1-40e8b774a2e0}:join_request: chirpstack::storage::device_keys: Device-nonce validated and stored dev_eui=79739dd7cae90dcb dev_nonce=54565
Aug 07 20:39:20.851  INFO up{deduplication_id=b8b11b56-7a9a-4ee7-86f1-40e8b774a2e0}:join_request: chirpstack::storage::device_keys: Device-keys updated dev_eui=79739dd7cae90dcb
Aug 07 20:39:20.853  INFO up{deduplication_id=b8b11b56-7a9a-4ee7-86f1-40e8b774a2e0}:join_request: chirpstack::storage::device_session: Device-session saved dev_eui=79739dd7cae90dcb dev_addr=01448947
Aug 07 20:39:20.855  INFO up{deduplication_id=b8b11b56-7a9a-4ee7-86f1-40e8b774a2e0}:join_request: chirpstack::storage::device_queue: Device queue flushed dev_eui=79739dd7cae90dcb count=0
Aug 07 20:39:20.859  INFO up{deduplication_id=b8b11b56-7a9a-4ee7-86f1-40e8b774a2e0}:join_request: chirpstack::storage::device: Enabled class updated dev_eui=79739dd7cae90dcb enabled_class=A
Aug 07 20:39:20.859  INFO up{deduplication_id=b8b11b56-7a9a-4ee7-86f1-40e8b774a2e0}:join_request: chirpstack::gateway::backend::mqtt: Sending downlink frame gateway_id=0242acfffe130002 topic=us915_1/gateway/0242acfffe130002/command/down
Aug 07 20:39:20.862  INFO up{deduplication_id=b8b11b56-7a9a-4ee7-86f1-40e8b774a2e0}:join_request: chirpstack::storage::downlink_frame: Downlink-frame saved downlink_id=1185052619
Aug 07 20:39:20.869  INFO up{deduplication_id=b8b11b56-7a9a-4ee7-86f1-40e8b774a2e0}:join_request: chirpstack::integration::aws_sns: Publishing event event=join dev_eui=79739dd7cae90dcb
Aug 07 20:39:20.870  INFO up{deduplication_id=b8b11b56-7a9a-4ee7-86f1-40e8b774a2e0}:join_request: chirpstack::integration::mqtt: Publishing event topic=application/38acdd9d-24f8-45d3-9fc9-921b6205633c/device/79739dd7cae90dcb/event/join
Aug 07 20:39:21.103 ERROR up{deduplication_id=b8b11b56-7a9a-4ee7-86f1-40e8b774a2e0}: chirpstack::uplink::join: Handle join-request error error=Error { code: "InvalidClientTokenId", message: "The security token included in the request is invalid.", request_id: "d71f53d3-9fe2-52b7-88d5-08b9badb2272" }

Couldn’t find any other ticket error message like this :

Aug 07 20:39:21.103 ERROR up{deduplication_id=b8b11b56-7a9a-4ee7-86f1-40e8b774a2e0}: chirpstack::uplink::join: Handle join-request error error=Error { code: "InvalidClientTokenId", message: "The security token included in the request is invalid.", request_id: "d71f53d3-9fe2-52b7-88d5-08b9badb2272" }

I’m using this code to create the Chirpstack : https://github.com/chirpstack/chirpstack-docker.

If it works with TTN and fails with Chirpstack then somehing is setup wrong in Chirpstack. Maybe a question for the Chirpstack forum.

Might be you changed the DevEUI, but the two DevEUI’s in your messages are different.

Hi @beegee

Thanks for the reply. I mistakenly shared output while testing rak113100 and also mkr1310. Hence those values are different.

I will cross post this question to chirpstack forum. Thank you.


Regards,
AC

Update:

I tried RAK7271/RAK7371 Quick Start Guide | RAKwireless Documentation Center on Raspberry Pi and still have same issue.

I tried Configuration | The Things Stack for LoRaWAN with steps described to setup as localhost using ip address and result was the same.

Connecting to publicly hosts ThingsStack worked well.

Request:

Is there a specific version of Chirpstack or Things Stack I should consider while using RAK7371 with US915?

Kindly share the firmware version I should install on RAK7371 and RAK113100?

If possible share any documentation to follow while working with either Chirpstack or Things Stack opensource version while running with Docker containers.


Regards

This getting more into a gateway problem solving than a problem with the RAK11310.

@Hobo @velev @Nikola There is no channel here for RAK7271/RAk7371, I tested the general communication to Chirpstack on US915 using our RAK7268 gateway and it works.
Can you have a look please.

@dexterac
In Chirpstack, do you have the gateway registered and does it show any activity?

In TTN, did you register the gateway and does it show active? (I have no gateways connected, so the screenshot shows just disconnected)

1 Like

Hi @beegee,

Kindly find the attachments below:


Creating Gateway


Creating Device


Sending data


Logs

Docker logs

docker logs

Aug 10 02:56:04.014  INFO chirpstack::gateway::backend::mqtt: Message received from gateway region_name="us915_1" topic="us915_1/gateway/0242acfffe130002/event/up" qos=0
Aug 10 02:56:04.016  INFO chirpstack::gateway::backend::mqtt: Message received from gateway region_name="us915_1" topic="us915_1/gateway/0242acfffe130002/event/up" qos=0
Aug 10 02:56:04.221  INFO up{deduplication_id=cf3b7161-51a3-4554-a840-6a8d3fb260f3}: chirpstack::uplink: Uplink received m_type="JoinRequest"
Aug 10 02:56:04.223  INFO up{deduplication_id=39e86983-5eaa-4457-82da-c2eb2a3fd0bc}: chirpstack::uplink: Uplink received m_type="JoinRequest"
Aug 10 02:56:04.256  INFO up{deduplication_id=cf3b7161-51a3-4554-a840-6a8d3fb260f3}:join_request: chirpstack::storage::device_keys: Device-nonce validated and stored dev_eui=79739dd7cae90dcf dev_nonce=35145
Aug 10 02:56:04.263  INFO up{deduplication_id=cf3b7161-51a3-4554-a840-6a8d3fb260f3}:join_request: chirpstack::storage::device_keys: Device-keys updated dev_eui=79739dd7cae90dcf
Aug 10 02:56:04.269  INFO up{deduplication_id=cf3b7161-51a3-4554-a840-6a8d3fb260f3}:join_request: chirpstack::storage::device_session: Device-session saved dev_eui=79739dd7cae90dcf dev_addr=0140b771
Aug 10 02:56:04.272  INFO up{deduplication_id=cf3b7161-51a3-4554-a840-6a8d3fb260f3}:join_request: chirpstack::storage::device_queue: Device queue flushed dev_eui=79739dd7cae90dcf count=0
Aug 10 02:56:04.281  INFO up{deduplication_id=39e86983-5eaa-4457-82da-c2eb2a3fd0bc}:join_request: chirpstack::integration::mqtt: Publishing event topic=application/2cdc4cf7-95aa-4574-8572-de678b8657d1/device/79739dd7cae90dcf/event/log
Aug 10 02:56:04.285  INFO up{deduplication_id=cf3b7161-51a3-4554-a840-6a8d3fb260f3}:join_request: chirpstack::storage::device: Enabled class updated dev_eui=79739dd7cae90dcf enabled_class=A
Aug 10 02:56:04.285  INFO up{deduplication_id=cf3b7161-51a3-4554-a840-6a8d3fb260f3}:join_request: chirpstack::gateway::backend::mqtt: Sending downlink frame gateway_id=0242acfffe130002 topic=us915_1/gateway/0242acfffe130002/command/down
Aug 10 02:56:04.289  INFO up{deduplication_id=39e86983-5eaa-4457-82da-c2eb2a3fd0bc}:join_request: chirpstack::storage::metrics: Metrics saved name=device:79739dd7cae90dcf aggregation=HOUR
Aug 10 02:56:04.291  INFO up{deduplication_id=39e86983-5eaa-4457-82da-c2eb2a3fd0bc}:join_request: chirpstack::storage::metrics: Metrics saved name=device:79739dd7cae90dcf aggregation=DAY
Aug 10 02:56:04.292  INFO up{deduplication_id=cf3b7161-51a3-4554-a840-6a8d3fb260f3}:join_request: chirpstack::storage::downlink_frame: Downlink-frame saved downlink_id=3747101233
Aug 10 02:56:04.293  INFO up{deduplication_id=39e86983-5eaa-4457-82da-c2eb2a3fd0bc}:join_request: chirpstack::storage::metrics: Metrics saved name=device:79739dd7cae90dcf aggregation=MONTH
Aug 10 02:56:04.294 ERROR up{deduplication_id=39e86983-5eaa-4457-82da-c2eb2a3fd0bc}: chirpstack::uplink::join: Handle join-request error error=Invalid DevNonce
Aug 10 02:56:04.296  INFO up{deduplication_id=cf3b7161-51a3-4554-a840-6a8d3fb260f3}:join_request: chirpstack::integration::mqtt: Publishing event topic=application/2cdc4cf7-95aa-4574-8572-de678b8657d1/device/79739dd7cae90dcf/event/join
Aug 10 02:56:08.821  INFO chirpstack::gateway::backend::mqtt: Message received from gateway region_name="us915_1" topic="us915_1/gateway/0242acfffe130002/event/stats" qos=0
Aug 10 02:56:08.830  INFO stats{gateway_id=0242acfffe130002}: chirpstack::storage::gateway: Gateway state and location updated gateway_id=0242acfffe130002
Aug 10 02:56:08.832  INFO stats{gateway_id=0242acfffe130002}: chirpstack::storage::metrics: Metrics saved name=gw:0242acfffe130002 aggregation=HOUR
Aug 10 02:56:08.834  INFO stats{gateway_id=0242acfffe130002}: chirpstack::storage::metrics: Metrics saved name=gw:0242acfffe130002 aggregation=DAY
Aug 10 02:56:08.836  INFO stats{gateway_id=0242acfffe130002}: chirpstack::storage::metrics: Metrics saved name=gw:0242acfffe130002 aggregation=MONTH

Console logs

minicom -D /dev/ttyACM0

=====================================                                                                                                                                      
Welcome to RAK11300 LoRaWan!!!                                                                                                                                             
Type: OTAA                                                                                                                                                                 
Region: US915
=====================================
OTAA join failed!
Check your EUI's and Keys's!
Check if a Gateway is in range!

TTN cloud service join-accept works

Yes. When I change the packet-forwarder configuration and copy the global_conf.json it shows up and does work. I was able to use same RAK113100 without change code and able to connect successfully then send data.

TTN localhost deployment join-accept fails

If it works with TTN now and doesn’t work with Chirpstack I am out of ideas and the problem is obviously not on the WisBlock side.

My Chirpstack works fine with all my devices, but I am not using Docker. I have it running on a VPS, installed and setup manually from commandline.

Sorry, I cannot help you with the Chirpstack problem.

As per the documentation when I installed chirpstack without docker I’ve had same issue. Only the cloud based TTN works. Any locally installed application has same issue.


Hi Team,

Kindly inform if there’s any document which covers steps with Chirpstack or with TTN Localhost setup (with or without docker) where RAK113100 is able to complete OTAA and send/receive data.


Regards.

Setup of Chirpstack Network and Application servers guides are provided by Chirpstack:

Chirpstack Network Server
Chirpstack Application Server

For connecting a RAK Edge gateway to Chirpstack and adding a WisBlock device I wrote a short tutorial.

But your problem is not the registration of a device on Chirpstack, your problem is somewhere in the settings of Chirpstack or in the connection of the RAK7271 to Chirpstack and with that I cannot help.

I have multiple WisBlock devices on my local Chirpstack installation (RPi3) connected through my gateway (on same local network) and it works without problems.

I talked with our gateway expert Todor yesterday. He said he will reach out to you to help.

1 Like

Thank you @beegee.

I will look for a message or email from Todor. We were discussing about other issue in email a few days ago.

Regards

Just to echo this. Using RAK11310 with Chirpstack and i’ve got no problems :slight_smile:

2 Likes

:smiley: ok will do it

Regards

Hi @cyclops Which gateway are you using and the documentation you followed to setup your environment?

I’m using RAK7371 US915 connected to Raspberry Pi 64bit OS connected to USB-2 port and no luck with Chirpstack and ThingsStack on localhost.


Regards.

I’m actually using the ic880a.

But, given the fact that your joinRequest comes into your chirpstack, it means there’s nothing wrong with your gateway (IMHO - i’m not an expert).

So, what have you set for your join mode? ABP or OTAA?
In both options, you need to setup a few keys and stuff. Please share those. Can you then also show the code and how you’ve modified those keys in your code?

Those are my assumptions too… Packets arrive to the Chirpstack or ThingsStack on the localhost.

I’m using OTAA for both solutions. Only the ThingsStack cloud based works, any localhost on the raspberryPi doesn’t work. My device is more than 5meters away from the gateway and RSSI values are between -50 to -60.

I’m using this code: https://github.com/RAKWireless/WisBlock/blob/master/examples/RAK11300/communications/LoRa/LoRaWAN/LoRaWAN_OTAA_ABP/LoRaWAN_OTAA_ABP.ino

Here,

  • line number 20 is changed to LORAMAC_REGION_US915
  • line 45 is updated with my devEUI
  • and line 47 is updated with appKey.

Regards.

can you try changing the AppEUI to all 0’s?

So, change line 46 to:

uint8_t nodeAppEUI[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};