Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
HACK: Extend HACK to boards with DPPU-based pullup control (e.g. F0)
  • Loading branch information
matthijskooijman authored and fpistm committed Sep 18, 2020
commit 2f148bfb69959df6e996a509b510a019a64a7d85
6 changes: 6 additions & 0 deletions cores/arduino/stm32/usb/usbd_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,18 @@ WEAK void USBD_reenumerate(void)
digitalWriteFast(USBD_PULLUP_CONTROL_PINNAME, USBD_ATTACH_LEVEL);
#endif /* defined(USBD_PULLUP_CONTROL_FLOATING) */
#elif defined(USBD_HAVE_INTERNAL_PULLUPS)
#ifdef USB_OTG_DCTL_SDIS
uint32_t USBx_BASE = (uint32_t)USBD_USB_INSTANCE;
USBx_DEVICE->DCTL |= USB_OTG_DCTL_SDIS;
//USB_DevDisconnect(USBD_USB_INSTANCE);
USBD_early_startup_delay_us(USBD_ENUM_DELAY * 1000);
//USB_DevConnect(USBD_USB_INSTANCE);
USBx_DEVICE->DCTL &= ~USB_OTG_DCTL_SDIS;
#else
USBD_USB_INSTANCE->BCDR &= (uint16_t)(~(USB_BCDR_DPPU));
USBD_early_startup_delay_us(USBD_ENUM_DELAY * 1000);
USBD_USB_INSTANCE->BCDR |= (uint16_t)(USB_BCDR_DPPU);
#endif
#else
#warning "No USB attach/detach method, USB might not be reliable through system resets"
#endif
Expand Down