Skip to main content
Graduate II
February 22, 2024
Solved

STM32 USB OTG Dual Role

  • February 22, 2024
  • 1 reply
  • 5718 views

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

    This topic has been closed for replies.
    Best answer by FBL

    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!

    1 reply

    FBLAnswer
    Technical Moderator
    February 22, 2024

    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!

    Visitor II
    February 23, 2024

    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.

    ShikamaruAuthor
    Graduate II
    February 23, 2024

    @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