Skip to main content
Robmar
Senior II
October 18, 2024
Question

Using both of the STM32H7 USB controllers as Host ports - issues?

  • October 18, 2024
  • 1 reply
  • 1283 views

Are there any issue using both controllers in host mode?

 

 

USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef *phost)
{
 /* Init USB_IP */
 if (phost->id == HOST_FS)
 {
 /* Link the driver to the stack. */

 hhcd_USB_OTG_FS.pData = phost;
 phost->pData = &hhcd_USB_OTG_FS;

 hhcd_USB_OTG_FS.Instance = USB_OTG_FS;
 hhcd_USB_OTG_FS.Init.Host_channels = 16;
 hhcd_USB_OTG_FS.Init.speed = HCD_SPEED_FULL;
 hhcd_USB_OTG_FS.Init.dma_enable = DISABLE;
 hhcd_USB_OTG_FS.Init.phy_itface = HCD_PHY_EMBEDDED;
 hhcd_USB_OTG_FS.Init.Sof_enable = DISABLE;		// GW8RDI NOTE todo try with SOF
 if (HAL_HCD_Init(&hhcd_USB_OTG_FS) != HAL_OK)
 {
 Error_Handler( );
 }

 USBH_LL_SetTimer(phost, HAL_HCD_GetCurrentFrame(&hhcd_USB_OTG_FS));
 }
 return USBH_OK;
}

 

 

1 reply

AScha.3
Super User
October 18, 2024

Both working fine. But only at full speed setting, HS phy not present on HOST_HS .

But i only use Cube/HAL to set it, so try this. (LL i never tried.)

And i use both, on H743:

/* USB Host core handle declaration */
USBH_HandleTypeDef hUsbHostHS;
USBH_HandleTypeDef hUsbHostFS;
ApplicationTypeDef Appli_state = APPLICATION_IDLE;

/*
 * -- Insert your variables declaration here --
 */
/* USER CODE BEGIN 0 */
ApplicationTypeDef Appli_state_sound = APPLICATION_IDLE;
/* USER CODE END 0 */

/*
 * user callback declaration
 */
static void USBH_UserProcess1(USBH_HandleTypeDef *phost, uint8_t id);
static void USBH_UserProcess2(USBH_HandleTypeDef *phost, uint8_t id);

/*
 * -- Insert your external function declaration here --
"If you feel a post has answered your question, please click ""Accept as Solution""."
Robmar
RobmarAuthor
Senior II
October 18, 2024

Okay thanks, but I already have host and device working well for CDC and HID, I wonder how much code I'm going to have to rewrite to get this working using the latest HAL, I guess it doesn't allow switching on the fly between CDC and HID?