Skip to main content
Graduate
October 26, 2025
Solved

The “Virtual Port Comm” issue on STM32F407

  • October 26, 2025
  • 1 reply
  • 190 views

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.

 

images.jpegstm32f407vet6-mini-development-board-development-boards-motorobit-35797-34-B.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I replaced the MCU on the board with the original MCU.

thank you :)

    This topic has been closed for replies.
    Best answer by No_Name

    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.

    1 reply

    No_NameAuthorAnswer
    Graduate
    October 27, 2025

    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.