Hello,
In some cases, UHS-I card are not communicating with the right timming. This bug is present is SDK 2.4.2.
To reproduce the bug:
1. Initialize with UHS-I card inserted, bus speed goes to kSD_TimingSDR104Mode=> OK
2. Remove the UHS-I card and insert an non UHS-I card, bus goes to kSD_TimingSDR25HighSpeedMode => OK
3. Remove the non UHS-I card and insert an UHS-I card, bus goes to kSD_TimingSDR12DefaultMode => NOK
Because "currentTiming" is not reset to kSD_TimingSDR12DefaultMode, the init sequence does not work as expected.
My fix is reset card->currentTiming to kSD_TimingSDR12DefaultMode in fsl_sd.c.
status_t SD_CardInit(sd_card_t *card)
{
assert(card);
uint32_t applicationCommand41Argument = 0U;
if (!card->isHostReady)
{
return kStatus_SDMMC_HostNotReady;
}
/* reset variables */
card->flags = 0U;
card->currentTiming = kSD_TimingSDR12DefaultMode;
/* set DATA bus width */
SDMMCHOST_SET_CARD_BUS_WIDTH(card->host.base, kSDMMCHOST_DATABUSWIDTH1BIT);
/*set card freq to 400KHZ*/
card->busClock_Hz = SDMMCHOST_SET_CARD_CLOCK(card->host.base, card->host.sourceClock_Hz, SDMMC_CLOCK_400KHZ);
/* send card active */
SDMMCHOST_SEND_CARD_ACTIVE(card->host.base, 100U);
/* Get host capability. */
GET_SDMMCHOST_CAPABILITY(card->host.base, &(card->host.capability));
...
Hi Anthony.
Thanks for sharing your solution with the Community!!
Best regards!
/Carlos