Testing LoRaWAN functionality



  • I started a systematic test of LoPy's LoRaWAN functionality. I will share my findings here.

    Test enviroment

    LoPy firmware - 1.4.0.b1
    Network server - Loriot
    Gateway - RPi
    Region - Europe

    It is a very basic initial test, using wrong parameters, timing, etc. will come later, it is out of scope now.

    ABP

    Started test with a simple ABP setup sending 4 bytes data with DR5 (SF7) in every 10 seconds unconfirmed.

    Setting keys

    Setting of DevAddr, NwkSkey and AppSkey works as expected, no issue found.

    Setting of port and DR

    Setting port used to send data and selecting DR in 0-5 (SF12-SF7) range works as expected.

    Uplink sequence numbers

    Works as expected, LoRaWAN stack increments it from 1 by packets.

    Frequency usage

    LoPy is using only the 3 mandatory channels, 868,100, 868.300 and 868.500 MHz which is a safe choice, but in real life gateways offer 8 channels. Would be better to have the Semtech 8-channels bandplan as default and to offer different bandplan optionally as a 868 MINIMAL setup or to add/remove channels using the API.

    Stability

    Now the test run is over 2,170 packets and still running. No errors, no out of memory. Looks good!

    Stay tuned, testing goes on.



  • Multitech Mlinux



  • @jubbs said in Testing LoRaWAN functionality:

    I have managed to get data through. I am not sure what got it working for me. May have been an issue with my gateway which required a number of restarts.

    What type of gateway are you using?



  • I have managed to get data through. I am not sure what got it working for me. May have been an issue with my gateway which required a number of restarts.

    Thanks it was helpful to know that it worked and I wasnt wasting my time.



  • The unit has never connected so the gateway has a message count of -1



  • @affoltep said in Testing LoRaWAN functionality:

    @jubbs : This might be a problem of the packet counter. ABP starts at zero if you do a reset on LoPy. As long as your counter on Loriot is higher than your counter from your node, messages are ignored.
    Try to reset your ABP counter in Loriot dashboard

    @jubbs

    right, your code is sending only one packet which, each time you start program sequence number will start with 0 and will be dropped.

    Send 5-10 packets in a loop with 15-20 sec between them with SF7-SF9 if radio link allows and check result. Increase spacing for SF10-12.



  • @jubbs

    Sure I will put my test code to GitHub today.



  • @jubbs : This might be a problem of the packet counter. ABP starts at zero if you do a reset on LoPy. As long as your counter on Loriot is higher than your counter from your node, messages are ignored.
    Try to reset your ABP counter in Loriot dashboard



  • Can you post your source code?

    I have been trying to get a Loriot ABP connection and nothing is coming through. OTA seems OK so not sure what I am doing wrong.

    This is my attempt that is getting nothing.

    config.py
    import binascii
    import struct

    dev_addr = struct.unpack(">l", binascii.unhexlify('01 E5 13 A6'.replace(' ','')))[0]
    nwk_swkey = binascii.unhexlify('7DEF76E3A66D91106A4BC2CFC1825EAF')
    app_swkey = binascii.unhexlify('A74440BFE2DB9C299DCE58228B3DEAA9')

    test.py
    from network import LoRa

    import socket
    import config

    lora = LoRa(mode=LoRa.LORAWAN)
    lora.add_channel(1, frequency=865200000, dr_min=0, dr_max=5)
    lora.add_channel(2, frequency=865400000, dr_min=0, dr_max=5)
    lora.add_channel(3, frequency=866200000, dr_min=0, dr_max=5)
    lora.add_channel(4, frequency=866400000, dr_min=0, dr_max=5)
    lora.add_channel(5, frequency=866600000, dr_min=0, dr_max=5)
    lora.add_channel(6, frequency=866800000, dr_min=0, dr_max=5)
    lora.add_channel(7, frequency=867000000, dr_min=0, dr_max=5)
    lora.add_channel(8, frequency=865600000, dr_min=5, dr_max=5)
    lora.remove_channel(9)
    lora.remove_channel(10)
    lora.remove_channel(11)
    lora.remove_channel(12)
    lora.remove_channel(13)
    lora.remove_channel(14)
    lora.remove_channel(15)
    lora.join(activation=LoRa.ABP, auth=(config.dev_addr, config.nwk_swkey, config.app_swkey))
    s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)

    set the LoRaWAN data rate

    s.setsockopt(socket.SOL_LORA, socket.SO_DR, 5)

    s.setblocking(True)
    s.send(bytes([0x01, 0x02, 0x03]))
    s.setblocking(False)


Log in to reply
 

Pycom on Twitter