I found this thread when searching for a solution to our micro SD-Card problem. On the OM13092 board, full size SD cards work fine, micro SDs in adapters don't. Initialization always fails/hangs. Anyway, I also found this, pointing me into the right direction:
https://github.com/trezor/trezor-firmware/issues/65
It seems that Micro-SD cards have internal pull-ups on Dat3 for Card-Detect, which must be disabled in order to use the Dat3 for data transfer. So I copyfied the SD_SetDataBusWidth() in fsl_sd.c to the following:
static status_t SD_ClearCardDetect(sd_card_t *card)
{
assert(card);
SDMMCHOST_TRANSFER content = {0};
SDMMCHOST_COMMAND command = {0};
status_t error = kStatus_Success;
if (kStatus_Success != SD_SendApplicationCmd(card, card->relativeAddress))
{
return kStatus_SDMMC_SendApplicationCommandFailed;
}
command.index = kSD_ApplicationSetClearCardDetect;
command.responseType = kCARD_ResponseTypeR1;
command.argument = 0;
content.command = &command;
content.data = NULL;
error = card->host.transfer(card->host.base, &content);
if ((kStatus_Success != error) || ((command.response[0U]) & SDMMC_R1_ALL_ERROR_FLAG))
{
SDMMC_LOG("\r\nError: send ACMD42 failed with host error %d, response %x", error, command.response[0U]);
}
return error;
}
This should be called before switching from 1-bit to 4-bit-wide data bus. I hope this helps someone.
Side-note: Also, we have a custom board featuring a micro SD slot. Therefore we need to use the Dat3-pin for Card-Detect. This doesn't work on the OM13092 board, as there are hardwired pull-ups on the board for all the SD-Pins, which interfere with Dat3/CD.