Hello guys, I want to use LSE mode configuration for RTC working in STM32F411RCT6. Herer I am mentioning code for LSE mode. I dont know why its not setting time.
void RTC_Initialize(void) {
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
/* Allow access to BKP Domain */
PWR_BackupAccessCmd(ENABLE);
status = RTC_ReadBackupRegister(RTC_BKP_DR19);
/* LSE Enable */
RCC_LSEConfig(RCC_LSE_ON);
/* Wait until LSE is ready */
while (RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET);
/* RTC Clock Source Selection */ RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE);
/* Enable the RTC */
RCC_RTCCLKCmd(ENABLE);
RTC_WriteProtectionCmd(DISABLE);
/* Wait for RTC APB registers synchronisation (needed after start-up from Reset) */
RTC_WaitForSynchro();
/* Enable write protection */
RTC_WriteProtectionCmd(ENABLE);
/* Write status */
RTC_WriteBackupRegister(RTC_BKP_DR19, 0x1234);
RTC_ClearITPendingBit(RTC_IT_WUT); }
then i am setting tiome in main Function and getting time In while(1) in main function. Help me with this. Thank You.
View all questions in Keil forum