File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -173,6 +173,14 @@ USBPhyHw::~USBPhyHw()
173173
174174}
175175
176+ void USB_reenumerate ()
177+ {
178+ DigitalInOut usb_disc_pin (USB_DP, PIN_OUTPUT, PullNone, 0 );
179+ wait_us (10000 );
180+ usb_disc_pin.input ();
181+ }
182+
183+
176184void USBPhyHw::init (USBPhyEvents *events)
177185{
178186 const PinMap *map = NULL ;
@@ -225,6 +233,8 @@ void USBPhyHw::init(USBPhyEvents *events)
225233
226234 __HAL_RCC_USB_CLK_ENABLE ();
227235 map = PinMap_USB_FS;
236+
237+ USB_reenumerate ();
228238#endif
229239
230240 // Pass instance for usage inside call back
@@ -334,9 +344,7 @@ bool USBPhyHw::powered()
334344void USBPhyHw::connect ()
335345{
336346#if (MBED_CONF_TARGET_USB_SPEED == USE_USB_NO_OTG)
337- DigitalOut usb_disc_pin (USB_DP, 1 ) ;
338- wait_ns (1000 );
339- usb_disc_pin = 0 ;
347+ USB_reenumerate ();
340348
341349 uint32_t wInterrupt_Mask = USB_CNTR_CTRM | USB_CNTR_WKUPM | USB_CNTR_SUSPM | USB_CNTR_ERRM |
342350 USB_CNTR_SOFM | USB_CNTR_ESOFM | USB_CNTR_RESETM;
You can’t perform that action at this time.
0 commit comments