summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Schodet2016-09-08 10:57:06 +0200
committerNicolas Schodet2019-10-09 23:05:50 +0200
commit4e983f98f6425cce8ccb14d01b6d0fc78e74794e (patch)
tree3076f69d90bcac37124c1098058778ebe5039429
parent79ffe04c2feb6c42d915c3c7bbd3175a173d47b6 (diff)
ucoo/hal/usb: fix on OTG HS
-rw-r--r--ucoo/hal/usb/usb_dwc_otg.stm32.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/ucoo/hal/usb/usb_dwc_otg.stm32.cc b/ucoo/hal/usb/usb_dwc_otg.stm32.cc
index 76f1b24..f58337a 100644
--- a/ucoo/hal/usb/usb_dwc_otg.stm32.cc
+++ b/ucoo/hal/usb/usb_dwc_otg.stm32.cc
@@ -57,7 +57,7 @@ static const UsbHardware usb_hardware[] =
12, 11, 10
#endif
},
-#ifdef USB_OTG_HS_BASE
+#ifdef USB_OTG_HS_PERIPH_BASE
{ reg::USB_OTG_HS, Rcc::OTGHS, Irq::OTG_HS, GPIOB, 15, 14, 12 },
#endif
};
@@ -71,7 +71,7 @@ void interrupt<Irq::OTG_FS> ()
usb_instance->isr ();
}
-#ifdef USB_OTG_HS_BASE
+#ifdef USB_OTG_HS_PERIPH_BASE
template<>
void interrupt<Irq::OTG_HS> ()
{
@@ -100,7 +100,9 @@ UsbDriverDwcOtg::enable ()
asm volatile ("nop"); // TODO: Do not know why this is needed.
asm volatile ("nop");
asm volatile ("nop");
- // Reset.
+ // Reset, on HS, need to select and power up the PHY or IP is stuck.
+ hard.base->global.GUSBCFG |= USB_OTG_GUSBCFG_PHYSEL;
+ hard.base->global.GCCFG |= USB_OTG_GCCFG_PWRDWN;
while (!(hard.base->global.GRSTCTL & USB_OTG_GRSTCTL_AHBIDL))
;
hard.base->global.GRSTCTL = USB_OTG_GRSTCTL_CSRST;