Gateways ping in chirpstack v4

Dear @brocaar , is it possible, theoretically, to develop gateways ping feature to current chirpstack v4 by some developer-enthusiast for some RnD? how difficult can this processs be in your opinion according current architecture of chirpstack v4?

It is not difficult, but as I already explained in an other topic, not all gateways support gateway to gateway communication properly. In the end it is nothing more than sending a downlink over MQTT to the ChirpStack Gateway Bridge. In ChirpStack v3 I was using the Proprietary LoRaWAN MType for this with the correct signal polarity (such that it is received by other gateways, not the devices).

1 Like

Dear @brocaar, thanks for answer. To my happiness I have two gateways supporting ping communication: I checked this in chirpstack v3 and it works perfeclty, so thanks for this feature in chirpstak v3.

You mentioned:

In the end it is nothing more than sending a downlink over MQTT to the ChirpStack Gateway Bridge

So I believe I may use MQTT to send some ping command to ChirpStack Gateway Bridge… Or how will it look like?

You will send a downlink payload (e.g. using MType Proprietary + some token) as a downlink to the gateway of your choice. This is then received as uplink by other gateways and reported back to the MQTT broker (as. uplink frame). Then you can do your magic using the RSSI, SNR etc… :slight_smile:

Dear @brocaar , could you show me in which place of chirpstack v4 sources I may simulate sending downlink payload to gateways?

Edited: can I use rust chirpstack sdk to develop gateways ping?

I would recommend using the ChirpStack Gateway Bridge MQTT topic directly for sending and receiving :slight_smile:

Dear @brocaar , yes, I also think the same way. I had already made it for chirp v3 and it works. Now I’m working on chirp v4.

P.S.: I will message you here if I get success.

Dear @brocaar ,my friend, I simulate pings in chirpstack v3 by sending into mqtt topic

gateway/e45f01fffe14ccfe/command/down

the message:

{
  "phyPayload": "4B8KzGo=",
  "txInfo": {
    "gatewayID": "5F8B//4UzP4=",
    "frequency": 868300000,
    "power": 14,
    "modulation": "LORA",
    "loRaModulationInfo": {
      "bandwidth": 125,
      "spreadingFactor": 11,
      "codeRate": "4/5",
      "polarizationInversion": false
    },
    "board": 0,
    "antenna": 0,
    "timing": "IMMEDIATELY",
    "immediatelyTimingInfo": {},
    "context": null
  },
  "token": 35561,
  "downlinkID": "iun2UJpBScCrX4CdgnB7ug==",
  "items": [
    {
      "phyPayload": "4B8KzGo=",
      "txInfo": {
        "gatewayID": null,
        "frequency": 868300000,
        "power": 14,
        "modulation": "LORA",
        "loRaModulationInfo": {
          "bandwidth": 125,
          "spreadingFactor": 11,
          "codeRate": "4/5",
          "polarizationInversion": false
        },
        "board": 0,
        "antenna": 0,
        "timing": "IMMEDIATELY",
        "immediatelyTimingInfo": {},
        "context": null
      }
    }
  ],
  "gatewayID": "5F8B//4UzP4="
}

In chirpstack v4 I found that message above doesn’t work. Also I found that in chirpstack v4 topic became

eu868/gateway/3cee594eb5913c33/command/down

and its message looks like:

