TWR-K70 board SDHC 4 bit mode

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

TWR-K70 board SDHC 4 bit mode

1,584 Views
jeemonjoy
Contributor II

Hi,

What all things to be done to enable 4 bit mode SDHC communication in TWR-K70 board?

Thanks in Advance

Jeemon Joy

0 Kudos
Reply
4 Replies

1,133 Views
mjbcswitzerland
Specialist V

Hi Jeemon

1. Power up the SDHC interface and configure the port pins for SDHC mode.

2. Set speed to about 400kHz ready for initialisation and send at least 74 clocks

3. Send GO_IDLE_STATE_CMD0 to the SD card in 1 bit mode

4. Send IF_COND_CMD8 to retrieve non-supported voltage range (mandatory)

5. Send APP_CMD_CMD55 and OP_COND_ACMD_CMD41 (after waiting for it to not be busy)

6. Send CID_CMD2 followed by SET_REL_ADD_CMD3 to set the card's relative address

7. Send SEND_CSD_CMD9 to get the card's capacity information

8. Select the card with SELECT_CARD_CMD7

9. Send APP_CMD_CMD55 followed by SET_BUS_WIDTH_CMD6 to set the bus width at the card

10. Increase the bus speed to the final operating speed (eg. 25MHz) and program the 4 bit mode in the controller using SDHC_PROCTL |= SDHC_PROCTL_DTW_4BIT;

11 . Continue mounting the SD card in 4 bit mode

See also TWR-K70 SDHC SD Card

Regards

Mark

0 Kudos
Reply

1,133 Views
jeemonjoy
Contributor II

Hi Mark,

Thanks for replying.

I am using the demo project of SDHC of TWR-K64 and ported to TWR-K70. Clock made it set-up to work in 50MHz, but initially it was working with 30MHz. I need to get maximum writing speed (so tried in 50MHz), also FAT FS is included. Clock is ensured using a DSO. But the problem facing is in both 1bit and 4bit operation, it is taking approximate the same time to write the data to the file. Data written to the file is not corrupted. Also by checking DTW of SDHC_PROCTL, I ensured its working in 1bit mode and 4bit mode.

I feel due to the OSA and HAL layers, it is taking the same time in both data widths. Can I conclude it?

I wish to isolate my code from OSA and HAL. Is there any way to do it quickly?

Regards,

Jeemon Joy

0 Kudos
Reply

1,133 Views
mjbcswitzerland
Specialist V

Hi Jeemon

The SD card write speed is not very fast and it will take about 2..4ms on average to write a 512 byte sector. This means that there is in fact little or no difference in the speed between 1 and 4 bit modes because the limitation is not the SW layers/communication but the approx. 128kByte/s write speed of the card.

The only way to speed it up is to use multiple block writes rather than sector writes, which will typically achieve several MBytes/s write speed (here the SD card speed classes limit) but you will need a FAT solution that supports this and possibly also use SPI mode instead because the SDHC controller in the Kinetis seems to have a problem with pausing multiple block writes/reads whch makes it generally unuseable for this (unless you have a simple system that has only ever one read/write taking place and so you never need to pause an operation). See Re: How to cancel multi-block SDHC transfers?

Regards

Mark

0 Kudos
Reply

1,133 Views
jeemonjoy
Contributor II

Hi Mark,

So, I concluded better to use SPI than SDHC for high speed.

Thanks for your support. Expecting the same in future.

Let me try with what you mentioned.

Regards

Thanks a lot

Jeemon Joy

0 Kudos
Reply