Skip to main content
Visitor II
January 19, 2021
Question

STM32F429I-Disc1: Windows 10 fails to recognize Virtual Com Port after configuring USB_OT_FS with cubeMX.

  • January 19, 2021
  • 1 reply
  • 1022 views

I am using a STM32F429I-Disc1 board and configured my project as follows:

USB_OT_FS:

0693W000007Bk2SQAS.pngUSB_DEVICE (middleware):

0693W000007Bk2XQAS.pngAll parameter settings are default and nothing has been changed. I also increased the minimum heap and stack size for the project :

0693W000007Bk2cQAC.pngClock config:

0693W000007Bk3aQAC.png 

What Im trying to achieve is just sending simple data over the VCOM port.

The while loop:

 while (1)
 {
 // usbBuffer is now just a simple buffer containing "Hello World" for debugging 
 // (declared outside scope)
 CDC_Transmit_FS(usbBuffer, strlen((char *)usbBuffer));
 // Toggle LED for debugging
 HAL_GPIO_TogglePin(GPIOG, GPIO_PIN_13);
 HAL_Delay(500);
 }

I debugged the "MX_USB_DEVICE_Init" function that cubeMX generated (and gets called before the while loop) and everything seems to initialize normally. (no error handlers being called, timeouts etc.)

The project compiles without any errors or warnings and when flashing on the board nothing out of the ordinary happens when debugging:

  • Transmit function gets called and runs to completion
  • Debug Led gets toggled on/off

However when look for my board in Windows Device Manager it is nowhere to be found:

0693W000007Bk3LQAS.pngOnly the STLink debugger VCOM is detected and I am running out of options here.

What I have tried so far:

  • Reinstall the aforementioned driver
  • Further increase the size of the stack and heap
  • Tweaking the clock configuration in cubeMX

Hopefully someone knows what I have overlooked here. All help is appreciated, thanks in advance.

    This topic has been closed for replies.

    1 reply

    Super User
    January 19, 2021

    Put a delay after initialization and before you call CDC_Transmit_FS for the first time. The PC needs time to initialize the peripheral which triggers some other initialization within the USB stuff. The HAL USB driver is not particularly robust.

    FatihAuthor
    Visitor II
    January 19, 2021

    Thanks for the quick reply,

    I put a delay of 30000ms after the usb initialization:

    int main(void)
    {
     /* USER CODE BEGIN 1 */
     uint8_t usbBuffer[20] = "Hello World \r\n";
     /* USER CODE END 1 */
     
     /* MCU Configuration--------------------------------------------------------*/
     
     /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
     HAL_Init();
     
     /* USER CODE BEGIN Init */
     
     /* USER CODE END Init */
     
     /* Configure the system clock */
     SystemClock_Config();
     
     /* USER CODE BEGIN SysInit */
     
     /* USER CODE END SysInit */
     
     /* Initialize all configured peripherals */
     MX_GPIO_Init();
     MX_SPI5_Init();
     MX_USB_DEVICE_Init();
     MX_I2C1_Init();
     /* USER CODE BEGIN 2 */
     HAL_Delay(30000);
     /* USER CODE END 2 */
     
     /* Infinite loop */
     /* USER CODE BEGIN WHILE */
     while (1)
     {
     /* USER CODE END WHILE */
     
     /* USER CODE BEGIN 3 */
     CDC_Transmit_FS(usbBuffer, strlen((char *)usbBuffer));
     HAL_GPIO_TogglePin(GPIOG, LED_GREEN_Pin);
     HAL_Delay(1000);
     }
     /* USER CODE END 3 */
    }

    Unfortunately Windows still does not see a second Virtual Com Port except for the standard STLink debugger.

    I have seen on different forums that people with this particular board have the same troubles I am experiencing (Windows 10 not recognizing the port).

    Maybe the problem lies somewhere else?

    Super User
    January 19, 2021
    I should have specified a delay of 500ms should be sufficient, if that’s the problem. If you really wanted to dive into it, you can download a usb monitor such as usb monitor pro or wireshark to see what’s on the line. It’s a tedious process.