2025-10-26 1:27 PM - edited 2025-10-26 1:41 PM
Hi everyone.
I tried adding USB_OTG_FS/Virtual Port Comm to STM32F407VET6 as a device only, but the problem is that when I try to connect the STM32 USB to my PC/laptop, it says “USB not recognized” on my PC/laptop, and I think it might be a problem with the cable, but after I replaced the cable 5 times and tried connecting it to my laptop, the problem remained the same.
Where does this problem originate—in the code or the hardware itself?
I used two boards, and both experienced the same problem.
I replaced the MCU on the board with the original MCU.
thank you :)
Solved! Go to Solution.
2025-10-26 5:09 PM
Okay, I've found the problem.
The problem lies in the clock settings, more specifically in the PLLM value being too low.
Wrong.
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = 25;
RCC_OscInitStruct.PLL.PLLN = 336;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 7;Correct.
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = 8; <- set 25 to 8
RCC_OscInitStruct.PLL.PLLN = 336;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 7;After I changed the PLLM value to 8, performed debugging, then unplugged and plugged the USB cable back in, the Virtual Port Comm was finally fully recognized by the PC/laptop.
2025-10-26 5:09 PM
Okay, I've found the problem.
The problem lies in the clock settings, more specifically in the PLLM value being too low.
Wrong.
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = 25;
RCC_OscInitStruct.PLL.PLLN = 336;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 7;Correct.
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = 8; <- set 25 to 8
RCC_OscInitStruct.PLL.PLLN = 336;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 7;After I changed the PLLM value to 8, performed debugging, then unplugged and plugged the USB cable back in, the Virtual Port Comm was finally fully recognized by the PC/laptop.