RAK2245 PIHAT on Pi4 gateway won't connect

Hello all,
i am new to the lora world and for a project i need to create a lora network.
I work with an Pi4 and added a RAKwireless 2245 PIHAT to it. After that i installed the “RAK7243_on_Raspbian_OS_V4.2.5_20200909” image and run the pi.
To set the pi up i looked to this manual “LoRaWAN Gateway with RAK2245 Pi HAT and Raspberry Pi 4 - Hackster.io” but i use LAN instead of WiFi.
The Pi itself is able to access the internet and i am able to connect via ssh to the Pi. As far as well, now i will come to my problem.

I created the gateway on ttn but it ceeps showing me that the gateway is disconnected.
In this forum i already looked around a bit and tried to solve the problem mainly with the following issues:

Here is a snipped of my /var/log/syslog file:

Aug 16 12:14:32 rak-gateway ttn-gateway[663]: JSON up: {"stat":{"time":"2022-08-16 11:13:02 GMT","rxnb":0,"rxok":0,"rxfw":0,"ackr":100.0,"dwnb":0,"txnb":0}}
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: INFO: [up] PUSH_ACK received in 44 ms
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: INFO: [down] PULL_ACK received in 43 ms
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: INFO: [down] PULL_ACK received in 43 ms
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: INFO: [down] PULL_ACK received in 43 ms
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: ##### 2022-08-16 11:13:32 GMT #####
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: ### [UPSTREAM] ###
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # RF packets received by concentrator: 1
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # CRC_OK: 0.00%, CRC_FAIL: 100.00%, NO_CRC: 0.00%
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # RF packets forwarded: 0 (0 bytes)
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # PUSH_DATA datagrams sent: 1 (113 bytes)
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # PUSH_DATA acknowledged: 100.00%
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: ### [DOWNSTREAM] ###
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # PULL_DATA sent: 3 (100.00% acknowledged)
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # PULL_RESP(onse) datagrams received: 0 (0 bytes)
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # RF packets sent to concentrator: 0 (0 bytes)
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # TX errors: 0
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # BEACON queued: 0
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # BEACON sent so far: 0
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # BEACON rejected: 0
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: ### [JIT] ###
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # SX1301 time (PPS): 722827753
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: src/jitqueue.c:448:jit_print_queue(): INFO: [jit] queue is empty
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: ### [GPS] ###
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # Valid time reference (age: 0 sec)
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # no valid GPS coordinates available yet
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: ##### END #####
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: JSON up: {"stat":{"time":"2022-08-16 11:13:32 GMT","rxnb":1,"rxok":0,"rxfw":0,"ackr":100.0,"dwnb":0,"txnb":0}}
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: INFO: [up] PUSH_ACK received in 44 ms
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: INFO: [down] PULL_ACK received in 43 ms
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: INFO: [down] PULL_ACK received in 43 ms
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: INFO: [down] PULL_ACK received in 43 ms
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: INFO: Disabling GPS mode for concentrator's counter...
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: INFO: host/sx1301 time offset=(1660647659s:245124µs) - drift=120µs
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: INFO: Enabling GPS mode for concentrator's counter.
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: ##### 2022-08-16 11:14:02 GMT #####
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: ### [UPSTREAM] ###
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # RF packets received by concentrator: 2
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # CRC_OK: 0.00%, CRC_FAIL: 100.00%, NO_CRC: 0.00%
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # RF packets forwarded: 0 (0 bytes)
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # PUSH_DATA datagrams sent: 1 (113 bytes)
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # PUSH_DATA acknowledged: 100.00%
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: ### [DOWNSTREAM] ###
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # PULL_DATA sent: 3 (100.00% acknowledged)
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # PULL_RESP(onse) datagrams received: 0 (0 bytes)
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # RF packets sent to concentrator: 0 (0 bytes)
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # TX errors: 0
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # BEACON queued: 0
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # BEACON sent so far: 0
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # BEACON rejected: 0
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: ### [JIT] ###
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # SX1301 time (PPS): 782828196
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: src/jitqueue.c:448:jit_print_queue(): INFO: [jit] queue is empty
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: ### [GPS] ###
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # Valid time reference (age: 0 sec)
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # no valid GPS coordinates available yet
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: ##### END #####
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: JSON up: {"stat":{"time":"2022-08-16 11:14:02 GMT","rxnb":2,"rxok":0,"rxfw":0,"ackr":100.0,"dwnb":0,"txnb":0}}
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: INFO: [up] PUSH_ACK received in 44 ms
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: INFO: [down] PULL_ACK received in 43 ms
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: INFO: [down] PULL_ACK received in 43 ms
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: ##### 2022-08-16 11:14:32 GMT #####
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: ### [UPSTREAM] ###
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # RF packets received by concentrator: 1
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # CRC_OK: 0.00%, CRC_FAIL: 100.00%, NO_CRC: 0.00%
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # RF packets forwarded: 0 (0 bytes)
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # PUSH_DATA datagrams sent: 1 (113 bytes)
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # PUSH_DATA acknowledged: 100.00%
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: ### [DOWNSTREAM] ###
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # PULL_DATA sent: 2 (100.00% acknowledged)
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # PULL_RESP(onse) datagrams received: 0 (0 bytes)
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # RF packets sent to concentrator: 0 (0 bytes)
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # TX errors: 0
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # BEACON queued: 0
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # BEACON sent so far: 0
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # BEACON rejected: 0
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: ### [JIT] ###
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # SX1301 time (PPS): 782828196
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: src/jitqueue.c:448:jit_print_queue(): INFO: [jit] queue is empty
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: ### [GPS] ###
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # Valid time reference (age: 0 sec)
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: # no valid GPS coordinates available yet
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: ##### END #####
Aug 16 12:14:32 rak-gateway ttn-gateway[663]: JSON up: {"stat":{"time":"2022-08-16 11:14:32 GMT","rxnb":1,"rxok":0,"rxfw":0,"ackr":100.0,"dwnb":0,"txnb":0}}

