Arduino LoRa RH_RF95 SF change

Hi guys,

So i have a problem.

I have an Arduino mega with a LoRa Shield

and i can't use SF12, up to SF 10 is fine tho and i dont know why.

However my real problem is on an Arduino Due that i have set up with a Lora_BEE

I am using RadioHead Simple LoRa Client to connect to the Dragino LG01-N Gateway

I am in the EU so the frequency i use is ISM 868 MHz

/*
  LoRa Simple Client for Arduino :
  Support Devices: LoRa Shield + Arduino 
  
  Example sketch showing how to create a simple messageing client, 
  with the RH_RF95 class. RH_RF95 class does not provide for addressing or
  reliability, so you should only use RH_RF95 if you do not need the higher
  level messaging abilities.

  It is designed to work with the other example LoRa Simple Server
  User need to use the modified RadioHead library from:
  https://github.com/dragino/RadioHead

  modified 16 11 2016
  by Edwin Chen <support@dragino.com>
  Dragino Technology Co., Limited
*/

#include <SPI.h>
#include <RH_RF95.h>

// Singleton instance of the radio driver
RH_RF95 rf95;

//The parameter are pre-set for 868Mhz used. If user want to use lower frenqucy 433Mhz.Better to set 
//rf95.setSignalBandwidth(31250);
//rf95.setCodingRate4(8);
float frequency = 868.1;

int i=0;


void setup() 
{
  Serial.begin(9600);
  //while (!Serial) ; // Wait for serial port to be available
  Serial.println("Start LoRa Client");
  if (!rf95.init())
    Serial.println("init failed");
  // Setup ISM frequency
  rf95.setFrequency(frequency);
  // Setup Power,dBm
  rf95.setTxPower(13);

  // Setup Spreading Factor (6 ~ 12)
  rf95.setSpreadingFactor(10);
  
  // Setup BandWidth, option: 7800,10400,15600,20800,31250,41700,62500,125000,250000,500000
  //Lower BandWidth for longer distance.
  rf95.setSignalBandwidth(125000);
  
  // Setup Coding Rate:5(4/5),6(4/6),7(4/7),8(4/8) 
  rf95.setCodingRate4(5);

  rf95.setSyncWord(0x34);
  /*
  //Different Combination for distance and speed examples: 
  Example 1: Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on. Default medium range
    rf95.setSignalBandwidth(125000);
    rf95.setCodingRate4(5);
    rf95.setSpreadingFactor(7);
  Example 2: Bw = 500 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on. Fast+short range
    rf95.setSignalBandwidth(500000);
    rf95.setCodingRate4(5);
    rf95.setSpreadingFactor(7);
  Example 3: Bw = 31.25 kHz, Cr = 4/8, Sf = 512chips/symbol, CRC on. Slow+long range
    rf95.setSignalBandwidth(31250);
    rf95.setCodingRate4(8);
    rf95.setSpreadingFactor(9);
  Example 4: Bw = 125 kHz, Cr = 4/8, Sf = 4096chips/symbol, CRC on. Slow+long range
    rf95.setSignalBandwidth(125000);
    rf95.setCodingRate4(8);
    rf95.setSpreadingFactor(12); 
  */
}

void loop()
{
 if(Serial.read()=='r'){i=0;}
  if(i<20){
    i++;
  Serial.println("Sending to LoRa Server");
  Serial.println(i);
  // Send a message to LoRa Server
  // 331 bytes de Lorem Ipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer a leo sed orci vestibulum maximus et id lacus. Mauris vestibulum ac lacus suscipit suscipit. Morbi non neque urna. Proin id sodales risus. Nullam vulputate ligula nulla, a condimentum justo fermentum id. Nullam semper elementum nibh, quis convallis risus mattis vel."
  uint8_t data[] = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer a leo sed orci vestibulum maximus et id lacus.";
  rf95.send(data, sizeof(data));

  
  rf95.waitPacketSent();
  /*// Now wait for a reply
  
  uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
  uint8_t len = sizeof(buf);

  if (rf95.waitAvailableTimeout(3000))
  { 
    // Should be a reply message for us now   
    if (rf95.recv(buf, &len))
   {
      Serial.print("got reply: ");
      Serial.println((char*)buf);
      Serial.print("RSSI: ");
      Serial.println(rf95.lastRssi(), DEC);    
    }
    else
    {
      Serial.println("recv failed");
    }
  }
  else
  {
    Serial.println("No reply, is LoRa server running?");
  }*/
  delay(5000);
}}

When i try to change the SF it fails to init and i dont know why.

Adicional info

Code from RadioHead Library

Arduino due RFM95/96/97/98
/// GND----------GND (ground in)
/// 3V3----------3.3V (3.3V in)
/// interrupt 0 pin D2----------DIO0 (interrupt request out)
/// pin D3----------DIO1
/// pin D5----------RESET
/// SS pin D10----------NSS (CS chip select in)
/// SCK pin PSI3----------SCK (SPI clock in)
/// MOSI pin PSI4----------MOSI (SPI Data in)
/// MISO pin PSI1----------MISO (SPI Data out)

As standard that Dragino is configured to accept connections from a LoRaWAN compatible client\node.

The RadioHead library is not for use with LoRaWAN.

Hi @aalves:

Do you resolve your problem?? I have similar situation.

Regards