lopy4 set to send on one frequency, but gateway receives the packet on a different frequency



  • Hi,

    I have a dual channel gateway only receives on the 902.3 and 903.1 frequencies. When I attempt to send using only 902.3, my gateway does not receive anything. But when I use 903.1, my TTN console shows that the packet was received at 902.3. Does anyone have any idea what's going on?

    My code modified from https://github.com/pycom/pycom-libraries/blob/master/examples/lorawan-regional-examples/main_US915.py

    rom network import LoRa
    import socket
    import binascii
    import struct
    import time
    
    # 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('xxxxx'))[0]
    nwk_swkey = binascii.unhexlify('xxxxx')
    app_swkey = binascii.unhexlify('xxxx')
    
    # remove all the channels
    for channel in range(0, 72):
        lora.remove_channel(channel)
    
    # set all channels to the same frequency (must be before sending the OTAA join request)
    for channel in range(0, 8):
        lora.add_channel(channel, frequency=903100000, 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)
    
    # make the socket non-blocking
    s.setblocking(False)
    
    for i in range (200):
        pkt = b'PKT #' + bytes([i])
        print('Sending:', pkt)
        s.send(pkt)
        time.sleep(4)
        rx, port = s.recvfrom(256)
        if rx:
            print('Received: {}, on port: {}'.format(rx, port))
        time.sleep(6)
    
    

    My TTN console output:

    Screen Shot 2019-03-26 at 2.31.19 PM.png



  • I switched the code on the gateway to the single channel version and TTN shows an output as intended. You are probably correct about the chip getting confused about which channel it is listening on. Thank you!



  • @kylecjo Are you sure this setup supports 2 frequencies at the same time? I always thought the SX1276 could support only one frequency at a time, and I don't see anything in the data sheet that says otherwise, did I miss that?

    The documentation is unclear, but it seems to indicate you actually need two SX1272 or SX1276 (or a combination of the two) to support two frequencies.

    Looking quickly through the code, it seems to be using two different pins (pin_nss and pin_nss2 in the config file) to select one of two chips, what did you set there? The HAT you linked to has a single NSS input for the LoRa chip.

    If you only have one, it's only listening on one channel and possibly getting confused on what chip is listening on what channel and incorrectly reporting to the LNS.



  • @jcaron I'm using a raspberry pi with a Dragino LoRa/GPS Hat as a gateway. I used this code to use the device as a dual channel gateway on 902.3 and 903.1 frequencies.

    I have tested the gateway with other LoRa devices and the console reports as receiving on the correct frequencies.



  • @kylecjo Can you share details of your gateway? Are you sure its configuration/reporting is correct?


Log in to reply
 

Pycom on Twitter