FRDM64F & SD card using SDCH_LDD not working

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

FRDM64F & SD card using SDCH_LDD not working

865 Views
eyaldoron
Contributor II

Hi,

I've seen discussions around this, but not quite. I'm trying to read/write to an SD card in the Freedom64F card, using Processor Expert and the SDHC_LDD component. I'm using KDS 3.0.0, with no OS and no SDK. I'm following the documentation example as closely as possible, but I can't get it to work - I always get a timeout at SDHC_GetCardInfo. Looking into the code, specifically CardInfoRetrieval in SDHC.c, the last viable state is SDHC_CIR_TRANSFER_STATE.

I noticed that the board does not include a pullup resistor on the CMD line, which should be there (also possibly on D0). I changed the port pins to include pullups, but it made no difference. I also modified the example code to support active-high card detect. Card detection now works, but not the rest of the code.

I've tried Erich Styger's logger code, which uses SPI mode, and it works nicely, however its slow - both read and write take roughly the same time, ~190 kbyte/sec, which seems to be mainly driver code overhead, as it changes when I change optimization, and almost doesn't depend on SPI clock. I would really like higher read rates, and DMA/interrupts would also be nice though not essential.

Has anybody got SDHC_LDD or one of its derivatives working on this board, in full 4-bit data width and a higher data rate? Any ideas?

Thanks,

Eyal Doron

0 Kudos
5 Replies

717 Views
haraldlandro
Contributor I

In my case, the last viable is SDHC_CMD_AMCD (which seems to be a substate of SDHC_CIR_TRANSFER_STATE?) Within this state, there is a line which reads

SDHC_PDD_SendCommand(SDHC_BASE_PTR, SDHC_PDD_ACMD51_SEND_SCR, SDHC_PDD_ENABLE_DMA | SDHC_PDD_DATA_PRESENT | SDHC_PDD_DATA_READ | SDHC_PDD_RESPONSE_LENGTH_48);

After this line has been executed, the IRQSTAT register becomes 0x1000000, which according to the reference manual means that there was an ADMA error. The operation never finishes, and I get a timeout.

0 Kudos

717 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Eyal,

I think you can refer to the "Typical Usage" , there is demo code .

Please right click the SDHC component , then select the "help on component " , then you can find it :

pastedImage_0.png

Hope it helps


Have a great day,

Alice

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

717 Views
eyaldoron
Contributor II

Hello Alice,

Thank you for your answer. Unfortunately, if it were that simple I would not have posted... The example does not work for me, failing (as I said in my post) at the GetCardInfo command. The project is a clean test of the component, with nothing else except what appears in the typical usage code.

One caveat - the code as described in the help also produces a hard fault in the OnFinished event, due to some problem with the UserData pointer. I changed the code to directly use the SD variable, instead of a cast on the UserData.

Any ideas?

Thanks,

Eyal

0 Kudos

717 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Eyal,

I checked in the demo code , there is a wait for the SDHC_GetCardInfo() :

pastedImage_0.png

BR

Alice

0 Kudos

717 Views
eyaldoron
Contributor II

Hello Alice.

I know there is a wait. It doesn’t help, it exists on a timeout. If I disable the timeout it waits forever.

Eyal

0 Kudos