how can make MSC and SDMMC faster?

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

how can make MSC and SDMMC faster?

Jump to solution
1,648 Views
joseph5760
Contributor II

I ran the usb_device_composite_cdc_msc_disk example, and saw a speed of about 5 MiB/s through the sdhc card.

 

And this picture is the speed of only USB MSC benchmarked after reading Null (zero) instead of SD card.

joseph5760_0-1637879041791.png

 

 

From this, USB can operate up to about 30 MiB/s, and SD is about 5 MiB/s.

 

But I want more speed. At least the speed of the SD card of 5 MiB/s seems to be too slow.

198MHz * 4bit => 99MiB/s is the theoretical speed, and the SD card speed measured by the PC is at least 60MiB/s.

 

Any ideas on how to do this faster?

Labels (1)
Tags (4)
0 Kudos
1 Solution
1,560 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @joseph5760 ,

Please refer to the attachment. It shows how to speed up. You can make the buffer size as big as possible. If DTCM space is not enough, you can move to OCRAM.

And if you can set card operation voltage to 1.8v, this will enable UHS-I operation. It can improve the performance too.

 

Regards,

Jing

 

View solution in original post

0 Kudos
3 Replies
1,630 Views
joseph5760
Contributor II

After changing USB_DEVICE_MSC_READ_BUFF_SIZE to 512 * 26, the speed increased to 32 MiB/s. 

joseph5760_1-1637923337020.png

 

Also, if use an SD card, the speed is 10 MiB/s.

joseph5760_2-1637923409940.png

 

Although it is faster than before, I want to get about 30 MiB/s even when using an SD card. What should I do?

 

---

 

````

if (1) {
int i=0;
int j=0;
int st = xTaskGetTickCount();
int dt;
for (i=0; i<4096; i++, j+=8) {
SD_ReadBlocks(usbDeviceMscSdcard, buffer, j, 8);
}
dt = xTaskGetTickCount() - st;
PRINTF("dt: %d\n", dt);
}

```

milliseconds = 374
speed = 42.78MiB/s (4096 * 8 * 512 / 0.374)

Reading the SD card seems fast enough. Why is SD access with MSC slow?

 

card->operationVoltage: 3 (1.8v)
BOARD_SD_Pin_Config: freq=198MHz
16384 blocks & TIME = 843 ms
=> 9.48MiB/s (So slowly...)

 

 

0 Kudos
1,561 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @joseph5760 ,

Please refer to the attachment. It shows how to speed up. You can make the buffer size as big as possible. If DTCM space is not enough, you can move to OCRAM.

And if you can set card operation voltage to 1.8v, this will enable UHS-I operation. It can improve the performance too.

 

Regards,

Jing

 

0 Kudos
1,512 Views
joseph5760
Contributor II

Thank you!

The optimize (-O2) option gave me a 25% performance improvement.

0 Kudos