Is anyone know how to increase the clk of lpc313x_mci driver

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

Is anyone know how to increase the clk of lpc313x_mci driver

385 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by xwf72 on Wed May 29 01:57:07 MST 2013

I use the "lpc313x_mci_driver" of lpc3xxx_cdl,  I measure the clk of SD , it is 22.5MHz , So reading  SD card is too slow, when I change the parameter below in the lpc313x_mci.h, But it does not work.


 


#define SD_MMC_ENUM_CLOCK       400000


#define MMC_MAX_CLOCK           20000000


#define MMC_LOW_BUS_MAX_CLOCK   26000000


#define MMC_HIGH_BUS_MAX_CLOCK  52000000


#define SD_MAX_CLOCK            5000000


#define MCI_FIFO_SZ             32


#define SYS_REG_SD_CARD_DELAY  <span class="Apple-tab-span" style="white-space: pre;"> </span>0x1B


#define SYS_REG_MMC_CARD_DELAY  0x16


 


<em><strong>Is anyone know how to increase the clk. thanks!</strong></em>

Labels (1)
0 Kudos
1 Reply

325 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kenh6942 on Fri May 31 12:19:23 MST 2013

There's a few things to understand regarding the SD card in order to support clock speeds over 25MHz.


1) You must have a card that supports the higher speed. Although I can't guarantee it, I specifically ordered a SD card with a minimum speed class 4 hoping that it would support the higher speed. The 4GB microSDHC SanDisk one I ordered does. A speed class 10 card likely supports SD 3.0 and would be overkill/not supported by the lpc31xx; don't spend your money on it.


2) You must implement some calls to the SD card in order to determine that the card supports at least SD Spec 2.0 and that it supports switching to the higher clock rate.


3) Once you determine the card can support the higher clock rate, there's a command sent to put the card in high speed mode. After that, change the clock speed of the MCI peripheral.


4) The clock delay must be changed to a lower amount of delay to support the higher clock rate. I believe for a high speed SD card, the delay should be 2ns. However, the linux code sets it to the same delay as for MMC (3ns?) and I did the same. I've had no issues in doing such.


5) If your PLL is outputting 180MHz or 270MHz, the fastest your clock will be is 45MHz due to dividing and needing a 50% duty cycle clock.


Here are some references to look at/for:


- Get the SD 2.0 spec from the SD org. It details the commands and means of determining what your card does support. The free version of the spec is adequate for your needs.


- Take a look at the Linux driver code for the LPC31xx available from lpclinux.com. It will provide clues on how the card is being configured to support how linux would like to access the card.


- Also take a look at up-to-date linux source for mmc drivers and the commands that are sent to put the card into high speed mode. You won't be able to use the linux code directly, but use it as a guideline.


- There's an actual spec for a toshiba SD card that supports high speed floating around somewhere on the internet that I had found previously. I don't recall where I found it now. I think that was where I found the spec for the required delay timing since the free spec doesn't give timing information.


 


All this said, I have verified that you can read an SD card that supports high speed clock with the lpc31xx. The maximum I've seen for a sequential read is 21MB/s; non-sequential reads impose ~800us seek time. I'd provide source example on how to do all of the above, but my source has been far-removed from the CDL at this point, I don't think any portion of it would work with the CDL "as is".

0 Kudos