cancel
Showing results for 
Search instead for 
Did you mean: 

USB pull up USB_FS_DP line

Chuev.Vladimir
Associate III
Posted on February 03, 2017 at 09:31

I use ''USB Device'' on STM.

My STM32F401 has USB OTG so it means that it can pull up USB_FS_DP data line without pull up resistor .

But I can't find a way how to do it, please help me

0690X00000606EDQAY.png
4 REPLIES 4
Amel NASRI
ST Employee
Posted on February 03, 2017 at 14:49

Hi

Chuev.Vladimir

‌,

By default, the USB selected pins will be configured as following (in USB_FS configuration wizard):

0690X0000060686QAA.png

Select the pin for which the configuration hasto be updated (if this is really needed) then make the modifications you want.

-Amel

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.

Posted on February 06, 2017 at 09:42

Hi.

I've already tried this way, he didn't give any results.
stm32cube-t
Senior III
Posted on October 04, 2017 at 13:36

Please note that STM32Cube HAL library does not support OTG mode, but only Host or Device modes.

In device mode, changing the USB_OTG_FS_DP  pin settings to pull-up mode should update the stm32cubef4xx_hal_msp.c file with the  following code:

void HAL_PCD_MspInit(PCD_HandleTypeDef* hpcd){

....

 GPIO_InitStruct.Pin = GPIO_PIN_12;

    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

    GPIO_InitStruct.Pull = GPIO_PULLUP;

    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

    GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;

    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

...

}

Posted on October 04, 2017 at 14:05

But that does not set the proper USB pullup... The GPIO pullup is nominally 40kOhm; the USB pullup is lower and as implemented on silicon it's composed of two resistors and a switch, see 22.3.2  Full-speed OTG PHY in RM0368. It is controlled from the USB core and switches on when device mode is selected, either through the OTG mechanisms, or if device mode is forced by setting OTG_FS_GUSBCFG.FDMOD then by the VUSB detection input, potentially overriden by OTG_FS_GCCFG.NOVBUSSENS

JW