edit: previously I wrote that problems occurs with freertos, I checked without it and I am having the same problem (ending in dead loop after sending more than 8 characters).
Steps to reproduce:
Create project in CubeMX for STM32F4DISCOVERY, enable USB_FS Device only. Configure clock: PLL_N = 72, PLL_Q=3, that gives me 48 MHz for usb, other settings remain unchanged. In configuration I enable CDC device with default parameters. Generate code for SW.
I add some led toggle in order to know it it is running.
/* StartDefaultTask function */
void StartDefaultTask(void const * argument)
/* init code for USB_DEVICE */
/* USER CODE BEGIN 5 */
/* Infinite loop */
/* USER CODE END 5 */
In file usbd_cdc_if.c I am setting breakpoint at CDC_Receive_FS function.
When I am sending 8 characters or less it works fine. Program enters function above. When I send more than 8 characters, program is not entering CDC_Receive_FS function
>>> import serial
>>> ser = serial.Serial(port='/dev/ttyACM0')
# python hangs here
- Sometimes program hangs in this loop:
* @brief This is the code that gets called when the processor receives an
* unexpected interrupt. This simply enters an infinite loop, preserving
* the system state for examination by a debugger.
* @param None
* @retval None
.size Default_Handler, .-Default_Handler