cancel
Showing results for 
Search instead for 
Did you mean: 

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

ABrid.1
Associate

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 ?

2 REPLIES 2
ABrid.1
Associate

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 !

TDK
Guru

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.

If you feel a post has answered your question, please click "Accept as Solution".