From 79ca1e76c06bb4559ad9bf0437fb5dfc854f7e8f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 26 May 2018 12:55:56 +1000 Subject: [PATCH] HAL_ChibiOS: improve reliability of reboot --- libraries/AP_HAL_ChibiOS/Scheduler.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/AP_HAL_ChibiOS/Scheduler.cpp b/libraries/AP_HAL_ChibiOS/Scheduler.cpp index b5ef037363..98ff7c7b56 100644 --- a/libraries/AP_HAL_ChibiOS/Scheduler.cpp +++ b/libraries/AP_HAL_ChibiOS/Scheduler.cpp @@ -244,12 +244,12 @@ void Scheduler::reboot(bool hold_in_bootloader) // lock all shared DMA channels. This has the effect of waiting // till the sensor buses are idle Shared_DMA::lock_all(); - - // delay to ensure the async force_saftey operation completes - delay(500); - // disable interrupts during reboot - chSysDisable(); + // disable interrupts + disable_interrupts_save(); + + // wait for 1ms to ensure all pending DMAs are complete + delay_microseconds(1000); // reboot NVIC_SystemReset();