AnsweredAssumed Answered

USB Host CDC example for STM32407G Discovery board?

Question asked by Pilot B on Apr 11, 2018
Latest reply on Apr 11, 2018 by Clive One

Hello everyone,

 

We have a product uses STM32407 MCU. We want to support USB Host CDC for the product. So we ordered a STM32407G Discovery board. We'd like to make USB Host CDC working on the evaluation board first. Basically, we need the Micro-USB to support:

A. The board provide power as the USB Host

B. Support communication with other USB device.

 

For the power supply, the sample code doesn't support USB Host.

1: So I came cross this page and found some samples:

https://my.st.com/content/my_st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32-s… 

We use IAR, so I found this: STM32_USB-Host-Device_Lib_V2.2.0\Project\USB_Host_Examples\CDC\EWARM

But there is no power from the USB port. I figured we need to use PC0 instead of PH5, so we changed the GPIO definition:

#define HOST_POWERSW_PORT_RCC RCC_AHB1Periph_GPIOC
#define HOST_POWERSW_PORT GPIOC
#define HOST_POWERSW_VBUS GPIO_Pin_0

We also have to disable LCD stuff as there is no LCD on the eval board. But there is still no power. Does anyone know how to get it work?

 

2. Then I kept searching and found: STM32Cube_FW_F2_V1.7.0\Projects\STM322xG_EVAL\Applications\USB_Host\CDC_Standalone\EWARM

This is CubeMX. I found usbh_conf.c:

HAL_GPIO_WritePin(GPIOH, GPIO_PIN_5, GPIO_PIN_RESET);

And changed it to:

HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0, GPIO_PIN_RESET);

However there is still power from USB port. Does anyone know how to git it to work?

 

Thanks everyone!

Outcomes