2021-09-15 06:15 AM
Hi,
I have STM32F746 discovery board. I use USB OTG host/device mode on the Micro USB FS port.
If the OTG cable plugged is a flash drive, the firmware detect as a MSC host mode. If the OTG cable
plugged is a USB type A to micro USB, the firmware detect as a VCP serial device mode.
How the firmware automatically detect device/host mode when the different OTG cable plug in? Is there any USB read
pin signal level change between the two cables?
2021-09-15 06:22 AM
If a device is a slave, it ties the ID pin to GND. The OTG hardware can have a weak pullup on this pin and if the signal is low, the attached item is a device, otherwise it is a host.
2021-09-15 06:36 AM
Thank you very much for the info. I will try it.
2021-09-15 01:18 PM
I measure 0V on id line, with both flash drive(host) and VCP(device) USB OTG cables.
Is there any examples for OTG Dual Role Device operation on F7 series?
I have separate firmware for host and device mode, but do not know how to combine them.
2021-09-15 02:19 PM
Do you have a pullup on the line?
2021-09-15 02:35 PM
I am using STM32F746G Discovery board, no pull up resistor in id line.
2021-09-16 12:10 AM
Use internal pull-ups on the ID pin, if there's no external one.
There's no ready-made OTG support in Cube, as far as I know. You need to stop ("deinit") the device stack and start the host stack, and vice versa, when the ID pin state changes.
JW
2021-09-26 12:30 PM
I got it running. Thanks a lot! TDK and waclawek.