cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 USB OTG Dual Role

Shikamaru
Associate III

HI team,

          I am using STM32F7 series controller. I want to use USB OTG in dual mode where I want to run USB device and Host on same application. So till now I couldn't find a single application or sample related to this. Can anyone narrow down the path for me how to achieve this. 

 

 

regards,

Shikamaru

1 ACCEPTED SOLUTION

Accepted Solutions
FBL
ST Employee

Hello @Shikamaru 

Unfortunately, there is no example or demo for this dual role device on STM32F7. OTG requires additional circuitry to support the protocols, called HNP and SRP as explained in the reference manual. With reference boards dedicated to F7, I guess this would not be achievable. 

FBL_0-1708618669672.png

However, if you want to learn more about USB PD dual role application, here is a ST wiki to help you step by step create your dual role application.

STM32StepByStep:Getting started with USB-Power Delivery Dual Role - stm32mcu

I hope this helps!

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.

View solution in original post

12 REPLIES 12
FBL
ST Employee

Hello @Shikamaru 

Unfortunately, there is no example or demo for this dual role device on STM32F7. OTG requires additional circuitry to support the protocols, called HNP and SRP as explained in the reference manual. With reference boards dedicated to F7, I guess this would not be achievable. 

FBL_0-1708618669672.png

However, if you want to learn more about USB PD dual role application, here is a ST wiki to help you step by step create your dual role application.

STM32StepByStep:Getting started with USB-Power Delivery Dual Role - stm32mcu

I hope this helps!

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.

It is not possible to run Device and Host "at the same" time. The ID pin would tell the direction. And as Host you have to provide power, as Device you get it from host (PC). No possible, not intended.
If your MCU is Host and would provide VBUS - but you connect it to a PC which "thinks" your MCU is a Device - you have a POWER conflict!

You could change the role, depending on what is connected (e.g. via the ID signal or if you see VBUS powered) to Device or Host (but not both at the same time!).

You might need to deal with USBC-PD inside the chip (for USB PWR handling). And you need external components, like an USBC-PD chip, a power switch for VBUS.


@tjaekel wrote:

It is not possible to run Device and Host "at the same" time. The ID pin would tell the direction. And as Host you have to provide power, as Device you get it from host (PC). No possible, not intended.
If your MCU is Host and would provide VBUS - but you connect it to a PC which "thinks" your MCU is a Device - you have a POWER conflict!

You could change the role, depending on what is connected (e.g. via the ID signal or if you see VBUS powered) to Device or Host (but not both at the same time!).

You might need to deal with USBC-PD inside the chip (for USB PWR handling). And you need external components, like an USBC-PD chip, a power switch for VBUS.


Exactly, this is what am also planning, depending on the ID signal will decide which is device and host then I will initialize the stacks of device or host. Do we have any samples for this ?

             If not then I am planning this way, first will make sure only device is working fine then same goes for Host only. At final will merge those two and build a stand alone project which has both of them. how about this method ?

 

regards,

Shikamaru


@FBL wrote:

Hello @Shikamaru 

Unfortunately, there is no example or demo for this dual role device on STM32F7. OTG requires additional circuitry to support the protocols, called HNP and SRP as explained in the reference manual. With reference boards dedicated to F7, I guess this would not be achievable. 

FBL_0-1708618669672.png

However, if you want to learn more about USB PD dual role application, here is a ST wiki to help you step by step create your dual role application.

STM32StepByStep:Getting started with USB-Power Delivery Dual Role - stm32mcu

I hope this helps!


Thanks @FBL , got it.

 

Abysmal USB support from STM as usual.  If ST don't make good driver support available I doubt the MCU department will prosper over the decade ahead given the competition.

Its pretty simple, there are 2 status lines to set on USB-C to configure the mode, and a small VBUS IC or FET to power external device when in Host mode.
What abysmal is the lack of support from ST as usual.

Hi @Robmar 

We may recommend different USB stacks from Tuxera partner for example, which may be helpful. Tuxera USB Stack - USB Host & Device and OTG stacks with wide range of class drivers for STM32 - STMicroelectronics

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.

I've checked their web and they don 't publish their license costs, so I'm guessing for small-medium volumes the price is going to be too high.

Raspberry Pi embedded boards are the only option we now have given ST aren't interested in providing USB OTG drivers, and the prices are very affordable.

The hardware is easy, but I wrote about ST not providing an USB OTG dual role driver, there are numerous posts complaining about a lack of support.

FBL from ST said customers can buy a driver from Tuxera, but they haven't even bothered to reply to our email, and we're a business!

So there you go, read posts a bit more carefully nextime.