2020-02-18 07:07 PM
Hello:
Problem Description:
When I run STM32H7 + USB_HOST bare metal, the USB HOST peripheral of STM32H7 can work normally.
When I add USB_HOST to Free RTOS, the program will get stuck in the USB enumeration process to get the device descriptor.
at this time:USBH_Process ()-> USBH_HandleEnum ()-> USBH_Get_DevDesc ();The function USBH_Get_DevDesc () returns USBH_BUSY, causing the USB HOST to fail to work properly.
Before change:
usbh_conf.h:
#ifndef __USBH_CONF_H
#define __USBH_CONF_H
/* Includes ------------------------------------------------------------------*/
#include "stm32h7xx_hal.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Exported types ------------------------------------------------------------*/
#define USBH_MAX_NUM_INTERFACES 2
#define USBH_MAX_NUM_CONFIGURATION 1
#define USBH_MAX_NUM_SUPPORTED_CLASS 1
#define USBH_KEEP_CFG_DESCRIPTOR 0
#define USBH_MAX_SIZE_CONFIGURATION 256U
#define USBH_MAX_DATA_BUFFER 512U
#define USBH_DEBUG_LEVEL 2
-> #define USBH_USE_OS 0
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* CMSIS OS macros */
#if (USBH_USE_OS == 1)
#include "cmsis_os.h"
//#define USBH_PROCESS_PRIO osPriorityNormal
#define USBH_PROCESS_PRIO osPriorityRealtime
#define USBH_PROCESS_STACK_SIZE ((uint16_t)128)
#endif
After changes:
usbh_conf.h:
#ifndef __USBH_CONF_H
#define __USBH_CONF_H
/* Includes ------------------------------------------------------------------*/
#include "stm32h7xx_hal.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Exported types ------------------------------------------------------------*/
#define USBH_MAX_NUM_INTERFACES 2
#define USBH_MAX_NUM_CONFIGURATION 1
#define USBH_MAX_NUM_SUPPORTED_CLASS 1
#define USBH_KEEP_CFG_DESCRIPTOR 0
#define USBH_MAX_SIZE_CONFIGURATION 256U
#define USBH_MAX_DATA_BUFFER 512U
#define USBH_DEBUG_LEVEL 2
-> #define USBH_USE_OS 1
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* CMSIS OS macros */
#if (USBH_USE_OS == 1)
#include "cmsis_os.h"
//#define USBH_PROCESS_PRIO osPriorityNormal
#define USBH_PROCESS_PRIO osPriorityRealtime
#define USBH_PROCESS_STACK_SIZE ((uint16_t)128)
#endif
keil debug info:
I don't know why such a problem occurs, please help me.
thank you very much.
jack zeng
2020-04-09 10:12 AM
Hello just having the same problem: did you manage to solve it?