if you need a bigger snippet please let me know.
I need to add, there is a bias of 1 hour because it doesnt receive valid gps data and put me in the wrong time zone. I hope that wont cause any problem.

And here is my /opt/ttn-gateway/packet_forwarder/lora_pkt_fwd/global_config.json:

{
    "SX1301_conf": {
        "lorawan_public": true,
        "clksrc": 1,
        "antenna_gain": 0,
        "radio_0": {
            "enable": true,
            "type": "SX1257",
            "freq": 867500000,
            "rssi_offset": -166.0,
            "tx_enable": true,
            "tx_freq_min": 863000000,
            "tx_freq_max": 870000000
        },
        "radio_1": {
            "enable": true,
            "type": "SX1257",
            "freq": 868500000,
            "rssi_offset": -166.0,
            "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": 9,
            "rf_power": -6,
            "dig_gain": 0
        },
        "tx_lut_1": {
            "pa_gain": 0,
            "mix_gain": 12,
            "rf_power": -3,
            "dig_gain": 0
        },
        "tx_lut_2": {
            "pa_gain": 0,
            "mix_gain": 15,
            "rf_power": 0,
            "dig_gain": 0
        },
        "tx_lut_3": {
            "pa_gain": 1,
            "mix_gain": 8,
            "rf_power": 3,
            "dig_gain": 1
        },
        "tx_lut_4": {
            "pa_gain": 1,
            "mix_gain": 9,
            "rf_power": 6,
            "dig_gain": 0
        },
        "tx_lut_5": {
            "pa_gain": 1,
            "mix_gain": 11,
            "rf_power": 10,
            "dig_gain": 0
        },
        "tx_lut_6": {
            "pa_gain": 1,
            "mix_gain": 12,
            "rf_power": 11,
            "dig_gain": 1
        },
        "tx_lut_7": {
            "pa_gain": 1,
            "mix_gain": 12,
            "rf_power": 12,
            "dig_gain": 0
        },
        "tx_lut_8": {
            "pa_gain": 2,
            "mix_gain": 11,
            "rf_power": 13,
            "dig_gain": 1
        },
        "tx_lut_9": {
            "pa_gain": 2,
            "mix_gain": 11,
            "rf_power": 14,
            "dig_gain": 0
        },
        "tx_lut_10": {
            "pa_gain": 3,
            "mix_gain": 8,
            "rf_power": 16,
            "dig_gain": 1
        },
        "tx_lut_11": {
            "pa_gain": 3,
            "mix_gain": 8,
            "rf_power": 20,
            "dig_gain": 0
	},
	"tx_lut_12": {
		"desc": "TX gain table, index 12",
		"pa_gain": 3,
		"mix_gain": 12,
		"rf_power": 23,
		"dig_gain": 1
	},
	"tx_lut_13": {
		"desc": "TX gain table, index 13",
		"pa_gain": 3,
		"mix_gain": 13,
		"rf_power": 25,
		"dig_gain": 0
	},
	"tx_lut_14": {
		"desc": "TX gain table, index 14",
		"pa_gain": 3,
		"mix_gain": 13,
		"rf_power": 26,
		"dig_gain": 0
	},
	"tx_lut_15": {
		"desc": "TX gain table, index 15",
		"pa_gain": 3,
		"mix_gain": 13,
		"rf_power": 27,
		"dig_gain": 0
        }
    },
	"gateway_conf": {
		"gateway_ID": "DCA632FFFEC5D788",
		/* change with default server address/ports, or overwrite in local_conf.json */
		"server_address": "eu1.cloud.thethings.network",
		"serv_port_up": 1700,
		"serv_port_down": 1700,
		/* adjust the following parameters for your network */
		"keepalive_interval": 10,
		"stat_interval": 30,
		"push_timeout_ms": 100,
		/* forward only valid packets */
		"forward_crc_valid": true,
		"forward_crc_error": false,
		"forward_crc_disabled": false,
		/* gps enable */
		"gps_tty_path": "/dev/ttyAMA0",
		"fake_gps": false,
		"ref_latitude": 10,
		"ref_longitude": 20,
		"ref_altitude": -1,
		"autoquit_threshold": 20
	}
}

To check, here is the output of the command gateway-version:
gateway_version

