Electrical – STM32 HAL_PCD_EP_Transmit work only once

hal-librarynucleostm32stm32f4usb device

I'm developing a USB composite device with the Nucleo-F446ZE.
I'm adding a Virtual com port and I have some trouble to send back data.
I receive everything from the computer but when I try to send back something it work only once. Then the EP->xfer_count is still at zero and HAL status is always 0.

//usbd_conf.c

HAL_PCDEx_SetRxFiFo(&hpcd, 0x40);
HAL_PCDEx_SetTxFiFo(&hpcd, 0, 0x20);
HAL_PCDEx_SetTxFiFo(&hpcd, 1, 0x20);
HAL_PCDEx_SetTxFiFo(&hpcd, 2, 0x10);
HAL_PCDEx_SetTxFiFo(&hpcd, 3, 0x20);
HAL_PCDEx_SetTxFiFo(&hpcd, 4, 0x10);
HAL_PCDEx_SetTxFiFo(&hpcd, 5, 0x20);

//init

USBD_LL_OpenEP(pdev,
             CDC_IN_EP, //0x85
             USBD_EP_TYPE_BULK,
             CDC_DATA_FS_MAX_PACKET_SIZE); //64

USBD_LL_OpenEP(pdev,
             CDC_OUT_EP, //0x03
             USBD_EP_TYPE_BULK,
             CDC_DATA_FS_MAX_PACKET_SIZE); //64



//The receive/send back function

dataLen = USBD_GetRxCount (pdev, epnum);
Hstatus = HAL_PCD_EP_Transmit(pdev->pData, CDC_IN_EP, VCP_recv, dataLen);
HAL_PCD_EP_Receive (pdev->pData,
    CDC_OUT_EP,
    VCP_recv,
    CCID_BULK_EPOUT_SIZE);           

Best Answer

In fact, it was working like a charm. It's just windows who was ignoring the messages because of this