STM32F103 USB cdc receiver is very slow
i am using stm32f103 for one project. Previously we were using UART interface to transfer data but now we want to use USB CDC interface for the same.
i configured the usb in cdc mode and it is working also.
I am facing one issue like data receiving is very slow. If i send 20-30 bytes characters then i am getting only 2-3 characters on the screen.
Followign are the changes i have done in usbd_cdc_if.c
static int8_t CDC_Receive_FS(uint8_t* Buf, uint32_t *Len)
{
/* USER CODE BEGIN 6 */
USBD_CDC_SetRxBuffer(&hUsbDeviceFS, &Buf[0]);
USBD_CDC_ReceivePacket(&hUsbDeviceFS);
memset (usb_cdc_buffer, '\0', 64); // clear the buffer
uint8_t len = (uint8_t)*Len;
memcpy(usb_cdc_buffer, Buf, len); // copy the data to the buffer
memset(Buf, '\0', len); // clear the Buf also
usb_cdc_rx_flag = 1;
return (USBD_OK);
/* USER CODE END 6 */
}and in while loop of the main function i am checking for the flag and transmitting it like follow,
if(usb_cdc_rx_flag)
{
CDC_Transmit_FS(usb_cdc_buffer,64);
usb_cdc_rx_flag = 0;
}Any help will be appreciated.
