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.
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?
Solved! Go to Solution.
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
After changing USB_DEVICE_MSC_READ_BUFF_SIZE to 512 * 26, the speed increased to 32 MiB/s.
Also, if use an SD card, the speed is 10 MiB/s.
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 = 374speed = 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...)
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
Thank you!
The optimize (-O2) option gave me a 25% performance improvement.