That's a strange one. When you get DISK_ERR, can do do anything (eg. list files) or is it totally dead?
Are you sure it's not that something is using the pin for something else, or even potentially a wiring issue? Calling E.connectSDCard would cause the card to be re-initialised, so if something had confused it (for instance dodgy power wiring?) that would fix it.
To detect it, I think you could check for readFile returning undefined, or even catching any exceptions that get thrown. However I'd maybe check wiring first, and put a capacitor across the power lines right near the SD card just in case. It really shouldn't happen in normal use.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
That's a strange one. When you get DISK_ERR, can do do anything (eg. list files) or is it totally dead?
Are you sure it's not that something is using the pin for something else, or even potentially a wiring issue? Calling
E.connectSDCard
would cause the card to be re-initialised, so if something had confused it (for instance dodgy power wiring?) that would fix it.To detect it, I think you could check for
readFile
returning undefined, or even catching any exceptions that get thrown. However I'd maybe check wiring first, and put a capacitor across the power lines right near the SD card just in case. It really shouldn't happen in normal use.