2024-06-14 12:30 AM - edited 2024-06-14 12:43 AM
Hello,
I want to test the read and write speed of U5 on the USB flash drive. I have made modifications to the demo (STM32U5G9J-DK2 \ Applications \ USBX \ Ux_Host_HUB_HID_MSC) so that I can observe the read and write speed.
#define MASS_TEST_WR_LEN (64*1024)
#define MASS_TEST_LEN (ULONG64)(64*1024*1024)
But when I write data in 64MByte, there is a transmission timeout issue.
How should I solve this problem?
thanks!
2024-06-14 12:36 AM
update:
If I enabled USB DMA, then this problem wouldn't have occurred, but why is that?
hhcd_USB_OTG_HS.Init.dma_enable = ENABLE;
2024-06-14 10:26 AM
HI @Xiang
Indeed, by using DMA especially in bulk transfers, you can achieve better overall performance and avoid bottlenecks that might lead to timeouts when the CPU is managing the transfers. Also, avoiding copying from media memory to MSC Bot buffer would increase the throughput.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-06-16 09:07 PM
Hi @FBL
Thank you very much for your reply.
I also tested the situation without a hub, and the same amount of data can be written into the USB drive without any errors. Can this indicate that the throughput is sufficient?
Due to project requirements, it is necessary to reinitialize the USB after the device is connected. Enabling DMA will cause the HUB enumeration to fail, and the same error code is 0x5C. But the first enumeration can be successful. Can you help me review it?
2024-06-18 03:02 AM
Hi @Xiang
If it is connected to High-Speed Upstream port, then it operates in HS mode. Otherwise, it operates in FS and narrows down the throughput.
Could you please confirm that the Hub you are using is self-powered? If not, this could be linked to amount of power sourced by DK board.
When using DMA, could you try to add this condition here
if ((USBx == USB_OTG_HS) && (hc->speed == USBH_HS_SPEED))
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.