Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arduino MEGA getting "starting LORA Failed" #205

Closed
Flavio-da-Brescia opened this issue Nov 28, 2018 · 26 comments
Closed

Arduino MEGA getting "starting LORA Failed" #205

Flavio-da-Brescia opened this issue Nov 28, 2018 · 26 comments

Comments

@Flavio-da-Brescia
Copy link

Hello and thank you in advance for the help. I have Arduino Mega and Lora-02 module.

The Module works fine with Arduino UNO, as I tried, but when I wire it to the Arduino Mega it is not able to communicate with the module.

I wired it like this:

LORA------------MEGA

MOSI------------51
SCK-------------52
MISO-----------50
NSS-------------10
RESET-----------9
DIO0-------------2

I am using SPI.h and LoRa.h Library

What can be the reason? Thank you.

@morganrallen
Copy link
Collaborator

@Flavio-da-Brescia
Copy link
Author

Yes I am calling it, and it works with UNO, I can arbitrarily choose them.
But not with MEGA. Did you personally ever manage to do it with Arduino Mega?

/*
 
The transmitter code arduino for sending data packet lora radio module 433MHz  ra02 lora
 
*/
 
#include <SPI.h> // arduino spi library
 
#include <LoRa.h> // arduino libraries ra02 lora

int counter = 0;
 
void setup() {



 LoRa.setPins(10, 9, 2);//NSS, NRESET, and DIO0 pins can be changed by using LoRa.setPins(ss, reset, dio0).
  Serial.begin(9600);
 
  while (!Serial);
 
  Serial.println("LoRa Sender");
 
  if (!LoRa.begin(433E6)) {
 
    Serial.println("Starting LoRa failed!");
 
    while (1);
 
  }
 
 LoRa.setSpreadingFactor(10);
 
 LoRa.setSignalBandwidth(62.5E3);
 
 LoRa.crc();


 
 
}
 
void loop() {
 
  Serial.print("Sending packet: ");
 
  Serial.println(counter);
 
   // send packet
 
  LoRa.beginPacket();
 
  LoRa.print("Halo Like Circuit");
 
  Serial.println(counter);
 
  LoRa.endPacket();
 
  counter++;
 
  delay(2000);
 
}

@Flavio-da-Brescia
Copy link
Author

By the way I also tried with 3 different Mega, even a brand new one, and I still get no commmunication

@Flavio-da-Brescia
Copy link
Author

Ok I solved it. I simply forgot to connect the 5V of the logic converter. My bad. Thank you very much for all your support

@ranaahtishamali
Copy link

Ok I solved it. I simply forgot to connect the 5V of the logic converter. My bad. Thank you very much for all your support

Please can you upload the circuit diagram of it. its not working!

@feras33
Copy link

feras33 commented Mar 19, 2020

hello everyone
i am using lora sx1278 ra-02 , and i have tried this method with connecting exactly the same as mention above .Unfortunately it still not working i dont know why can any one help ?.

@IoTThinks
Copy link
Collaborator

@feras33 Why dont you create a new thread?

@ranaahtishamali
Copy link

hello everyone
i am using lora sx1278 ra-02 , and i have tried this method with connecting exactly the same as mention above . Unfortunately it still not working i dont know why can any one help ?.

Send your circuit diagram.

@feras33
Copy link

feras33 commented Mar 24, 2020

I wired it like this:

LORA------------MEGA

MOSI------------51
SCK-------------52
MISO-----------50
NSS-------------10
RESET-----------9
DIO0-------------2

I am using SPI.h and LoRa.h Library
Same as it is mentioned in this thread

@ranaahtishamali
Copy link

Attach DIO1 to 3.
Is your lora module of 433mhz?

@feras33
Copy link

feras33 commented Mar 25, 2020

Yes it is 433MHZ

@feras33
Copy link

feras33 commented Mar 25, 2020

I have changed the frequency in the code from the library

@agisyahrain
Copy link

