cancel
Showing results for 
Search instead for 
Did you mean: 

When I make a usb host freertos programe using stm32cube, the usbh thread is block

JYu.2
Associate

I make a usbh freertoss programe by stm32cube.

The programe have three thread

 /* definition and creation of defaultTask */

 osThreadDef(defaultTask, StartDefaultTask, osPriorityNormal, 0, 512);

 defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);

 /* definition and creation of commTask */

 osThreadDef(commTask, StartCommTask, osPriorityIdle, 0, 512);

 commTaskHandle = osThreadCreate(osThread(commTask), NULL);

 /* definition and creation of LedTask */

 osThreadDef(LedTask, StartLedTask03, osPriorityIdle, 0, 512);

 LedTaskHandle = osThreadCreate(osThread(LedTask), NULL);

The usbH thread is created in StartDefaultTask thread.

#if (USBH_USE_OS == 1U)

#if (osCMSIS < 0x20000U)

 /* Create USB Host Queue */

 osMessageQDef(USBH_Queue, MSGQUEUE_OBJECTS, uint16_t);

 phost->os_event = osMessageCreate(osMessageQ(USBH_Queue), NULL);

 /* Create USB Host Task */

#if defined (USBH_PROCESS_STACK_SIZE)

 osThreadDef(USBH_Thread, USBH_Process_OS, USBH_PROCESS_PRIO, 0U, USBH_PROCESS_STACK_SIZE);

#else

 osThreadDef(USBH_Thread, USBH_Process_OS, USBH_PROCESS_PRIO, 0U, 8U * configMINIMAL_STACK_SIZE);

#endif /* defined (USBH_PROCESS_STACK_SIZE) */

 phost->thread = osThreadCreate(osThread(USBH_Thread), phost);

#else

 /* Create USB Host Queue */

 phost->os_event = osMessageQueueNew(MSGQUEUE_OBJECTS, sizeof(uint32_t), NULL);

 /* Create USB Host Task */

 USBH_Thread_Atrr.name = "USBH_Queue";

#if defined (USBH_PROCESS_STACK_SIZE)

 USBH_Thread_Atrr.stack_size = USBH_PROCESS_STACK_SIZE;

#else

 USBH_Thread_Atrr.stack_size = (8U * configMINIMAL_STACK_SIZE);

#endif /* defined (USBH_PROCESS_STACK_SIZE) */

 USBH_Thread_Atrr.priority = USBH_PROCESS_PRIO;

 phost->thread = osThreadNew(USBH_Process_OS, phost, &USBH_Thread_Atrr);

#endif /* (osCMSIS < 0x20000U) */

#endif /* (USBH_USE_OS == 1U) */

But the function can not goto USBH_Process_OS.

I can see the UsbH thread is blocked when I use osThreadList;

3 REPLIES 3
JYu.2
Associate

UP UP UP UP

Hello @JYu.2​ ,

Can you provide the firmware package used?

Thanks in advance.

BeST Regards,

Walid