MCF52259 SD Card 4-Bit Mode?

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

MCF52259 SD Card 4-Bit Mode?

1,928 Views
EDesigns
Contributor I

I have an SD card fully working with MFS using SPI, but for my application I want to attain the fastest speeds possible with my microSDHC card. So this brings up the question:

 

Is it possible using the MCF52259 to operate the SD card in the 4-bit SD mode?The 4-bit mode is significantly faster than the SPI mode. If it is possible, I am a bit confused as to which pins I would connect the DAT[3:0] and CMD lines of the SD card to.

0 Kudos
Reply
3 Replies

944 Views
PetrM
Senior Contributor I

For this purpose, eSDHC HW module was introduced on some chips and there's new esdhc driver in MQX 3.6.1. for that.

Unfortunately MCF52259 doesn't support this functionality.

You can try to set the spi to highest speed possible.

 

PetrM

 

944 Views
EDesigns
Contributor I

The MCF52259 datasheet says the QSPI can go as high as 20Mb/sec, which I set the baud rate to.

When I put the pin under a scope, I see the CLK running at the 20Mb/sec speed.

But when I am trying to read data from the SD card, it is moving at a significantly slower speed, around 95kb/sec.

 

Any ideas? I notice that the data is coming out in "bursts" rather continuously. All I am doing is looping and reading data until I reach the "end of file." My intuition tells me there is some sort of interrupt or low level process in MQX that is preventing the SPI from smoothly reading at its highest speed?

0 Kudos
Reply

944 Views
PetrM
Senior Contributor I

Well, it's not just about SPI. Let me summarize the overheads I know about along with some hints:

 

1) RAM target (execution from RAM) => use flash target

2) higher priority tasks and interrupts => review your needs/architecture

3) MFS stack (caches, FAT read/write, single sector based processing) => set MFSCFG_FAT_CACHE_SIZE to 2 (minimum)

4) SD card layer (commands issuing, busy waiting, CRC calculation) => N/A

5) SPI driver (IOCTLs, CS assertions) => N/A

6) debug code overhead => use release targets

 

There's no doubt that SD card could be operated more efficiently (even on this processor) and there could be done some improvements, but on the other hand, it's quite an universal stack and multitasking we're talking about.

 

PetrM