USB CDC Increase Reading Speed
Hello,
I'm currently working on a USB project and i encounter some issues.
I would like to send data to the STM32 and the STM32 must re-send it as fast as possible. I already test the sending speed and it work great for me but the reading speed is low.
The function CDC_Receive_FS work as a callback function and is call at the right speed (as fast as the sending speed) but between the sending and the writing, there's a delay... I've looked into the library but i don't understant where it comes from or how to fix it.
The STM32 seems to be able to receive et write data with a latency of 10ms but combining these two operation make the board have a latency of (avg)124ms.
I suspect the USBD_CDC_ReceivePacket function to be the cause of this issue.
Do you have any idea ?
```C
static int8_t CDC_Receive_FS(uint8_t* Buf, uint32_t *Len)
{
/* USER CODE BEGIN 6 */
incrtest++;
TCountMsgReceive = StartingValueTCount;
USBD_CDC_SetRxBuffer(&hUsbDeviceFS, &Buf[0]);
CDC_Transmit_FS(UserRxBufferFS, *Len);
USBD_CDC_ReceivePacket(&hUsbDeviceFS);
if(((USBD_CDC_HandleTypeDef*) hUsbDeviceFS.pClassData)->RxState==0)
{
//USB_CAN_SwitchReceive();
}
return (USBD_OK);
/* USER CODE END 6 */
}
```