{
  "downlinkId": 2761927457,
  "downlinkIdLegacy": "AAAAAAAAAAAAAAAApJ+rIQ==",
  "items": [
    {
      "phyPayload": "IE2wr1E0F7ZoLy+QijXHssc=",
      "txInfoLegacy": {
        "frequency": 2425000000,
        "power": 10,
        "timing": "DELAY",
        "context": "cSXvAQ==",
        "loraModulationInfo": {
          "bandwidth": 812,
          "spreadingFactor": 12,
          "codeRateLegacy": "4/5",
          "polarizationInversion": true
        },
        "delayTimingInfo": {
          "delay": "5s"
        }
      },
      "txInfo": {
        "frequency": 2425000000,
        "power": 10,
        "modulation": {
          "lora": {
            "bandwidth": 812000,
            "spreadingFactor": 12,
            "codeRate": "CR_4_5",
            "polarizationInversion": true
          }
        },
        "timing": {
          "delay": {
            "delay": "5s"
          }
        },
        "context": "cSXvAQ=="
      }
    },
    {
      "phyPayload": "IE2wr1E0F7ZoLy+QijXHssc=",
      "txInfoLegacy": {
        "frequency": 2423000000,
        "power": 10,
        "timing": "DELAY",
        "context": "cSXvAQ==",
        "loraModulationInfo": {
          "bandwidth": 812,
          "spreadingFactor": 12,
          "codeRateLegacy": "4/5",
          "polarizationInversion": true
        },
        "delayTimingInfo": {
          "delay": "6s"
        }
      },
      "txInfo": {
        "frequency": 2423000000,
        "power": 10,
        "modulation": {
          "lora": {
            "bandwidth": 812000,
            "spreadingFactor": 12,
            "codeRate": "CR_4_5",
            "polarizationInversion": true
          }
        },
        "timing": {
          "delay": {
            "delay": "6s"
          }
        },
        "context": "cSXvAQ=="
      }
    }
  ],
  "gatewayIdLegacy": "GhhKqrAPVRM=",
  "gatewayId": "1a184aaab00f5513"
}

SI my question is: how should message ping look for chirpstack v4?

@brocaar , now, I sent to topic

eu868/gateway/3cee594eb5913c33/command/down

message:

{
  "downlinkId": 2761927457,
  "downlinkIdLegacy": "AAAAAAAAAAAAAAAApJ+rIQ==",
  "items": [
    {
      "phyPayload": "IE2wr1E0F7ZoLy+QijXHssc=",
      "txInfoLegacy": {
        "frequency": 868300000,
        "power": 14,
        "timing": "IMMEDIATELY",
        "context": "cSXvAQ==",
        "loraModulationInfo": {
          "bandwidth": 125000,
          "spreadingFactor": 11,
          "codeRateLegacy": "4/5",
          "polarizationInversion": false
        },
        "delayTimingInfo": {
        }
      },
      "txInfo": {
        "frequency": 868300000,
        "power": 14,
        "modulation": {
          "lora": {
            "bandwidth": 125000,
            "spreadingFactor": 11,
            "codeRate": "CR_4_5",
            "polarizationInversion": false
          }
        },
        "timing": {
          "delay": {

          }
        },
        "context": "cSXvAQ=="
      }
    }
  ],
  "gatewayIdLegacy": "GhhKqrAPVRM=",
  "gatewayId": "3cee594eb5913c33"
}

But packet-forwarder (based on semtech) gives error:


Wed Sep 28 13:00:51 2022 daemon.info lora_pkt_fwd[7794]: JSON down: {"txpk":{"imme":false,"rfch":0,"powe":14,"ant":0,"brd":0,"tmst":1898311425,"freq":868.3,"modu":"LORA","datr":"SF11BW125","codr":"4/5","ipol":false,"size":17,"data":"IE2wr1E0F7ZoLy+QijXHssc="}}
Wed Sep 28 13:00:51 2022 daemon.info lora_pkt_fwd[7794]: src/jitqueue.c:243:jit_enqueue(): ERROR: Packet REJECTED, timestamp seems wrong, too much in advance (current=2765814865, packet=1898311425, type=0)
Wed Sep 28 13:00:51 2022 daemon.info lora_pkt_fwd[7794]: ERROR: Packet REJECTED (jit error=2)
Wed Sep 28 13:00:52 2022 daemon.info lora_pkt_fwd[7794]: INFO: [down] PULL_RESP received  - token[33:171] :)
Wed Sep 28 13:00:52 2022 daemon.info lora_pkt_fwd[7794]:

How to fix it?