Performance question, MSC on STM32U5 / DWC2 #2966
Replies: 5 comments
-
Hi, What block size you used with dd ? |
Beta Was this translation helpful? Give feedback.
-
I tried several values, 512, 1k, 4k, 32k, 1M. The difference is very little. (Except the write speed drops by choosing smaller chunks bs < 4k) |
Beta Was this translation helpful? Give feedback.
-
I think that the turnaround time is significant.
I think during the steps 2 and 3 the USB EP is stalled. This lost time results in a significant drop of the throughput. But currently I don't know how I can test my assumption. Are there any kind of double buffering mechanism in MSC? |
Beta Was this translation helpful? Give feedback.
-
I took out my STM32U5A5-NUCLEO and did a test:
With Mingw's dd 8k read I got 18.8MB/s without DMA and 23MB/s with DMA. So I thought it could be something wrong in your side but anyway I booted into Linux to check (dd should be quicker run natively), guess what I got 14MB/s ! It turns out actual block read size is pretty random, especially with 512 bytes blocks command-status turnaround overhead is pretty high: I tried different queue schedulers without success, maybe there are some USB mass storage specific tuneables.
TUSB tries to queue each USB transfer with maximum possible length, in case of DMA enabled there is no cpu intervention between 2 packets. You could be interested by #2967 |
Beta Was this translation helpful? Give feedback.
-
I got good block size on dd with |
Beta Was this translation helpful? Give feedback.
-
Hi,
I started a small test with tinyUSB on a STM32U5A5 evaluation board. Integration and compiling worked really well. The system has the following features:
I made some performance tests. To check which effect is related to the SD card I made a dummy MSC interface returning all zeros. On the host side I used linux dd command for the tests. I got the following results.
Dummy interface:
Reading: 15 MBytes/s
Writing: 34 MBytes/s
SD-Card connected:
Reading: 8.5 MBytes/s
Writing: 12.2 MBytes/s
Writing is almost twice as fast as reading. Enable or disable DMA doesn't make much difference except that the IRQ rate drops significant when DMA is enabled.
Does anyone know why the reading speed is much slower than writing?
Beta Was this translation helpful? Give feedback.
All reactions