7 years, 1 month ago.

RTC - External Crystal - Nucleo

I soldered on a 32 Khz to use as the LSE for the RTC, will the mbed time library take that into consideration? If not, how can I enable it to use the onboard rtc ?


3 Answers

7 years, 1 month ago.

It should automatically detect it and use it, but I have seen issues where it didn't really work, so if you got a scope check out if it oscillates, if yes, then iti s used.

7 years ago.

You need a 32Khz crystal with 6 pF ! Most 32Khz crystals have 12 pF. The oscillator will not start with a 12pF crystal. You have to desolder SB49 and SB48 on the backside and place them to R34 and R36. Also C32 and C32 have to be fitted with 4.7pF or 6.8pF. The startup of the oscillator is critical !

If you attach the crystal with a scope probe it will not start !

You can check if the oscillator is running with this code :

#include "mbed.h"
#include "rtc_api.h"

DigitalOut myled(LED1);

int main() {
    //set_time(1387188323); // Set RTC time to 16 December 2013 10:05:23 UTC
                          // this will start the external osc  
    if(RCC_GetFlagStatus(RCC_FLAG_LSERDY)) {  // 32khz osc is running
        while(1) {
            myled = !myled;
    else myled = 1;   // error - external osc is not running    

If the led is blinking the oscillator run.

Erick and Peter,
thanks your hints.
I summarize the problem in my notebook below.
Route case is (a)load capacitors (Peter pointed out) and (b) time-out setting in "HAL_RCC_OscConfig" function.

posted by Kenji Arai 25 Oct 2014
6 years, 11 months ago.

Hi Tom,
Please try following program.
You can use "CheckRTC" library(subroutine) for your own application.