F
Here is a minimal example that show the problem.
Expansion board V3.1 + Lopy4
Platform IO / C++
#include <SPI.h>
#include <LoRa.h>
int counter = 0;
#define LORA_SCK 5 // GPIO5 -- SX1278's SCK
#define LORA_MISO 19 // GPIO19 -- SX1278's MISO
#define LORA_MOSI 27 // GPIO27 -- SX1278's MOSI
#define LORA_SS 18 // GPIO18 -- SX1278's CS
#define LORA_RST 23 // GPIO14 -- SX1278's RESET
#define LORA_DI0 26 // GPIO26 -- SX1278's IRQ(Interrupt Request)
//#define LORA_DI0 33 // GPIO26 -- SX1278's IRQ(Interrupt Request)
#define LORA_FREQ_BAND 433E6
void setup() {
Serial.begin(115200);
while (!Serial);
Serial.println("Init LoRa Sender");
SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_SS);
LoRa.setPins(LORA_SS, LORA_RST, LORA_DI0);
if (!LoRa.begin(LORA_FREQ_BAND)) {
Serial.println("Starting LoRa failed!");
while (1);
}
// set spread factor
LoRa.setSpreadingFactor(8); // defaults to 7, supported values are between 6 and 12
LoRa.setTxPower(17); // TX power in dB, defaults to 17 - value from 2 to 20
LoRa.setSignalBandwidth(125E3); // defaults to 125E3. Supported values are 7.8E3, 10.4E3, 15.6E3, 20.8E3, 31.25E3, 41.7E3, 62.5E3, 125E3, and 250E3
// LoRa.setCodingRate4(codingRateDenominator); // defaults to 5, Supported values are between 5 and 8, these correspond to coding rates of 4/5 and 4/8. The coding rate numerator is fixed at 4.
// LoRa.enableCrc(); // LoRa.disableCrc(); // by default a CRC is not used.
}
void loop() {
Serial.print("Sending packet: ");
Serial.println(counter);
Serial.println("start to send packet ... ");
// send packet
LoRa.beginPacket();
LoRa.print(millis());
LoRa.print(" ");
LoRa.print(counter);
LoRa.print(" abcdefghijklmnopqrstuvwxyz");
LoRa.endPacket();
delay(1000);
Serial.print("packet sent... ");
counter++;
}