我用STM32CUBE 创建 一个 USBH FREERTOS
我缺省有3个线程
/* Create the thread(s) */
/* 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);
我看 STM32CUBE 是在 StartDefaultTask 新创建了一个 USBH 的线程
#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) */
我单步执行过,创建都是成功的
但是 USBH_Process_OS 函数就是进不去
然后我用 osThreadList(ucD);函数检测 ,发现 是 USBH 这个线程 阻塞了
我尝试过把3个线程变成一个,这个线程里面为osDelay延时空循环,都不行
不知道哪位大侠能指点一二
|