AnsweredAssumed Answered

STM32F334 RTC Smooth Calibration

Question asked by Manu Abraham on Apr 20, 2017
Latest reply on Apr 4, 2018 by Manu Abraham

Hi,

 

Trying to calibrate the RTC, Using a LSE with 32768kHz xtal, which is running at a frequency of 32985.6Hz.

 

// with 32768Hz LSE, with AsynchPre=0x7f(128),
// CALIBOUT = 257.7Hz (measured on a scope)
// 32768/128 = 256Hz, but output is 257.7Hz
// 257.7Hz * 128 = 32985.6Hz
// error in this situation: +217.6 pulses
// 257.7 / 256.0 = 1.006640625

 

Doing smooth calibration with the CALM bits appeared to the straightforward choice to do the error correction.

 

So, I did

 

    // RTC Block diagram Fig:320 on Page #825 of the Reference Manual
    // RTC_OUT can either Output RTC_CALIB or RTC_ALARM
    // RTC_CALIB is either 1Hz or 512Hz, which is derived from RTCCLK
    // RTC_OUT, RTC_TS, RTC_TAMP1 are mapped to the same pin PC.13

    // RTC Calib Output on PC.13
    __GPIOC_CLK_ENABLE();                /* PC.13 CALIB_OUT    */

..

..

    RTC_CalibOutputConfig(RTC_CalibOutput_1Hz);
    RTC_CalibOutputCmd(ENABLE);            /* 1Hz on PC.13            */
    RTC_SmoothCalibConfig(RTC_SmoothCalibPeriod_8sec,
                  RTC_SmoothCalibPlusPulses_Reset,
                  RTC_CALR_CALM_7);        /* subtract 127 clocks        */

 

I get the very same frequency on PC.13, irrespective of the CALM bits.

 

Am I on the right path ?

Wondering whether the PC.13 pin is supposed to reflect the changes set by Smooth Calibration ?

Can someone clarify ?

 

Thanks!

Outcomes