sandeepmistry / arduino-LoRa

An Arduino library for sending and receiving data using LoRa radios.
MIT License
1.67k stars 633 forks source link

Connecting two LoRa Module to Arduino Mega #174

Closed CodeHub-Anup closed 6 years ago

CodeHub-Anup commented 6 years ago

Hi, I tried connecting two rfm95 modules to arduino mega. I have used the same SPI pins but different SS, RST and interrupt pins. I defined a new Lora class and set the new SPI pins using the new lora class, but .begin() throws up an error? Is there any way to achieve this?

morganrallen commented 6 years ago

What's the error? Can you provide example code?

CodeHub-Anup commented 6 years ago
const char csPin = 10;          // LoRa radio chip select
const char resetPin = 9;       // LoRa radio reset
const char irqPin = 2;         // change for your board; must be a hardware interrupt pin

const char csPin2 = 8;          // LoRa radio chip select
const char resetPin2 = 7;       // LoRa radio reset
const char irqPin2 = 3;         // change for your board; must be a hardware interrupt pin
LoRaClass LoRaT;

void setup() {
  Serial.begin(9600);

  Serial.println("LoRa Receiver");
  LoRa.setPins(csPin, resetPin, irqPin);

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

  LoRaT.setPins(csPin2, resetPin2, irqPin2);

  int v = LoRaT.begin(866E6);
  if (!v) {
    Serial.println(v);
    Serial.println("Starting LoRa Two failed!");
    while (1);
  }

The Output is:

LoRa Receiver
0
Starting LoRa Two failed!
sandeepmistry commented 6 years ago

If you try just the second set of pins on the regular LoRa does it work?

CodeHub-Anup commented 6 years ago

Yes.

sandeepmistry commented 6 years ago

Have you tried an 3.3V external power supply?

What does LoRa.dumpRegisters(Serial) and LoRaT.dumpRegisters(Serial) output?

sandeepmistry commented 6 years ago

Closing this for now due to lack of activity.