Question
Real Time on STM32F103RDT6
Posted on November 22, 2011 at 18:53
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 Khzvoid 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) RTC_EnterConfigMode(); RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE); // set RTC clock source RCC_RTCCLKCmd(ENABLE); // enable RTC clock RTC_WaitForLastTask(); RTC->CRH |= 1 << 0; RTC_ExitConfigMode(); RTC_WaitForLastTask(); // wait until write is finished PWR->CR &= ~0x00000100; // disable access to RTCregisters }