STM32Cube MCU Full Package for the STM32F4 series - (HAL + LL Drivers, CMSIS Core, CMSIS Device, MW libraries plus a set of Projects running on all boards provided by ST (Nucleo, Evaluation and Discovery Kits))
The board (either ST RPN reference or your custom board).
IDE or at least the compiler and its version.
IDE: STM32CubeIDE 1.10.1
MCU: STM32F401RC
Describe the bug
I'm testing USB CDC on STM32.
The STM32 uses 12Mhz HSE clock, HCLK is 32Mhz.
The host PC recognizes the USB device. But sending `"hello world!\n" string repeatedly every about 10ms, the received data by host show message below.
Firmware Package version is 1.27.1 (latest at time)
Only USB and SWD peripherals enabled. (make sure the right clock configuration)
Only this code used on while() loop
#include "usbd_cdc_if.h"
#include <string.h>
...
while (1)
{
const char str = "hello world!\n";
CDC_Transmit_FS((unsigned char )str, strlen(str));
HAL_Delay(10);
/ USER CODE END WHILE /
/* USER CODE BEGIN 3 */
}
**Additional context**
- It also happens when I increase HAL_Delay() to 1000ms.
- It's not a serial terminal error. I tested on Coolterm, Arduino Terminal, node.js serialport package.
**Screenshots**
![image](https://user-images.githubusercontent.com/22570054/188542860-8190d419-2cb4-4975-83af-cc53ed92ef58.png)
![image](https://user-images.githubusercontent.com/22570054/188542869-453f8d70-914f-4bb8-9581-9427c29a4236.png)
OMG.. I think I resolved this issue.
I increased HCLK to 64Mhz and the problem doesn't appears.
Why I used 32Mhz is that I first tested on L0 MCU on 32Mhz and it worked well.
Describe the set-up
Describe the bug I'm testing USB CDC on STM32. The STM32 uses 12Mhz HSE clock, HCLK is 32Mhz. The host PC recognizes the USB device. But sending `"hello world!\n" string repeatedly every about 10ms, the received data by host show message below.
How To Reproduce
...
while (1) { const char str = "hello world!\n"; CDC_Transmit_FS((unsigned char )str, strlen(str)); HAL_Delay(10); / USER CODE END WHILE /
}