diff --git a/firmware/hw_layer/ports/stm32/stm32_common.cpp b/firmware/hw_layer/ports/stm32/stm32_common.cpp index 83583d55ed..1d083665ca 100644 --- a/firmware/hw_layer/ports/stm32/stm32_common.cpp +++ b/firmware/hw_layer/ports/stm32/stm32_common.cpp @@ -313,6 +313,13 @@ stm32_hardware_pwm* getNextPwmDevice() { #endif void jump_to_bootloader() { + #ifdef STM32H7XX + // H7 needs a forcible reset of the USB peripheral(s) in order for the bootloader to work properly. + // If you don't do this, the bootloader will execute, but USB doesn't work (nobody knows why) + // See https://community.st.com/s/question/0D53W00000vQEWsSAO/stm32h743-dfu-entry-doesnt-work-unless-boot0-held-high-at-poweron + RCC->AHB1ENR &= ~(RCC_AHB1ENR_USB1OTGHSEN | RCC_AHB1ENR_USB2OTGFSEN); + #endif + // leave DFU breadcrumb which assembly startup code would check, see [rusefi][DFU] section in assembly code *((unsigned long *)0x2001FFF0) = 0xDEADBEEF; // End of RAM // and now reboot