Stm32 Virtual COM Port - Can not connect

cbr picture cbr · Mar 6, 2013 · Viewed 10.5k times · Source

This is a code, part of my project;

  //----------------------------------------------------------------------------
  // USB: Virtual COM ----------------------------------------------------------
  //----------------------------------------------------------------------------
  USB_Interrupts_Config();
  Set_USBClock();
  USB_Init();

  while (bDeviceState != CONFIGURED)
      ;

  //----------------------------------------------------------------------------
  // Main Loop -----------------------------------------------------------------
  //----------------------------------------------------------------------------
  while(1)
  {
    USB_printf("Main Function");

    GPIO_SetBits(GPIOC, GPIO_Pin_10);
    Wait(200);
    GPIO_ResetBits(GPIOC, GPIO_Pin_10);
    Wait(200);
  }

After plugging my usb to the Circuit, Virtual COM Port Driver installation finishes correctly and LED blinking is also OK.

But when I try to connect COM port via Hyper Terminal or 3th party tools, I can not achieve it.

Is there any opinion?

Thanks..

Answer

stiebrs picture stiebrs · Nov 6, 2018

I had similar issue with a slightly different wording - it is possible to connect to the device until it's reset. My custom board would enumerate VCP correctly but would not connect after device reset. Turns out, that USB host keeps the enumerated address for the device, while device looses its address after reset/reprogramming. To avoid such issues, software reset should also perform USB physical layer reset (disconnecting pullup on D+/D- pin, depending on the speed used). In such a case it should be possible to connect to the device after disabling and then re-enabling it in the device manager or re-plugging