cancel
Showing results for 
Search instead for 
Did you mean: 

Using USB Hub chip with Internal USB PHY on STM32H735

I would like to use the single USB internal PHY on the STM32H735 to connect to a 2 port hub chip (like the Microchip USB2422) so that I can connect to both a USB stick for firmware upgrades as well as a cellular module.  I started connecting everything up and then I came across a multiple sources saying that you can't connect USB Hubs to the internal PHY and you have to use the ULPI interface to connect to an external PHY, but none of the sources really explain why other than saying the internal PHY isn't capable of High Speed operation, and the USB software from ST doesn't allow for hubs.  I don't understand what this has to do with interfacing with a hub IC when I'm perfectly fine with operating at Full Speed.  So I have a few quesitons:

1) Can I use a USB Hub (like the USB2422) as long as I'm OK with it operating at Full Speed only?  Is it technically possible to connect these devices and get them to work?

2) Will the USB Host middleware provided through STM32CubeMX work with USB Hub ICs?  Do I have to use a 3rd party USB Host Middleware like Keil MDK's?

3) Assuming I can interface the hub chip how does the VBus pin on the STM32 and Hub's Upstream port work?  Do I just connect them together and also to the 5V power supply so that both the STM32 and the Hub see that they are connected and getting 5V?

1 ACCEPTED SOLUTION

Accepted Solutions

So just to recap, USB hubs may be used in FS mode but packet transmission may hang and require reconnecting to the port and ST's classic core middleware will not work and a different middle ware like USBX must be used?

For the VBus signal, the VBus pin on the STM32 is an input that is just sensing whether 5V is available or not?  Reviewing the USB2422 datasheet and eval kit schematics it looks like the USB power switch goes on the downstream ports and connect to the USB2422, not the MCU.  Are you saying I need to have an additional power switch on the upstream port between the STM32 and the USB2422?  Since this Hub is permenently part of the system and doesn't disconnect with a connector can I just tie the Vbus signal on both the STM32 and the USB2422 directly to 5V?

View solution in original post

11 REPLIES 11
FBL
ST Employee

Hi @Nicholas Yunker_2 

1. Indeed we have an errata saying: 2.25.3 Host packet transmission may hang when connecting the full speed interface through a hub to a low-speed device. So yes, this issues does not imply to Full Speed devices.

FBL_0-1768231408480.png

2. ST classic core middleware doesn't support hub. Hub is supported through USBX. Here is an example;

3. About Vbus, it must come from an external 5 V power switch, not directly from the MCU pin.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.




Best regards,
FBL

So just to recap, USB hubs may be used in FS mode but packet transmission may hang and require reconnecting to the port and ST's classic core middleware will not work and a different middle ware like USBX must be used?

For the VBus signal, the VBus pin on the STM32 is an input that is just sensing whether 5V is available or not?  Reviewing the USB2422 datasheet and eval kit schematics it looks like the USB power switch goes on the downstream ports and connect to the USB2422, not the MCU.  Are you saying I need to have an additional power switch on the upstream port between the STM32 and the USB2422?  Since this Hub is permenently part of the system and doesn't disconnect with a connector can I just tie the Vbus signal on both the STM32 and the USB2422 directly to 5V?

> USB hubs may be used in FS mode but packet transmission may hang 

The error is limited to cases when a low-speed device (e.g. typically a keyboard or mouse) is connected to the hub. If you are sure only full-speed devices will be used, e.g. if the devices are fixed, or are unlikely to be LS - as is the case of MSC ("memory stick") where no commercially produced device is LS.

Host (i.e. STM32 in host mode) doesn't need to *detect* VBUS. It may need to *control* VBUS, i.e. be able to disconnect the downstream device's power supply, e.g. if that device draws excessive current.

JW

The devices I plan to connect are only going to be a removable memory stick on one of the hub's downstream ports and a cellular module on the hub's other downstream port.

 

Looking at the schematics for the STM32H735 USB connector it shows PA9 connected to both Pin 1 of the connector and the output pin of the Power Switch.  How is this "controlling" the Power?

waclawek.jan
Super User

> Looking at the schematics for the STM32H735 USB connector

Where?

JW

I'm sorry, I meant to say STM32H735G-DK Discovery Kit.  Here is a screen capture of the relevant page:

 

NicholasYunker_2_0-1768238764924.png

 

waclawek.jan
Super User

That Disco is to showcase OTG, i.e. possibility to use the STM32 as both Device and Host. In Device capability, it needs to sense VBUS, in Host, it may need to switch VBUS.

JW

So does that mean then that PA9 doesn't do anything in HOST ONLY mode?  The control of the power switch enable pin is handled by a different signal (PH5 on the disco board) and when using the USB2422 Hub it has it's only enable output signals for each downstream port.  STM32CubeMX allows the Vbus pin to be activated in HOST ONLY mode by drop down menu, what does this do?  Should I just deactivate the VBus pin and let it be GPIO?

waclawek.jan
Super User

> So does that mean then that PA9 doesn't do anything in HOST ONLY mode?

The USB protocol has seen several confusing updates during its existence, one of them was related to OTG and role changing. This involves two marginal sub-protocols, SRP and HNP, both of which are implemented in the OTG module used in STM32. PA9 = OTG_xx_VBUS pin is an input to a comparator (more precisely, two comparators), which is used to indicate changes in power within those sub-protocols (as they allow either of the parties to assume the power-supplier role, regardless of their data role). As USB host states subchapter in the OTG chapter in RM states:

When HNP and SRP are both disabled, the VBUS sensing pin does not need to be
connected to VBUS.

This is your case, as you want to be a "plain old" Host which is the sole provider of the VBUS power, with no alternative powering schemes. However, the libraries (Cube/HAL/LL/whatever) and related clicky (CubeMX) may cater for the HNP/SRP, too, in which case you need to enable OTG_xx_VBUS pin and subsequently handle the HNP/SRP protocol.

Note, that I don't know the reasons, I am just speculating. I am not ST insider and I don't use Cube/CubeMX.

JW