PyGate, GPy, Stopping concentrator, Unable to Connect



  • I am trying to get a PyGate plus GPy connected to TTN using WiFi. I'm following the tutorial. I have updated the config.json file for US-915 and added my TTN Gateway ID. I am using the normal MAC Id plus FFFF in the middle to make it 8 bytes.

    last part of the config.json =

    	"tx_lut_14": {
    		"desc": "TX gain table, index 14",
    		"pa_gain": 3,
    		"mix_gain": 12,
    		"rf_power": 26,
    		"dig_gain": 0
    	},
    	"tx_lut_15": {
    		"desc": "TX gain table, index 15",
    		"pa_gain": 3,
    		"mix_gain": 14,
    		"rf_power": 27,
    		"dig_gain": 0
    	}
    },
    "gateway_conf": {
    	"gateway_ID": "840d8effff120e08",
    	"server_address": "router.us.thethings.network",
    	"serv_port_up": 1700,
    	"serv_port_down": 1700,
    	"keepalive_interval": 10,
    	"stat_interval": 30,
    	"push_timeout_ms": 2000,
        "autoquit_threshold": 6,
    	"forward_crc_valid": true,
    	"forward_crc_error": false,
    	"forward_crc_disabled": false
    }
    

    }

    Right at the start I had an issue with the main.py code getting stuck at the RTC time sync, and having an infinite string of dots.

    Doesn't work ..

    # Sync time via NTP server for GW timestamps on Events
    print('Syncing RTC via ntp...', end='')
    rtc = RTC()
    rtc.ntp_sync(server="pool.ntp.org")
    

    Does work...

    # Sync time via NTP server for GW timestamps on Events
    print('Syncing RTC via ntp...', end='')
    rtc = RTC()
    rtc.ntp_sync("pool.ntp.org")
    

    The current issue is the gateway will start and then immediately stops with the message "Stopping concentrator". No connection has been made to TTN. PyBytes shows data received. The full log is:

    WMAC: 840D8E120E08
    Firmware: 1.20.2.r4
    Pybytes: 1.6.1
    Initialized watchdog for WiFi and LTE connection with timeout 1260000 ms
    WiFi connection established
    Connected to MQTT mqtt.pybytes.pycom.io
    Pybytes connected successfully (using the built-in pybytes library)
    Pybytes configuration read from /flash/pybytes_config.json
    
    Starting LoRaWAN concentrator
    Connecting to WiFi... OK
    Syncing RTC via ntp....... OK
    
    [3736321084] LORAPF_INFO_:lora_gw_init() start fh=305472 high=5252 LORA_GW_STACK_SIZE=15000
    [3736321086] LORAPF_INFO_:lora_gw_init() done fh=290468 high=5252
    Pycom MicroPython 1.20.2.r4 [v1.11-ffb0e1c] on 2021-01-12; GPy with ESP32
    Pybytes Version: 1.6.1
    Type "help()" for more information.
    >>> [3736321099] LORAPF_INFO_:*** Packet Forwarder for Lora PicoCell Gateway ***
    Version: undefined
    [3736321108] LORAPF_INFO_:lorapf *** Lora concentrator HAL library version info ***
    Version: " 0.2.3 ";
    [3736321117] LORAPF_INFO_:[main] Little endian host
    [3736321163] LORAPF_INFO_:[main] lorawan_public 1, clksrc 1
    lgw_board_setconf:592: Note: board configuration; lorawan_public:1, clksrc:1
    [3736321164] LORAPF_INFO_:[main] antenna_gain 0 dBi
    [3736321172] LORAPF_INFO_:[main] Configuring TX LUT with 16 indexes
    [3736321175] LORAPF_INFO_:[main] radio 0 enabled (type SX1257), center frequency 904300000, RSSI offset -165.999994, tx enabled 1
    lgw_rxrf_setconf:626: Note: rf_chain 0 configuration; en:1 freq:904300000 rssi_offset:-166.000000 radio_type:2 tx_enable:1
    [3736321197] LORAPF_INFO_:[main] radio 1 enabled (type SX1257), center frequency 905000000, RSSI offset -165.999994, tx enabled 0
    lgw_rxrf_setconf:626: Note: rf_chain 1 configuration; en:1 freq:905000000 rssi_offset:-166.000000 radio_type:2 tx_enable:0
    [3736321219] LORAPF_INFO_:[main] Lora multi-SF channel 0>  radio 0, IF -400000 Hz, 125 kHz bw, SF 7 to 12
    lgw_rxif_setconf:745: Note: LoRa 'multi' if_chain 0 configuration; en:1 freq:-400000 SF_mask:0x7e
    [3736321237] LORAPF_INFO_:[main] Lora multi-SF channel 1>  radio 0, IF -200000 Hz, 125 kHz bw, SF 7 to 12
    lgw_rxif_setconf:745: Note: LoRa 'multi' if_chain 1 configuration; en:1 freq:-200000 SF_mask:0x7e
    [3736321255] LORAPF_INFO_:[main] Lora multi-SF channel 2>  radio 0, IF 0 Hz, 125 kHz bw, SF 7 to 12
    lgw_rxif_setconf:745: Note: LoRa 'multi' if_chain 2 configuration; en:1 freq:0 SF_mask:0x7e
    [3736321272] LORAPF_INFO_:[main] Lora multi-SF channel 3>  radio 0, IF 200000 Hz, 125 kHz bw, SF 7 to 12
    lgw_rxif_setconf:745: Note: LoRa 'multi' if_chain 3 configuration; en:1 freq:200000 SF_mask:0x7e
    [3736321289] LORAPF_INFO_:[main] Lora multi-SF channel 4>  radio 1, IF -300000 Hz, 125 kHz bw, SF 7 to 12
    lgw_rxif_setconf:745: Note: LoRa 'multi' if_chain 4 configuration; en:1 freq:-300000 SF_mask:0x7e
    [3736321307] LORAPF_INFO_:[main] Lora multi-SF channel 5>  radio 1, IF -100000 Hz, 125 kHz bw, SF 7 to 12
    lgw_rxif_setconf:745: Note: LoRa 'multi' if_chain 5 configuration; en:1 freq:-100000 SF_mask:0x7e
    [3736321325] LORAPF_INFO_:[main] Lora multi-SF channel 6>  radio 1, IF 100000 Hz, 125 kHz bw, SF 7 to 12
    lgw_rxif_setconf:745: Note: LoRa 'multi' if_chain 6 configuration; en:1 freq:100000 SF_mask:0x7e
    [3736321343] LORAPF_INFO_:[main] Lora multi-SF channel 7>  radio 1, IF 300000 Hz, 125 kHz bw, SF 7 to 12
    lgw_rxif_setconf:745: Note: LoRa 'multi' if_chain 7 configuration; en:1 freq:300000 SF_mask:0x7e
    [3736321360] LORAPF_INFO_:[main] Lora std channel> radio 0, IF 300000 Hz, 500000 Hz bw, SF 8
    lgw_rxif_setconf:719: Note: LoRa 'std' if_chain 8 configuration; en:1 freq:300000 bw:1 dr:4
    [3736321377] LORAPF_INFO_:[main] FSK channel 8 disabled
    lgw_rxif_setconf:654: Note: if_chain 9 disabled
    [3736321430] LORAPF_INFO_:[main] gateway MAC address is configured to lX
    [3736321431] LORAPF_INFO_:[main] server hostname or IP address is configured to "router.us.thethings.network"
    [3736321435] LORAPF_INFO_:[main] upstream port is configured to "1700"
    [3736321441] LORAPF_INFO_:[main] downstream port is configured to "1700"
    [3736321448] LORAPF_INFO_:[main] downstream keep-alive interval is configured to 10 seconds
    [3736321456] LORAPF_INFO_:[main] statistics display interval is configured to 30 seconds
    [3736321464] LORAPF_INFO_:[main] upstream PUSH_DATA time-out is configured to 100 ms
    [3736321471] LORAPF_INFO_:[main] packets received with a valid CRC will be forwarded
    [3736321479] LORAPF_INFO_:[main] packets received with a CRC error will NOT be forwarded
    [3736321486] LORAPF_INFO_:[main] packets received with no CRC will NOT be forwarded
    [3736321494] LORAPF_INFO_:[main] Auto-quit after 6 non-acknowledged PULL_DATA
    [3736321504] LORAPF_INFO_:[main] found global configuration file and parsed correctly
    lgw_calibrate_sx125x:511: Note: calibration started (time: 2300 ms)
    lgw_calibrate_sx125x:532: Note: calibration finished (status = 0xBF)
    lgw_calibrate_sx125x:569: calibration a_i = 76
    lgw_calibrate_sx125x:569: calibration a_i = 61
    lgw_calibrate_sx125x:569: calibration a_i = 48
    lgw_calibrate_sx125x:569: calibration a_i = 42
    lgw_calibrate_sx125x:569: calibration a_i = 32
    lgw_calibrate_sx125x:569: calibration a_i = 26
    lgw_calibrate_sx125x:569: calibration a_i = 20
    lgw_calibrate_sx125x:569: calibration a_i = 16
    lgw_calibrate_sx125x:511: Note: calibration started (time: 2300 ms)
    lgw_calibrate_sx125x:532: Note: calibration finished (status = 0xB7)
    WARNING: problem in calibration of radio A for image rejection
    lgw_calibrate_sx125x:569: calibration a_i = 42
    lgw_calibrate_sx125x:569: calibration a_i = 32
    lgw_calibrate_sx125x:569: calibration a_i = 26
    lgw_calibrate_sx125x:569: calibration a_i = 20
    lgw_calibrate_sx125x:569: calibration a_i = 16
    lgw_calibrate_sx125x:569: calibration a_i = 13
    lgw_calibrate_sx125x:569: calibration a_i = 11
    lgw_calibrate_sx125x:569: calibration a_i = 9
    Info: Initialising AGC firmware...
    Info: putting back original RADIO_SELECT value
    [3736328675] LORAPF_INFO_:[main] concentrator started, packet can now be received
    [3736328677] LORAPF_INFO_373:6[33728677]32LORA8PF_ERROR:[m[ai37363 im28posspib  ] le 8to 680cre] Lat LORAPF_Itmarer Sy
    4 thrNFO_ead:[ do1wn] )st (3art
    )R (11,22,1)
    APF_INFO_:[jit ] start
    [3736328692] LORAPF_INFO_:[jit ] end
    [3736328736] LORAPF_INFO_:[up  ] End of upstream thread
    
    [3736338779] LORAPF_INFO_:[down] End of downstream thread
    
    [3736338780] LORAPF_INFO_:[main] Stopping concentrator
    

    Other logs are similar, but not identical

    Info: putting back original RADIO_SELECT value
    [3736235261] LORAPF_INFO_:[main] concentrator started, packet can now be received
    [3736235262] LORAPF_INF[O_:[up3736[3352673]  ] st LORArPt
    _ERROR:3623526a43i235264]]  im]posLsible OtRAo crPF_INFO_:te TimAer Sdync thnre] staad t
    (12) (34) (11,22,1)
    _INFO_:[jit ] start
    [3736235277] LORAPF_INFO_:[jit ] end
    [3736235316] LORAPF_INFO_:[up  ] End of upstream thread
    
    [3736245318] LORAPF_INFO_:[down] End of downstream thread
    
    [3736245319] LORAPF_INFO_:[main] Stopping concentrator
    
    Info: putting back original RADIO_SELECT value
    [3735952915] LORAPF_INFO_:[main] concentrator started, packet can now be received
    [3735952916] LORAPF_INFO_:[3u73[5952917[3L735952917]  ] startERRO3595R29:[m ai
    22,1O)8]ssib le to ORAPF_reINFOteOTi_:[jmier Sync t] hreasd (F_IN) (34)art (11F,
    :[down] start
    [3735952933] LORAPF_INFO_:[down[3735952933] End of do] LORAPF_INwnstream thrFO_:[jit ] eead
    
    nd
    [3735952971] LORAPF_INFO_:[up  ] End of upstream thread
    
    [3735952993] LORAPF_INFO_:[main] Stopping concentrator
    

    How do I resolve this?



  • Pygate needs a lot of RAM. As suggested in the docs you can turn off LTE or Wifi (whichever you don't need) https://docs.pycom.io/tutorials/expansionboards/pygate/#setup



  • Update >> I was able to solve the problem.

    Based on another post about not running PyGate with PyBytes, I added this line to main.py

    # ensure pybytes disabled
    pycom.pybytes_on_boot(False)
    

    I also restored the rtc.ntp_sync command back to the original version

    # Sync time via NTP server for GW timestamps on Events
    print('Syncing RTC via ntp...', end='')
    rtc = RTC()
    rtc.ntp_sync(server="pool.ntp.org")
    

    Now everything is running.



Pycom on Twitter