AnsweredAssumed Answered

Real Time on STM32F103RDT6

Question asked by truong.thanh on Nov 22, 2011
Latest reply on Nov 25, 2011 by Clive One
Hi everybody,

I am using MCU STM32F103RBT6, i have a problem with real time clock.that is after reset MCU, real-time counter stand by 4~6 seconds and run. so, my real-time delay 4~6s after every reset MCU. I think real-time counter independent with reset MCU.

why is this issue?I hope to get everyone's help.Thank you very much.

P/S: This is my real time config, using CMSIS Library. Real time 's crystal : 32.768 Khz

void RTC_Configuration(void) {

    RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); // enableclock for Power interface

    PWR->CR |= 0x00000100; // enable access to RTC, BDC registers

    RCC_LSEConfig(RCC_LSE_ON); // enable LSE
    while ((RCC->BDCR & 0x02) == 0)
        ; // Wait for LSERDY = 1 (LSE is ready)


    RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE); // set RTC clock source
    RCC_RTCCLKCmd(ENABLE); // enable RTC clock

    RTC->CRH |= 1 << 0;

    RTC_WaitForLastTask(); // wait until write is finished

    PWR->CR &= ~0x00000100; // disable access to RTCregisters