I try to implement USB CDC FS on the discovery Board from STM. But it is really frustrating.
I created a project via Cube MX with the HAL libraries. At the end I want a data rate near 500 kByte/s. Till now I can see my device in the device manager but really often I cannot open the com port in Hterm. Hterm is only not responding.
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USB_DEVICE_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
CDC_Transmit_FS(buf, 300);
HAL_Delay(1);
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
I initialise the clocks correctly. Maybe the virtual com port driver cannot buffer the high amount of data they are comeing from the MCU?! If I increase the delay time in the while loop, sometimes I can open the com port and get the data. The highest data rate I got were about 70 kByte/s. Too less:(
Are there any known bugs in the software? I already increased the heap and stack sizes, but it didn't fix the problem.
Thanks for help,