Configure ChirpStack with US915

Hello everyone!
I’ve always used the whole system with EU868 with no problems.
Now, I’m going move the whole project also on US915 and I’m not able to configure the system, since I receive only very few packets or none.

I’m aware that there are 64 + 8 channels for Uplink and 8 channels for Downlink (uplinkCh % 8)

Firstly, on End-Device side (firmware):
I use I-CUBE-LRWAN and I noted that for US915 the max number of channels set is 72. As I use RAK7243 as gateway which supports 8 channels, I think I have to reduce the number of channels in the End-Device (am I right??).
So I took a look at the channel configuration C code:

// Channels
// 125 kHz channels
for( uint8_t i = 0; i < US915_MAX_NB_CHANNELS - 8; i++ )
{
    NvmCtx.Channels[i].Frequency = 902300000 + i * 200000;
    NvmCtx.Channels[i].DrRange.Value = ( DR_3 << 4 ) | DR_0;
    NvmCtx.Channels[i].Band = 0;
}
// 500 kHz channels
for( uint8_t i = US915_MAX_NB_CHANNELS - 8; i < US915_MAX_NB_CHANNELS; i++ )
{
    NvmCtx.Channels[i].Frequency = 903000000 + ( i - ( US915_MAX_NB_CHANNELS - 8 ) ) * 1600000;
    NvmCtx.Channels[i].DrRange.Value = ( DR_4 << 4 ) | DR_4;
    NvmCtx.Channels[i].Band = 0;
}

As you can see, If I want to use the first 8 channels (0 - 7) I need to set define US915_MAX_NB_CHANNELS to 16, because in this way, the code configures the first 8 (125 kHz) channels and the 8 (500 kHz) ones. Is it the right procedure??

Secondly, on Gateway side:
in the /etc/chirpstack-network-server/chirpstack-network-server.toml I edited:

# LoRaWAN regional band configuration.
#
# Note that you might want to consult the LoRaWAN Regional Parameters
# specification for valid values that apply to your region.
# See: https://www.lora-alliance.org/lorawan-for-developers
[network_server.band]
name="US_902_928"

# LoRaWAN network related settings.
[network_server.network_settings]
enabled_uplink_channels=[0,1,2,3,4,5,6,7]
# Disable ADR
#
# When set, this globally disables ADR.
disable_adr=true

