AnsweredAssumed Answered

CubeMX - STM32F411 code generation CDC ACM bug ?

Question asked by testuo on Dec 23, 2015
Latest reply on Jan 2, 2016 by testuo
Hi,
not sure it's a bug because it's my first time with CDC ACM.
But After a fresh CubeMX generation with USB_OTG_FS in device mode.

I just add this :

  uint8_t buf[] = "Hello\r\n";
  // delay to allow time to pc to load driver (I think so)
  HAL_Delay(1000);
 
  while (1)
  {
    HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);
    HAL_Delay(50);
    CDC_Transmit_FS(buf, 8);
  }
 
}

If usb is connected to host during startup it's works.
Even if i disconnect usb cable. My led blinking.

But if usb cable is disconected the program freeze at line :
CDC_Transmit_FS(buf, 8);


have you any idea of what is the cause and how to fix it ?

Thanks

Attached is a zip of project with a Makefile for gcc.

Attachments

Outcomes