SDK 3.1 + KSDK 2.0 + SD card driver

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

SDK 3.1 + KSDK 2.0 + SD card driver

2,062 Views
neilporven
Senior Contributor I

Where can I find the SD card driver function calls (document)?

Second question, are there any instructions on how to initialize and setup the SD card with the

                              KSDK 2.0 driver?

than you,

Neil

0 Kudos
9 Replies

1,053 Views
efnlpz1010
Contributor I

Hello Neil,

i was was wondering how did you make out with the microSD project using 2.0?   I'm looking for a project example to work from. Thanks. 

0 Kudos

1,053 Views
neilporven
Senior Contributor I

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

clock. 

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...

Thanks,

Neil Porven

0 Kudos

1,052 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Neil,

Pls check the project in the attachment.

BR

XiangJun Rong

0 Kudos

1,052 Views
neilporven
Senior Contributor I

Hi Xiangjun,

Can you please attach the project?  I don't see an attachment?

Thank you,

Neil Porven

0 Kudos

1,052 Views
neilporven
Senior Contributor I

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.

Neil Porven

0 Kudos

1,052 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Dear Neil,

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.

BR

Xiangjun Rong

0 Kudos

1,051 Views
neilporven
Senior Contributor I

Hi Xiangjun,

I don't see your attachment?  Can you please attach it.

Thank you,

Neil Porven

0 Kudos

1,052 Views
neilporven
Senior Contributor I

Update,

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;

SDHC_Init(BOARD_SDHC_BASEADDR, sdhcConfig);

/* 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.

if (SD_Init(card))

{

PRINTF("nrnnSD card init failed.nrnn");

}

PRINTF("nrnnRead/Write/Erase the card continuously until it encounters error......nrnn");

while (true)

{

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");

}

}

SD_Deinit(card);

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?".

thank you,

Neil Porven

0 Kudos

1,052 Views
neilporven
Senior Contributor I

Hi everyone,

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?

Thank you,

Neil

0 Kudos