Skip to content

Commit

Permalink
fix(USB): power management
Browse files Browse the repository at this point in the history
Signed-off-by: Frederic Pillon <[email protected]>
  • Loading branch information
fpistm committed May 30, 2023
1 parent f234b80 commit 1dc2b81
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions cores/arduino/stm32/usb/usbd_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,18 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
pinMode(PIN_UCPD_TCPP, OUTPUT_OPEN_DRAIN);
digitalWriteFast(digitalPinToPinName(PIN_UCPD_TCPP), LOW);
#endif

#if defined(PWR_CR3_USB33DEN) || defined(PWR_USBSCR_USB33DEN)
HAL_PWREx_EnableUSBVoltageDetector();
#endif
#if defined(PWR_CR3_USB33RDY)
while (!LL_PWR_IsActiveFlag_USB());
#elif defined(PWR_VMSR_USB33RDY)
while (!LL_PWR_IsActiveFlag_VDDUSB());
#endif
#if defined(PWR_CR2_USV) || defined(PWR_SVMCR_USV) || defined(PWR_USBSCR_USB33SV)
/* Enable VDDUSB on Pwrctrl CR2 register*/
/* Enable VDDUSB */
HAL_PWREx_EnableVddUSB();
#endif
#ifdef STM32H7xx
if (!LL_PWR_IsActiveFlag_USB()) {
HAL_PWREx_EnableUSBVoltageDetector();
}
#endif
#if defined (USB)
if (hpcd->Instance == USB) {

Expand Down

0 comments on commit 1dc2b81

Please sign in to comment.