chirpstack / chirpstack-concentratord

Concentrator HAL daemon for LoRa gateways.
https://www.chirpstack.io/
MIT License
76 stars 56 forks source link

Model seeed_wm1302 doesn't work #176

Closed JackThird closed 3 weeks ago

JackThird commented 3 months ago

What happened?

I used UDP packet forwarder to communicate with lora gateway model seeed_wm1302 and it works fine. I used this fork: https://github.com/peterpanstechland/sx1302_hal.git

Now I'm trying to use Chirpstack concentratord and it failed to start, this is the log:

2024-07-24T08:33:45.439Z INFO  [libconcentratord::reset] Configuring sx1302 power enable pin, dev: /dev/gpiochip0, pin: 18
2024-07-24T08:33:45.439Z INFO  [libconcentratord::reset] Configuring sx1261 reset pin, dev: /dev/gpiochip0, pin: 5
2024-07-24T08:33:45.440Z INFO  [chirpstack_concentratord_sx1302::cmd::root] Starting Concentratord SX1302 (version: 4.4.1, docs: https://www.chirpstack.io/docs/chirpstack-concentratord/)
2024-07-24T08:33:45.440Z INFO  [libconcentratord::reset] Enabling concentrator power
2024-07-24T08:33:45.540Z INFO  [libconcentratord::reset] Triggering sx130x reset
2024-07-24T08:33:45.740Z INFO  [libconcentratord::reset] Triggering sx1261 reset
2024-07-24T08:33:45.941Z INFO  [chirpstack_concentratord_sx1302::concentrator] Setting i2c device path, path: /dev/i2c-1
2024-07-24T08:33:45.941Z INFO  [chirpstack_concentratord_sx1302::concentrator] Setting i2c temperature sensor address, address: 57
2024-07-24T08:33:45.941Z INFO  [chirpstack_concentratord_sx1302::concentrator] Setting board configuration, lorawan_public: true, clock_source: 0, com_type: Spi, com_path: /dev/spidev0.0
2024-07-24T08:33:45.942Z INFO  [chirpstack_concentratord_sx1302::concentrator] Setting up fine timestamp, enable: false
2024-07-24T08:33:45.942Z DEBUG [chirpstack_concentratord_sx1302::concentrator] Configuration TX gain for radio, radio: 0, rf_power: 12, dig_gain: 0, pa_gain: 0, dac_gain: 0, mix_gain: 5, offset_i: 0, offset_q: 0, pwr_idx: 15
2024-07-24T08:33:45.942Z DEBUG [chirpstack_concentratord_sx1302::concentrator] Configuration TX gain for radio, radio: 0, rf_power: 13, dig_gain: 0, pa_gain: 0, dac_gain: 0, mix_gain: 5, offset_i: 0, offset_q: 0, pwr_idx: 16
2024-07-24T08:33:45.942Z DEBUG [chirpstack_concentratord_sx1302::concentrator] Configuration TX gain for radio, radio: 0, rf_power: 14, dig_gain: 0, pa_gain: 0, dac_gain: 0, mix_gain: 5, offset_i: 0, offset_q: 0, pwr_idx: 17
2024-07-24T08:33:45.943Z DEBUG [chirpstack_concentratord_sx1302::concentrator] Configuration TX gain for radio, radio: 0, rf_power: 15, dig_gain: 0, pa_gain: 0, dac_gain: 0, mix_gain: 5, offset_i: 0, offset_q: 0, pwr_idx: 19
2024-07-24T08:33:45.943Z DEBUG [chirpstack_concentratord_sx1302::concentrator] Configuration TX gain for radio, radio: 0, rf_power: 16, dig_gain: 0, pa_gain: 0, dac_gain: 0, mix_gain: 5, offset_i: 0, offset_q: 0, pwr_idx: 20
2024-07-24T08:33:45.943Z DEBUG [chirpstack_concentratord_sx1302::concentrator] Configuration TX gain for radio, radio: 0, rf_power: 17, dig_gain: 0, pa_gain: 0, dac_gain: 0, mix_gain: 5, offset_i: 0, offset_q: 0, pwr_idx: 22
2024-07-24T08:33:45.944Z DEBUG [chirpstack_concentratord_sx1302::concentrator] Configuration TX gain for radio, radio: 0, rf_power: 18, dig_gain: 0, pa_gain: 1, dac_gain: 0, mix_gain: 5, offset_i: 0, offset_q: 0, pwr_idx: 1
2024-07-24T08:33:45.944Z DEBUG [chirpstack_concentratord_sx1302::concentrator] Configuration TX gain for radio, radio: 0, rf_power: 19, dig_gain: 0, pa_gain: 1, dac_gain: 0, mix_gain: 5, offset_i: 0, offset_q: 0, pwr_idx: 2
2024-07-24T08:33:45.944Z DEBUG [chirpstack_concentratord_sx1302::concentrator] Configuration TX gain for radio, radio: 0, rf_power: 20, dig_gain: 0, pa_gain: 1, dac_gain: 0, mix_gain: 5, offset_i: 0, offset_q: 0, pwr_idx: 3
2024-07-24T08:33:45.944Z DEBUG [chirpstack_concentratord_sx1302::concentrator] Configuration TX gain for radio, radio: 0, rf_power: 21, dig_gain: 0, pa_gain: 1, dac_gain: 0, mix_gain: 5, offset_i: 0, offset_q: 0, pwr_idx: 4
2024-07-24T08:33:45.945Z DEBUG [chirpstack_concentratord_sx1302::concentrator] Configuration TX gain for radio, radio: 0, rf_power: 22, dig_gain: 0, pa_gain: 1, dac_gain: 0, mix_gain: 5, offset_i: 0, offset_q: 0, pwr_idx: 5
2024-07-24T08:33:45.945Z DEBUG [chirpstack_concentratord_sx1302::concentrator] Configuration TX gain for radio, radio: 0, rf_power: 23, dig_gain: 0, pa_gain: 1, dac_gain: 0, mix_gain: 5, offset_i: 0, offset_q: 0, pwr_idx: 6
2024-07-24T08:33:45.945Z DEBUG [chirpstack_concentratord_sx1302::concentrator] Configuration TX gain for radio, radio: 0, rf_power: 24, dig_gain: 0, pa_gain: 1, dac_gain: 0, mix_gain: 5, offset_i: 0, offset_q: 0, pwr_idx: 7
2024-07-24T08:33:45.946Z DEBUG [chirpstack_concentratord_sx1302::concentrator] Configuration TX gain for radio, radio: 0, rf_power: 25, dig_gain: 0, pa_gain: 1, dac_gain: 0, mix_gain: 5, offset_i: 0, offset_q: 0, pwr_idx: 9
2024-07-24T08:33:45.946Z DEBUG [chirpstack_concentratord_sx1302::concentrator] Configuration TX gain for radio, radio: 0, rf_power: 26, dig_gain: 0, pa_gain: 1, dac_gain: 0, mix_gain: 5, offset_i: 0, offset_q: 0, pwr_idx: 11
2024-07-24T08:33:45.946Z DEBUG [chirpstack_concentratord_sx1302::concentrator] Configuration TX gain for radio, radio: 0, rf_power: 27, dig_gain: 0, pa_gain: 1, dac_gain: 0, mix_gain: 5, offset_i: 0, offset_q: 0, pwr_idx: 14
2024-07-24T08:33:45.947Z INFO  [chirpstack_concentratord_sx1302::concentrator] Setting up concentrator channels
2024-07-24T08:33:45.947Z INFO  [chirpstack_concentratord_sx1302::concentrator] Configuring radio, radio: 0, enabled: true, center_freq: 867500000, type: SX1250
2024-07-24T08:33:45.947Z INFO  [chirpstack_concentratord_sx1302::concentrator] Configuring radio, radio: 1, enabled: true, center_freq: 868500000, type: SX1250
2024-07-24T08:33:45.947Z INFO  [chirpstack_concentratord_sx1302::concentrator] Setting up concentrator channels
2024-07-24T08:33:45.947Z INFO  [chirpstack_concentratord_sx1302::concentrator] Configuring multi-SF LoRa channel, channel: 0, enabled: true, freq: 868100000, rf_chain: 1, if_freq: -400000
2024-07-24T08:33:45.948Z INFO  [chirpstack_concentratord_sx1302::concentrator] Configuring multi-SF LoRa channel, channel: 1, enabled: true, freq: 868300000, rf_chain: 1, if_freq: -200000
2024-07-24T08:33:45.948Z INFO  [chirpstack_concentratord_sx1302::concentrator] Configuring multi-SF LoRa channel, channel: 2, enabled: true, freq: 868500000, rf_chain: 1, if_freq: 0
2024-07-24T08:33:45.948Z INFO  [chirpstack_concentratord_sx1302::concentrator] Configuring multi-SF LoRa channel, channel: 3, enabled: true, freq: 867100000, rf_chain: 0, if_freq: -400000
2024-07-24T08:33:45.948Z INFO  [chirpstack_concentratord_sx1302::concentrator] Configuring multi-SF LoRa channel, channel: 4, enabled: true, freq: 867300000, rf_chain: 0, if_freq: -200000
2024-07-24T08:33:45.948Z INFO  [chirpstack_concentratord_sx1302::concentrator] Configuring multi-SF LoRa channel, channel: 5, enabled: true, freq: 867500000, rf_chain: 0, if_freq: 0
2024-07-24T08:33:45.948Z INFO  [chirpstack_concentratord_sx1302::concentrator] Configuring multi-SF LoRa channel, channel: 6, enabled: true, freq: 867700000, rf_chain: 0, if_freq: 200000
2024-07-24T08:33:45.949Z INFO  [chirpstack_concentratord_sx1302::concentrator] Configuring multi-SF LoRa channel, channel: 7, enabled: true, freq: 867900000, rf_chain: 0, if_freq: 400000
2024-07-24T08:33:45.949Z INFO  [chirpstack_concentratord_sx1302::concentrator] Configuring Std LoRa channel, enabled: true, freq: 868300000, rf_chain: 1, if_freq: -200000
2024-07-24T08:33:45.949Z INFO  [chirpstack_concentratord_sx1302::concentrator] Configuring FSK channel, enabled: true, freq: 868800000, rf_chain: 1, if_freq: 300000
2024-07-24T08:33:45.949Z INFO  [chirpstack_concentratord_sx1302::concentrator] Starting the concentrator
Opening SPI communication interface
thread 'main' panicked at chirpstack-concentratord-sx1302/src/main.rs:117:80:
called `Result::unwrap()` on an `Err` value: lgw_start failed

Stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
stack backtrace:
   0:           0x65e958 - <unknown>
   1:           0x6a56b4 - <unknown>
   2:           0x65b924 - <unknown>
   3:           0x65e764 - <unknown>
   4:           0x65fe34 - <unknown>
   5:           0x65fad4 - <unknown>
   6:           0x660350 - <unknown>
   7:           0x6600f0 - <unknown>
   8:           0x65ee1c - <unknown>
   9:           0x65fe88 - <unknown>
  10:           0x40d1ac - <unknown>
  11:           0x40d4ec - <unknown>
  12:           0x45f6a8 - <unknown>
  13:           0x46edfc - <unknown>
  14:           0x459af0 - <unknown>
  15:           0x65573c - <unknown>
  16:           0x460524 - <unknown>
Note: chip version is 0x00 (v0.0)
ERROR: Failed to set SX1250_0 in STANDBY_RC mode
ERROR: failed to setup radio 0

What did you expect?

I expect that concentratord starts and read messages received on lora gateway.

Steps to reproduce this issue

Steps:

  1. Download last chirpstack concentratord from github
  2. decompress package
  3. create concentratord.toml config file:

    
    [concentratord]
    # Log level.
    #
    # Valid options are:
    #   * TRACE
    #   * DEBUG
    #   * INFO
    #   * WARN
    #   * ERROR
    #   * OFF
    #log_level="INFO"
    log_level="TRACE"
    
    # Log to syslog.
    #
    # When set to true, log messages are being written to syslog instead of stdout.
    log_to_syslog=false
    
    # Statistics interval.
    stats_interval="30s"
    
    # Disable CRC status filter.
    #
    # By default, the Concentratord will ignore received frames which do not have
    # a valid CRC. This option makes it possible to disable this filter such that
    # received frames without (valid) CRC can be analyzed.
    disable_crc_filter=false
    
    # Configuration for the (ZeroMQ based) API.
    [concentratord.api]
    # Event PUB socket bind.
    event_bind="ipc:///tmp/concentratord_event"
    
    # Command REP socket bind.
    command_bind="ipc:///tmp/concentratord_command"

LoRa gateway configuration.

[gateway]

Antenna gain (dB).

antenna_gain=0

Public LoRaWAN network.

lorawan_public=true

Region.

#

The region of the gateway. Options:

EU868, US915, CN779, EU433, AU915, CN470, AS923, AS923_2, AS923_3, AS923_4,

KR923, IN865, RU864

#

Not not all the gateway models implement all regions.

region="EU868"

Gateway vendor / model.

#

This configures various vendor and model specific settings.

model="seeed_wm1302"

Gateway vendor / model flags.

#

Flag can be used to configure additional vendor / model features. The

following flags can be used:

#

Global flags:

GNSS - Enable GNSS / GPS support

USB - Use USB for concentrator communication (default is SPI)

model_flags=[]

Time fallback.

#

In case the gateway does not have a GNSS module or is unable to aquire a

GNSS fix, use the system-time for setting the 'time' field on RX.

time_fallback_enabled=true

LoRa concentrator configuration.

[gateway.concentrator]

# Multi spreading-factor channels (LoRa).
multi_sf_channels=[
  868100000,
  868300000,
  868500000,
  867100000,
  867300000,
  867500000,
  867700000,
  867900000,
]

# LoRa std channel (single spreading-factor).
[gateway.concentrator.lora_std]
  frequency=868300000
  bandwidth=250000
  spreading_factor=7

# FSK channel.
[gateway.concentrator.fsk]
  frequency=868800000
  bandwidth=125000
  datarate=50000

Static gateway location.

[gateway.location]

# When set to non-zero values, the static gateway location will be reported
# when the gateway does not have a GNSS module or when no GNSS location fix
# is available.
latitude=0.0
longitude=0.0
altitude=0

4. start concentratord via cli:
```RUST_BACKTRACE=full ./chirpstack-concentratord-sx1302 -c concentratord.toml```

## Could you share your log output?
already shared

## Your Environment

Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm

lora gateway: WM1302 
region: EU868

I attach UDP packet forwarder sx1302_hal working config files (udp_packet_forwarder_configs.zip)
[udp_packet_forwarder_configs.zip](https://github.com/user-attachments/files/16359604/udp_packet_forwarder_configs.zip)
brocaar commented 2 months ago

Could you try to reproduce the issue using the ChirpStack Gateway OS? If that doesn't work, then it is a lot easier for me to reproduce as I can reproduce the exact environment at my side. Please see: https://www.chirpstack.io/docs/chirpstack-gateway-os/install/raspberry-pi.html