H747 : USB HS , USBD_CDC_TransmitPacket() stucks BUSY
Hello,
I have an issue with USB CDC in my project. it worked flowless till I tried to send faster.
Fisrt I was using :CDC_Transmit_HS((uint8_t *)pSendBuffer , length); without pb at all.
But if I send with a higer data rate the TxState are continiously busy here:
uint8_t CDC_Transmit_HS(uint8_t* Buf, uint16_t Len)
{
uint8_t result = USBD_OK;
/* USER CODE BEGIN 12 */
USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*)hUsbDeviceHS.pClassData;
if (hcdc->TxState != 0){
return USBD_BUSY;
}I found some other implementation with a while loop to wait until the frame has been sent, like this :
len = sizeof(UserTxBufferHS);
for (i = 0; i < _Len / len; i++)
{
memcpy(UserTxBufferHS, _Buf, len);
USBD_CDC_SetTxBuffer(&hUsbDeviceHS, UserTxBufferHS, len);
while (1)
{
re = USBD_CDC_TransmitPacket(&hUsbDeviceHS);
if (re == USBD_OK)
{
break;
} else if (re == USBD_BUSY) {
continue;
} else if (re == USBD_FAIL) {
break;
}
}
_Buf += len;
}But I stay stuck in the while loop.
I have made a lot of tries and I have no moreidea how to manage this problem.
Many thanks for your help
Bertrand
