LoRaWAN Network Join failed - ERR_INVALID_FREQUENCY (-12)

I have a LILYGO T3_V1.6.1 (915 MHz) LoRa board that I am trying to connect to my TTN application. I have Heltec boards (Lora32 v3) already connected, so I’m pretty sure the application and gateway are all setup correctly. I am trying to use the recommended RadioLib examples from the Arduino library and have specifically selected “LoRaWAN_Starter” from the examples library since it is mentioned in The Things Stack LILYGO LoRa32 setup article (LILYGO LoRa32 | The Things Stack for LoRaWAN). I have made what I believe are the appropriate changes to the config.h file (see below) and the sketch compiles, uploads, and runs, but I get the following in serial output:

Setup ... 
Initialise the radio
Join ('login') the LoRaWAN Network
Join failed - ERR_INVALID_FREQUENCY (-12)

I am able to see that the node connects with my TTN Gateway (Heltec Indoor Gateway) because each time i reset the board, I get a new event detail as follows:

{
  "name": "gs.status.receive",
  "time": "2025-04-08T14:24:39.113727575Z",
  "identifiers": [
    {
      "gateway_ids": {
        "gateway_id": "ecuador-gateway-02",
        "eui": "40D63CFFFE82111D"
      }
    }
  ],
  "data": {
    "@type": "type.googleapis.com/ttn.lorawan.v3.GatewayStatus",
    "time": "2025-04-08T14:24:39Z",
    "versions": {
      "ttn-lw-gateway-server": "3.34.0-rc0-SNAPSHOT-77eea657c3"
    },
    "ip": [
      "157.100.138.132"
    ],
    "metrics": {
      "rxok": 0,
      "rxfw": 0,
      "ackr": 0,
      "txin": 0,
      "txok": 0,
      "temp": 30,
      "rxin": 0
    }
  },
  "correlation_ids": [
    "gs:status:01JRAWKX69XHE6V8NK97RRZ93W"
  ],
  "origin": "ip-10-101-15-210.us-west-1.compute.internal",
  "context": {
    "tenant-id": "CgN0dG4="
  },
  "visibility": {
    "rights": [
      "RIGHT_GATEWAY_STATUS_READ"
    ]
  },
  "unique_id": "01JRAWKX69NX23K1GQ63Q5K66Y"
}

As a result, I don’t think it is actually a frequncy issue. Furthermore, I have confirmed that I am using the same frequency plan on this node as I setup on the gateway AND that I have used with other boards. The LoRa radio pins were selected by comparing the SX127x_PingPong example from the RadioLib library, with the pins provided at RadioBoards/src/maintained/LilyGo/TTGO_TBeam.h at main · radiolib-org/RadioBoards · GitHub since I have not found a specific reference to the board I have. I’m wondering if I have one or two of the pins wrong. Here is the snipit from my config.h file,:

// first you have to set your radio model and pin configuration
// this is provided just as a default example
SX1278 radio = new Module(18, 26, 23, 33);

// if you have RadioBoards (https://github.com/radiolib-org/RadioBoards)
// and are using one of the supported boards, you can do the following:
/*
#define RADIO_BOARD_AUTO
#include <RadioBoards.h>

Radio radio = new RadioModule();
*/

// how often to send an uplink - consider legal & FUP constraints - see notes
const uint32_t uplinkIntervalSeconds = 5UL * 60UL;    // minutes x seconds

// joinEUI - previous versions of LoRaWAN called this AppEUI
// for development purposes you can use all zeros - see wiki for details
#define RADIOLIB_LORAWAN_JOIN_EUI  0x--------- (removed for security)

// the Device EUI & two keys can be generated on the TTN console 
#ifndef RADIOLIB_LORAWAN_DEV_EUI   // Replace with your Device EUI
#define RADIOLIB_LORAWAN_DEV_EUI   0x----------------- (removed for security)
#endif
#ifndef RADIOLIB_LORAWAN_APP_KEY   // Replace with your App Key 
#define RADIOLIB_LORAWAN_APP_KEY   0x--, (removed for security)
#endif
#ifndef RADIOLIB_LORAWAN_NWK_KEY   // Put your Nwk Key here
#define RADIOLIB_LORAWAN_NWK_KEY   0x--, (removed for security)
#endif

