how can make MSC and SDMMC faster?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

how can make MSC and SDMMC faster?

跳至解决方案
1,642 次查看
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?

标签 (1)
标记 (4)
0 项奖励
1 解答
1,554 次查看
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 项奖励
3 回复数
1,624 次查看
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 项奖励
1,555 次查看
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 项奖励
1,506 次查看
joseph5760
Contributor II

Thank you!

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

0 项奖励