Problem with receiving ABP due to frequencies
I'm trying to set up comm. between a transmitter and a receiver but I am unable to prevent the receiver from using multiple frequencies. Is there an easy way to force the Pycom to only use one frequency? I'm using LoPy4 and LoRa
@robert-hh I just tried this, but it's still using the other frequencies. I have also tried powering it off fully, but again, no luck...
robert-hh last edited by
@fink did you perform a hard reset between the tests? I have had situatutions where channel Configurations did not get active until. I made a hard reset by pushing the reset button.
If I set the first four channels (0,1,2,3) as 868.0MHz, I got the following results:
868.0: 30 packets
868.1: 28 packets
868.3: 22 packets
868.5: 22 packets
If I set all channels to 868.0 MHz (so channel 0 through 15), i get the following distribution:
868.0: 126 packets
868.1: 12 packets
868.3: 10 packets
868.5: 8 packets
So it seems there are some channels which cannot be changed.
The code I'm using is as follows:
from network import LoRa import socket import struct import ubinascii import time lora = LoRa(mode=LoRa.LORAWAN, region=LoRa.EU868, tx_power=8) # Set channels for x in range(0,16): lora.add_channel(index=x, frequency=868000000, dr_min=5, dr_max=5) # ABP parameters and join dev_addr = struct.unpack(">l", ubinascii.unhexlify('12345678')) nwk_swkey = ubinascii.unhexlify('12341234123412341234123412341234') app_swkey = ubinascii.unhexlify('12341234123412341234123412341234') lora.join(activation=LoRa.ABP, auth=(dev_addr, nwk_swkey, app_swkey)) while True: s.setblocking(True) s.send(payload) s.setblocking(False) print(lora.stats()) time.sleep(1)
@jonas2707 remove all channels and indeed set them all to the same frequency and you should be fine.
I don’t remover the default channels settings in ABP mode. I know in OTAA mode in the EU region only the first 3 channels are used for join requests, but maybe all channels are used by default in ABP mode, too lazy to check right now.
You could also check the nanogateway and associated client examples for hints.
My current setup is two LoPy4 devices:
First is in LoRaWAN mode transmitting periodically.
Second is in raw LoRa mode.
As I understand it, the LoRaWAN mode changes channel in order to increase robustness. But this makes it difficult to receive the data on the second device, and as I am just using a cable for now, i don't care too much about performance.
I have tried setting the first three channels to the same frequency (868.0MHz, dr_min=5, drmax=5), and removing all other channels, but i can see from lora.stats() that the frequency still changes.
So basically, I'm wondering how to set the transmitter in LoRaWAN mode to only use a single frequency and data rate.
@jonas2707 It's unclear what you are doing and what your problem is. I suppose if you mention ABP that you are using LoRaWAN rather than raw LoRa? Also you talk about transmitters and receivers, but you should probably tell us which device is a node and which one is a gateway (both LoPy4? or are you using a different device as a gateway? In that case, which?), and which one you have a problem with. You tell us the "receiver" is using multiple frequencies, which shouldn't be a problem for a receiver, quite the opposite.
If you are in a situation where you use a LoPy as a gateway (the so-called "nano-gateway"), it will only listen on a single frequency and data rate at a time, so you need to force the node to only use that frequency as well. This is usually achieved by using the
lora.add_channelmethods to adjust things.