cancel
Showing results for 
Search instead for 
Did you mean: 

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

Markus Rudolf
Associate III
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
1 REPLY 1
Nesrine M_O
Lead II
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-