I have a Pygate with a Gpy attached, and connect the Pygate to TTN via LTE (1nce - LTE Cat-NB1).
There is a radio mast about 100m air-line distance at the same height as the Pygate, the Gpy has full network connection throughout and no breaks.
It works very well until after an undefined time (between 15min and 12 hours) the connection to the TTN network is lost and the gateway is offline in the TTN console (webapp and ttnctl), in the 1nce web interface the Gpy is listed as connected.
(Nodes can send or receive data to the TTN network during this time without any problems)
I would be very happy about help, it is unfortunately very frustrating, because I have been looking for a long time for the error but can't find it.
The code and the config are attached
Subquestion:
Is it possible to test programmatically if the connection to ttn is active? (like e.g. lte.is_connected())
Used hardware:
Pygate & Gpy
Firmware Version:
Pycom MicroPython 1.20.2.rc11 [v1.11-d574024] on 2020-08-25; GPy with ESP32
from network import LTE
import time
import machine
from machine import RTC
import pycom
off = 0x000000
white = 0xffffff
red = 0x8a0000
green = 0x007f00
orange = 0xff7300
blue = 0x035afc
yellow = 0xffff00
purple = 0xf700ff
print('\nStarting LoRaWAN concentrator')
pycom.heartbeat(False)
def machine_cb(arg):
evt = machine.events()
print("-------------------------")
print(evt)
print("-------------------------")
if (evt & machine.PYGATE_START_EVT):
pycom.rgbled(green)
elif (evt & machine.PYGATE_ERROR_EVT):
pycom.rgbled(red)
elif (evt & machine.PYGATE_STOP_EVT):
pycom.rgbled(off)
# register callback function
machine.callback(trigger=(machine.PYGATE_START_EVT |
machine.PYGATE_STOP_EVT | machine.PYGATE_ERROR_EVT), handler=machine_cb)
# setup LTE
lte = LTE()
if not lte.isconnected():
# Modem does not connect successfully without first being reset.
print("Resetting LTE modem ... ", end='')
lte.send_at_cmd('AT^RESET')
print("OK")
time.sleep(1)
if not lte.isattached():
print("Attaching to LTE network ", end='')
lte.attach(band=8, apn="iot.1nce.net")
arc = 0
while(True):
if arc >= 60:
machine.reset()
if lte.isattached():
pycom.rgbled(purple)
time.sleep(0.1)
pycom.rgbled(off)
print(" OK")
lte.send_at_cmd("AT+CSQ")
break
print('.', end='')
arc += 1
time.sleep(1)
if not lte.isconnected():
print("Connecting on LTE network ", end='')
lte.connect()
crc = 0
while(True):
if crc >= 30:
machine.reset()
if lte.isconnected():
pycom.rgbled(orange)
time.sleep(0.1)
pycom.rgbled(off)
print(" OK")
break
print('.', end='')
crc += 1
time.sleep(1)
# 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")
while not rtc.synced():
print('.', end='')
time.sleep(.5)
print(" OK\n")
# Read the GW config file from Filesystem
fp = open('/flash/config.json', 'r')
buf = fp.read()
# Start the Pygate
print("------ start paygate ------", end="\n\n")
machine.pygate_init(buf)
# disable degub messages
# machine.pygate_debug_level(1)
# while True:
# time.sleep(1)
# if not lte.isconnected():
# pycom.rgbled(red)
# time.sleep(5)
# machine.pygate_deinit()
# machine.pygate_reset()
Hello,
I have a Pygate with a Gpy attached, and connect the Pygate to TTN via LTE (1nce - LTE Cat-NB1).
There is a radio mast about 100m air-line distance at the same height as the Pygate, the Gpy has full network connection throughout and no breaks.
It works very well until after an undefined time (between 15min and 12 hours) the connection to the TTN network is lost and the gateway is offline in the TTN console (webapp and ttnctl), in the 1nce web interface the Gpy is listed as connected.
(Nodes can send or receive data to the TTN network during this time without any problems)
I would be very happy about help, it is unfortunately very frustrating, because I have been looking for a long time for the error but can't find it.
The code and the config are attached
Subquestion: Is it possible to test programmatically if the connection to ttn is active? (like e.g. lte.is_connected())
Used hardware: Pygate & Gpy
Firmware Version: Pycom MicroPython 1.20.2.rc11 [v1.11-d574024] on 2020-08-25; GPy with ESP32
First log of the Pymakr Console, after the TTN connection is lost