2021-04-28 07:00 PM
Hi ,
I want to setup my STM32F769 Discovery board as USB Host. I use STM32CubeMX :
Middleware-> USB_HOST-> Class For HS IP: Mass Storage Class.
But when I generate the code, it gave me pop up warning as following. What does this warning mean? And how should I resolve it?
Solved! Go to Solution.
2021-04-29 05:36 AM
Hi @BParh.1 ,
Thank you for having reporting. Normally, as indicated by the warning message there is a missing configuration in the USB_HOST > Configuration panel > Platform Settings tab in STM3CubeMX:
Please complete the Drive_VBUS_HS configuration and try to re-generate the code.
Otherwise, when clicking the Yes button in displayed warning pop up, the project will be generated anyway.
Hope this answers your question. If it is the case, please click on the Select as Best button on my reply . This will help other members of the community find this solution more quickly.
Khouloud.
2021-04-29 05:36 AM
Hi @BParh.1 ,
Thank you for having reporting. Normally, as indicated by the warning message there is a missing configuration in the USB_HOST > Configuration panel > Platform Settings tab in STM3CubeMX:
Please complete the Drive_VBUS_HS configuration and try to re-generate the code.
Otherwise, when clicking the Yes button in displayed warning pop up, the project will be generated anyway.
Hope this answers your question. If it is the case, please click on the Select as Best button on my reply . This will help other members of the community find this solution more quickly.
Khouloud.
2021-04-29 03:32 PM
Thank you @Khouloud OTHMAN , but what is this setting for? What are the guidelines to choose which configuration?
2021-05-04 04:32 AM
Hi @BParh.1 ,
Sorry for the late reply.
Actually one of the OTG_FS/OTG_HS interface in host-mode features is the external charge pump for VBUS voltage generation, in other words the VBUS pin is used to power any connected peripheral by supplying power from USB host.
Noting that, on-chip 5 V VBUS generation is not supported. For this reason, a charge pump or, if 5 V are available on the application board, a basic power switch must be added externally to drive the 5 V VBUS line. The external charge pump can be driven by any GPIO output. This is required for host-only configuration. Please refer to STM32F7 Reference Manual for more details about Host port power.
Hereafter screenshots showing an example, where I configured PA9 on a STM32F7 as a GPIO_Output:
Having a look at the generated code by CubeMX, once the Platform Settings are correctly configured, a file implementing the USB platform will be generated: usbh_platform.c
void MX_DriverVbusHS(uint8_t state)
{
uint8_t data = state;
/* USER CODE BEGIN PREPARE_GPIO_DATA_VBUS_HS */
if(state == 0)
{
/* Drive high Charge pump */
data = GPIO_PIN_SET;
}
else
{
/* Drive low Charge pump */
data = GPIO_PIN_RESET;
}
/* USER CODE END PREPARE_GPIO_DATA_VBUS_HS */
HAL_GPIO_WritePin(GPIOA,GPIO_PIN_9,(GPIO_PinState)data);
}
If you click the Yes button in displayed warning pop up (without completing the platform settings), the project will be generated without any problems but the usbh_platform.c file will not be generated.
I hope I answer your question.
Khouloud.
2021-05-10 03:04 PM
Hi @BParh.1,
I'm going to mark this response as a Best Answer, so that other customers with the same issue/feedback can find the relevant information more easily.
Feel free to raise any comment or feedback.
Khouloud.
2021-05-10 06:06 PM
Hi @Khouloud OTHMAN , sorry for my late response, the reason was I have been trying with and without the Drive_VBUS_HS and it looks to behave the same. Even without, I can still detect my USB. Also, since I use USB_OTG_HS, according to docs you gave, it uses external PHY and would not the 5V would come from that external PHY? I look at the schematic, the 5V signal is not connected to any of MCU GPIO or I2C. That is why I am still confused about this setting :)