Changed NRF52 USB initialization to check for power via USBREGSTATUS instead of waiting for interrupt, in case we've been launched from a bootloader.

This commit is contained in:
Brian Doherty 2023-08-12 12:46:55 -05:00 committed by Xiang Xiao
parent cc99d94cfd
commit d7aea88727

View File

@ -3052,9 +3052,8 @@ static void nrf52_hwinitialize(struct nrf52_usbdev_s *priv)
{
/* Wait for VBUS */
/* TODO: connect to POWER USB events */
while (getreg32(NRF52_POWER_EVENTS_USBDETECTED) == 0);
while ((getreg32(NRF52_POWER_USBREGSTATUS) &
NRF52_POWER_USBREGSTATUS_VBUSDETECT) == 0) ;
/* Errata [187] USBD: USB cannot be enabled */