sdmmc hangs on SD_Init()

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

sdmmc hangs on SD_Init()

3,489 Views
JohnU
Contributor III

Hi,

I test FSL sdmmc on OM13092 LPCXpresso54608 using sdcard_polling example (SDK 2.2.0).

I have found it hangs with an old Toshiba SDHC card (SD-F04G 0742 TL8159V).

Backtrace:

SD_Init()

SD_SetDriverStrength()

SD_SelectFunction()

SD_SwitchFunction()

SDIF_TransferFunction()

SDIF_TransferBlocking()

SDIF_TransferDataBlocking()

dmaStatus = 0xA000 and does not change.

Previous command SD_SetBlockSize(64bytes) is successful. It hangs after kSD_Switch command sent (R1 response[0]=0x900). It can't handle DMA data transfer finish correctly (SDIF_TransferDataBlocking()).

Card data:

RawCid Details:{469793351, 833741708, 1144009799, 39079251}

RawCsd Details:{171966589, 503283584, 1532559360, 1074659378}

RawScr Details:{45416448, 402739458}

ocr 0xc0ff8000

Is it known problem?

best regards

J.

Tags (2)
0 Kudos
Reply
6 Replies

2,414 Views
ben11
Contributor II

Hi,

Has anyone found a fix for this issue yet? I'm having the same issue on two separate SD cards.

Cheers,

Ben

0 Kudos
Reply

2,414 Views
carstengroen
Senior Contributor II

I'm seeing the same problems here with older cards, any plans on fixing this so we can start using the SDK code "for real" ??

My original thread: https://community.nxp.com/thread/461018 

0 Kudos
Reply

2,414 Views
soledad
NXP Employee
NXP Employee

Hi,

 

I found the below thread: sdmmc SD_Write()/SD_Read() failed with ATP card , is the same issue?

in the thread sdmmc eMMC Decode CID properly did you find the solution to this issue?

 

Regards

Sol

0 Kudos
Reply

2,414 Views
JohnU
Contributor III

Hi,

 

no, each of the issues is separate.

The sdmmc library does not support the SD card properly.

Yet another SD card initialization (Sandisk microSD 2GB card) fails on SD_SelectBusTiming() in the file sdmmc/src/fsl_sd.c.

Here is a workaround but I didn't investigate a real reason:

@@ -1058,6 +1058,9 @@ static status_t SD_SelectBusTiming(sd_card_t *card)
             {
                 card->currentTiming = kSD_TimingSDR25HighSpeedMode;
                 card->busClock_Hz = HOST_SET_CARD_CLOCK(card->host.base, card->host.sourceClock_Hz, SD_CLOCK_50MHZ);
+            } else {
+                /* workaround for Sandisk microSD 2GB card */
+                return kStatus_Success;
             }
         }

Moreover sdmmc library examples seem not to be robust enough for SDIF + SD cards:

sdmmc/port/fsl_host.c
@@ -150,7 +150,7 @@ static status_t SDIF_TransferFunction(SDIF_Type *base, sdif_transfer_t *content)
     do
     {
         error = SDIF_TransferNonBlocking(base, &g_sdifHandle, &dmaConfig, content);
-    } while (error == kStatus_SDIF_SyncCmdTimeout);
+    } while (error == kStatus_SDIF_SyncCmdTimeout);//why hangs forever in the loop in some cases?

     if ((error != kStatus_Success) || (false == EVENT_Wait(kEVENT_TransferComplete, EVENT_TIMEOUT_TRANSFER_COMPLETE)) ||
         (!g_sdifTransferSuccessFlag))

Do you happen to know whether sdmmc library upgrade is planned in a next SDK version?

best regards

J.

0 Kudos
Reply

2,414 Views
Eli_H
NXP Pro Support
NXP Pro Support

Please see this thread:

https://community.nxp.com/message/931558 

If you are using the SDRAM on the LPCXpresso board with the pin mux settings given the SD card examples, you will get some intermittent problems.   The fix is some pin mux adjustments.

0 Kudos
Reply

2,414 Views
JohnU
Contributor III

Thanks Eli.

Pinmux is set according to the errara. But probably your hint helps others.

Described issue seems also related to SD specifications, eg. Part 1 Physical Layer, Simplified Specification version 2.00.

Some SD cards works, some not - especially older controllers.

 

kind regards

J.

0 Kudos
Reply