Hi, I’m using Heltec Wifi LoRa 32 as my microprocessor to do Unit 3, Module 11 (Lora receiver). I tried to mount the SD card to save the data but it said “card mount failed” . can you explain what it means? By the way, below is the pin mappings that I used.
MOSI- GPIO 27
Hope to hear from you soon, thank you.
Both the SX1278 (lora chip) and SD cards use SPI as communication bus. In your case, the SPI pins you are using for the SD card are being used by the LoRa chip, so you can’t initialize the SD card.
So, you need to use two SPI buses.
For example, to initialize the SD card:
#define SD_CS 23 #define SD_SCK 17 #define SD_MOSI 12 #define SD_MISO 13 SPIClass sd_spi(HSPI); sd_spi.begin(SD_SCK, SD_MISO, SD_MOSI, SD_CS); if (!SD.begin(SD_CS, sd_spi)) Serial.println("SD Card: mounting failed."); else Serial.println("SD Card: mounted.");
This should solve your problem.
I found these information here on GitHub: https://github.com/jonashoechst/ttgo-lora-sd you may find this information useful.
I hope this helps. Let me know if it works.
Hi Sara, I’ve tried using the solution as above but it still gave me “mounting failed” instead of “mounted”. the pin mapping I used is same as the above because TTGO and Heltec board are similar in pin mapping. So is there any solutions that you can suggest to me?
No worries Sara, just checked the adapter of the SD Card and it said that it need to connect to 5V instead of 3.3V. Just changed a wire and used the code above and yes, it worked! Thank you very much 🙂