0

Here there, recently I am testing Lora Ra-02 module I saw many videos and it is easy to set up, according to this schematic:

LoRa SX1278 Module-----Arduino Nano Board

3.3V-------

Gnd---------Gnd

En/Nss------D10

G0/DIO0------D2

SCK---------D13

MISO----------D12

MOSI----------D11

RST-------------D9

I am using a very common library called sandeepmistry. and I tried this code:

#include <SPI.h>
#include <LoRa.h>
int counter = 1;
void setup() {
 Serial.begin(9600);
 while (!Serial);
 Serial.println("LoRa Sender");
 if (!LoRa.begin(433E6)) {
 Serial.println("Starting LoRa failed!");
 while (1);
 }
}
void loop() {
 Serial.print("Sending packet: ");
 Serial.println(counter);
 // send packet
 LoRa.beginPacket();
 LoRa.print("hello ");
 LoRa.print(counter);
 LoRa.endPacket();
 counter++;
 delay(500);
}

When I run it, it just sticks in this line {Serial.println("Starting LoRa failed!");}

Then I updated the code and tried to reduce the SPI Frequency because I am using Arduino Nano now the code is this:

#include <SPI.h>
#include <LoRa.h>
int counter = 1;
int frequency = 8E6; // Set the desired frequency here
void setup() {
 Serial.begin(9600);
 while (!Serial);
 Serial.println("LoRa Sender");
 LoRa.setSPIFrequency(frequency); // Add the missing semicolon here
 if (!LoRa.begin(433E6)) {
 Serial.println("Starting LoRa failed!");
 while (1);
 }
}
void loop() {
 Serial.print("Sending packet: ");
 Serial.println(counter);
 // send packet
 LoRa.beginPacket();
 LoRa.print("hello ");
 LoRa.print(counter);
 LoRa.endPacket();
 counter++;
 delay(500);
}

This code passes the line Starting LoRa failed! but it again stuck in here

LoRa Sender Sending packet: 1

So why won't it do LoRa.beginPacket(); and loop the code? Why does it stop here?

dda
1,5951 gold badge12 silver badges17 bronze badges
asked Jul 21, 2023 at 21:24

2 Answers 2

0

Have you set the pins properly? Try doing:

 LoRa.setPins(csPin, resetPin, irqPin);// set CS, reset, IRQ pin

There is a problem with the way your SX1276 is connected to the board, which is why .begin() returns false.

answered Sep 23, 2023 at 16:15
1
  • By saying csPin - do you mean SS pin?? and irq - DIO0 pin? Commented Nov 17, 2024 at 10:39
-1

From my experience, I was facing exact same error!!

After reviewing lot of forums and troubleshooting session, I've identified the root cause - I was connecting the Arduino Uno / Nano board to my laptop which was receiving a 5V supply. As Arduino boards (when connected to higher current source), always supplies 5V power from the 3.3V pin, in my case the LoRa module was receiving 5V power supply!! As the LoRa module can't handle the 5V power, it was throwing error.

After using a Level Shifter and connecting to Arduino Nano board, I was able to fix the error!!

Hoping my response would be helpful for someone facing similar issue!!

answered Nov 23, 2024 at 12:03
9
  • 1
    you have a board which has 5 V on pin labeled as 3.3 V pin? that is very wrong. Commented Nov 23, 2024 at 12:24
  • @Juraj - I've an official arduino board, can't say the incorrect pin issue. However, It was mentioned in the Official Arduino forums that 3.3V pin emits 5V if connected to higher current - please follow this link - forum.arduino.cc/t/using-lora-with-arduino-nano/1266604 Commented Nov 23, 2024 at 12:41
  • you misunderstood one or more things there. 1) io pins are 5 V. 2) 3.3 V pin can't supply enough current Commented Nov 23, 2024 at 14:08
  • FYI - forum.arduino.cc/t/using-lora-with-arduino-nano/1266604/15 Commented Nov 23, 2024 at 14:58
  • @Juraj Could you please elaborate ?? if either 5V or 3.3V can't supply enough current, then why are we connecting 3.3V arduino pin with 3.3V pin LoRa ?? Commented Nov 23, 2024 at 14:58

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.