summaryrefslogtreecommitdiffstatshomepage
path: root/ports/stm32/mpconfigboard_common.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-04-11 12:09:21 +1000
committerDamien George <damien.p.george@gmail.com>2019-04-11 12:09:21 +1000
commit46e5d6b8893e07538c33677a349e9e2fd038e62c (patch)
tree3c7e4981e20f5ad56cbc3cd022ab5b3e002ef00b /ports/stm32/mpconfigboard_common.h
parentd5f0c87bb985ae344014dc2041fbaad5c522f638 (diff)
downloadmicropython-46e5d6b8893e07538c33677a349e9e2fd038e62c.tar.gz
micropython-46e5d6b8893e07538c33677a349e9e2fd038e62c.zip
stm32/rtc: Add auto-LSE-bypass detection with fallback to LSE then LSI.
If MICROPY_HW_RTC_USE_BYPASS is enabled the RTC startup goes as follows: - RTC is started with LSE in bypass mode to begin with - if that fails to start (after a given timeout) then LSE is reconfigured in non-bypass - if that fails to start then RTC is switched to LSI
Diffstat (limited to 'ports/stm32/mpconfigboard_common.h')
-rw-r--r--ports/stm32/mpconfigboard_common.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/ports/stm32/mpconfigboard_common.h b/ports/stm32/mpconfigboard_common.h
index 1ace8fcaf4..08c835a1c2 100644
--- a/ports/stm32/mpconfigboard_common.h
+++ b/ports/stm32/mpconfigboard_common.h
@@ -210,6 +210,12 @@
#endif
#endif
+// If disabled then try normal (non-bypass) LSE first, with fallback to LSI.
+// If enabled first try LSE in bypass mode. If that fails to start, try non-bypass mode, with fallback to LSI.
+#ifndef MICROPY_HW_RTC_USE_BYPASS
+#define MICROPY_HW_RTC_USE_BYPASS (0)
+#endif
+
#if MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE
// Provide block device macros if internal flash storage is enabled
#define MICROPY_HW_BDEV_IOCTL flash_bdev_ioctl