Function SDC Init
Detects and initializes SD card.
Zero on success, error code on failure.
This takes a few dozen milliseconds. It populates the SD data structure according to the results, which means setting the Initialized, SDHC and CRC flags. Normally you don't ever need to call this as it is called by FS_Init().
The error codes returned by this function:
- 1: CMD0 failed (possibly no card in socket)
- 2: CMD59 failed (couldn't enable CRC checking)
- 3: ACMD41 failed (not possible to initialize, bad card)
- 4: ACMD41 timed out
- 5: CMD58 failed (couldn't query card)
When the library is operating in compatibility mode (no bootloader detected), it does not return error code 2, rather tries to enable CRC checking twice and ignore failure. This is used to support the Uzem emulator which doesn't emulate SD CRC.