sandeepmistry / arduino-LoRa

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

LoRa.begin() fails when using SD. #266

Closed horellana closed 5 years ago

horellana commented 5 years ago

I have an arduino nano with a lora antenna connected with a SD module. The following code fails when the SD Module is connected to the arduino:

void setup() {

  Serial.begin(9600);
  while (!Serial);

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

   Serial.begin(9600);
   if (!SD.begin(4)) {
     Serial.println("SD Init failed");
  }

  LoRa.setSpreadingFactor(10);
  LoRa.setSignalBandwidth(255E3);
 LoRa.crc();
}

With the message: Starting LoRa failed.

Lora is using SS 10, SD is using SS 4.

morganrallen commented 5 years ago

You probably need to call setPins, reopen if this doesn't fix your issue.