cancel
Showing results for 
Search instead for 
Did you mean: 

USB otg automatic role switching device cdc - host msc

christian239955_st
Associate II
Posted on October 17, 2014 at 13:12

Hello I have a question about USB OTG with STM32F4 discovery. I have a working application for cdc device mode and in another project a application for msc host mode (from STM32CubeF4 V1.3.0).

Is it possible to configure the USB core so that it switches automatically between device cdc and host msc when it detects the corresponding device on the USB port?

#otg #library #usb #stm32
12 REPLIES 12
chen
Associate II
Posted on October 17, 2014 at 13:15

''Is it possible to configure the USB core so that it switches automatically between device cdc and host msc when it detects the corresponding device on the USB port?''

YES - that is the very point of the USB OTG specification, OTG = On The Go

ie can dynamically switch between Host and device modes.

(It cannot be both on the same USB peripheral at the same time !)

christian239955_st
Associate II
Posted on October 17, 2014 at 13:53

Thank you for your fast reply. Is there any example or documentation how to configure the USB host and device library for my use case? I found the documents ''UM1734 STM32Cube USB device library'' and ''UM1720 STM32Cube USB host library'', but I can't find anything about how to configure the otg feature.

Posted on October 21, 2014 at 10:51

Hi Chris,

The USB OTG features are not really implemented within the STM32_USB libraries available under the STM32Cube_FW_F4 package. Some HAL USB LL APIs can help you to start implementing OTG features, but the provided solution as it is now, can't really deal with USB OTG details.

 Let me know if this helps or if you have further questions.

Regards,

Heisenberg.

christian239955_st
Associate II
Posted on October 21, 2014 at 12:19

Hi Heisenberg,

thank you for this information, at the moment I don't have further questions.

Regards,

Chris.

chen
Associate II
Posted on October 21, 2014 at 15:36

Hi

Sorry, forgot to check back on this post.

The old, no longer supported USB OTG library I think should do this

http://www.st.com/web/catalog/tools/FM147/CL1794/SC961/SS1743/PF257882

st140728
Associate II
Posted on November 26, 2015 at 01:47

Hello are there any examples yet to support USB OTG switching between device to host mode as advertised by the presence of the OTG_ID bit. Many thanks. 

Posted on November 26, 2015 at 18:50

Hi neilh,

I think the example under STM32Cube_FW_F4_V1.9.0\Projects\STM324x9I_EVAL\Applications\USB_Host\DualCore_Standalone can help you.

-Shahrzad-

Shail Shah
Associate II
Posted on August 01, 2017 at 14:21

BEN_ROMDHANE.Mon.001/people?filterID=followers

Chip:- STM32Fxxx. Can U help us to convert USB Standard peripheral library to HAL Library? In USB OTG Stack Implementation and not able to switch between Device and HOST mode. ID Line detection is problem. What kind of configuration is require to detect ID Pin status correctly? Is any hardware changes required? Can U help us to explain OTG Driver as per HAL Library? what can be initial state of USB HOST or Device in USB OTG Implementation?

Thanks and Regards,

Shail Shah

These examples are using both USB cores on the MCU, they don't (that I can see) give any examples for switching mode between device and host.

James