-
• #2
That all looks fine to me - SD cards should be 3.3v, as is the Espruino - so you shouldn't need level conversion circuitry.
However you are doing this in
onInit
- what if you just paste the commands into the left-hand side one by one to test?I have found that sometimes the SD cards take a few seconds to start working after they're powered on - I'm not sure if that could be an issue here...
-
• #3
I actually did exactly as you suggest, cutting and pasting from the code above. I'm really at a loss as to how to debug, as I've had no issues getting these adapters to work with Arduinos, Rasp PIs, etc.
-
• #4
Have you tried different SD cards, and cards that you're sure are FAT32 formatted?
I actually just tried this with a Pico and it works fine - however I have a 2GB card that it doesn't appear to work with, but I'm also having trouble with the Espruino WiFi.
I'll try and track this down a bit more as it should really be more resilient, but it might be a few weeks as I'm waiting for a micro SD card breakout.
-
• #5
Yes, tried with a number of cards and both sockets. Cards were formatted Fat32 on a Linux machine with parted. They could be read by a Windows machine as well.
-
• #6
Wondering if anyone has had a chance to follow up on this?
Thanks
-
• #7
I haven't got the breakout yet, so I'm struggling to debug exactly why it's working on a Pico but not the Wifi.
You could maybe try adding a timeout after setting up the SD card - that's about the only thing I can think would really be different. You're using hardware SPI so it'd not like it'll be going too fast or anything.
function onInit() { console.log("Connected!"); // Wire up up MOSI, MISO, SCK and CS pins (along with 3.3v and GND) SPI1.setup({mosi:B5, miso:B4, sck:B3}); E.connectSDCard(SPI1, B6 /*CS*/); setTimeout(function(){ // see what's on the device console.log(require("fs").readdirSync()); for (var i in files) console.log("Found file "+files[i]); var f = E.openFile("log.txt", "w"); f.write("Testing 123"); f.close(); f = E.openFile("log.txt", "r"); f.pipe(console.log); f.close(); },2000); }
-
• #8
Ok, I've done quite a lot of checking and fiddling now with a signal analyser, and:
- Some cards seemed to work reliably as-is
- Some cards worked reliably if you tried to initialise them a second time after the first time had failed
- Some cards wouldn't work at all *unless you added a pullup resistor to the CS/CD pin)
So I have modified the firmware now so that it automatically retries the initialisation a few times, which fixes a lot of problems... And I'll modify the documentation to suggest adding a pullup resistor to CS (which is good practice anyway as it'll stop noise from inadvertantly writing rubbish to the card, even if it's amazingly unlikely).
- Some cards seemed to work reliably as-is
-
• #9
From the Raspberry Pi site here is am SD card formatting program that might help.
-
• #10
I have successfull connected a microsd with fat32. Sometime i have wifi or sd errors.
Fixed that by waiting a few seconds after Oninit with setTimeout(....);Best regards
Sacha
1 Attachment
-
• #11
Great! That's a really tidy place to put the SD card!
Are you using cutting edge firmwares? the SD card handling should have improved a lot since 1v95
-
• #12
Hi Gordon
Yep, using 1v95. Works perfect for me.
Regards
Sacha -
• #13
Until the rumored EspruinoWifi SD edition comes out :-)
1 Attachment
-
• #14
Nice - how did you manage that? There aren't even any pins at that end of the board :)
-
• #15
This way
1 Attachment
-
• #17
Nice - thanks! Good use of ethernet cable there ;)
Hi folks,
I had wired up an SD card socket from Sparkfun:
https://www.mouser.com/ProductDetail/SparkFun-Electronics/DEV-13743/?qs=WyAARYrbSna7AKzdOk0X8g%3D%3D&gclid=Cj0KCQiAsqLSBRCmARIsAL4Pa9TQXhYrFu8L0QQcDVMAQE91NwG4RAm4irzcp8LHGGQq_icz7bBiY6saAuxPEALw_wcB
But I keep getting the message, even with multiple different SD cards, all formatted to Fat32.
I triple-checked all the connections, and then used a meter to check connectivity, power, shorts, etc. They were all correct.
So I figured it must be the socket. I removed it and soldered this one on in it's place, figuring that perhaps the added voltage regulation circuit might help:
https://www.adafruit.com/product/254?gclid=Cj0KCQiAsqLSBRCmARIsAL4Pa9SFqtMV7P6ijT3YC_O2wkmDjScGyUWDSlxgrcYFvsitDs03yyHVn2oaApQ7EALw_wcB
But I still get the exact same error message. Am I missing something obvious here? Again, I checked all the connections and they're fine. I have a DS18B20 connected to different pins and it works great, so the Espruino appears to be fine. Test program for SD card looks like this: