-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SD cards not mounting #7707
Comments
@P-R-O-C-H-Y can you please help with triage? Thanks |
I don't have this particular issue, that SD cards fail to mount, but I see other SD related problems like writes to files returning 0 (and no data was written), but also data that silently gets dropped. I cannot say more ATM, unfortunately. Just wanted to raise my suspicion, that something is off with SD card support in the current core, in case someone else sees similar issues. |
Im experiencing this issue too. |
I can confirm this behavior in my setup: [env:esp32dev]
platform = espressif32
board = esp-wrover-kit An older SanDisk Extreme 16GB will mount without errors, while a new SanDisk Ultra 32GB leads to:
There is no difference in my case regarding the version used: it fails with 2.0.6 as well as 1.0.6 using Arduino IDE 1.8.19 |
@nsieg If I understand correctly, the issues with the new Sanddisk SD card accurs even using Arduino IDE? So it's not related to platformIO? Thanks |
Yes, I am primarily using PlatformIO. I have tried different versions here (manually specifying |
Okay so i resolved my problem by manually specifying SPI pins, like this: int SD_CS_PIN = 19; But It's still unclear to me why I need to manually specify SPI pins only on PlatformIO. |
Same problem here, the card mount correctly 2 or 3 times then give this error message. If I remove the SD card then pull back the problem dissapear for 2 or 3 run then back again with same error |
I am also experiencing the same problem. Whether I try a purchased SD card module or a simple self-soldered adapter. |
The M5stack-stamp-s3 (?) does not have spi pins defined in the variant file. You can submit a PR if you would like to fix it. |
We are experiencing the same issue, however it is very specific to the SanDisk Extreme 32 GB card. Other cards are mounting fine and multiple people with different devices are experiencing the same issue from our testing. We are using Arduino and the SD card test sketch for testing the issue and it's present in all versions we have tried. Is there a solution for mounting SanDisk 32GB cards? Below is the output from the SD card test sketch
|
Hardware: LilyGo TTGO T-SIM7600NA ESP32 I cannot seem to get the SD card to work at all. Originally I had purchased a SanDisk 32GB and in looking at the previous posts to this issue, I went out and purchased Lexar SD cards to see if I could use that instead. Both were formatted with FAT32, however I am still getting this issue:
I looked at the build output and it appears that I am using the latest code
The code for sdSelectCard() in sd_diskio.cpp is as follows: bool sdSelectCard(uint8_t pdrv)
{
ardu_sdcard_t * card = s_cards[pdrv];
digitalWrite(card->ssPin, LOW);
bool s = sdWait(pdrv, 500);
if (!s) {
log_e("Select Failed");
digitalWrite(card->ssPin, HIGH);
return false;
}
return true;
} I also tried the Arduino IDE v2.1.0 examples, but they also didn't work. I realize that this issue is still open but I was just wondering if there was something specific/obvious I was possibly missing in my setup to make the Lexar SD (non SanDisk) card work. |
I'm encountering similar issues trying to get various SD Cards to work. Sometime a card will work for a while then not mount. I had some success in running a Windows Scan disk on the card to correct errors. Sometimes that seems to help. The most consistent success I've had is formatting the card using an SD Card formatter from https://www.sdcard.org/ using the overwrite format. I do this when the card refuses to mount. Fixed 3 of the 4 cards that were having the mounting problem. |
Error is showing up using a brand new sandisk 32GB microsd, my other card works perfectly fine (also a sandisk 32GB microsd).. very odd. I made an image of my original card, wrote it to my new one.. same error. So I don't believe it's related to partitions. I'm using the arduino-esp32 library. I've attached the output of Edit: Kioxia (16GB) branded sd cards seem to be working fine. |
We are also having a similar problem and seems especially related to Sandisk cards, cards bought over a year ago work fine, cards bought recently do not work, cards from Kingston Canvas Select marked as SDCS do work, haven't tried the newer SDCS2 cards, cards from Lexar seem OK. Card from Sandisk manufactured China, works OK, similar card from Sandisk manufactured in Tiawan does not work. So my current thinking is that there are changes in manufacture that are responsible and not the current libraries per se. Possibly a speed issue or timing issue. All cards are Micro SD 32GB, SDHC, Class 10, UHS-I, all less than 100MB/s transfer speed and tested on M5Stack and custom designed ESP32 Wroom board, all with 40MHz cpu clock. |
I had the exact same problem and most probably it was a fault of the MicroSD Card Adapter Board. I think, I did break the adapter board by using 5V instead of 3,3V in one of my first trials. Actually this did not destroy my SD Card, only the adapter board. Luckily I always buy at least 3 pieces, even if I only need 1... |
I'm having same problem with 16GB and 32GB sandisk SDHC cards. I had no problems 2 years ago, deployed 6 devices with ESP32 and SD cards without issues. Now I cannot get any to work. Not sure whether it's the SD cards or the library updates, but SD cards with ESP32 no longer function for me. |
Same for me Sandisk Ultra 16GB however a old Sandisk 16GB works, I can read it but not write however that is a card problem I can't format it even on my PC For the Sandisk Ultra 16GB
I am using
I have tried @Catzy44 fix above without any luck and the MISO Pullup fix. Absolutly no response from the card when the mount is attempted at SD.Begin(SD_CS); Old 16GB Sandisk starts responding straight away And gets very chatty later on |
I have the same problem with different ESP32_S3 boards and the SPI SD Card Module: The Logic 2 Analyzer from saleae shows that the clock signal is not output correctly. If the power is supplied via a laboratory power supply, the SPI SD card is written correctly and the Logic 2 image looks correct. The old ESP32-D0WDQ6 work perfectly. My Source Code:
*/ //-----------to uncomment----------------- #ifdef BOARD_DOIT_DEFINED_DEFAULT_GPIO #include <SD.h> File sdFile; void clearStep() { void showStep(char stepNr, const char* stepName) { void writeToSD(const char* path, const char* msg) { void readFromSD(const char* path) { void setup() {
} void loop() {}` My platformio.ini platform = espressif32 build_flags = |
I've had exactly the same error as @eismeraldo. However in my case (I use ESP32 WROOM 32D dev board) I found out pin 23 can't be used for MOSI for some reason. After some frustration I found out that MOSI is still 0V. Using pin 21 fixed the issue. There is no need for me to use external power supply. USB power works ok for me too. |
I took all of the advice on this thread, and found a working solution... you're not going to like it...
So seems it's all part of a larger issue, perhaps the newer chips are super sensitive to fluctuations in voltage, certainly would explain the semi-randomness people have with it working or not, drops probably coincide with other devices kicking in dropping the voltage, I'll have to test the VCC pin with and without the external power supply and update here when my new Multimeter arrives next week. Curious if using a 3.7v battery or adding some kind of intermediate circuit (a capacitor and maybe a diode?) on the vcc line to smooth out any voltage fluctuations would also fix this, got all of those on order as well for another project. Update: Now that I have all the odd pin and card specific issues out of the way, I have also been able to get it running on the chip's 5v line, but not the 3.3v one, but like others it randomly cuts out when other chips are also using the 5v. |
Problem solved. |
Funny since mine only work when powered by the 5v and don't when on the 3.3v, I have a feeling it's probably board specific to do with the amps on each rail, I've only really got it working on my Freenove ESP32 but when I have time this weekend I plan to test on my entire library of ESP32's, perhaps some PI's, and I should have some AT based chips by then to try as well (if they're compatible even, I'm not sure). |
We may have gone a bit off track here. The original problem was that some cards work and some don't in particular Sandisk cards. So if you have a solution you need to say what card you were using. You may have just been lucky to choose a card that works. |
You're right, it might have been better to open a new thread, I apologize.
|
I ditched this module and switched to the 3V3 card adapter, but still have stability issues. Just like you mentioned, very well be power supply replated. My problem only went away after I directly wire the module with the 3V3 and GND pins. No cheap breadboard circuit in between! I have documented my setup here: qiweimao/ESP32-Datalogger#8 (comment) |
This adaptor works when I power the esp32 via USB and use the 5 VIN pin as a power source for the module. It appears that you need 5V for this module to work. |
Just adding my five cents to the discussion. If you share the SPI bus with a TFT screen or LoRa, the SD card must be initialized AFTER all other SPI devices are initialized. |
I solved with it, thanks @alesricar. It's strange that before it worked normally with MOSI on pin 23 but at one point when I uploaded the code back to esp32 it didn't work with MOSI on pin 23. Finally I read this and solved change MOSI to pin 21. My board is ESP32 DEV KIT. |
Hi, I am closing this issue as there was no activity for a long time, seems to be solved and I have not occurred any new issues with SD on latest versions. If the issue persists feel free to reopen or open a new issue. Thanks |
Wrong SD card was used in testing, issue still remains using certain Sandisk branded cards! |
@P-R-O-C-H-Y can you please reopen this issue? |
same module here, but I gotta an error:
|
Board
ESP32 Dev Board
Device Description
ESP32 Dev kit.
Micro SD card breakout board (3.3V).
Hardware Configuration
GPIO 5 connected to CS
GPIO 23 connected to MOSI
GPIO 18 connected to CLK
GPIO 19 connected to MISO
Version
v2.0.6
IDE Name
PlatformIO (VS Code)
Operating System
Ubuntu
Flash frequency
40Mhz
PSRAM enabled
no
Upload speed
921600
Description
Most SD cards will not connect. The sketch compiles and runs, but when trying to mount SD cards produces an error.
Using the SD library communicating by SPI most SD cards do not mount. I have five identical (same size, type, brand etc.) micro SD cards, one of them always connects and runs perfectly. The other four do not mount at all.
They all mount to my computer and have all been formatted as FAT32.
I have tried directly wiring up the SD cards and I get the same behaviour (four don't work and one does).
I have tried powering off a power supply to ensure that isn't the issue but the behaviour remains the same.
The error message that I get is:
ff_sd_initialize(): APP_OP_COND failed: 1
This is different to the error that I get when the SD cards are not connected which is:
ff_sd_initialize(): GO_IDLE_STATE failed
Sketch
Debug Message
Other Steps to Reproduce
I have also reproduced this soldering the pins of a micro SD card adaptor to the ESP32 with the correct pull-ups. The behaviour is identical.
I have tried two different dev boards and the behaviour persists.
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: