I'm trying to get some basic USB CDC stuff to work on the stm32f103 blue pill.
In the examples, there are these code snippets
#define APP_RX_DATA_SIZE 8
uint8_t UserRxBufferFS[APP_RX_DATA_SIZE];
static int8_t CDC_Init_FS(void)
{
/* USER CODE BEGIN 3 */
/* Set Application Buffers */
USBD_CDC_SetTxBuffer(&hUsbDeviceFS, UserTxBufferFS, 0);
USBD_CDC_SetRxBuffer(&hUsbDeviceFS, UserRxBufferFS);
return (USBD_OK);
/* USER CODE END 3 */
}
so... the function USBD_CDC_SetRxBuffer doesn't take length as an argument. How can that be?
When I send a dumb string of 144 chars from a terminal, I get the data in chunks of 64.
With the length of 8 above this means the buffer overflows. I read somewhere that USB stuff happens in packet sizes as large as 64. ok.
So on what basis should I set APP_RX_DATA_SIZE? How to I prevent overflows?
Why doesn't USBD_CDC_SetRxBuffer take the buffer size as an argument?