Skip to main content
Skfir
Associate III
December 23, 2022
Solved

RTC ICSR_INITF (init flag) doesn't set! NUCLEO-U575ZI-Q

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:

This topic has been closed for replies.
Skfir
SkfirBest answer
Associate III
December 23, 2022

Found the problem! Forgot to select LSE as the RTC clock source: RCC->BDCR |= RCC_BDCR_RTCSEL_0;

1 reply

Skfir
SkfirAuthorBest answer
Associate III
December 23, 2022

Found the problem! Forgot to select LSE as the RTC clock source: RCC->BDCR |= RCC_BDCR_RTCSEL_0;