When using OTAA on the RAK811 LoRa Node pHat does not provide true Class C functionality because there is only a small window of time(maybe a second or two?) after an uplink has been sent that allows immediate downlinks from my private Chirpstack (on the RAK2245 RPI gateway) to be read. Class C is supposed to keep listening after transmission until the next packet needs to be sent. It seems to act more like Class A. Chirpstack has already been configured to work with Class C, so it transmits the downlinks almost immediately. Where I have gone wrong? I already configured the node to run in Class C by typing rak811 set-config class=2.
Here is my code:
#!/usr/bin/env python3 from random import randint from sys import exit from time import sleep from rak811 import Mode, Rak811 lora = Rak811() # Most of the setup should happen only once... print('Setup') lora.hard_reset() lora.mode = Mode.LoRaWan lora.band = 'EU868' DEV_EUI = ' ' APP_KEY = ' ' lora.set_config(dev_eui=DEV_EUI, app_key=APP_KEY) print('Joining') lora.join_otaa() # Note that DR is different from SF and depends on the region # See: https://docs.exploratory.engineering/lora/dr_sf/ # Set Data Rate to 5 which is SF7/125kHz for EU868 sleep(10) lora.dr = 5 print('Sending packets every minute - Interrupt to cancel loop') print('You can send downlinks from the TTN console') try: while True: print("Sending packet") lora.send("Hello World") while lora.nb_downlinks: print("Received", lora.get_downlink()['data']) sleep(60) except Exception as e: # noqa: E722 print(e) pass print('Cleaning up') lora.close() exit(0)