OTAA does not join for US config. using last firmware



  • I changed frequencies as recommended.
    Changed dr_max=4 instead of 5
    Changed socket.SO_DR, 3
    But funciton lora.has_joined(): always send false

    With abp works without problem. Do you see an error in my code. I read all the post about OTAA and nothing. Somebody from pycom engineering.

    Best regards,

    from network import LoRa
    import socket
    import binascii
    import struct
    import time
    
    # Initialize LoRa in LORAWAN mode.
    lora = LoRa(mode=LoRa.LORAWAN)
    
    # create an OTA authentication params
    dev_eui = binascii.unhexlify('70 B3 D5 49 9E A9 24 C0'.replace(' ',''))
    app_eui = binascii.unhexlify('70 B3 D5 7E F0 00 5A 3F'.replace(' ',''))
    app_key = binascii.unhexlify('36 AB 76 25 FE 77 77 68 81 68 3B 49 53 00 FF D6'.replace(' ',''))
    
    # remove channels
    for channel in range(0, 72):
        lora.remove_channel(channel)
    
    # set the default channel to the same frequency (must be before sending the OTAA join request)
    lora.add_channel(0, frequency=903900000, dr_min=0, dr_max=4)
    
    # join a network using OTAA
    lora.join(activation=LoRa.OTAA, auth=(dev_eui, app_eui, app_key), timeout=0)
    
    # wait until the module has joined the network
    while not lora.has_joined():
        time.sleep(2.5)
        print('Not joined yet...')
    
    # 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)
    
    # make the socket blocking
    s.setblocking(False)
    
    time.sleep(5.0)
    
    for i in range (200):
        s.send(b'PKT #' + bytes([i]))
        time.sleep(4)
        rx = s.recv(256)
        if rx:
            print(rx)
        time.sleep(6)
    


  • @blackansible
    Try this modification in your nanogateway.py code:

    https://forum.pycom.io/post/8290



  • @jmarcelino Lopy gateway



  • @blackansible
    What are you using as your LoRaWAN gateway?



Pycom on Twitter