2021-04-29 11:17 PM
So far in various online resources, the sample given is to configure USB FS as USB Host e.g. this https://www.youtube.com/watch?v=dC0d8CVEPrQ
But my board STM32769 Discovery does not have USB FS peripheral routed out of the board which leave me to use USB HS only. I try trial and error blindly to config it as USB Host as MSC class but no luck. Certain settings can't detect at all when I insert my USB thumb drive to USB HS connector, certain setting able to detect but immediately lead to HardFault_Handler() which seems due to memory access violation which I have no idea how that occurred. Could it be my clock setting?
So could someone please give me CubeMX setting (.ioc) how to configure the USB HS as USB Host? Also, there is tab under Middleware->USB_HOST->Platform Settings which gave warning but I have no idea at all what is that and how to configure it.
I'd appreciate the help.
2021-05-03 05:52 AM
Hello @BParh.1
Thanks for your post,
To Configure the USB host as Mass storage class, you need to Enable the USB_OTG_HS first (under connectivity) with Host mode selected, you can notice then, that the USB Host will be available to be configured (under Middleware), just set the Class to Mass storage class, and continue your configuration according to your need.
The warning message is linked to the platform settings, so to avoid it, you need to choose the Drive_VBUS_HS component, in case you prefer I2C, so it should be activated to find the solution then, otherwise, you should set one pin as Output then select it under Found Solutions.
Hope my answer helped you :) When your question is answered please close this topic by choosing Select as best, this will help other user find that answer faster.
Thanks for your contribution, Khouloud
2021-05-03 06:21 PM
Thank you @Khouloud ZEMMELI , that helps :grinning_face: . Could you brief me the background of this Drive_VBUS_HS setting please?
Sorry for my many questions, but need to resolve this in my prototype to see if USB Host can work in our project. I appreciate your help.
2021-05-12 04:20 AM
Hi again @BParh.1
Sorry for the delay,
In fact, the purpose of the USB_Host VBUS driver is:
When the USB Host MW need to drive this pin (at least after the stack initialization), the MW call the USBH_LL_DriverVBUS() during the start or during the stop :
USBH_StatusTypeDef USBH_Start(USBH_HandleTypeDef *phost)
{
/* Start the low level driver */
USBH_LL_Start(phost);
/* Activate VBUS on the port */
USBH_LL_DriverVBUS(phost, TRUE);
return USBH_OK;
}
Now, to use the I2C or GPIO depends on the board, so the user needs to know on which board the project is running and so can determine if the driver must be connected through a GPIO or an I2C or other connection, not supported by CubeMX.
To do this functionality, CubeMX propose two solutions:
Hope my answer helped you =) When your question is answered please close this topic by choosing Select as best, this will help other user find that answer faster.
Thanks for your contribution, Khouloud
2021-05-12 06:52 AM
Thank you @Khouloud ZEMMELI , I appreciate you take time to explain and attach the layout :).
However from your layout, it was for USB_OTG_FS and I can understand why it needs dedicated GPIO to drive VBUS. But in my case, it is USB_OTG_HS which is connected to external PHY, the connection to VBUS is different as attached, As you can see, to drive 5V VBUS is by external PHY CPEN pin, not by MCU. So it seems to me the 5V is driven by this not by MCU. In this case, I am confused by in CubeMX still asking platform setting which GPIO/I2C to drive this 5V VBUS.
Anyway I am using STM32F769 Discovery Board which only has USB HS connector, no USB FS
2021-05-12 07:54 AM
@BParh.1 Yes, as you've noticed, in host mode of course STM32 does not provide VBUS directly. It drives an external regulator.
If the Cube insists on something different you'll have to fix the code manually.
Now, why I2C? I don't have this board, but a similar H7 Disco has an I2C I/O extender and there's a BSP driver for it.
The output pin that enables the USBH power may be connected thru such extender on your board.
-- pa