NebraLtd / helium-rak

Nebra OpenFleet for RAK v1.5, v2 and MNTD Miners
https://nebra.io/rak
MIT License
14 stars 14 forks source link

Concentrator reset pin on RAK v1.5 different than variant file, causing packet-forwarder crashes #21

Open danstruble opened 1 year ago

danstruble commented 1 year ago

I encountered an issue with an older RAK v1.5 where the concentrator reset pin was 17 instead of 25, which is the default specified in the variant file for COMP-RAKHM. This was causing an endless loop of packet-forwarder crashes.

Using a device variable "CONCENTRATOR_RESET_PIN_OVERRIDE" set to 17 resolved this issue. Wanted to get this out there for any others that might have older RAK v1.5 units that experience the same issue. No issues on my RAK v2s

Log of packet forwarder:

Restarting service 'packet-forwarder sha256:5c3ad980b694a4105f0a8dcfac40d0b4726d2b2de9882df12afaa927c4afa294'
<packet-forwarder> FREQ variable is already set as N/A (Non Nebra Miner).
<packet-forwarder> VARIANT variable is already set as COMP-RAKHM.
<packet-forwarder> All required environment variables have been set.
<packet-forwarder> 2023-02-09 00:50:51,396 - [DEBUG] - __main__ - (__main__.py).validate_env -- /opt/pktfwd/__main__.py:(63) - Starting with the following ENV:
<packet-forwarder>         VARIANT=COMP-RAKHM
<packet-forwarder>         REGION_OVERRIDE=False
<packet-forwarder>         REGION_FILEPATH=/var/pktfwd/region
<packet-forwarder>         SX1301_REGION_CONFIGS_DIR=/opt/pktfwd/config/lora_templates_sx1301
<packet-forwarder>         SX1302_REGION_CONFIGS_DIR=/opt/pktfwd/config/lora_templates_sx1302
<packet-forwarder>         SENTRY_DSN=False
<packet-forwarder>         BALENA_ID=3803ba4779605edd9a0c9314bfdbcf6d
<packet-forwarder>         BALENA_APP=helium-rak
<packet-forwarder>         DIAGNOSTICS_FILEPATH=/var/pktfwd/diagnostics
<packet-forwarder>         AWAIT_SYSTEM_SLEEP_SECONDS=5
<packet-forwarder>         RESET_LGW_FILEPATH=/opt/reset_lgw.sh
<packet-forwarder>         UTIL_CHIP_ID_FILEPATH=/opt/sx1302/chip_id
<packet-forwarder>         ROOT_DIR=/opt
<packet-forwarder>         SX1302_LORA_PKT_FWD_FILEPATH=/opt/sx1302/lora_pkt_fwd
<packet-forwarder>         SX1301_LORA_PKT_FWD_DIR=/opt/sx1301
<packet-forwarder> 
<packet-forwarder> 2023-02-09 00:50:51,398 - [DEBUG] - pktfwd.pktfwd_app - (pktfwd_app.py).set_variant_attributes -- /opt/pktfwd/pktfwd_app.py:(92) - Variant COMP-RAKHM set with reset_pin 25 and spi_bus spidev0.0
<packet-forwarder> 2023-02-09 00:50:51,398 - [DEBUG] - pktfwd.pktfwd_app - (pktfwd_app.py).start -- /opt/pktfwd/pktfwd_app.py:(39) - STARTING PKTFWD
<packet-forwarder> 2023-02-09 00:50:51,399 - [DEBUG] - hm_pyhelper.miner_param - (miner_param.py).await_spi_available -- /opt/pktfwd-dependencies/hm_pyhelper/miner_param.py:(340) - SPI bus spidev0.0 Configured Correctly
<packet-forwarder> 2023-02-09 00:50:51,400 - [DEBUG] - hm_pyhelper.miner_param - (miner_param.py).retry_get_region -- /opt/pktfwd-dependencies/hm_pyhelper/miner_param.py:(320) - No region override set (value = False), will retrieve from miner.
<packet-forwarder> 2023-02-09 00:50:51,401 - [DEBUG] - hm_pyhelper.miner_param - (miner_param.py).retry_get_region -- /opt/pktfwd-dependencies/hm_pyhelper/miner_param.py:(324) - Region US915 parsed from /var/pktfwd/region 
<packet-forwarder> 2023-02-09 00:50:51,401 - [DEBUG] - pktfwd.pktfwd_app - (pktfwd_app.py).prepare_to_start -- /opt/pktfwd/pktfwd_app.py:(74) - Region set to US915
<packet-forwarder> 2023-02-09 00:50:51,402 - [DEBUG] - pktfwd.utils - (utils.py).await_system_ready -- /opt/pktfwd/utils.py:(60) - Waiting 5 seconds for systems to be ready
<packet-forwarder> 2023-02-09 00:50:56,402 - [DEBUG] - pktfwd.utils - (utils.py).await_system_ready -- /opt/pktfwd/utils.py:(62) - System now ready
<packet-forwarder> 2023-02-09 00:50:56,402 - [DEBUG] - pktfwd.pktfwd_app - (pktfwd_app.py).prepare_to_start -- /opt/pktfwd/pktfwd_app.py:(77) - Finished preparing pktfwd
<packet-forwarder> 2023-02-09 00:50:58,006 - [DEBUG] - pktfwd.utils - (utils.py).is_concentrator_sx1302 -- /opt/pktfwd/utils.py:(89) - Command '['/opt/sx1302/chip_id', '-d', '/dev/spidev0.0']' returned non-zero exit status 1.
<packet-forwarder> 2023-02-09 00:50:58,007 - [DEBUG] - pktfwd.utils - (utils.py).replace_sx1301_global_conf_with_regional -- /opt/pktfwd/utils.py:(155) - Copying SX1301 global conf from /opt/pktfwd/config/lora_templates_sx1301/global_conf.json.US915 to /opt/global_conf.json
<packet-forwarder> 2023-02-09 00:50:58,010 - [DEBUG] - pktfwd.utils - (utils.py).replace_sx1301_global_conf_with_regional -- /opt/pktfwd/utils.py:(158) - Copying SX1301 local conf from /opt/pktfwd/config/lora_templates_sx1301/local_conf.json to /opt/local_conf.json
<packet-forwarder> CONCENTRATOR_RESET_PIN parameter not passed in, using value from the environment (val=25)
<packet-forwarder> CoreCell reset through GPIO25...
<packet-forwarder> CONCENTRATOR_RESET_PIN parameter not passed in, using value from the environment (val=25)
<packet-forwarder> CoreCell reset through GPIO25...
<packet-forwarder> 2023-02-09 00:50:58,766 - [DEBUG] - hm_pyhelper.miner_param - (miner_param.py).retry_get_region -- /opt/pktfwd-dependencies/hm_pyhelper/miner_param.py:(320) - No region override set (value = None), will retrieve from miner.
<packet-forwarder> 2023-02-09 00:50:58,767 - [DEBUG] - hm_pyhelper.miner_param - (miner_param.py).retry_get_region -- /opt/pktfwd-dependencies/hm_pyhelper/miner_param.py:(324) - Region US915 parsed from /var/pktfwd/region 
<packet-forwarder> 2023-02-09 00:50:58,768 - [DEBUG] - pktfwd.utils - (utils.py).retry_start_concentrator -- /opt/pktfwd/utils.py:(238) - Region before starting concentrator US915
<packet-forwarder> *** Beacon Packet Forwarder for Lora Gateway ***
<packet-forwarder> Version: 4.0.1
<packet-forwarder> *** Lora concentrator HAL library version info ***
<packet-forwarder> Version: 5.0.1;
<packet-forwarder> ***
<packet-forwarder> INFO: Little endian host
<packet-forwarder> INFO: found global configuration file global_conf.json, parsing it
<packet-forwarder> INFO: global_conf.json does contain a JSON object named SX1301_conf, parsing SX1301 parameters
<packet-forwarder> INFO: lorawan_public 1, clksrc 1
<packet-forwarder> INFO: no configuration for LBT
<packet-forwarder> INFO: antenna_gain 0 dBi
<packet-forwarder> INFO: Configuring TX LUT with 16 indexes
<packet-forwarder> INFO: radio 0 enabled (type SX1257), center frequency 904300000, RSSI offset -159.000000, tx enabled 1, tx_notch_freq 0
<packet-forwarder> INFO: radio 1 enabled (type SX1257), center frequency 905000000, RSSI offset -159.000000, tx enabled 0, tx_notch_freq 0
<packet-forwarder> INFO: Lora multi-SF channel 0>  radio 0, IF -400000 Hz, 125 kHz bw, SF 7 to 12
<packet-forwarder> INFO: Lora multi-SF channel 1>  radio 0, IF -200000 Hz, 125 kHz bw, SF 7 to 12
<packet-forwarder> INFO: Lora multi-SF channel 2>  radio 0, IF 0 Hz, 125 kHz bw, SF 7 to 12
<packet-forwarder> INFO: Lora multi-SF channel 3>  radio 0, IF 200000 Hz, 125 kHz bw, SF 7 to 12
<packet-forwarder> INFO: Lora multi-SF channel 4>  radio 1, IF -300000 Hz, 125 kHz bw, SF 7 to 12
<packet-forwarder> INFO: Lora multi-SF channel 5>  radio 1, IF -100000 Hz, 125 kHz bw, SF 7 to 12
<packet-forwarder> INFO: Lora multi-SF channel 6>  radio 1, IF 100000 Hz, 125 kHz bw, SF 7 to 12
<packet-forwarder> INFO: Lora multi-SF channel 7>  radio 1, IF 300000 Hz, 125 kHz bw, SF 7 to 12
<packet-forwarder> INFO: Lora std channel> radio 0, IF 300000 Hz, 500000 Hz bw, SF 8
<packet-forwarder> INFO: FSK channel 8 disabled
<packet-forwarder> INFO: global_conf.json does contain a JSON object named gateway_conf, parsing gateway parameters
<packet-forwarder> INFO: server hostname or IP address is configured to "multiplexer"
<packet-forwarder> INFO: upstream port is configured to "1700"
<packet-forwarder> INFO: downstream port is configured to "1700"
<packet-forwarder> INFO: downstream keep-alive interval is configured to 10 seconds
<packet-forwarder> INFO: statistics display interval is configured to 30 seconds
<packet-forwarder> INFO: upstream PUSH_DATA time-out is configured to 100 ms
<packet-forwarder> INFO: packets received with a valid CRC will be forwarded
<packet-forwarder> INFO: packets received with a CRC error will NOT be forwarded
<packet-forwarder> INFO: packets received with no CRC will NOT be forwarded
<packet-forwarder> INFO: Reference latitude is configured to 0.000000 deg
<packet-forwarder> INFO: Reference longitude is configured to 0.000000 deg
<packet-forwarder> INFO: Reference altitude is configured to 0 meters
<packet-forwarder> INFO: fake GPS is enabled
<packet-forwarder> INFO: found local configuration file local_conf.json, parsing it
<packet-forwarder> INFO: redefined parameters will overwrite global parameters
<packet-forwarder> INFO: local_conf.json does not contain a JSON object named SX1301_conf
<packet-forwarder> INFO: local_conf.json does contain a JSON object named gateway_conf, parsing gateway parameters
<packet-forwarder> INFO: gateway MAC address is configured to 0000DCA632DCA47F
<packet-forwarder> INFO: server hostname or IP address is configured to "helium-miner"
<packet-forwarder> INFO: upstream port is configured to "1680"
<packet-forwarder> INFO: downstream port is configured to "1680"
<packet-forwarder> INFO: downstream keep-alive interval is configured to 10 seconds
<packet-forwarder> INFO: statistics display interval is configured to 30 seconds
<packet-forwarder> INFO: upstream PUSH_DATA time-out is configured to 100 ms
<packet-forwarder> INFO: packets received with a valid CRC will be forwarded
<packet-forwarder> INFO: packets received with a CRC error will NOT be forwarded
<packet-forwarder> INFO: packets received with no CRC will NOT be forwarded
<packet-forwarder> INFO: Reference latitude is configured to 0.000000 deg
<packet-forwarder> INFO: Reference longitude is configured to 0.000000 deg
<packet-forwarder> INFO: Reference altitude is configured to 0 meters
<packet-forwarder> INFO: fake GPS is enabled
<packet-forwarder> ERROR: [main] failed to start the concentrator
<packet-forwarder> 2023-02-09 00:51:03,774 - [WARNING] - pktfwd.utils - (utils.py).retry_start_concentrator -- /opt/pktfwd/utils.py:(262) - lora_pkt_fwd stopped with code=1.
<packet-forwarder> 2023-02-09 00:51:03,774 - [DEBUG] - hm_pyhelper.miner_param - (miner_param.py).retry_get_region -- /opt/pktfwd-dependencies/hm_pyhelper/miner_param.py:(320) - No region override set (value = None), will retrieve from miner.
<packet-forwarder> 2023-02-09 00:51:03,775 - [DEBUG] - hm_pyhelper.miner_param - (miner_param.py).retry_get_region -- /opt/pktfwd-dependencies/hm_pyhelper/miner_param.py:(324) - Region US915 parsed from /var/pktfwd/region 
<packet-forwarder> 2023-02-09 00:51:03,776 - [WARNING] - pktfwd.pktfwd_app - (pktfwd_app.py).start -- /opt/pktfwd/pktfwd_app.py:(60) - Shutting down concentrator.
<packet-forwarder> 2023-02-09 00:51:03,777 - [DEBUG] - pktfwd.pktfwd_app - (pktfwd_app.py).stop -- /opt/pktfwd/pktfwd_app.py:(80) - STOPPING PKTFWD
<packet-forwarder> 2023-02-09 00:51:03,779 - [INFO] - __main__ - (__main__.py).start -- /opt/pktfwd/__main__.py:(106) - Stopping and cleaning up pktfwd
<packet-forwarder> 2023-02-09 00:51:03,779 - [DEBUG] - pktfwd.pktfwd_app - (pktfwd_app.py).stop -- /opt/pktfwd/pktfwd_app.py:(80) - STOPPING PKTFWD
Service exited 'packet-forwarder sha256:5c3ad980b694a4105f0a8dcfac40d0b4726d2b2de9882df12afaa927c4afa294'
shawaj commented 1 year ago

what concentrator is used on this? As far as the rak v1.5s and rak v2s we have here, they seem to all have the same reset pin. Have never seen one with a different pin.

Can you show a picture of the outside and inside of all the units?

Exohayvan commented 5 months ago

had the same issue, I'm pretty sure it's actually a v1.1 RAK (as I've been told but never looked into it) it uses pin 17 instead of the default 25.

CONCENTRATOR_RESET_PIN_OVERRIDE being set to the value of 17 fixed this for me as well. (Been trying to figure it out, but went to open an issue and my solution was in the top of an already open issue xD)