Skip to content

Commit

Permalink
HACK: Extend HACK to boards with DPPU-based pullup control (e.g. F0)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthijskooijman authored and fpistm committed Sep 18, 2020
1 parent 8c34b37 commit 59e0103
Showing 1 changed file with 6 additions and 0 deletions.
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

0 comments on commit 59e0103

Please sign in to comment.