The RT1052 sd card reads slowly

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

The RT1052 sd card reads slowly

1,297 Views
InvisibleWind
Contributor I

Dear NXP groups

when I used the USDH1 peripheral of RT1052 to operate the sd card, I found that the USDH took too long to read and write the sd card block. The sdk version I used is SDK_2_13_0. Used is sdmmc_examples/sdcard_fatfs_freertos, sd clock is set to 198MHz, I use Sandisk 64G high-speed sdcard, sdcard correctly identified as SDR104, and fatfs file operation is normal, oscilloscope observed clk is indeed 198MHz

qingfeng_0-1694172318759.png
However, the underlying function sd card reads and writes the block time is too long, the theory reads two blocks (512byte*2) is 1024byte, in the four-wire case, the need for 2048 clocks, in the case of 198MHz, the theoretical need time is 1/198*2048=10.3us, But the actual operation time of the two blocks is 3.87ms (link script, code running in SDRAM and Nor Qspi Flash I have tried, the problem is the same)
SDS5104X_PNG_1.png

This is seriously beyond normal expectations. The block read and write time is too long, so it takes 1 to 2 seconds for my upper-layer FATFS to read and write 1M files. The high-speed read and write ability of SD card is very important for the project, and I think RT series with SD3.0 peripheral performance should not be at this speed. How to solve it.

attachment:

My system clock is configured as follows

HFQK@[E_7NU0]_)IXNK9CX7.png

I barely changed the sdmmc_examples/sdcard_fatfs_freertos code in the SDK

I can confirm that the testing process was rigorous

Apply critical code

X(A@ORBD1}_XS@$_L[N@QIT.png

 Fatfs oprate sd mark

EU8I0IT{9MQ{5PS$JS1)PH5.png

Continuous block read and write output from the serial port

R2OQ}B`}WKM[2[PS6J0EUGD.png

Then the CLK waveform of the oscilloscope above appeared on the oscilloscope piece by piece, and the time I indicated with the cursor

Best wishes

Labels (1)
0 Kudos
Reply
3 Replies

843 Views
oneofzero
Contributor I

I have same problem! 

sdcard read speed only about 2MB/S !!! 

No other thread running!

 

0 Kudos
Reply

1,174 Views
vicentegomez
NXP TechSupport
NXP TechSupport

do you have another process running on the mcu?

Are you using the evaluation board?

regards 

vicente

0 Kudos
Reply

1,103 Views
InvisibleWind
Contributor I
  • No other threads are running on the board

  • i did not used the evaluation board,i have used the third party development board vendor board and the board made by our hardware department
  • I found that i shouldn't be 1024 bytes every time and read 1024 times to oprate 1M,the underlying function has a minimum number of read blocks,underlying function will read or write data which its size is decided by upper function,if fatfs fuction read or write to little data,the underlying function will oprate many blocks but still return little data,it takes a lot of time.I modfy the cluster to 128K on PC,then fatfs write 1024*1024 byte,it take 41ms

  • i have a question,USDHC read and wite bock funtion like SD_ReadBlocks(&g_sd, buff, sector, count),what is the maximum count  is.The cluster value determines the maximum number of FATFS read and write blocks at a time,for example,if the cluster is 128K,FATFS can oprate 128K/512byte blockes a time when you operate data's size is more than 128K.but the cluster haves many values when formatted
    InvisibleWind_0-1695352976994.png

    if the the number of block reads and writes exceeds the range of the underlying function,what will happen

0 Kudos
Reply