The 2.0, is giving me issues. I had to stop trying to get it going to keep things moving along, so I reverted back to 1.3.0.
Unfortunately or fortunately, we found that if you heat up the board we start getting read/write failures (the read/write comes
back with an error), in my application, then I create a recovery, which allows me to continue. We believe that slowing down
the SDcard clock will resolve the issue, but now I am struggling doing that. You can see my latest POST slowing down the
I am able to slow it down, using the Freedom K64F board and their example code, but on our custom board its not happening.
I believe it has to do with the settings of our processor clock along with other registers that handle the SDHC module clock.
Eventually I will have to go back to and fight with 2.0, but for now slowing down the clock is a priority...
Thank you Xiangjun,
I will take a look at it and see if I can compile it and understand how it works. The
code on the main looks almost identical to Jorge Gonzales FatFs example.
Do you want to implement a File system on the SD card via SDHC interface? If it is the case, I have an example based on FRDM-K64, it works fine. I attach it, you can refer to it. If you have issue when you compile the project, you have to modify the the "include" directory in the KDS tools.
If you want to write data to SD card directory without File System, I have not example.
Under Freescale->SDK_2.0_K64F->docs, there exist the following .pdf ( Kinetis SDK v.2.0 API Reference Manual)
Under the SDHC, I found the following:
Typical use case
/* Initializes the SDHC.
sdhcConfig->cardDetectDat3 = false;
sdhcConfig->endianMode = kSDHC_EndianModeLittle;
sdhcConfig->dmaMode = kSDHC_DmaModeAdma2;
sdhcConfig->readWatermarkLevel = 0x80U;
sdhcConfig->writeWatermarkLevel = 0x80U;
/* Fills state in the card driver.
card->sdhcBase = BOARD_SDHC_BASEADDR;
card->sdhcSourceClock = CLOCK_GetFreq(BOARD_SDHC_CLKSRC);
card->sdhcTransfer = sdhc_transfer_function;
/* Initializes the card.
PRINTF("nrnnSD card init failed.nrnn");
PRINTF("nrnnRead/Write/Erase the card continuously until it encounters error......nrnn");
if (kStatus_Success != SD_WriteBlocks(card, g_dataWrite, DATA_BLOCK_START, DATA_BLOCK_COUNT))
PRINTF("Write multiple data blocks failed.nrnn");
if (kStatus_Success != SD_ReadBlocks(card, g_dataRead, DATA_BLOCK_START, DATA_BLOCK_COUNT))
PRINTF("Read multiple data blocks failed.nrnn");
if (kStatus_Success != SD_EraseBlocks(card, DATA_BLOCK_START, DATA_BLOCK_COUNT))
PRINTF("Erase multiple data blocks failed.nrnn");
1. Question is: "What are the includes needed?"
I am currently placing this one: #include "fsl_sd_disk.h", but sdhcConfig-> is not being recognized?
2. Question is: "Is the above all I need for the SDcard to function?".
I am re-visiting this thread and noticed that I never got a reply to questions 1 & 2, can someone from NXP
try answering these questions?