Grove LoRa 433 not working on Mega 2560

Hi

I’ve been playing around with the Grove Lora 433 for a while, and tought to give it a go on my Arduino mega. I’m using the client example, same code as on my Arduino Uno (which works great). But on my mega I get the following message:

RF95 client test.
0
init failed

Heres the code (I only changed pins to 3,4 instead of 5,6)

// rf95_client.pde
// -- mode: C++ --
// 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 rf95_server
// Tested with Anarduino MiniWirelessLoRa

#include <SoftwareSerial.h>
#include <RH_RF95.h>

// Singleton instance of the radio driver
SoftwareSerial ss(3, 4);
RH_RF95 rf95(ss);

void setup()
{
Serial.begin(115200);
Serial.println(“RF95 client test.”);

if (!rf95.init())
{
Serial.println(“init failed”);
while(1);
}

// Defaults after init are 434.0MHz, 13dBm, Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on

// The default transmitter power is 13dBm, using PA_BOOST.
// If you are using RFM95/96/97/98 modules which uses the PA_BOOST transmitter pin, then
// you can set transmitter powers from 5 to 23 dBm:
//rf95.setTxPower(13, false);

rf95.setFrequency(434.0);
}

void loop()
{
Serial.println(“Sending to rf95_server”);
// Send a message to rf95_server
uint8_t data = “Hello World!”;
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);
}
else
{
Serial.println(“recv failed”);
}
}
else
{
Serial.println(“No reply, is rf95_server running?”);
}

delay(1000);
}

Anyone who knows whats causing this?

I have tried a few other megas, and changed pins to 30,31, and default 5,6 too.

Why would you use SoftwareSerial on a Mega when it has 3 spare HardwareSerial ports that work much better?

And please modify your Post to use the code button <> for your code rather than the quote button.

…R

Stigern:
Heres the code (I only changed pins to 3,4 instead of 5,6)

Anyone who knows whats causing this?

I have tried a few other megas, and changed pins to 30,31, and default 5,6 too.

Did you check the documentation on Softserial to see which pins on the Mega support softserial ?

Although why you would use software serial when the Mega has 3 spare hardware serial ports I do not understand.

// you can set transmitter powers from 5 to 23 dBm:

In PA_LF and PA_HF modes you can set power to -4dBm to 15dBm.

In PA_HP mode, which uses the RF output on the PA_Boost pin, you can set power to between 2dBm and 17dBm. There is then a seperate option to set power to 20dBm.

Suspect whoever wrote that is 'confused' about the implications of the PA_Boost RF output.