2009-01-21 01:27 PM
RTC on VBAT going faster
2011-05-17 03:59 AM
Hi
I'm testing RTC in this way: 1) in debug mode i read RTC using RTCTimer=RTC_GetCounter(); 2) next i restart and check in again; RTCTimer value is match with time 3) tourn off debug and powrer supply- now RTC is powered from 3.3V battery 4) do 1) again and RTCTimer is 20000-30000 times greater then should; i use 32.768 kHz LSE Before reading RTCTimer=RTC_GetCounter() i execute: static void RTC_Configuration(void) { /* PWR and BKP clocks selection ----------*/ RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE); /* Allow access to BKP Domain */ PWR_BackupAccessCmd(ENABLE); /* Reset Backup Domain */ //BKP_DeInit(); /* Enable the LSE OSC */ RCC_LSEConfig(RCC_LSE_ON); /* Wait till LSE is ready */ while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET) { } /* Select the RTC Clock Source */ RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE); /* Enable the RTC Clock */ RCC_RTCCLKCmd(ENABLE); RTC_EnterConfigMode(); BKP_RTCOutputConfig(BKP_RTCOutputSource_Second); /* Wait for RTC registers synchronization */ RTC_WaitForSynchro(); /* Wait until last write operation on RTC registers has finished */ RTC_WaitForLastTask(); /* Set RTC prescaler: set RTC period to 1sec */ RTC_SetPrescaler(32767); /* RTC period = RTCCLK/RTC_PR = (32.768 KHz)/(32767+1) */ /* Wait until last write operation on RTC registers has finished */ RTC_WaitForLastTask(); } and after reading: static void RTC_DeConfiguration(void) { RTC_ExitConfigMode(); RTC_WaitForSynchro(); /* Allow access to BKP Domain */ PWR_BackupAccessCmd(DISABLE); /* PWR and BKP clocks selection ----------*/ RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, DISABLE); } i'm not using any low-power modes; simply i'm turning off power supply it seems that prescaler isnt working - what is wrong? [ This message was edited by: lordac on 16-01-2009 23:25 ]2011-05-17 03:59 AM
problem was solved when i remove battery and insert it again
2011-05-17 03:59 AM
removing battery and put it again didn't solve this problem.
in my project i have one big capacitor for supply microcontroler and SD card after remove power from USB; it is use for close any open file and write them to SD card. it seems that to slow voltege drop cause many switching between VDD and VBAT and this change randomly content of backup domain registers