2022-12-22 08:41 PM
Hello friends!
The thing is I have been trying to start the RTC, enable backup domain in PWR, Connect RTC to the bus, set the INIT bit - so far so good, the I
void RTC_init(void){
RCC->APB3ENR |= (RCC_APB3ENR_RTCAPBEN); //Power the RTC up
PWR->DBPR |= PWR_DBPR_DBP; //Disable backup domain write protection
RTC->WPR = 0xCA; //^Unlock RTC registers
RTC->WPR = 0x53;
RTC->ICSR |= RTC_ICSR_INIT; //Stop RTC and unlock registers
while(!(RTC->ICSR & RTC_ICSR_INITF)){} // !!!STUCK HERE!!! Wait for entering the init mode
RTC->PRER = 0x00007fff;
RTC->ICSR &= ~(RTC_ICSR_INIT); //Finish initialization and start the RTC
}
NIT bit sets fine, but the point is after that the INITF flag doesn't set. Please is someone could point out at the problem. What am I missing? Here is the init code:
Solved! Go to Solution.
2022-12-22 09:18 PM
Found the problem! Forgot to select LSE as the RTC clock source: RCC->BDCR |= RCC_BDCR_RTCSEL_0;
2022-12-22 09:18 PM
Found the problem! Forgot to select LSE as the RTC clock source: RCC->BDCR |= RCC_BDCR_RTCSEL_0;