diff --git a/Tools/AP_Bootloader/bl_protocol.cpp b/Tools/AP_Bootloader/bl_protocol.cpp index b6f90287d1..84f3a214de 100644 --- a/Tools/AP_Bootloader/bl_protocol.cpp +++ b/Tools/AP_Bootloader/bl_protocol.cpp @@ -733,9 +733,14 @@ bootloader(unsigned timeout) // send the sync response for this command sync_response(); + delay(5); + // set the baudrate port_setbaud(baud); + lock_bl_port(); + timeout = 0; + // this is different to what every other case in this // switch does! Most go through sync_response down the // bottom, but we need to undertake an action after diff --git a/Tools/AP_Bootloader/support.cpp b/Tools/AP_Bootloader/support.cpp index 9d22618e1f..ff57756c37 100644 --- a/Tools/AP_Bootloader/support.cpp +++ b/Tools/AP_Bootloader/support.cpp @@ -29,7 +29,7 @@ int16_t cin(unsigned timeout_ms) } } } - chThdSleepMicroseconds(100); + chThdSleepMicroseconds(500); return -1; } @@ -43,7 +43,7 @@ int cin_word(uint32_t *wp, unsigned timeout_ms) } } } - chThdSleepMicroseconds(100); + chThdSleepMicroseconds(500); return -1; } @@ -346,14 +346,14 @@ void init_uarts(void) */ void port_setbaud(uint32_t baudrate) { - sercfg.speed = baudrate; #ifdef HAL_USE_SERIAL_USB if (uarts[last_uart] == (BaseChannel *)&SDU1) { // can't set baudrate on USB return; } #endif - sdStop((SerialDriver *)uarts[last_uart]); + memset(&sercfg, 0, sizeof(sercfg)); + sercfg.speed = baudrate; sdStart((SerialDriver *)uarts[last_uart], &sercfg); }