The idea with USB OTG is that it can be used as either a device or a host. This is true only to a point. Hardware external to the chip needs to support either device or host mode. My impression is that this discovery board supports only host mode! The following comments in the user manual are instructive:
The STM32F429ZIT6 drives USB OTG High-Speed through its internal PHY, which limits it to USB OTG Full Speed on this board.The manual goes on to say:
The USB Micro-AB connector (CN6) allows the user to connect a host or device component, such as a USB key, mouse, or other.
The USB OTG host operation is realized once the Discovery is connected to the PC via the ST-LINK cable (mini USB). Once the USB OTG host device is detected and identified, then the USB ST-LINK cable can be removed.This second comment is entirely confusing and makes no sense at all. It makes even less sense once I study the schematic (see below). How is the board then powered once the ST-Link cable is removed?
I have a little 3 inch long "OTG" cable. It plugs into this connector and has a good old rectangular USB-A female thing at the other end. You could plug a keyboard or flash stick into this thing -- and of course the discovery board would need to be operating in host mode to make use of this. Millions of such things are available from every source you can imagine online.
I am interested in using the micro-AB connector as a USB device, but it is not clear that this is possible. Cables for such don't seem to exist (perhaps because you use a plain old micro-USB cable in such a case.
At the USB connector itself, we find a chip (STMPS2141STR) driving the 5 volt VBUS. This chip is enabled by a signal OTG_FS_PSO, which has a note next to it "power switch on" -- this comes from PC4. This power fail is labeled VBUS_FS. VBUS_FS is connected to PB13, and as near as I can tell, nowhere else.
A green LED will ight up if VBUS_FS is powered, but this LED requires 3 volt power from somewhere. So if we just connect a micro-USB cable we would not expect anything.
This suggests an experiment. I fire up the discovery board using the ST-Link cable. Then I take a micro-USB cable and plug it into both the discovery board and my PC. Yes! The green LED near the micro connector comes on.
What can we conclude from all of this?
First, to use this thing in host mode, we would need to switch on the host power, and use an OTG cable like the little gadget I have.
It just might be possible to use this in device mode. The power switch would need to be off of course so we don't fight with power from someplace else. The board has no arrangement to be powered by the OTG port, so it would need to be powered from the ST-Link or a supply connected to the headers. Then away we ought to be able to go at FS.
I find the datasheet for the STMPS2141STR. It is one-way (not bidirectional) and the datasheet specifies that it will block current from the OUT pin when it is not enabled.
We should be able to examine PB13 and be able to tell if a cable is plugged in or not. (note that this implies that PB13 is 5 volt tolerant).
We should be able to run our F411 USB code (in Hydra) if we just switch the USB base address from 0x5000_0000 to 0x4004_0000. We will also need to take care to appropriately set the GPIO pin registers for the USB alternate function.
There will also be issues of clocks and reset in the RCC, as well as making sure the proper 48 Mhz clock is making it to the HS usb subsystem.
What is not so simple is who is listening and who is controlling this. My general impression of the F429 discovery board is that it expects to be acting as a host by default and that you will plug in something like a keyboard or flash drive.
Tom's Computer Info / [email protected]