Hello I have a USB communication between two STM32F769 µC. This works perfectly except in one case. When the amount of data is equal to the Bulk Maximum Endpoint Packet Size (64byte).
I have attached the eventlog of 2 transmissions. The first one works without problems. In the second one, it seems that the device wants to start another transfer with length 0. For some reason, this causes the host to never reach the ACM_Receive_done event.
Unfortunately, it is not clear to me whether this is an error in the USBH or USBD driver or whether I have configured something incorrectly. Maybe someone here can help me or knows a workaround.
18, 55.00062091, , id=0x0A02, 0x00000009 0x0000000019, 55.00118750, USBD_Driver, EndpointTransfer, device=0 ep_addr=0x82 data=0x20039960 num=3620, 55.00120335, USBD_CDC, ACM_WriteData, instance=0 len=36 result=3621, 55.00122139, USBD_Driver, OnSignalEndpointEvent, device=0 ep_addr=0x82 event=ARM_USBD_EVENT_IN22, 55.00124539, USBH_Driver, OnSignalPipeEvent, ctrl=0 pipe_hndl=0x40040560 event=ARM_USBH_EVENT_TRANSFER_COMPLETE23, 55.00128160, USBD_Driver, EndpointTransferGetResult, device=0 ep_addr=0x82 num=3624, 55.00132179, USBH_Driver, PipeTransferGetResult, ctrl=0 pipe_hndl=0x40040560 num=3625, 55.00132825, USBH_CDC, ACM_ReceiveDone, instance=0 num=51226, 55.00146280, USBH_CDC, ACM_Send, instance=0 num=1527, 55.00146749, USBH_Core, PipeSend, pipe_handle=0x2003A084 len=1528, 55.00148893, USBH_Driver, PipeTransfer, ctrl=0 pipe_hndl=0x40040540 packet=0x02 num=1529, 55.00150943, USBD_Driver, OnSignalEndpointEvent, device=0 ep_addr=0x02 event=ARM_USBD_EVENT_OUT30, 55.00152511, USBH_Driver, OnSignalPipeEvent, ctrl=0 pipe_hndl=0x40040540 event=ARM_USBH_EVENT_TRANSFER_COMPLETE31, 55.00156479, USBD_Driver, EndpointTransferGetResult, device=0 ep_addr=0x02 num=1532, 55.00158246, USBD_Driver, EndpointTransfer, device=0 ep_addr=0x02 data=0x20037760 num=6433, 55.00159203, USBD_CDC, ACM_ReadData, instance=0 len=15 result=1534, 55.00162583, USBH_Driver, PipeTransferGetResult, ctrl=0 pipe_hndl=0x40040540 num=1535, 55.00163194, USBH_CDC, ACM_SendDone, instance=0 num=1536, 55.00164870, USBH_CDC, ACM_GetStatus, instance=0 status=usbOK37, 55.00170857, USBH_CDC, ACM_Receive, instance=0 num=51238, 55.00171364, USBH_Core, PipeReceive, pipe_handle=0x2003A09C len=51239, 55.00173923, USBH_Driver, PipeTransfer, ctrl=0 pipe_hndl=0x40040560 packet=0x03 num=51240, 55.00177201, , id=0x0A02, 0x00000009 0x0000000041, 55.00222110, USBD_Driver, EndpointTransfer, device=0 ep_addr=0x82 data=0x20039960 num=6442, 55.00223702, USBD_CDC, ACM_WriteData, instance=0 len=64 result=6443, 55.00227466, USBD_Driver, OnSignalEndpointEvent, device=0 ep_addr=0x82 event=ARM_USBD_EVENT_IN44, 55.00234438, USBD_Driver, EndpointTransferGetResult, device=0 ep_addr=0x82 num=6445, 55.00239225, USBD_Driver, OnSignalEndpointEvent, device=0 ep_addr=0x82 event=ARM_USBD_EVENT_IN46, 55.00241658, USBH_Driver, OnSignalPipeEvent, ctrl=0 pipe_hndl=0x40040560 event=ARM_USBH_EVENT_TRANSFER_COMPLETE47, 55.00243350, USBD_Driver, EndpointTransfer, device=0 ep_addr=0x82 data=0x20039960 num=048, 55.00245671, USBD_Driver, EndpointTransferGetResult, device=0 ep_addr=0x82 num=049, 55.00248261, USBH_Driver, PipeTransferGetResult, ctrl=0 pipe_hndl=0x40040560 num=6450, 55.00250663, USBH_Driver, PipeTransfer, ctrl=0 pipe_hndl=0x40040560 packet=0x03 num=448
Have you tried calling 'USBH_CDC_ACM_Receive' function with 'num' parameter 64, since that is maximum packet size on the device?
I have just tested it. If I call USBH_CDC_ACM_Receive with num = 64, it works. But my buffer is bigger and the string length is not constant.
So i would like to find out what the problem is in order to prevent an error.
It looks like the problem is that USB Host wants to read 512 bytes and the read is not terminated by Zero Length Packet but USB Host continues to try to receive the remaining 448 bytes from requested 512.