Skip to main content
Explorer
March 14, 2022
Question

STM32H753 USB Host pin not reseted to original state when stopping driver

  • March 14, 2022
  • 2 replies
  • 751 views

STM32H753

HAL 1.19.1

I need to reset the USB host dedicated pins (PB14/PB15) to their original state when stoping the USB HOST driver.

The USB Host driver is activated on demand using MX_USB_HOST_init.

The HS part is activated and the driver is well performing.

Once the USB Host task has processed its data, I need to stop it.

I then call USBH_DeInit and USBH_LL_Deinit, so the HAL_HCD_MspDeInit is called and the USB Host pins are reconfigured so they are not used for USB AF anymore.

Mesuring voltage the PB14/PB15 pins, they doesn't return to their original state.

Original state : PB14/PB15 2.5V/2.5V

After usb usage : PB14/PB15 3.3V/0.5V

Any advice ?

    This topic has been closed for replies.

    2 replies

    ABrid.1Author
    Explorer
    March 14, 2022

    For someone who would have the same problem :

    Just after USBH_DeInit and USBH_LL_Deinit add :

       /* Deactivate the USB Transceiver */

       __HAL_RCC_USB_OTG_HS_CLK_ENABLE();

       ((HCD_HandleTypeDef *)hUsbHostHS.pData)->Instance->GCCFG &= ~(USB_OTG_GCCFG_PWRDWN);

       __HAL_RCC_USB_OTG_HS_CLK_DISABLE();

    That is, powerdown the USB PHY (HS).

    And the voltage will return to initial state and the pins will be available for something else.

    Cheers !

    Super User
    March 14, 2022

    Look at the GPIOB registers to verify they are configured as you wish.

    If they are not, add the appropriate (de)initialization in HAL_HCD_MspDeInit.