summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDave Hylands <dhylands@gmail.com>2015-08-01 20:22:08 -0700
committerDamien George <damien.p.george@gmail.com>2015-08-03 00:46:31 +0100
commit9e8eba797e250d808bca7807ef7dd44e23a56a5b (patch)
tree3c388114c29d24c61f26623cbd1ca17f4397b962
parent8f1eced69da2275b70f0c6426290a5370cd250f2 (diff)
downloadmicropython-9e8eba797e250d808bca7807ef7dd44e23a56a5b.tar.gz
micropython-9e8eba797e250d808bca7807ef7dd44e23a56a5b.zip
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.
-rw-r--r--stmhal/system_stm32.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/stmhal/system_stm32.c b/stmhal/system_stm32.c
index 72cc0b2ea5..7758aae305 100644
--- a/stmhal/system_stm32.c
+++ b/stmhal/system_stm32.c
@@ -307,4 +307,12 @@ void SystemClock_Config(void)
{
__fatal_error("HAL_RCC_ClockConfig");
}
+
+#if defined(STM32F7)
+ // The DFU bootloader changes the clocksource register from its default power
+ // on reset value, so we set it back here, so the clocksources are the same
+ // whether we were started from DFU or from a power on reset.
+
+ RCC->DCKCFGR2 = 0;
+#endif
}