do you have source code for the receiver? and using arduino mega too?

@IoTThinks
Copy link
Collaborator

IoTThinks commented Apr 15, 2020

Your mapping to SS to 10 may be wrong.
LoRa - Mega 2560
MISO - 50
MOSI - 51
SCK - 52
SS - 53
RST - 9
DIO0 - 8 ( I always want to avoid using GPIO 0 and 2)

Ah, 3.3v in Mega said up to 50mA!!!! => LoRa may need up to 100mA => You may not have enough power to send packets far. Try to use external power.

GND - GND

And add the two magic lines:

  pinMode(LORA_SS, OUTPUT);
  digitalWrite(LORA_SS, HIGH);  

image

Full of my code

#include <SPI.h> // arduino spi library
#include <LoRa.h> // arduino libraries ra02 lora

#define LORA_SS 53
#define LORA_RST 9
#define LORA_DIO0 8

int counter = 0;
void setup() {
// SS, RST, DIO0
pinMode(LORA_SS, OUTPUT);
digitalWrite(LORA_SS, HIGH);

LoRa.setPins(LORA_SS, LORA_RST, LORA_DIO0);
Serial.begin(115200);

while (!Serial);
Serial.println("LoRa Sender");

if (!LoRa.begin(433E6)) {
Serial.println("Starting LoRa failed!");
while (1);
}

// LoRa.setSpreadingFactor(10);
// LoRa.setSignalBandwidth(62.5E3);
}

void loop() {
Serial.print("Sending packet: ");
Serial.println(counter);

// send packet
LoRa.beginPacket();
LoRa.print("Halo Like Circuit");
Serial.println(counter);
LoRa.endPacket();
counter++;
delay(2000);

}

@IoTThinks
Copy link
Collaborator

I'm too lazy to write a receiver so I turn on my SDR.
Something is sending at 433Mhz. in the middle.
Hope it works for you guys.

image

@IoTThinks
Copy link
Collaborator

Overview of my physical wiring.
image

@alfantamamy
Copy link

Overv- iew of my physical wiring.
image

I tried too, but still not working. I used arduino mega as transmitter, and uno as receiver. Both are using lora.

@alfantamamy
Copy link

Overview of my physical wiring.
image

WhatsApp Image 2020-04-16 at 10 44 28 PM
my physical wiring

@IoTThinks
Copy link
Collaborator

As an IT, define "not working".

@alfantamamy
Copy link

As an IT, define "not working".

Starting Lora Failed

@IoTThinks
Copy link
Collaborator

Did you put this in front of LoRa.begin()

 pinMode(LORA_SS, OUTPUT);
 digitalWrite(LORA_SS, HIGH); 

If still failed, your LoRa is likely faulty.
Beware that LoRa is 3.3v.

@alfantamamy
Copy link

Did you put this in front of LoRa.begin()

 pinMode(LORA_SS, OUTPUT);
 digitalWrite(LORA_SS, HIGH); 

If still failed, your LoRa is likely faulty.
Beware that LoRa is 3.3v.

Already, previously I tried to connect LoRa with arduino uno, it works to sending data, which is my LoRa is good. But I tried to connect arduino mega, failed.

*I copied your code, and your set pins to my project

@IoTThinks
Copy link
Collaborator

What GPIO you use to connect to NSS/SS of LoRA?

@alfantamamy
Copy link

Digital pin 53

@IoTThinks
Copy link
Collaborator

IoTThinks commented Apr 17, 2020

Try to use external 3.3v for LoRa
If still failed then you have to rely on your own already.
Very likely some error on your side or your board.

@JanRealAcc
Copy link

JanRealAcc commented Mar 24, 2023

Hehe just found out the solution to this problem. It was LoRa.h that make this error. Just change the SS 10 to 53 if you wish to use arduino mega.

image

There's another method, but I prefer the 1st method. Read the notepad.

image

Hope it helps :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants