SD cart mount failed
-
I'm facing a weird issue.
When I use theSD.exists
orSD.open
on different CPP files, everything works well, but when I click on the reset button, an error occurred.It's also happening when I try to save a file on the SD card twice.I have to remove and reinsert the SD card every time which is a little annoying.
What I'm trying to do is check if there is an SD card available, if yes, I can add a button to save the current game state, or I'm able to load the JSON stored on the SD card.
[ 1788][E][sd_diskio.cpp:199] sdCommand(): Card Failed! cmd: 0x00 [ 1788][E][sd_diskio.cpp:795] sdcard_mount(): f_mount failed: (3) The physical drive cannot work [ 2095][E][sd_diskio.cpp:199] sdCommand(): Card Failed! cmd: 0x00
Everything I do is public: https://github.com/PierreRambaud/pokegotchi/
I'm not sure it's the right approach as I started C/C++ one month ago.
https://github.com/PierreRambaud/pokegotchi/blob/master/src/main.cpp#L85
https://github.com/PierreRambaud/pokegotchi/blob/master/lib/Pokegotchi/Pokegotchi.cpp#L17 -
Ok, I bypass the problem by using
SD.begin()
andSD.end()
each time I need to use SD methods -
Glad you got things working, out of interest, are you running with tasks/threads? I'm working on a project that is reading and writing to an SD card, and luckily I've not had this problem yet. But I may implement what you've found just to be extra safe.