cancel
Showing results for 
Search instead for 
Did you mean: 

The “Virtual Port Comm” issue on STM32F407

No_Name
Associate III

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 :)

1 ACCEPTED SOLUTION

Accepted Solutions
No_Name
Associate III

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.

View solution in original post

1 REPLY 1
No_Name
Associate III

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.