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
This commit is contained in:
Damien George
2019-04-11 12:09:21 +10:00
parent d5f0c87bb9
commit 46e5d6b889
2 changed files with 52 additions and 19 deletions

View File

@@ -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