LoRawan join: operation not possible using spreading factor other than seven(?)


  • Pybytes Beta

    Hey guys,

    I am trying to send a packet with a size of 155 bytes. From my understanding of the lorawan specification with a spreading factor of 7, the maximum size is 51 bytes.

    However, when I try to change the spreading the factor the lora.join() method produces the error:

    Traceback (most recent call last): File "<stdin>", line 1, in <module> OSError: the requested operation is not possible

    The code I am using is as follows:

    from network import LoRa
    import socket
    import binascii
    import struct
    import pycom
    import time
    
    # Initialize LoRa in LORAWAN mode.
    # lora = LoRa(mode=LoRa.LORAWAN)
    lora = LoRa(mode=LoRa.LORAWAN)
    lora.BW_125KHZ
    lora.CODING_4_8
    lora.sf(12)
    
    # create an ABP authentication params
    dev_addr = struct.unpack(">l", binascii.unhexlify('00 00 00 05'.replace(' ','')))[0]
    nwk_swkey = binascii.unhexlify('70 b3 d5 49 95 be 95 0b 70 b3 d5 49 95 be 95 0b'.replace(' ',''))
    app_swkey = binascii.unhexlify('a3 1d 09 36 00 a1 8f fe 8c 62 56 99 35 3e 9b 31'.replace(' ',''))
    
    # join a network using ABP (Activation By Personalization)
    lora.join(activation=LoRa.ABP, auth=(dev_addr, nwk_swkey, app_swkey))
    

    As I said, the lora.join() method produces and error.

    The lora.join() only works with a spreading factor of 7 all other values produce the same error.

    Does anyone know of a solution/can see what I am doing wrong?

    Using firmware version:
    1.0.0.b1

    Thanks,

    Matt


  • Pybytes Beta

    okay cool, thanks very much for the reply. Will update the firmware



  • @matt_tait
    Your firmware is very old, try updating to the latest. Many things in LoRa have changed.

    I think longer packets are supported now, but as the documentation explains SF settings are reserved for raw LoRa, in LoRaWAN mode it expects SF to be set by the network using ADR. The default should already be 7 though.



Pycom on Twitter