cancel
Showing results for 
Search instead for 
Did you mean: 

How to Configure Micro Controller as USB Host and Device with Single WorkSpace

AGond.2
Associate III

Hello,

           we have Custom PCB Board which Build's around Stm32F4 Series Micro Controller.

In which we have Two USB Port, One Connected with External ULPI (High Speed 480mb/s) Another Connected with internal ULPI (full Speed 12mb/s). And we are Using CDC workspace for Configuring Host and Device on Different Different Port with Different Workspace.

So Now we have Requirement to Develop the Software for Both USB as HOST and USB as Device with There Respective Port.

We want External ULPI as HOST (480 Mb/s) and Internal ULPI as Device(12 Mb/s) but right now For HOST there is Different workspace and for Device there is Different workspace with their Default Configuration of High Speed and Full Speed. So how we can Handle Both Condition in Single Workspace with their Respective Port Configuration.

Thank You 

Aman

 

8 REPLIES 8
Pavel A.
Evangelist III

We want External ULPI as HOST (480 Mb/s) and Internal ULPI as Device(480 Mb/s) 

No STM32F4 models have internal high speed ULPI. Not as device and not as host.

 

Hello ,

As I Read in stm32f4 Datasheet, there it was Written PA11 and PA12 Used AF as USB_FS_DM and USB_FS_DP Respectively. 

So it Means Smt32f4 Module have Internal ULPI.

Am i Correct ?

QuantumShade
Associate

To handle both USB host and device on different ports in a single workspace, you can configure the STM32F4 USB stack to support both modes. Use conditional initialization to set the external ULPI as the host (480 Mb/s) and the internal ULPI as the device (12 Mb/s). Implement dynamic mode switching based on the active port, ensuring each USB port is initialized with its respective configuration. This approach allows you to manage both ports within a single workspace efficiently.

Ok after editing it is clear. If you don't find a ready example of host and device in one project, get two examples and carefully merge them manually. The USB controllers are independent.

 

 

Thanks For the Response, we don't want Conditional initialization ,it has to be Initialise Upfront One Port as Host and Another Port as Device. Means One Port Always Configure as Device HS and Another Port Always Configure as HOST FS so How we can Merge Configuration File of Both ? 

For this anything we can do ?

Thank You 

Aman Kumar Gond

Thank you for Your Response

How we can Merge Configuration File of Both ? 

The names in the configuration .h files and in cube-generated C files usually have suffixes _HS and _FS for respectively HS and FS USB controller. So combining files for both controllers should not cause lot of conflicts. Of course, manual revision is needed.

 

 

FBL
ST Employee

Hi @AGond.2 

You can check datasheet to find out the block diagram of the chip and figure out PHYs embedded in the MCU. STM32F72x for example embeds ULPI PHY for high-speed operations.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.