I’ve seen a few posts on this forum where folks ask for help with setting up point-to-point LoRa on the SparkFun LoRa Gateway - 1-Channel, and they inevitably seem to post back days later saying “never mind, I figured it out” ([example). If anyone has functional code for transmitting and receiving point-to-point on this device and they’d be willing to share it, I’d greatly appreciate it. Some things I’ve tried without success:
The RadioLib library and the SX127x examples (I can’t figure out the right pin combination and the Module definition and the examples seem to be inconsistent)
The RadioHead library, which won’t compile due to this error: “fatal error: util/atomic.h: No such file or directory” (I believe the reason is ESP32-related, but I’m far from an expert)
The LoRA library, where again I believe I’m having an issue with pin combinations
Per my interpretation of the [schematic, I’m using Pin 27 for NSS, 0 for reset, and 11 for DIO0.
I was indeed choosing the wrong pins, so I want to document what did work for me here so others have a reference. I used the LoRa by Sandeep Mistry, version 0.7.2, and modified the LoRaSender and LoRaReceiver examples slightly:
#include <SPI.h>
#include <LoRa.h>
void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println("LoRa Receiver");
LoRa.setPins(16, 0, 26); // ss, rst, dio0
if (!LoRa.begin(915E6)) {
Serial.println("Starting LoRa failed!");
while (1);
}
}
void loop() {
// try to parse packet
int packetSize = LoRa.parsePacket();
if (packetSize) {
// received a packet
Serial.print("Received packet '");
// read packet
while (LoRa.available()) {
Serial.print((char)LoRa.read());
}
// print RSSI of packet
Serial.print("' with RSSI ");
Serial.println(LoRa.packetRssi());
}
}
My modification was to add the LoRa.setPins(16, 0, 26) line to both scripts. I was indeed reading the schematic wrong for the select and interrupt pins, but the other important part was setting reset to Pin 0. This was based on the dialogue [here about the lack of a reset pin on the SparkFun LoRa Gateway - 1-Channel. Hope this helps someone else!](https://forum.sparkfun.com/viewtopic.php?f=117&t=51672)