go to nanocad.com, download personal version.
https://nanocad.com/personal/
I have Hard fault when USB device Attached to my STM32F407.
STM32CubeMX makes rtos STACK SIZE default to 128 bytes.
It is too small.
You can increase stack size.
Filename : USB_HOST/Target/usbh_config.h
#if (USBH_USE_OS == 1)
#include "cmsis_os.h"
#define USBH_PROCESS_PRIO osPriorityNormal
#define USBH_PROCESS_STACK_SIZE ((uint16_t)128)
#endif /* (USBH_USE_OS == 1) */
#if (USBH_USE_OS == 1)
#include "cmsis_os.h"
#define USBH_PROCESS_PRIO osPriorityNormal
#define USBH_PROCESS_STACK_SIZE ((uint16_t)2048)
#endif /* (USBH_USE_OS == 1) */