8 years, 3 months ago.

LSE Clock and mbed initialisation

I am working with Nucleo F103RB and i am trying to set the clock to LSE. For that i am using this lib https://developer.mbed.org/users/kenjiArai/code/Nucleo_RTC_Clock_setting/

When running the code it says that LSE is already configured. What i am not understanding is how is it possible? 1 - Does mbed per default configure LSE? If yes where is the code for that?

I also checked this file

https://developer.mbed.org/users/mbed_official/code/mbed-src/file/a11c0372f0ba/targets/cmsis/TARGET_STM/TARGET_STM32F1/TARGET_NUCLEO_F103RB/system_stm32f1xx.c

but maybe i am overlooking something.

2 - How does the initialisation on mbed works? Does it run even before the main() method?

1 Answer

8 years, 3 months ago.

The nucleo's use an automated selection process to choose the correct clocks. In case of the main clock for example a first attempt is to use an external clocksource (HSE_EXT), then try to use the external xtal generator (HSE_XTAL), finally try to use the internal RC clockgenerator (HSI). See system_st32f1xx.c The RTC clocks will do something similar. All of this is indeed executed before main() starts as part of the booting process.

Accepted Answer