ricaun / LoRaNow

LoRaNow Library is a simple LoRa Node <> Gateway communication protocol.
http://loranow.com/
MIT License
63 stars 21 forks source link

ttgo lora 32 got problems #4

Closed halukmy closed 5 years ago

halukmy commented 5 years ago

i just set LoRa.setPins(18, 26); // set CS, reset, IRQ pin

. Connected to sungerbob IP address: 192.168.0.25 HTTP server started LoRa init failed. Check your connections.

ricaun commented 5 years ago

The right command should be LoRaNow.setPins(18, 26); And by default, the esp32 board autoselect the pins CS 18 and DIO0 26. You dont need to set the pins. Just run the example and should work. =D

halukmy commented 5 years ago

nope :( i tried all of them........ damn :D not works

halukmy commented 5 years ago

in other framework i made it with

define SCK 5 // GPIO5 -- SX1278's SCK

define MISO 19 // GPIO19 -- SX1278's MISO

define MOSI 27 // GPIO27 -- SX1278's MOSI

define SS 18 // GPIO18 -- SX1278's CS

define RST 14 // GPIO14 -- SX1278's RESET

define DI0 26 // GPIO26 -- SX1278's IRQ(Interrupt Request)

while (!Serial) ;
SPI.begin(SCK, MISO, MOSI, SS);
LoRa.setPins(SS, RST, DI0); // set CS, reset, IRQ pin
ricaun commented 5 years ago

Are you selecting the right board ?! This pinout is from Heltec Wifi LoRa 32 (V2)

Try this code!

#define SCK 5 // GPIO5 -- SX1278's SCK
#define MISO 19 // GPIO19 -- SX1278's MISO
#define MOSI 27 // GPIO27 -- SX1278's MOSI
#define SS 18 // GPIO18 -- SX1278's CS
#define DI0 26 // GPIO26 -- SX1278's IRQ(Interrupt Request)

SPI.begin(SCK, MISO, MOSI, SS);
LoRaNow.setPins(SS, DI0);

if (!LoRaNow.begin()) {
    Serial.println("LoRa init failed. Check your connections.");
    while (true);
  }
halukmy commented 5 years ago

https://www.aliexpress.com/item/TTGO-ESP32-SX1276-LoRa-868-915MHz-Bluetooth-WI-FI-Lora-Internet-Antenna-Development-Board-for-Arduino/32845370112.html?spm=a2g0s.9042311.0.0.2d154c4dkQMhnk

this is of board i try,

it works on old sample, but on your lib i got problem i dont know why

ricaun commented 5 years ago

Did you manage to work with the last release of the arduino-LoRa you can try my repository is basically the same!

Try this example.

#include <SPI.h>              // include libraries
#include <LoRa.h>

#define SCK 5 // GPIO5 -- SX1278's SCK
#define MISO 19 // GPIO19 -- SX1278's MISO
#define MOSI 27 // GPIO27 -- SX1278's MOSI
#define SS 18 // GPIO18 -- SX1278's CS
#define DI0 26 // GPIO26 -- SX1278's IRQ(Interrupt Request)

void setup() {
  Serial.begin(115200);
 while (!Serial);
  SPI.begin(SCK, MISO, MOSI, SS);
  LoRa.setPins(SS, -1, DI0);
  while (!LoRa.begin()) {
    Serial.println("LoRa init failed. Check your connections.");
  }
  Serial.println("LoRa init OK!");
  LoRa.dumpRegisters(Serial);
}

void loop() {

}

Should work, I really don't know what's wrong =(

halukmy commented 5 years ago

im going to try, do you have skype or insatnt message like whatsapp?

halukmy commented 5 years ago

this one worked well btw :)

ricaun commented 5 years ago

im going to try, do you have skype or insatnt message like whatsapp?

Add me on Skype: luizcassettari

Try this example.

#include <LoRaNow.h>

#define SCK 5 // GPIO5 -- SX1278's SCK
#define MISO 19 // GPIO19 -- SX1278's MISO
#define MOSI 27 // GPIO27 -- SX1278's MOSI
#define SS 18 // GPIO18 -- SX1278's CS
#define DIO0 26 // GPIO26 -- SX1278's IRQ(Interrupt Request)

void setup() {
  Serial.begin(115200);
  Serial.println("LoRaNow SetPins");
  while (!Serial);
  SPI.begin(SCK, MISO, MOSI, SS);
  LoRaNow.setPins(SS, DIO0);
  while (!LoRaNow.begin()) {
    Serial.println("LoRa init failed. Check your connections.");
  }
  Serial.println("LoRa init OK!");
  LoRa.dumpRegisters(Serial);
}

void loop() {

}
ricaun commented 5 years ago

Hello, The new version has this function LoRaNow.setPinsSPI(SCK, MISO, MOSI, SS, DIO0); Can help to make the code more clear.