Skip to main content
Visitor II
February 19, 2020
Question

STM32H7+FREERTOS+FATFS+USB_HOST USB enumeration get device descriptor return USBH_BUSY

  • February 19, 2020
  • 1 reply
  • 1220 views

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:

0690X00000DBqTxQAL.png

I don't know why such a problem occurs, please help me.

thank you very much.

jack zeng

    This topic has been closed for replies.

    1 reply

    Visitor II
    April 9, 2020

    Hello just having the same problem: did you manage to solve it?