Skip to content

Commit 9e8eba7

Browse files
dhylandsdpgeorge
authored andcommitted
stmhal: M7 Reset clocksources changed by DFU bootloader
The DFU bootloader on the ST32F7 chip changes the clocksource for various possible boot sources (UART1, UART3, I2C1-3). This commit resets those clock sources back to their cold reset values.
1 parent 8f1eced commit 9e8eba7

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

stmhal/system_stm32.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,4 +307,12 @@ void SystemClock_Config(void)
307307
{
308308
__fatal_error("HAL_RCC_ClockConfig");
309309
}
310+
311+
#if defined(STM32F7)
312+
// The DFU bootloader changes the clocksource register from its default power
313+
// on reset value, so we set it back here, so the clocksources are the same
314+
// whether we were started from DFU or from a power on reset.
315+
316+
RCC->DCKCFGR2 = 0;
317+
#endif
310318
}

0 commit comments

Comments
 (0)