TTN can' show device data of LoPy

  • Hi,
    I'm using two LoPy - one as LoRaWAN nano gateway, another as node device - to test the commnicatoin with TTN.
    I'm using US915 frequency and ABP method.
    Right now I can see the uplink data in gateway data traffic, and also the device status shows it's connected. But there is no data in application data page.
    The status of TTN page shows below:

    1. Gateway traffic

    2. Device overview

    3. Application data:

    My code is below:

    """ LoPy LoRaWAN Nano Gateway configuration options """
    import machine
    import ubinascii
    WIFI_MAC = ubinascii.hexlify(machine.unique_id()).upper()
    # Set  the Gateway ID to be the first 3 bytes of MAC address + 'FFFE' + last 3 bytes of MAC address
    GATEWAY_ID = WIFI_MAC[:6] + "FFFE" + WIFI_MAC[6:12]
    SERVER = ''
    PORT = 1700
    NTP = ""
    NTP_PERIOD_S = 3600
    WIFI_SSID = ''
    WIFI_PASS = ''
    # for EU868
    #LORA_FREQUENCY = 868100000
    #LORA_GW_DR = "SF7BW125" # DR_5
    #LORA_NODE_DR = 5
    # for US915
    LORA_FREQUENCY = 903900000
    LORA_GW_DR = "SF7BW125" # DR_3
    #LORA_NODE_DR = 4
    #####ABP example#####
    from network import LoRa
    import socket
    import binascii
    import struct
    import time
    import config
    # initialize LoRa in LORAWAN mode.
    # Please pick the region that matches where you are using the device:
    # Asia = LoRa.AS923
    # Australia = LoRa.AU915
    # Europe = LoRa.EU868
    # United States = LoRa.US915
    lora = LoRa(mode=LoRa.LORAWAN, region=LoRa.US915)
    # create an ABP authentication params
    dev_addr = struct.unpack(">l", binascii.unhexlify(''))[0]
    nwk_swkey = binascii.unhexlify('')
    app_swkey = binascii.unhexlify('')
    # remove all the channels
    for channel in range(0, 72):
    # set all channels to the same frequency (must be before sending the OTAA join request)
    for channel in range(0, 72):
        lora.add_channel(channel, frequency=config.LORA_FREQUENCY, dr_min=0, dr_max=3)
    # join a network using ABP (Activation By Personalization)
    lora.join(activation=LoRa.ABP, auth=(dev_addr, nwk_swkey, app_swkey))
    # create a LoRa socket
    s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
    # set the LoRaWAN data rate
    s.setsockopt(socket.SOL_LORA, socket.SO_DR, 3)# last parameter is 3 
    # make the socket non-blocking
    for i in range (200):
        pkt = b'PKT #' + bytes([i])
        print('Sending:', pkt)
        rx, port = s.recvfrom(256)
        if rx:
            print('Received: {}, on port: {}'.format(rx, port))

    I have deleted the data as device address, Network session key,etc.

    Moreover, the OTAA can't work for me, always shows "Not joined yet" when using the sample code from pycom github...

    The firmware version is :
    sysname='LoPy', nodename='LoPy', release='1.17.5.b6', version='v1.8.6-849-56d00234 on 2018-05-18', machine='LoPy with ESP32', lorawan='1.0.2'

    Hope you guys could help me!

Log in to reply

Pycom on Twitter