Skip to content

Commit bddcf34

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

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: cores/arduino/stm32/usb/usbd_if.c

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

0 commit comments

Comments
 (0)