diff --git a/firmware/stm32f1/platform.cxx b/firmware/stm32f1/platform.cxx index aca9bb2..2aa1120 100644 --- a/firmware/stm32f1/platform.cxx +++ b/firmware/stm32f1/platform.cxx @@ -3,6 +3,7 @@ #include #include #include +#include #include "platform.hxx" #include "stm32f1.hxx" @@ -87,6 +88,9 @@ bool mustEnterBootloader() noexcept { #if BOOTLOADER_TARGET == BMP rcc.apb2PeriphClockEn |= vals::rcc::apb2PeriphClockEnGPIOPortB; + // Delay a little after powering up the GPIO controller to allow the pin value to stabilise + for ([[maybe_unused]] volatile size_t i : substrate::indexSequence_t{10}) + continue; // If PB12 is low, then either the button is pressed, or the firmware set it low if (!vals::gpio::value(gpioB, vals::gpio_t::pin12)) return true;