Unless you’re a real SD/SPI guru then please quietly ignore this - I won’t mind - I do have a solution that’s not perfect, but good enough for now…
Scenario:
I have a little bare-metal “thing” which access the SD card and I’m struggling to make it work on my PicoCalc. (Fitted with RP2350 - Pimoroni Pico Plus 2W) With the exception of a few things like the FAT32 code it’s all my own code - a lot of assembler and some C, with nothing from the SDK. It’s also RISC-V, but that’s probably not important.
However, if I change the SD card out for another that I know works on other systems then it works just fine. I can read/write files, etc.
The other systems are an Adafruit Fruit Jam board - RP2350 and my own 65C816 SBC which uses an AVR mcu for SD card access. The code (in C) is the same in all cases - the underlying SPI driver is obviously different on the AVR but identical other than pin number changes on the Adafruit and PicoCalc boards. The code is conditionally assembled/compiled between the RP2350 platforms, but in reality the only difference is the pin numbers. Both are on SPI 0.
As far as I can tell, my code is essentially the same as the code I find all over the place - I’ve used it for over 8 years now on the AVR before migrating it to the RP2350 recently… You reset the card by running the clock, with CE and MOSI high for ~80 clock cycles then send it a CMD0 command to reset it into SPI mode then off you go…
But with the supplied SD card, a nice 32GB Sandisk SDHC-I (10) it fails to respond, but a micro SD card in a holder works just fine. (I tried a Samsung and another Sandisk card, both OK).
I can’t try the card in the other systems as they both take micro SDs - however it does work just fine in the PicoCalc with other uf2’s loaded and it reads/writes OK in a cheap little USB SD card reader I have which is very old and quite slow, but works OK.
The odd things is that sometimes the card will start to pass the early checks - putting it in to SPI mode then time-out at ACMD41 (e.g. if I hot plug it in) but it’ll fail from CMD0 after that.
I do know that SPI mode is being phased out but starting with the bigger/faster cards for now from what I gather. I’m sure this card will still work just fine in SPI mode but maybe I’m missing some arcane command or trick to make it work
So if anyone has a clue and has written their own code rather than use something from the SDK and has an “A-Ha!” moment the please let me know.
Thanks
-Gordon