2024-01-12 09:57 AM
Hello,
We are using a STM32F407 discovery board. We need to configure the USB as OTG/Dual_Role_Device. I have each (USB Host and USB Device) working in separate projects
In CubeMX when I select OTG/Dual_Role_Device, the USB_DEVICE and USB_HOST are grayed out as well as the FATFS not having USB Disk as an option.
Why is this?
Any example out there?
I did see this thread where the issue was also seen.
https://community.st.com/t5/stm32-mcus-products/usb-otg-dual-role-selection-from-cube-mx/td-p/569876
It appears from this that the OTG dual mode auto switching functionality between USB HOST and USB Device is have never worked - broken?
Does anyone have any work arounds for this?
Thanks for any help.
Brent
2024-01-13 02:22 PM - edited 2024-01-13 02:23 PM
> It appears from this that the OTG dual mode auto switching functionality between USB HOST and USB Device is have never worked - broken?
Why do you think there *is* some automatic switchover?
JW
2024-01-22 05:05 AM
Not sure I understand what you are asking?
Can you point me to a working example of the auto switchover?
Can you help me understabd why in CubeMX when I select OTG/Dual_Role_Device, the USB_DEVICE and USB_HOST are grayed out as well as the FATFS not having USB Disk as an option?
Thanks for your help.
Brent
2024-01-22 05:12 AM
I found a post from you (see below). So basically, to switch between modes we need to manually use a pin to determine what mode we want and uninitialize/initialize the mode we need.
I am new to USB. I guess I was thinking the automatic switchover would take care of doing this.
USB otg automatic role switching device cdc - host... - Page 2 - STMicroelectronics Community
2019-02-01 04:28 PM
You are right, but there is no magic in switching between the two modes on one port, either - simply uninitialize the mode you don't need and initialize the one which you need. The stimulus upon which such role switch occurs may be any upon your choice; the "official" one is the ID pin on the USB-microAB receptacle (there's some support for it in the OTG modules but it's basically just a pin interrupt) so that the role is given by the cable/plug wiring; but it may be also switched for example from a software menu.
JW