cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U5G9 USB HUB+MSC transmission timeout

Xiang
Associate II

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)

Xiang_0-1718349792318.png

But when I write data in 64MByte, there is a transmission timeout issue.

Xiang_1-1718349871401.png

How should I solve this problem?

 

thanks!

4 REPLIES 4
Xiang
Associate II

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;

Xiang_0-1718350564348.png

 

 

FBL
ST Employee

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.

Xiang
Associate II

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?

Xiang_0-1718596872938.png

Xiang_1-1718597157102.png

 

FBL
ST Employee

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.