cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Cube USB device transfer

0x4e71
Associate II
Posted on November 05, 2015 at 14:52

I am implementing new class driver for USB device. Basically this is PTP/MTP compatible class driver for device. I run into problem during USB transmission.  For now I have device descriptor configured and transferred to host - I can see one Interrupt endpoint and  two bulk endpoints correctly configured. Then what I (as a device) get from host is higher level OpenSession command which I get on OUT endpoint, and I respond with short message (12 bytes) on IN endpoint. This I can see in wireshark as 80 bytes URB _BULK out submit (64 bytes + openSession command), 64 bytes URB_BULK complete and 64 URB_BULK in submit, 76 URB_BULK in complete (64 bytes + 12 bytes of response). This gets transmitted correctly, now my host has the session open and tries to get some information about the device.

So again I get URB_BULK out with the request from host, I can see complete on USB bus, I send my response which  is 76 bytes long (larger then packet size for the endpoint which is set to 64 bytes) and I can have only 64 bytes sent through the endpoint. This is transfered correctly - host receives it, but there is no transmission of the rest of the data. Host receives only 64 bytes.

The application handles transfer in DataOut function (basically it is based on CDC class driver - so this is USBD_CDC_DataOut equivalent):

USBD_LL_GetRxDataSize();

Process_RXBuffer();

USBD_LL_Transmit();

USBD_LL_PrepareReceive();

return USBD_OK;

Process_RXBuffer handles the command processing and prepares the response in tx buffer.

I am working with STM32F429i-disco with USE_USB_HS_IN_FS set.

The transmission seems to be properly configured on STM side but the transmission does not get past initial block in transfers larger then 64 bytes. Is there some step I am missing to get transfer of data larger then maxpacket to be succesfull?

#stm32-usb-driver
2 REPLIES 2
0x4e71
Associate II
Posted on November 09, 2015 at 09:08

Hi, posting here in case somemeone else have similiar problem. After some more digging it seems that I get short read request from Linux MTP implementation - if I request 120 bytes from application which directly uses libusb, then STM sends correctly 120 bytes in two packets.

So probably I am missing something with libmtp on host side to get request for subsequent packets provided that max packet size is 64 bytes.

thorsten
Associate II
Posted on December 16, 2015 at 03:03

Hi,

have you had success with the mtp device mode driver ? Could you be so kind and share it ?

Best, Thorsten