2018-07-11 11:48 PM
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;}