ESP32 Thing Plus with Adafruit RFM95W LoRa Radio Transceiver Breakout: RadioHead RH_RF95() init

Hello,

I know this forum is related to Sparkfun products, but I have a ESP32 Thing plus that I’m using as a microcontroller. I’m controlling the Adafruit RFM95W LoRa Radio Transceiver Breakout as a peripheral using RadioHead.h library. This library controls the LoRa board via SPI, and its instance RH_RF95() takes in three parameters. The chip select, IRQ (interrupt), and SPI object pointer. The third parameter is option but will default to Arduino’s SPI pins.

My issue is that I’m creating an instance from RadioHead library with RH_RF95() rf, but when I use the rf.init() function, my init fails. I’m suspecting the issue is with pins

Arduino has different SPI pins than ESP32, and I was trying to change the SPI pins in RadioHead.h library. However, they don’t seem to set the SPI pins manually at all. I double checked all my pins in ESP32, and ensured the pin numbers I entered match the wires. If anyone can help, I’d be very happy. Here’s the code I’m using:

#include <RH_RF95.h>

#include

#include <SPI.h>

#include <RHGenericSPI.h>

using namespace std;

#define RFM95_SS 16

#define RFM95_RST 17

#define RFM95_INT 21

#define RF95_FREQ 915.0

RH_RF95 rf95(RFM95_SS, RFM95_INT);

void setup() {

// Manual reset for the LoRa board

pinMode(RFM95_RST, OUTPUT);

digitalWrite(RFM95_RST, HIGH);

delay(10);

digitalWrite(RFM95_RST, LOW);

delay(10);

digitalWrite(RFM95_RST, HIGH);

delay(10);

Serial.begin(9600);

while (!rf95.init()) {

Serial.println(“LoRa radio init failed”); // This is what I get on the Serial windows!!!

while (1);

}

if (!rf95.setFrequency(RF95_FREQ)) {

Serial.println(“setFrequency failed”);

while (1);

}

rf95.setTxPower(23, false);

}

void loop(){

string message = “This is a test”;

Serial.println(“Test”);

//Send the Message

rf95.send((uint8_t*) message.c_str(), strlen(message.c_str()));

rf95.waitPacketSent();

}

By the way I’m trying to do the same thing with https://randomnerdtutorials.com/esp32-l … duino-ide/, but Sparkfun ESP32 doesn’t work with it.