Issues connecting my ESP32-S3 to RAK7289V2 - TTN (Starting LoRa failed after PIN configuration)

Hi experts:

I’m knew here but did quite some due diligence to attempt a connection but still failing.

I’m trying to connect my HELTEC ESP32-S3 (QFN56) (revision v0.2) (ESP32-S3 V3) to my RAK wireless RAK7289V2 connected to TTN but so far failing.

Here is my code:

#include <LoRa.h>

// SPI Pin Configuration for Heltec LoRa 32 V3
#define LORA_SCK 9    // SCK pin
#define LORA_MISO 11  // MISO pin
#define LORA_MOSI 10  // MOSI pin
#define LORA_SS 8    // SS pin
#define LORA_RST 12   // RST pin
#define LORA_DIO0 14  // DIO0 pin
#define LORA_BAND 915E6 // Frequency for your region

void setup() {
  Serial.begin(115200);
  while (!Serial);

  // Step 1: Basic Serial Communication
  Serial.println("Step 1: Basic Serial Communication - Success!");

  // Step 2: Initialize SPI
  Serial.println("Step 2: Initializing SPI...");

  // Check each pin individually
  Serial.print("Configuring SCK pin: ");
  Serial.println(LORA_SCK);
  pinMode(LORA_SCK, OUTPUT);
  Serial.println("SCK pin configured successfully.");

  Serial.print("Configuring MISO pin: ");
  Serial.println(LORA_MISO);
  pinMode(LORA_MISO, INPUT);
  Serial.println("MISO pin configured successfully.");

  Serial.print("Configuring MOSI pin: ");
  Serial.println(LORA_MOSI);
  pinMode(LORA_MOSI, OUTPUT);
  Serial.println("MOSI pin configured successfully.");

  Serial.print("Configuring SS pin: ");
  Serial.println(LORA_SS);
  pinMode(LORA_SS, OUTPUT);
  Serial.println("SS pin configured successfully.");

  // Initialize SPI
  SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_SS);
  Serial.println("SPI initialized.");

  // Step 3: Initialize LoRa
  Serial.println("Step 3: Initializing LoRa...");

  // Set LoRa pins
  Serial.print("Configuring RST pin: ");
  Serial.println(LORA_RST);
  pinMode(LORA_RST, OUTPUT);
  Serial.println("RST pin configured successfully.");

  Serial.print("Configuring DIO0 pin: ");
  Serial.println(LORA_DIO0);
  pinMode(LORA_DIO0, INPUT);
  Serial.println("DIO0 pin configured successfully.");

  // Set LoRa pins in the library
  Serial.println("Setting LoRa pins...");
  LoRa.setPins(LORA_SS, LORA_RST, LORA_DIO0);
  
  // Initialize LoRa
  Serial.println("Calling LoRa.begin (LORA_BAND)...");
  if (!LoRa.begin(LORA_BAND)) {
    Serial.println("Starting LoRa failed (LORA_BAND)!");
    while (1);
  }
  Serial.println("LoRa Initial setup done.");

  // Send a simple message
  Serial.println("Sending packet: Hello LoRa");

  // Start packet
  if (LoRa.beginPacket()) {
    Serial.println("LoRa packet begun");
  } else {
    Serial.println("Failed to begin LoRa packet");
  }

  // Write packet content
  LoRa.print("Hello LoRa");
  Serial.println("LoRa packet content written");

  // End packet
  if (LoRa.endPacket()) {
    Serial.println("LoRa packet sent");
  } else {
    Serial.println("Failed to send LoRa packet");
  }

  // Blink LED to indicate success
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, HIGH);
}

void loop() {
  // Blink LED to indicate loop is running
  digitalWrite(LED_BUILTIN, HIGH);
  delay(1000);
  digitalWrite(LED_BUILTIN, LOW);
  delay(1000);
}

And the error seems to be when trying to initialize (LORA_BAND) here:

  Serial.println("Calling LoRa.begin (LORA_BAND)...");
  if (!LoRa.begin(LORA_BAND)) {
    Serial.println("Starting LoRa failed (LORA_BAND)!");
    while (1);

Here is the output:

18:27:55.432 -> load:0x403c9700,len:0x4

18:27:55.432 -> load:0x403c9704,len:0xad0

18:27:55.432 -> load:0x403cc700,len:0x29d8

18:27:55.432 -> entry 0x403c9880

18:27:55.530 -> Step 1: Basic Serial Communication - Success!

18:27:55.530 -> Step 2: Initializing SPI...

18:27:55.530 -> Configuring SCK pin: 9

18:27:55.530 -> SCK pin configured successfully.

18:27:55.530 -> Configuring MISO pin: 11

18:27:55.530 -> MISO pin configured successfully.

18:27:55.530 -> Configuring MOSI pin: 10

18:27:55.563 -> MOSI pin configured successfully.

18:27:55.563 -> Configuring SS pin: 8

18:27:55.563 -> SS pin configured successfully.

18:27:55.563 -> SPI initialized.

18:27:55.563 -> Step 3: Initializing LoRa...

18:27:55.563 -> Configuring RST pin: 12

18:27:55.563 -> RST pin configured successfully.

18:27:55.563 -> Configuring DIO0 pin: 14

18:27:55.563 -> DIO0 pin configured successfully.

18:27:55.563 -> Setting LoRa pins...

18:27:55.563 -> Calling LoRa.begin (LORA_BAND)...

18:27:55.596 -> Starting LoRa failed (LORA_BAND)!

PIN configuration seems to be succesful.

Thanks in advanced for your help. I’m using Arduino IDE - Version: 2.3.2

Hi @raver38, I see you are using the LoRa library, which is for just plain Point2Point LoRa, not LoRaWAN. Heltec provides their own version of a LoRaWAN library which is years and years old. You’re probably best off having a go at RadioLib.