From fdf808ee24fe8cdfbad7d3f6db905489549564bb Mon Sep 17 00:00:00 2001 From: flabbergast Date: Thu, 11 Feb 2016 21:12:19 +0000 Subject: [PATCH] Chibios: Fix a HardFault bug (wait after start). --- tmk_core/protocol/chibios/main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c index b62cfa9c..d588e4de 100644 --- a/tmk_core/protocol/chibios/main.c +++ b/tmk_core/protocol/chibios/main.c @@ -101,6 +101,13 @@ int main(void) { while(USB_DRIVER.state != USB_ACTIVE) chThdSleepMilliseconds(50); + /* Do need to wait here! + * Otherwise the next print might start a transfer on console EP + * before the USB is completely ready, which sometimes causes + * HardFaults. + */ + chThdSleepMilliseconds(50); + print("USB configured.\n"); /* init TMK modules */ -- 2.39.3