AnsweredAssumed Answered

Using STM32Cube USB Host library for multi-packets bulk OUT transfer

Question asked by Frost Lin on Apr 27, 2018

Hello Sirs,


I  have a question about whether the STM32Cube USB Host library support the multi-packets in bulk transfer due to I can only transfer only one packet of data every time invoking STM32Cube's bulk sending APIs and result in a quite low transferring data rate (8Mb/s in High-Speed configuration).


To simplify the question, I test the sample application "USB_Host/MSC_Standalone" of STM32Cube V1.17 on STM32F41G EV board (STM32F417 embedded) in SW4STM32 IDE. In this sample, I configure the USB to high speed, and I enlarge the data which will be written to the USB pen drive from a default short string to a 1024 bytes one, which is exactly 2 times of the size of OUT Endpoint (the max size of packet) of the USB pen drive. it will make the length parameter of USBH_BulkSendData() specified to 1024 and  further make PKTCNT field defined within OTG_HS_HCTSIZx register to be 2 (packets) in USB_HC_StartXfer() function. 


After the USBH_BulkSendData() result that USBH_GetURBState() return the URB_DONE, I can't receive the CSW which should acknowledge from the USB pen drive when I invoke USBH_BulkReceiveData(). And some debug on USB pen drive tell me it actually receive the CBW specify a 1024 bytes length data will be sent, but then receive nothing later. In the case of writing data to this USB pen drive with PC instead of STM32F41G board, this pen drive is capable to receive USB transfer with multi-packets up to 64K bytes in one URB transmission. So I doubt the API fail to transfer the data when I specify more than one packet of data to send.


By the way, description of multi packet transfer feature could be found with official user manual "UM1734, STM32Cube USB device library", but I can't find the same feature on host side manual "UM1720, STM32Cube USB host library".


Best Regards.