cancel
Showing results for 
Search instead for 
Did you mean: 

how to set PA11&PA12 to USB_OTG_HS pin after it is set to GPIO

Yang Yang
Associate II

Hello, ST experts

 

For some reason, PA12 of STM32U595VGT6 is set to GPIO at start up. But I can not find how to set PA12 to USB_DP again in any alternate function of AF1 to AF15.

 

BR

Yang

12 REPLIES 12

Get CubeMX to configure it, then examine the code that it generates?

SofLit
ST Employee

Hello,

The issue is not clear.

I can set PA11 and PA12 for USB in CubeMx for STM32U595.

SofLit_0-1734953121645.png

PS: There is no STM32U595VGT6 part number

 

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.
STTwo-32
ST Employee

HELLO @Yang Yang 

Infact, PA11 and PA12 provide OTG_HS additional functions, and they are not alternate functions:

STTwo32_0-1734956103732.png

When you enable the USB_OTG_HS (as done by my college @SofLit ) those Pins are automatically set to OTG_HS additional functions.

Best Regards.

STTwo-32

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.

Hello, ST experts

 

Yes, actually I found that OTG_HS_DP is additional function. But I don't know how to configure it. In cubemx generated framework is that done by MX_USB_OTG_HS_PCD_Init()?

 

BR

Yang


@Yang Yang wrote:

Yes, actually I found that OTG_HS_DP is additional function. But I don't know how to configure it. In cubemx generated framework is that done by MX_USB_OTG_HS_PCD_Init()?


You can use CubeMx and configure USB pins as I showed above.

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.

Hello @Yang Yang 

It is not required to add the code to configure the USB DP/DM as those pins are directly connected to USB as soon as this peripheral is enabled.

Best Regards.

STTwo-32

 

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.

Hello ST experts

 

In cubemx generated code framework,  Does HAL_GPIO_DeInit(GPIOA, GPIO_PIN_12) can set PA12 to OTG_HS_DP function?

 

BR

Yang

The pins config is not generated. These pins are used directly by the USB as soon as the USB is enabled.

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.

 PA12 is internally set to OTG_HS_DP as soon as you Enable your USB_OTG as i said on my second comment (no code needed to do that).

Best Regards.

STTwo-32

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.