and in the web GUI of ChirpStack Application Server I set:

  • In gateway profile: enabled channels 0, 1, 2, 3, 4, 5, 6, 7
  • In device profile (JOIN APB): rx delay 0, rx data-rate offset 0, rx2 data-rate 0, rx2 channel frequencies 0, factory-preset frequencies 902300000, 902500000, 902700000, 902900000, 903100000, 903300000, 903500000, 903700000 (which are the first 8 channels (125 kHz) configured on the device firmware.

With this configuration, I’m not able to receive any message.
Please help me understanding where I’m wrong and sorry if I made some obvious mistakes or misunderstanding.

Thank you all.

No, you are not.
you are confusing the simultaneous number of processed channels and the regional regulation of the allowed frequency channels

1 Like

If this will help, here are my configs for US915. You might find this useful as a starting point.

chirpstack-application-server.toml:

# This configuration sets the required settings and configures an integration
# with a MQTT broker. Many options and defaults have been omitted for
# simplicity.
#
# See https://www.chirpstack.io/application-server/install/config/ for a full
# configuration example and documentation.


# PostgreSQL settings.
#
# Please note that PostgreSQL 9.5+ is required.
[postgresql]
# PostgreSQL dsn (e.g.: postgres://user:password@hostname/database?sslmode=disable).
#
# Besides using an URL (e.g. 'postgres://user:password@hostname/database?sslmode=disable')
# it is also possible to use the following format:
# 'user=chirpstack_as dbname=chirpstack_as sslmode=disable'.
#
# The following connection parameters are supported:
#
# * dbname - The name of the database to connect to
# * user - The user to sign in as
# * password - The user's password
# * host - The host to connect to. Values that start with / are for unix domain sockets. (default is localhost)
# * port - The port to bind to. (default is 5432)
# * sslmode - Whether or not to use SSL (default is require, this is not the default for libpq)
# * fallback_application_name - An application_name to fall back to if one isn't provided.
# * connect_timeout - Maximum wait for connection, in seconds. Zero or not specified means wait indefinitely.
# * sslcert - Cert file location. The file must contain PEM encoded data.
# * sslkey - Key file location. The file must contain PEM encoded data.
# * sslrootcert - The location of the root certificate file. The file must contain PEM encoded data.
#
# Valid values for sslmode are:
#
# * disable - No SSL
# * require - Always SSL (skip verification)
# * verify-ca - Always SSL (verify that the certificate presented by the server was signed by a trusted CA)
# * verify-full - Always SSL (verify that the certification presented by the server was signed by a trusted CA and the server host name matches the one in the certificate)
# dsn="postgres://localhost/chirpstack_as?sslmode=disable"
dsn="postgres://chirpstack_as:dbpassword@127.0.0.1/chirpstack_as?sslmode=disable"


# Redis settings
#
# Please note that Redis 2.6.0+ is required.
[redis]
# Redis url (e.g. redis://user:password@hostname/0)
#
# For more information about the Redis URL format, see:
# https://www.iana.org/assignments/uri-schemes/prov/redis
url="redis://127.0.0.1:6379"

# Application-server settings.
[application_server]

  # Application-server identifier.
  #
  # Random UUID defining the id of the application-server installation (used by
  # ChirpStack Network Server as routing-profile id).
  # For now it is recommended to not change this id.
  #id="6d5db27e-4ce2-4b2b-b5d7-91f069397978"

  # Integration configures the data integration.
  #
  # This is the data integration which is available for all applications,
  # besides the extra integrations that can be added on a per-application
  # basis.

  [application_server.integration]
  # Payload marshaler.
  #
  # This defines how the MQTT payloads are encoded. Valid options are:
  # * protobuf:  Protobuf encoding
  # * json:      JSON encoding (easier for debugging, but less compact than 'protobuf')
  # * json_v3:   v3 JSON (will be removed in the next major release)
  marshaler="json_v3"

  # Enabled integrations.
  enabled=["mqtt"]

    # MQTT integration backend.
    [application_server.integration.mqtt]
    # Event topic template.
    event_topic_template="application/{{ .ApplicationID }}/device/{{ .DevEUI }}/event/{{ .EventType }}"

    # Command topic template.
    command_topic_template="application/{{ .ApplicationID }}/device/{{ .DevEUI }}/command/{{ .CommandType }}"

    # Retain events.
    #
    # The MQTT broker will store the last publised message, when retain events is set
    # to true. When a MQTT client connects and subscribes, it will always receive the
    # last published message.
    # retain_events=false


    # MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
    server="tcp://127.0.0.1:1883"

    # Connect with the given username (optional)
    username=""

    # Connect with the given password (optional)
    password=""


    # Settings for the "internal api"
    #
    # This is the API used by ChirpStack Network Server to communicate with ChirpStack Application Server
    # and should not be exposed to the end-user.
    [application_server.api]
    # ip:port to bind the api server
    bind="0.0.0.0:8001"

    # Public ip:port of the application-server API.
    #
    # This is used by ChirpStack Network Server to connect to ChirpStack Application Server. When running
    # ChirpStack Application Server on a different host than ChirpStack Network Server, make sure to set
    # this to the host:ip on which ChirpStack Network Server can reach ChirpStack Application Server.
    # The port must be equal to the port configured by the 'bind' flag
    # above.
    public_host="127.0.0.1:8001"


    # Settings for the "external api"
    #
    # This is the API and web-interface exposed to the end-user.
    [application_server.external_api]
    # ip:port to bind the (user facing) http server to (web-interface and REST / gRPC api)
    bind="0.0.0.0:8080"

    # http server TLS certificate (optional)
    tls_cert=""

    # http server TLS key (optional)
    tls_key=""

    # JWT secret used for api authentication / authorization
    # You could generate this by executing 'openssl rand -base64 32' for example
    jwt_secret="somethingsecret"


# Join-server configuration.
#
# ChirpStack Application Server implements a (subset) of the join-api specified by the
# LoRaWAN Backend Interfaces specification. This API is used by ChirpStack Network Server
# to handle join-requests.
[join_server]
# ip:port to bind the join-server api interface to
bind="0.0.0.0:8003"

chirpstack-network-server.toml:

# This configuration configures ChirpStack Network Server for the US915 band using a MQTT
# broker to communicate with the gateways. Many options and defaults have been
# omitted for simplicity.
#
# See https://www.chirpstack.io/network-server/install/config/ for a full
# configuration example and documentation.


# PostgreSQL settings.
#
# Please note that PostgreSQL 9.5+ is required.
[postgresql]
# PostgreSQL dsn (e.g.: postgres://user:password@hostname/database?sslmode=disable).
#
# Besides using an URL (e.g. 'postgres://user:password@hostname/database?sslmode=disable')
# it is also possible to use the following format:
# 'user=chirpstack_ns dbname=chirpstack_ns sslmode=disable'.
#
# The following connection parameters are supported:
#
# * dbname - The name of the database to connect to
# * user - The user to sign in as
# * password - The user's password
# * host - The host to connect to. Values that start with / are for unix domain sockets. (default is localhost)
# * port - The port to bind to. (default is 5432)
# * sslmode - Whether or not to use SSL (default is require, this is not the default for libpq)
# * fallback_application_name - An application_name to fall back to if one isn't provided.
# * connect_timeout - Maximum wait for connection, in seconds. Zero or not specified means wait indefinitely.
# * sslcert - Cert file location. The file must contain PEM encoded data.
# * sslkey - Key file location. The file must contain PEM encoded data.
# * sslrootcert - The location of the root certificate file. The file must contain PEM encoded data.
#
# Valid values for sslmode are:
#
# * disable - No SSL
# * require - Always SSL (skip verification)
# * verify-ca - Always SSL (verify that the certificate presented by the server was signed by a trusted CA)
# * verify-full - Always SSL (verify that the certification presented by the server was signed by a trusted CA and the server host name matches the one in the certificate)
dsn="postgres://chirpstack_ns:dbpassword@127.0.0.1/chirpstack_ns?sslmode=disable"


# Redis settings
#
# Please note that Redis 2.6.0+ is required.
[redis]
# Redis url (e.g. redis://user:password@hostname/0)
#
# For more information about the Redis URL format, see:
# https://www.iana.org/assignments/uri-schemes/prov/redis
url="redis://127.0.0.1:6379"


# Network-server settings.
[network_server]
# Network identifier (NetID, 3 bytes) encoded as HEX (e.g. 010203)
net_id="000000"


  # LoRaWAN regional band configuration.
  #
  # Note that you might want to consult the LoRaWAN Regional Parameters
  # specification for valid values that apply to your region.
  # See: https://www.lora-alliance.org/lorawan-for-developers
  [network_server.band]
  name="US_902_928"


  # LoRaWAN network related settings.
  [network_server.network_settings]
  enabled_uplink_channels=[8,9,10,11,12,13,14,15]
  # Disable ADR
  #
  # When set, this globally disables ADR.
  disable_adr=true
  
    # Extra channel configuration.
    #

    # Class B settings
    [network_server.network_settings.class_b]
    # Ping-slot data-rate.
    ping_slot_dr=0

    # Ping-slot frequency (Hz)
    #
    # Set this to 0 to use the default frequency plan for the configured region
    # (which could be frequency hopping).
    ping_slot_frequency=0


  # Network-server API
  #
  # This is the network-server API that is used by ChirpStack Application Server or other
  # custom components interacting with ChirpStack Network Server.
  [network_server.api]
  # ip:port to bind the api server
  bind="0.0.0.0:8000"


  # Backend defines the gateway backend settings.
  #
  # The gateway backend handles the communication with the gateway(s) part of
  # the LoRaWAN network.
  [network_server.gateway.backend]
  # Backend
  type="mqtt"


    # MQTT gateway backend settings.
    #
    # This is the backend communicating with the LoRa gateways over a MQTT broker.
    [network_server.gateway.backend.mqtt]
    # MQTT topic templates for the different MQTT topics.
    #
    # The meaning of these topics are documented at:
    # https://www.chirpstack.io/gateway-bridge/
    #
    # The default values match the default expected configuration of the
    # ChirpStack Gateway Bridge MQTT backend. Therefore only change these values when
    # absolutely needed.

    # Event topic template.
    event_topic="gateway/+/event/+"

    # Command topic template.
    #
    # Use:
    #   * "{{ .GatewayID }}" as an substitution for the LoRa gateway ID
    #   * "{{ .CommandType }}" as an substitution for the command type
    command_topic_template="gateway/{{ .GatewayID }}/command/{{ .CommandType }}"

    # MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
    server="tcp://127.0.0.1:1883"

    # Connect with the given username (optional)
    username=""

    # Connect with the given password (optional)
    password=""


# Metrics collection settings.
[metrics]
# Timezone
#
# The timezone is used for correctly aggregating the metrics (e.g. per hour,
# day or month).
# Example: "Europe/Amsterdam" or "Local" for the the system's local time zone.
timezone="Local"


# Join-server settings.
[join_server]

  # Default join-server settings.
  #
  # This join-server will be used when resolving the JoinEUI is set to false
  # or as a fallback when resolving the JoinEUI fails.
  [join_server.default]
  # hostname:port of the default join-server
  #
  # This API is provided by ChirpStack Application Server.
  server="http://127.0.0.1:8003"

chirpstack-gateway-bridge.toml:

# This configuration provides a Semtech UDP packet-forwarder backend and
# integrates with a MQTT broker. Many options and defaults have been omitted
# for simplicity.
#
# See https://www.chirpstack.io/gateway-bridge/install/config/ for a full
# configuration example and documentation.


# Gateway backend configuration.
[backend]
# Backend type.
type="semtech_udp"

  # Semtech UDP packet-forwarder backend.
  [backend.semtech_udp]

  # ip:port to bind the UDP listener to
  #
  # Example: 0.0.0.0:1700 to listen on port 1700 for all network interfaces.
  # This is the listener to which the packet-forwarder forwards its data
  # so make sure the 'serv_port_up' and 'serv_port_down' from your
  # packet-forwarder matches this port.
  udp_bind = "0.0.0.0:1700"


# Integration configuration.
[integration]
# Payload marshaler.
#
# This defines how the MQTT payloads are encoded. Valid options are:
# * protobuf:  Protobuf encoding
# * json:      JSON encoding (easier for debugging, but less compact than 'protobuf')
marshaler="protobuf"

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

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

  # MQTT authentication.
  [integration.mqtt.auth]
  # Type defines the MQTT authentication type to use.
  #
  # Set this to the name of one of the sections below.
  type="generic"

    # Generic MQTT authentication.
    [integration.mqtt.auth.generic]
    # MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
    server="tcp://127.0.0.1:1883"

    # Connect with the given username (optional)
    username=""

    # Connect with the given password (optional)
    password=""


1 Like

Thank you swagner ! I modified my configs in order to match yours as a starting point.
I think my problem is in my ChirpStack Application Server GUI coniguration.
Can I ask you to tell me what did you set as:

  • Gateway Profile (enabled channels)
  • Device Profile (Rx1 Delay, Rx1 DR offset, RX2 DR, RX2 Frequency, Factory-preset Frequecies)
    Thank you very much !

Ok thank you.
So I set US915_MAX_NB_CHANNELS to 72 (as default) in the firmware.

In this way, I receive about 20 % of the messages.
What am I missing ?

1 Like

Using LoRaWAN 1.0.3, the ChirpStack Network Server will send an OTAA join-accept message including the channel-mask containing the (in your case 8) channels used by the network. Before LoRaWAN 1.0.3, LinkADRReq mac-commands are used to synchronize the channels used by the network.

That way, there is no need to change the device to match your network config and your device will work on any network configuration (e.g. channels 0 - 7, 8 - 15, …). Note that it probably will take a few OTAA join-request attempts before the device hits a channel that is used by the network.

I should note that my devices are using LoRaWAN MAC version 1.0.2A.

Enabled channels: 8, 9, 10, 11, 12, 13, 14, 15

I made no changes to default Rx1 Delay, Rx1 DR offset, RX2 DR, RX2 Frequency, Factory-preset Frequecies settings.

Sorry @brocaar, I didn’t mention I use ABP (LoRaMAC version 1.0.2, regional parameters revision B).
In this case, how should I configure the device profile JOIN fields (Rx1 Delay, Rx1 DR offset, RX2 DR, RX2 Frequency, Factory-preset Frequecies) ? I didn’t find any mention on the Regional Parameters documentation (probably my fault).

In the Factory-preset Frequencies, is it correct to add all the 72 (64 + 8) frequencies ?

Update: if I set in the firmware to use only 8 - 15 channels, I correctly receive packets since these channels are disabled and I loose communication.

Why do I receive only 8 - 15 channels when I set in my chirpstack-network-server.toml enabled_uplink_channels=[] and in the Factory-preset Frequencies all the 72 frequencies ?

You should configure these with the same values as configured at the device-side. Basically with ABP you have to provide all this information yourself as the NS does not know the state of the device. With OTAA this is a lot easier as then the default state is known.