I'm looking at a possible new SD card bootloader for Arduinos, and this would typically require level shifting since Arduinos are usually 5V and SD cards are 3.3V. Here is the module widely available on Ebay:
https://www.ebay.com/itm/382768089497And I believe the relevant schematic is attached below.
The problem is detecting the presence of the card on power-up, if possible something other than sending commands into the ether and seeing if any response comes back. That's not a good solution because the user's circuit may have other things connected to the SPI pins.
I've done such a bootloader for a couple of the TI MSP430 parts, which don't require level shifting. Every card has a nominal 50K pullup resistor on its card select pin, so I put a 1M external pulldown resistor on that line at the MSP end, so I could read the value at boot. If the card is present it reads HI, otherwise LO. If a card is present, then I switch the pin over to output mode for its chip-select function, and the pullup and pulldown resistors are of high enough value that they don't interfere.
But I haven't figured out a way to make that work with level shifting, and haven't come up with any alternative. Unfortunately, the "card inserted" pin on the holder isn't brought out to the module header.
If anyone can think of something, please let me know.