cancel
Showing results for 
Search instead for 
Did you mean: 

Send multi-packet data with USB Host library

vlr
Associate II
Posted on December 02, 2015 at 18:22

Hi,

I'm

using the

STM32F407

with

USB

Host

library

, in high-speed.

I want to

communicate via

USB

with

a smartphone

.

When

i send

a

packet of

64 bytes

everything works

.

If I send a

packet

, for example,

of

94

bytes

,

the first time

send

all

94

bytes

,

the second time I

tried again

to

send

94

bytes

or

less

,

the

smartphone

receives

the last

94

- 64

=

30

bytes

.

Why?

This

is my code

for

sending

:

uint8_t do_ping = 1;

uint8_t buff[512];

sprintf(buff,''CAN source address: %d \n TSC1 speed [rpm]: %d ''

            ''\n Override Control mode: \n Override priority: \n'', buff_TSC1.address, speed_rpm);

USBH_Delay(800);

while(USBH_OK != USBH_BulkSendData (&hUSB_Host, buff, strlen(buff), pipe_numOUT, do_ping));

USBH_Delay(500);

Someone can

explain me how

sending

multi

packet

? Thank you

#usbh #stm32 #usb #multi-packet
1 REPLY 1
Frost Lin
Associate
Posted on April 26, 2018 at 08:28

Hi, do you have any clue on this issue? I also have similar question about whether the STM32Cube USB Host library support the multi-packets transfer too.

To simplify the question, I test the sample application 'USB_Host/MSC_Standalone' of 

STM32Cube V1.17 on STM32F41G EV board. In this sample, I configure the USB to high speed mode, and I change the data which will be written to the USB pen drive from a short string to a 1024 bytes one, which is 2 times of the End Point size (max packet size) of the USB pen drive. it will make 

USBH_BulkSendData() specify 1024 in length parameter and  further make PKTCNT field defined within OTG_HS_HCTSIZx register to be 2 packet. 

After the USBH_BulkSendData() return with URB_DONE, I can't receive the CSW which should acknowledge from the USB pen drive when I invoke USBH_BulkReceiveData(). And the debug on USB pen drive show it actually receive the CBW specify a 1024 bytes length data will be sent 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 mluti-packets up to 64K bytes.

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.