Skip to main content
Markus Rudolf
Associate III
December 21, 2016
Question

CubeMX 4.18.0 for STM32F407VG: USB Clock not enabled before calling MX_USB_Init()

  • December 21, 2016
  • 1 reply
  • 703 views
Posted on December 21, 2016 at 16:35

When I generate a project with USB CDC Device Class and FreeRTOS, enumeration fails because the clock to the USB peripheral is not enabled before calling MX_USB_DEVICE_Init(). If I insert the code as follows

void StartDefaultTask(void const * argument)

{

  /* init code for LWIP */

  MX_LWIP_Init();

  __HAL_RCC_USB_OTG_FS_CLK_ENABLE(); <----- INSERT THIS LINE

  /* init code for USB_DEVICE */

  MX_USB_DEVICE_Init();

  /* USER CODE BEGIN 5 */

  /* Infinite loop */

  for(;;)

  {

    osDelay(1);

  }

  /* USER CODE END 5 */

}

in the Default Task it works like a charm. Please consider fixing that as it took me quite some time to figure out what was wrong.

#stm32cube-bug #stm32-usb-cdc-cubemx #stm32f407 #freertos-stm32cube
This topic has been closed for replies.

1 reply

Nesrine M_O
Associate
December 22, 2016
Posted on December 22, 2016 at 16:49

Hi

Rudolf.Markus

‌,

I will check this problem with our MXteam & come back to you.Sorry for the inconvenience it may bring.

-Nesrine-