Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 1 month ago.
How to select the right clock LSE/LSI
Hi,
how does mbed selects the right RTC? I have made a PCB without LSE (planning to add it in the future). From what i have understood when mbed starts up it checks if it can select LSE external clock and if not it uses the LSI clock, but as i am seeing from these two projects https://developer.mbed.org/users/kenjiArai/code/Nucleo_RTC_Clock_setting/ and https://developer.mbed.org/users/kenjiArai/code/Nucleo_F411RE_SysClk/ the output i get is "no clock". Why is LSI not selected?
My target is to add later on also LSE and when LSE initialisation fails than LSI should be used as fallback. I have searched a little bit and i know that for beeing able to use LSE later on i have to follow this instructions and rebuild mbed https://developer.mbed.org/users/kenjiArai/notebook/nucleo-series-rtc-control-under-power-onoff-and-re/ but i am starting to doubt if this is possible at all since even without LSE incorporated, LSI is not selected.
Does mbed automatically select the best possible RTC on startup? if not how can i initialise the right RTC (LSE or LSI)?
Thnx
1 Answer
8 years, 1 month ago.
Anteo,
Look at targets/TARGET_STM/TARGET_STM32F4/rtc_api.c The RTC_LSI macro controls if the RTC code tries to start up the LSE or LSI clock. I checked targets.json and the RTC_LSI macro is not defined for the NUCLEO_F411RE platform.
Try compiling your program with RTC_LSI defined and I think you may have more success.
Cheers,
Mike