Hello! This is my first post here. I am developing a device to test the system reliability. I want to send an increasing number to the TTN gateway from a Lopy inserted in a pytrack module and monitor if any packet is lost. I have used the example provided by Lopy, modified to send 200 packets. I set constant payload (0x01,0x02,0x03) but the payload I receive in TTN is allways different. I have tried to change payload size, adding more bytes, and I see that the byte number in the payload shown by TTN changes and matches the number of bytes I send.
I upgraded Lopy firmware to last version.
¿ does anyone have the same problem ? ¿ any suggestions to solve it?
This is my code:
# 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, 5)
for i in range (200):
# make the socket blocking
# (waits for the data to be sent and for the 2 receive windows to expire)
s.setblocking(True)
# send some data
s.send(bytes([0x01, 0x02, 0x03]))
# make the socket non-blocking
# (because if there's no data received it will block forever...)
s.setblocking(False)
# get any data received (if any...)
data = s.recv(64)
print(data)
time.sleep(4)