diff --git a/cores/nRF5/main.cpp b/cores/nRF5/main.cpp index 49f9bc85..1998345e 100644 --- a/cores/nRF5/main.cpp +++ b/cores/nRF5/main.cpp @@ -46,17 +46,13 @@ static void loop_task(void* arg) #if CFG_DEBUG // If Serial is not begin(), call it to avoid hard fault - Serial.begin(115200); - - // Wait for Serial connection in debug mode - while ( !Serial ) yield(); - - dbgPrintVersion(); + if(!Serial) Serial.begin(115200); #endif setup(); #if CFG_DEBUG + dbgPrintVersion(); Bluefruit_printInfo(); #endif diff --git a/libraries/Bluefruit52Lib/examples/Peripheral/bleuart/bleuart.ino b/libraries/Bluefruit52Lib/examples/Peripheral/bleuart/bleuart.ino index 739ff03c..2287c494 100644 --- a/libraries/Bluefruit52Lib/examples/Peripheral/bleuart/bleuart.ino +++ b/libraries/Bluefruit52Lib/examples/Peripheral/bleuart/bleuart.ino @@ -24,7 +24,11 @@ BLEBas blebas; // battery void setup() { Serial.begin(115200); -// while ( !Serial ) delay(10); // for nrf52840 with native usb + +#if CFG_DEBUG + // Blocking wait for connection when debug mode is enabled via IDE + while ( !Serial ) yield(); +#endif Serial.println("Bluefruit52 BLEUART Example"); Serial.println("---------------------------\n");