chirpstack-tutorial/doc/global_conf.md

8.8 KiB

General Configuration

References

Naming Convention

This document uses 0-indexing to identify the US915 subbands. There are eight subbands and they are named in this document as subband_0, subband_1, ..., subband_7.

Chirpstack uses zero indexing in the configuration file name for each subband. For example, the configuration file for subband_0 is /etc/chirpstack/region_us915_0.toml.

Other sources use 1-indexing to identify subbands. The baranidesign reference, above, as well as Helium and The Things Network identify the US bands as subband_1, subband_2, ..., subband_8.

Set the Subband

Restart the computer after making changes to Chirpstack and the packet forwarder. If changes are made to the packet forwarder, the computer may need to be powered off in order to reset the packet forwarder.

Packet Forwarder

The RAK Wireless packet forwarder files are in /opt/ttn-gateway/packet_forwarder/lora_pkt_fwd. By default, the frequency subband is set in global_conf.json. An example global configuration file follows.

{
    "SX130x_conf": {
        "com_type": "SPI",
        "com_path": "/dev/spidev0.0",
        "lorawan_public": true,
        "clksrc": 0,
        "antenna_gain": 0, /* antenna gain, in dBi */
        "full_duplex": false,
        "fine_timestamp": {
            "enable": false,
            "mode": "all_sf" /* high_capacity or all_sf */
        },
        "radio_0": {
            "enable": true,
            "type": "SX1250",
            "freq": 909100000,
            "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": 909800000,
            "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},  /* Freq : 908.7 MHz*/
        "chan_multiSF_1": {"enable": true, "radio": 0, "if": -200000},  /* Freq : 908.9 MHz*/
        "chan_multiSF_2": {"enable": true, "radio": 0, "if":  0},       /* Freq : 909.1 MHz*/
        "chan_multiSF_3": {"enable": true, "radio": 0, "if":  200000},  /* Freq : 909.3 MHz*/
        "chan_multiSF_4": {"enable": true, "radio": 1, "if": -300000},  /* Freq : 909.5 MHz*/
        "chan_multiSF_5": {"enable": true, "radio": 1, "if": -100000},  /* Freq : 909.7 MHz*/
        "chan_multiSF_6": {"enable": true, "radio": 1, "if":  100000},  /* Freq : 909.9 MHz*/
        "chan_multiSF_7": {"enable": true, "radio": 1, "if":  300000},  /* Freq : 910.1 MHz*/
        "chan_Lora_std":  {"enable": true, "radio": 0, "if":  300000, "bandwidth": 500000, "spread_factor": 8,                                          /* Freq : 909.4 MHz*/
                           "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}                                          /* Freq : 910.1 MHz*/
    },

    "gateway_conf": {
        "gateway_ID": "AA555A0000000000",
        /* change with default server address/ports */
        "server_address": "localhost",
        "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 configuration */
        "gps_tty_path": "/dev/ttyAMA0",
        /* GPS reference coordinates */
        "ref_latitude": 0.0,
        "ref_longitude": 0.0,
        "ref_altitude": 0,
        /* Beaconing parameters */
        "beacon_period": 0,     /* disable class B beacon, set to 128 enable beacon */
        "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": "loragw_hal.log"
    }
}

Note that the settings for 125 kHz channels, chan_multiSF_0 - chan_multiSF_7, show frequency offsets from the radio_0 and radio_1 freq values. Specifically, chan_multiSF_0 through chan_multiSF_3 use offsets from the radio_0 freq and chan_multiSF_4 through multiSF_7 use offsets from the radio_1 freq. The 500 kHz channel, chan_Lora_std, uses an offset from the radio_0 freq. One method for setting the subband is to keep the offsets as shown and change the radio_0 and radio_1 freq values to match the desired subband.

Example 1. Set the frequencies for US915 subband_1

The eight required frequencies are 903.1, 903.3, 903.5, ..., 905.3 kHz. This is the subband used by Helium and The Things Network.

  • Set the radio_0 freq to 904300000. The frequency for chan_multiSF_0 is:
904300000 - 400000 = 903900000 \ \ (903.9 kHz)

Likewise, the frequency for chan_multiSF_3 is

904300000 + 200000 = 904500000 \ \ (904.5 kHz)

The 500 kHz bandwidth frequency is

904300000 + 300000 = 904600000 \ \ (904.6 kHz)
  • Set the radio_1 freq to 905000000. The frequency for chan_multiSF_4 is
905000000 - 300000 = 904700000 \ \ (904.7 kHz)

The frequency for chan_multiSF_6 is

905000000 + 1000000 = 905100000 \ \ (905.1 kHz)

Example 2. Set the frequencies for US915 subband_4

The eight required frequencies for subband_4 are 908.7, 908.9, 909.1, ..., 910.1 kHz.

  • Set the radio_0 freq to 909100000. The frequency for chan_multiSF_1 is
909100000 - 200000 = 908900000 \ \ (908.8 kHz)

The frequency for chan_multiSF_2 is

909100000 + 0 = 909100000 \ \ (909.1 kHz)

The 500 kHz bandwidth frequency is

909100000 + 300000 = 909400000 \ \ (909.4 kHz)
  • Set the radio_1 freq to 909800000. The frequency for chan_multiSF_5 is
909800000 - 100000 = 909700000 \ \ (909.7 kHz)

and the frequency for chan_multiSF_7 is

909800000 + 300000 = 910100000 \ \ (910.1 kHz)

Chirpstack

Gateway Bridge Configuration

The Chirpstack gateway bridge configuration file is /etc/chirpstack-gateway-bridge/chirpstack-gateway-bridge.toml. In the [integration.mqtt] section of this file, change the event_topic_template and the command_topic_template names to match the desired subband. For example, if subband_4 is used, the mqtt integration section should be:

  # MQTT integration configuration.
  [integration.mqtt]
  # Event topic template.
  event_topic_template="us915_4/gateway/{{ .GatewayID }}/event/{{ .EventType }}"

  # Command topic template.
  command_topic_template="us915_4/gateway/{{ .GatewayID }}/command/#"

Device Profile

Use the Chirpstack web interface to configure the Device Profile region.

Device Profile

Use the Region configuration dropdown box to select the subband_4 channels. The channels can be cross referenced to frequencies using the link shown in the references, above. After making the selection, click on "Submit" button to save the entry.