diff --git a/cpu/cc2538/usb/usb-arch.c b/cpu/cc2538/usb/usb-arch.c index d9c58558b..c209d7778 100644 --- a/cpu/cc2538/usb/usb-arch.c +++ b/cpu/cc2538/usb/usb-arch.c @@ -54,8 +54,12 @@ #include #include /*---------------------------------------------------------------------------*/ +#ifdef USB_PULLUP_PORT #define USB_PULLUP_PORT_BASE GPIO_PORT_TO_BASE(USB_PULLUP_PORT) +#endif +#ifdef USB_PULLUP_PIN #define USB_PULLUP_PIN_MASK GPIO_PIN_MASK(USB_PULLUP_PIN) +#endif /*---------------------------------------------------------------------------*/ /* EP max FIFO sizes without double buffering */ #if CTRL_EP_SIZE > 32 @@ -332,9 +336,11 @@ usb_arch_setup(void) /* Wait until USB PLL is stable */ while(!(REG(USB_CTRL) & USB_CTRL_PLL_LOCKED)); - /* Enable pull-up on usb port */ + /* Enable pull-up on usb port if driven by GPIO */ +#if defined(USB_PULLUP_PORT_BASE) && defined(USB_PULLUP_PIN_MASK) GPIO_SET_OUTPUT(USB_PULLUP_PORT_BASE, USB_PULLUP_PIN_MASK); GPIO_SET_PIN(USB_PULLUP_PORT_BASE, USB_PULLUP_PIN_MASK); +#endif for(i = 0; i < USB_MAX_ENDPOINTS; i++) { usb_endpoints[i].flags = 0;