And the gateway i created on ttn:
gateway_ttn

To avoid network based errors i connected the gateway to two different networks but neither worked.

What i see and i dont know if this could be an issu, it seems like the port 1700 isn’t used or a process isnt running.
netstat

Is there anything additional i could provide you ?
Have you any suggestion what i could try next?

Thank you already for any replies ^^

1 Like

Did you check your firewall settings?

I was thinking about that too. Unfortunatly i have no access to the companies firewall. But a workmate enabled the port 1700. Or do you mean the firewall of the pi (if there is something like this)

Yes both places, check the firewall.

Firewalls not a thing - there are acks up & down in the log.

What’s missing is an actual device to see the traffic and the understanding that the Disconnected status is not updated in real time due to in-memory database constraints on the server, something that really only gets updated/reinforced once there is traffic.

The ONLY truth for a gateway is the console showing traffic.

Get a device, turn it on.

I have no installed the ufw package and allowed the port manually on the pi. Also we checkt again the companies network and there it is allowed too

I am having a device next to me.
I created a test application
app_ttn
And added a device (a real one, no dummy)
device_ttn
Could the “uplink message failure” mean that i made a typo in the device key?
Is there any option to test if the device is working or to see on the pi if it receive data?

1 Like

You are most probably to close to the gateway, you need 5m and brick wall between gateway and node/device.

Thanks for the notice.
I now left the office on the first floor and went out of the building but i still dont receive data.
Could you imagine any quick check if the sensor works ?

No imagining needed - it’s clearly working as seen in the device console log.

Yes, the system logs - or you could look on the gateway console log …

Not a very accurate transcription - “Decode uplink data message failure” indicates that the payload formatter has a problem - if you are on the live data tab it will give you more info, if you click on the line it will give you all the detail.

But the “Forward uplink data message” means that the Application Server has forwarded the uplink on its final destination.

So just to proof i understand it correctly. My sensoe (device/end node) is working. And we can see that the application send the data to the destination, so my gateway should work fine as well.

Here are the details from one of the “ecode uplink data message failure” entries:

{
  "name": "as.up.data.decode.fail",
  "time": "2022-08-16T08:06:23.494504725Z",
  "identifiers": [
    {
      "device_ids": {
        "device_id": "eui-4aea73b31ed0a60bd2bf02cxxxxxxce6",
        "application_ids": {
          "application_id": "testapp788"
        }
      }
    }
  ],
  "context": {
    "tenant-id": "CgN0dG4="
  },
  "visibility": {
    "rights": [
      "RIGHT_APPLICATION_TRAFFIC_READ"
    ]
  },
  "unique_id": "01GAJV0ZG6C95TY5CXVPWCAJRZ"
}

Are you able to read something out of this ?

EDIT: Currently in the payload formatter menu the default “none” is selected

If you look at the json you will see the gateway ID, but you need to look at your decoder, it fails.

"rx_metadata": [
        {
          "gateway_ids": {
            "gateway_id": 

Thats a good one thank you!
To which json i need to add this?

I searched and found this when i selected the device and opened the payload formatter menu. As type is selected “use device repository”

function decodeUplink(input) {
    var bytes = input.bytes;

    switch (input.fPort) {
      case 100:
        return {
          data: {
            status: bytes[0] & 0x01,
            battery: (25 + (bytes[1] & 0x0f)) / 10,
            temperatureBoard: (bytes[2] & 0x7f) - 32,
            time: (bytes[4] << 8) | bytes[3],
            count: ((bytes[7] << 16) | (bytes[6] << 8)) | bytes[5]
          }
      };
    default:
      return {
        errors: ['unknown FPort'],
      };
    }
  }

If you lookin in the live view of application and select the message, scroll down the json, there are quit a few fields and lots of information in it.

Unfortunatly this is all i got when i select a message from the live data.

{
  "name": "as.up.data.decode.fail",
  "time": "2022-08-16T08:06:23.494504725Z",
  "identifiers": [
    {
      "device_ids": {
        "device_id": "eui-4aea73b31ed0a60bd2bf02cxxxxxxce6",
        "application_ids": {
          "application_id": "testapp788"
        }
      }
    }
  ],
  "context": {
    "tenant-id": "CgN0dG4="
  },
  "visibility": {
    "rights": [
      "RIGHT_APPLICATION_TRAFFIC_READ"
    ]
  },
  "unique_id": "01GAJV0ZG6C95TY5CXVPWCAJRZ"
}

EDIT: i think i see what you mean in the documentation. Can this be caused by the device repository formatter? There are many fields missing

Look in the Forward Uplink Data Message.

You will need to search for the correct decoder and fix that.

What node are you using a Browan?

Correct i am using a browan tbdw100

You will maybe need to contact them and ask them for the correct decoder.

I think thats the way to go. I cannot find anything by searching the web and also no issue here on the forum. I will update you if i get any reply.
Thank you

Why can’t you just look at the console logs for the gateway and the device as requested above - why add more, more is not good, simple is better - it’s “Live Data”

Not as a screen shot, because we never post screen shots when we can copy the text and then we format it with </>

Just turn off the payload formatter, it is clearly wrong or not for your device.