From 44c7b90a7bca1eb16ccbc21023c8bfb6d2bbeb94 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Fri, 29 Nov 2019 11:04:50 -0800 Subject: [PATCH] stm32h7:Bootloader fix assertion caused by USB running USB was still running in transition to Firmware. This resets the USB --- platforms/nuttx/src/bootloader/stm32h7/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/platforms/nuttx/src/bootloader/stm32h7/main.c b/platforms/nuttx/src/bootloader/stm32h7/main.c index 3414ba5012..72221b984a 100644 --- a/platforms/nuttx/src/bootloader/stm32h7/main.c +++ b/platforms/nuttx/src/bootloader/stm32h7/main.c @@ -311,6 +311,7 @@ board_deinit(void) #if INTERFACE_USB px4_arch_configgpio(MK_GPIO_INPUT(GPIO_OTGFS_VBUS)); + putreg32(RCC_AHB1RSTR_OTGFSRST, STM32_RCC_AHB1RSTR); #endif #if defined(BOARD_FORCE_BL_PIN_IN) && defined(BOARD_FORCE_BL_PIN_OUT) @@ -342,7 +343,10 @@ board_deinit(void) #endif - /* disable the AHB peripheral clocks */ + + /* Clear any RSTR set above and disable the AHB peripheral clocks */ + + putreg32(0, STM32_RCC_AHB1RSTR); putreg32(0, STM32_RCC_AHB1ENR); }