From 1b71e856a4ea9af82671cbaa4594f382f6037412 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 3 Aug 2022 15:15:33 -0400 Subject: [PATCH] deployer: Wait 100ms before overwriting existing bootloader If the power supply isn't fully stable or the reset line is glitchy then there may be a few reboots before the mcu becomes stable. If the deployer runs during this unstable period, it may erase the existing bootloader, but not be able to fully write the new bootloader. Wait a 100ms before erasing the existing bootloader in an effort to avoid this situation. Signed-off-by: Kevin O'Connor --- src/deployer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/deployer.c b/src/deployer.c index f7a2f72..27872db 100644 --- a/src/deployer.c +++ b/src/deployer.c @@ -77,6 +77,10 @@ sched_main(void) halt(); } + // Wait 100ms to help ensure power supply is stable before + // overwriting existing bootloader + udelay(100000); + // Write CanBoot to flash const uint8_t *p = deployer_canboot_binary, *end = &p[cbsize]; while (p < end) {