Skip to content

Commit 3f62df6

Browse files
adamgreenfacchinm
authored andcommitted
Add delay to allow USB to enumerate
Adding a 250msec delay to beginning of setup() appears to give time for the host to enumerate the USB CDC device.
1 parent 6f4c8a4 commit 3f62df6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

libraries/MRI/src/boards/portenta-h7/DebugSerial.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ extern "C" {
2323
#include <architectures/armv7-m/debug_cm3.h>
2424
}
2525

26+
27+
// The number of milliseconds to pause at the beginning of setup() to give time for host to enumerate USB device.
28+
#define STARTUP_DELAY_MSEC 250
29+
2630
static const char g_memoryMapXml[] = "<?xml version=\"1.0\"?>"
2731
"<!DOCTYPE memory-map PUBLIC \"+//IDN gnu.org//DTD GDB Memory Map V1.0//EN\" \"http://sourceware.org/gdb/gdb-memory-map.dtd\">"
2832
"<memory-map>"
@@ -170,6 +174,7 @@ void DebugSerial::setSerialPriority(uint32_t priority) {
170174

171175
void DebugSerial::_initSerial() {
172176
g_pDebugSerial->initSerial();
177+
delay(STARTUP_DELAY_MSEC);
173178
}
174179

175180
void DebugSerial::initSerial() {

0 commit comments

Comments
 (0)