cancel
Showing results for 
Search instead for 
Did you mean: 

Example via CubeIDE is OK, but same via MX is not (STM32C0, Ux_Host_HID_Standalone)

Grant Bt
Senior

This appears to be loosely related to

https://community.st.com/t5/stm32cubemx-mcus/warning-during-stm3cubemx-setting-in-usb-host-on-platform/m-p/194919#M8793

If I start with Cube IDE:

File -> New -> STM32 Project then select NUCLEO-C071RB and then Ux_Host_HID_Standalone

all goes swimmingly well.  However, if I start with CubeMX, then choose the same example I get errors:

WarningCodeGeneration.jpg

PlatformSettingsError.jpg

I can make the Platform Settings error go away by assigning a GPIO to who knows what, per the related post, but I don't want to waste a GPIO and furthermore, I want to make changes to the project that I cannot do using the IDE-only method. Is there some other setting I'm missing in the CubeMX example creation?

5 REPLIES 5
Grant Bt
Senior

My best guess at the moment is that the CubeMX generated version requires the dummy GPIO for

 

void USBH_DriverVBUS(uint8_t state);

 

found in usbxh_platform.c .h

 

I don't see this function being called anywhere though.

 

Drive_VBUS is not a dummy GPIO. It is the MCU output of the USB host that enables 5V power to the USB connector.

 

FBL
ST Employee

Hi @Grant Bt 

It is simply a warning in CubeMX. In your case, external charge pump for VBUS voltage generation might be not necessary since a stable 5V supply is already available on the board.

According to schematics, if a stable 5V supply is already available, a basic power switch can be used instead of a charge pump "also called Drive_VBUS". The VBUS2 voltage is connected to U17 for overvoltage protection. Depending on the USB Host's power capability, the boards can draw power from the VBUS terminal of CN13. In the schematic, this power line is labeled as 5V_USB.

FBL_0-1740735675583.png

 

 

 

 

 

 

To conclude, you don't need to assign a GPIO unnecessarily.

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.


Thanks, I will dig into this a little more. I understood the purpose for the USBH_DriverVBUS() function, but it's curious that the two project creation methods cause different results. If one edits the IOC from the instantly-functional-no-GPIO-IDE-created-project, then once again the requirement in CubeMX pops up whereby one needs to specify a GPIO for this. Using the IDE (v1.7) created technique, that function does not initially exist anywhere in the project, so it must be pulling files from somewhere else, or at least the catalog of files is different from starting with CubeMX.  Honestly if would be nice to have an option in CubeMX to choose whether or not to require this (rather than a warning you can't dismiss without using a GPIO).

As you mention, in my case I may not use/need this kind of switch since the USB device MCU is embedded in the final product along with the C071 acting as host for it.

On my NUCLEO board U17 is not populated, so I never even noticed it before, so thanks for that too. I will research the electronics further.

One followup question if I may. ... would the QFP48 pin part also work as a USB host?  I see conflicting online information. The block diagram does not indicate host. I guess I could build the firmware, but without hardware with that part I would not be able to test it.


Honestly if would be nice to have an option in CubeMX to choose whether or not to require this (rather than a warning you can't dismiss without using a GPIO).

I have not built projects to compare/contrast, but the Platform Settings error/warning appears only when

USBX Mode and Configuration -> Host Controllers FS

is checked. I don't know if that brings in other features or not, but will test next week.