USB_DriveVbus and enabling externally powered VBus

I’ve been debugging my project (Margarita Prototype (open source hardware)) and realised my issue is related to the VBus configuration.

I’m seeing a few variables in the firmware files relating to vbus sensing and vbus external power.
In stm32h7xx_ll_usb.c i see

/* Enable VBUS driving */ (void)USB_DriveVbus(USBx, 1U);

which would mean it’s already disabled instead of enabled according to:

  * @brief  USB_DriveVbus : activate or de-activate vbus
  * @param  state  VBUS state
  *          This parameter can be one of these values:
  *           0 : VBUS Active
  *           1 : VBUS Inactive
  * @retval HAL status

and in usbd_conf.c


is set to DISABLE

Which confuses my quite a bit haha

I don’t want to mess around with the drivers before I know exactly what I’m doing since low-level programming is way beyond my knowledge.

What is the correct and recommended way to enable external vbus power and enable vbus sensing?