Xinyuan-LilyGO / LilyGO-T-SIM7000G

LilyGO T-SIM7000G
https://pt.aliexpress.com/item/4000542688096.html
284 stars 123 forks source link

Unable to get SDCard working. Bad Board? #206

Closed tweathers-sec closed 1 year ago

tweathers-sec commented 1 year ago

Unable able to get the SDCard working. Bad board?

Using many variants of the sample code provided, I continue to get the following error. Yes, the SDCard is formatted to FAT.

[ 1821][E][sd_diskio.cpp:802] sdcard_mount(): f_mount failed: (13) There is no valid FAT volume SDCard MOUNT FAIL

Relevant Code Used - Snipped for brevity.

#include <SD.h>
#include <SPI.h>
#include <LittleFS.h>

#define SD_MISO 2
#define SD_MOSI 15
#define SD_SCLK 14
#define SD_CS 13

void setup()
{
    SPI.begin(SD_SCLK, SD_MISO, SD_MOSI, SD_CS);
    if (!SD.begin(SD_CS)) {
        Serial.println("SDCard MOUNT FAIL");
    } else {
        uint32_t cardSize = SD.cardSize() / (1024 * 1024);
        String str = "SDCard Size: " + String(cardSize) + "MB";
        Serial.println(str);
    }
}
Tig3rch3n commented 1 year ago

Have you tried a different brand of SD Cards? I had some Trouble with 'NoName' SDCards

They work under Windows/Linux/Android no Problem. But for some reason they don't support "SPI Mode" so they are useless for any Arduino Projects. Seytonic did a Video about the Topic a few days ago https://youtu.be/wNfpRwQgDG4

I bought those on Aliexpress... If you buy them from a reliable Source, from a known Brand, it should not be an issue

tweathers-sec commented 1 year ago

Thanks for the recommendation, but I don't use off label cards for that specific reason. I have tested a number of different SanDisk and Kingston cards that work fine with my other ESP32's. For whatever, this board just doesn't like them.

Tig3rch3n commented 1 year ago

Could you post the full Code? I can test in Tonight/Tomorrow :)

tweathers-sec commented 1 year ago

Sure thing... So far, I have just been using the examples provided in this repo.

https://github.com/Xinyuan-LilyGO/LilyGO-T-SIM7000G/blob/master/examples/Arduino_NetworkTest/Arduino_NetworkTest.ino

lewisxhe commented 1 year ago

My test is normal.

  1. Please try to add pinMode (SD_MISO, INPUT_PULLUP) before SPI.begin; Test whether it is normal
  2. Make sure the SD card is FAT format and accessible on the computer If it still doesn't work, I suspect that there is a problem with the SD card seat welding

image

Tig3rch3n commented 1 year ago

Sure thing... So far, I have just been using the examples provided in this repo.

https://github.com/Xinyuan-LilyGO/LilyGO-T-SIM7000G/blob/master/examples/Arduino_NetworkTest/Arduino_NetworkTest.ino

Just tested it with my Version 20200415 Board, I had to Comment out the Modem Init (no IoT Sim yet) But everything works out of the Box with a ext3 Formating I get

========INIT======== ========SDCard Detect.====== SDCard Size: 30436MB

tweathers-sec commented 1 year ago

Thanks all for the input. It was certainly a bad connection with the PCB. I ended up doing an exchange for a new board and my code is working without issue. Closing this out.