// for the curious, the #ifndef blocks allow for automated testing &/or you can
// put your EUI & keys in to your platformio.ini - see wiki for more tips

// regional choices: EU868, US915, AU915, AS923, AS923_2, AS923_3, AS923_4, IN865, KR920, CN500
const LoRaWANBand_t Region = US915;
const uint8_t subBand = 2;  // For US915, change this to 2, otherwise leave on 0

I have enabled reset of Join Nonces in the end device settings of TTN and I have enabled overwriting of the flash on the board in Arduino IDE.

I have also tried using the RadioBoards.h library rather than manually setting the LoRa pins, but I get the following error:

Setup ... 
Initialise the radio
Join ('login') the LoRaWAN Network
Join failed - RADIOLIB_ERR_NO_JOIN_ACCEPT (-1116)

I have searched for some help with this issue, but I’m not finding anything that will help me figure it out. If you have any ideas about what might be causing this, I’d love to hear them. Thanks!

SOLVED!
I’ll keep this topic rather than delete it just in case somebody else has similar issue, but I figured it out. In short, I had a space on the end of my NwkKey.

The combination that first got the node conencted was using the RadioBoards.h library AND checkiny all of my keys (I should have done this sooner). They were all ‘correct’, but I found a space on the end of my NwkKey and once delected, the board was able to connect to TTN and I was able to see the device all the way through to my Home Assistant instance.

I confirmed that manually entering the LoRa pins as (18, 26, 14, 33) still returned the invalid frequency error and that entering them as (18, 26, 23, 33) returns the same.

It appears that the config.h file has some ideas about other ‘manual’ pin settings to try, but I’m not sure it’s worth it since the automatic setup with RadioBoards.h worked, but here is the section of that config.h file that give those suggestions anyway:

// LilyGo 
#elif defined(ARDUINO_TTGO_LORA32_V1)
  #pragma message ("Using TTGO LoRa32 v1 - no Display")
  SX1276 radio = new Module(18, 26, 14, 33);

#elif defined(ARDUINO_TTGO_LORA32_V2)
   #pragma message ("Using TTGO LoRa32 v2 + Display")
   SX1276 radio = new Module(18, 26, 12, RADIOLIB_NC);

#elif defined(ARDUINO_TTGO_LoRa32_v21new) // T3_V1.6.1
  #pragma message ("Using TTGO LoRa32 v2.1 marked T3_V1.6.1 + Display")
  SX1276 radio = new Module(18, 26, 14, 33);

#elif defined(ARDUINO_TBEAM_USE_RADIO_SX1262)
  #pragma error ("ARDUINO_TBEAM_USE_RADIO_SX1262 awaiting pin map")

#elif defined(ARDUINO_TBEAM_USE_RADIO_SX1276)
  #pragma message ("Using TTGO T-Beam")
  SX1276 radio = new Module(18, 26, 23, 33);
1 Like

I suspect we need to add a note that says that the pins have to be set - perhaps with some a, b, c, d type hint that won’t compile - the RL repro can’t do a Harry Potter and morph depending on the board the user has as there are many potential boards, many which aren’t even ESP32 related!

But the RadioBoards library total does do that for you automagically, original design by a total genius, @CaptainAwesome.

Hmmm, interesting, the keys are just sub’d in to the array as a #define, so a space shouldn’t hurt, but we can test it. An error in the NwkKey will cause an issue on the console for the join, it shouldn’t cause anything to affect the frequency.

Many errors can occur with LW. Originally you had an issue from having the pins to sort out plus potentially an issue with the NwkKey. It may well be that there was something in the NwkKey that wasn’t quite right as that would affect the Join Accept decryption, causing the -1116 error.

The good news is, that a few tens of thousand uplinks later on the test devices, once its setup, it’s all good. If you are making adjustments, relax in to it all, there are many moving parts.

If you get to power saving, then please just use the Persistence examples.

By preference, if you can use the GitHub issues for the library as it helps focus the body of information & drive any updates or improvements. For anything once it gets to TTN, then this forum is the place to be.