diff --git a/cores/arduino/HardwareSerial.cpp b/cores/arduino/HardwareSerial.cpp index 3aba60253d..a06a6275eb 100644 --- a/cores/arduino/HardwareSerial.cpp +++ b/cores/arduino/HardwareSerial.cpp @@ -132,6 +132,7 @@ HardwareSerial::HardwareSerial(void *peripheral, HalfDuplexMode_t halfDuplex) // If Serial is defined in variant set // the Rx/Tx pins for com port if defined #if defined(Serial) && defined(PIN_SERIAL_TX) +#if !defined(USBCON) || defined(USBD_USE_CDC) && defined(DISABLE_GENERIC_SERIALUSB) if ((void *)this == (void *)&Serial) { #if defined(PIN_SERIAL_RX) setRx(PIN_SERIAL_RX); @@ -139,6 +140,7 @@ HardwareSerial::HardwareSerial(void *peripheral, HalfDuplexMode_t halfDuplex) setTx(PIN_SERIAL_TX); } else #endif +#endif #if defined(PIN_SERIAL1_TX) && defined(USART1_BASE) if (peripheral == USART1) { #if defined(PIN_SERIAL1_RX)