Skip to content

Commit 59e0103

Browse files
matthijskooijmanfpistm
authored andcommitted
HACK: Extend HACK to boards with DPPU-based pullup control (e.g. F0)
1 parent 8c34b37 commit 59e0103

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cores/arduino/stm32/usb/usbd_if.c

+6
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,18 @@ WEAK void USBD_reenumerate(void)
194194
digitalWriteFast(USBD_PULLUP_CONTROL_PINNAME, USBD_ATTACH_LEVEL);
195195
#endif /* defined(USBD_PULLUP_CONTROL_FLOATING) */
196196
#elif defined(USBD_HAVE_INTERNAL_PULLUPS)
197+
#ifdef USB_OTG_DCTL_SDIS
197198
uint32_t USBx_BASE = (uint32_t)USBD_USB_INSTANCE;
198199
USBx_DEVICE->DCTL |= USB_OTG_DCTL_SDIS;
199200
//USB_DevDisconnect(USBD_USB_INSTANCE);
200201
USBD_early_startup_delay_us(USBD_ENUM_DELAY * 1000);
201202
//USB_DevConnect(USBD_USB_INSTANCE);
202203
USBx_DEVICE->DCTL &= ~USB_OTG_DCTL_SDIS;
204+
#else
205+
USBD_USB_INSTANCE->BCDR &= (uint16_t)(~(USB_BCDR_DPPU));
206+
USBD_early_startup_delay_us(USBD_ENUM_DELAY * 1000);
207+
USBD_USB_INSTANCE->BCDR |= (uint16_t)(USB_BCDR_DPPU);
208+
#endif
203209
#else
204210
#warning "No USB attach/detach method, USB might not be reliable through system resets"
205211
#endif

0 commit comments

Comments
 (0)