Confusion about LoRaWan OTAA via RadioLib on a XIAO ESP32-S3 + SX1262 B2B (-1116)

Thanks so much for the reply and the encouragement! It means a lot. My initial problem was that I couldn’t figure out which part of this process was failing.

The project is for a client who needs to monitor soil moisture for plants that will be located in a field, outside of WiFi signal. The goal is to do this with the XIAO ESP32-S3 connected to the WIO SX1262 .

The Data Flow will look something lke this:

  • The ESP32 periodically wakes from deep sleep and gets a reading from the moisture sensor.
  • It sends it to a nearby KPN LoRaWan Gateway
  • The gateway forwards it to KPN Things Server, where the data gets decoded and forwarded to an IoT Dashboard, where the client gets live updates.

Now for the big update: I was actually able to send an uplink to the gateway. It was a range issue, as I expected. Now the problem is that I need to receive the JOIN Accept Back from KPN. Now I can see the JOIN Accept downlink is being sent but I still get error -1116. I am quite lost at this stage. I can’t find any information on how to deal with this.

I can’t figure out if it’s a timing issue, or a configuration error.

This is the relevant code snippet currently (I believe some lines are redundant since they’re the default option):

#include <Arduino.h>
#include <SPI.h>
#include <RadioLib.h>

// --- Radio & RF-switch pins ---
SX1262 radio(41, 39, 42, 40);
#define RF_SWITCH_PIN 38
static const uint32_t rfswitch_pins[] = {
  RF_SWITCH_PIN, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC
};
static const Module::RfSwitchMode_t rfswitch_table[] = {
  { Module::MODE_IDLE, { LOW   } },
  { Module::MODE_RX,   { HIGH  } },
  { Module::MODE_TX,   { HIGH  } },
  END_OF_MODE_TABLE,
};

// --- LoRaWAN credentials (zeros) ---
uint64_t joinEUI = 0x0000000000000000;
uint64_t devEUI  = 0x0000000000000000;
uint8_t  appKey[16] = { 0 };

// --- LoRaWAN node on EU868, no sub-band filter ---
LoRaWANNode node(&radio, &EU868, 0);

void setup() {
  Serial.begin(115200);
  delay(2000);

  // apply RF switch mapping
  radio.setRfSwitchTable(rfswitch_pins, rfswitch_table);

  // init radio
  if (radio.begin() != RADIOLIB_ERR_NONE) {
    Serial.println("Radio init failed");
    while (true);
  }

  // enable TCXO (1.6 V)
  if (radio.setTCXO(1.6) != RADIOLIB_ERR_NONE) {
    Serial.println("TCXO config failed");
    while (true);
  }

  // prepare OTAA join
  node.beginOTAA(joinEUI, devEUI, nullptr, appKey);

  // join with up to 3 retries
  Serial.println("Joining network...");
  for (int i = 1; i <= 3; i++) {
    if (node.activateOTAA() == RADIOLIB_LORAWAN_NEW_SESSION) {
      Serial.println("Join success");
      return;
    }
    Serial.printf("Join failed (%d), retrying in 30 s...\n", i);
    delay(30000);
  }
  Serial.println("Join failed after 3 tries");
}

void loop() {
  // the rest...
}

Do you have any ideas as to what might be going wrong?
Thanks in advance!

Best regards, Ary-x86