Skip to main content
mohan raj
Associate II
July 12, 2018
Question

STM32F103VCT6 USB Communication Port disconnection Problem Sometimes.

  • July 12, 2018
  • 0 replies
  • 468 views
Posted on July 12, 2018 at 08:48

Hi,

I am using STM32F103VCT6 for my project and I have Polling the data packets from Uc for every 200 milliseconds and send to PC,Sometimes USB Communication is disconnected.

when I debugging and find that Transmit state is set to one.afterwards USB port is disconnected,

is any solution to reconnect the USB port when the port is in disconnected state.

uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len)

{

uint8_t result = USBD_OK;

/* USER CODE BEGIN 7 */

USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*)hUsbDeviceFS.pClassData;

if (hcdc->TxState != 0){ -------> always Set to One.

return USBD_BUSY;

}

USBD_CDC_SetTxBuffer(&hUsbDeviceFS, Buf, Len);

result = USBD_CDC_TransmitPacket(&hUsbDeviceFS);

/* USER CODE END 7 */

return result;

}
    This topic has been closed for replies.