sandeepmistry / arduino-LoRa

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

LoRa library incompatibilities with SD Card. #634

Closed mariolopezp closed 1 year ago

mariolopezp commented 1 year ago

Good Morning,

I am developing a university project that consists on connecting two LoRa nodes, where the sender gathers data from different sensors and sends it to the receiver, that is connected to a PC that processes the data received.

In this project, I thought it would be nice to use the SD card slot that is already embedded in the TTGO-LoRa32-V2.1 board to have a more resilient system in case there are interferences or the radio interface fails. What I found out, is that both the SD library and Sd_fat library collide with the LoRa library, so I am unable to add this functionality to my project. I checked that the pins of the LoRa SPI interface and the SD SPI interface dont collide. Is there anything I am doing wrong, or that I should take into account? Or it is actually incompatible to use both the LoRa and SD capabilities of the board at the same time?

Thank you very much.

morganrallen commented 1 year ago

This is usually an issue of both libraries trying to use the global SPI.

Have a look at the documentation for setSPI https://github.com/sandeepmistry/arduino-LoRa/blob/master/API.md#set-spi-interface

There are also several usage example in the issues for additional help on using.

mariolopezp commented 1 year ago

I have tried my code now making the changes you said and it worked perfectly. The mistake I was making was exactly what you explained there. Thank you very much!

morganrallen commented 1 year ago

Glad to hear!