2018-11-27 05:39 AM
Hi,
I'm currently trying out the configuration of RTC in the STM32F407G-DISC1 using Atollic truestudio.
I was successful in enabling RTC registers write access by setting the DBP bit in PWR_CR registers after system reset, but I'm unable to write the key values (0xca ,0x53) in the RTC_WPR registers so as to unlock the write protection on all the RTC registers.
How to fix this problem?
2018-11-27 06:31 AM
Check PWR and BKP domain clocks are on.
There are delay requirements in the unlock process, the library gets around this by using function calls, but if coded as linear instructions will likely fail.
2018-11-28 01:31 AM
2019-07-20 07:42 AM
Did you find the solution to this? I'm facing the same problem and unable to detect any fault.
2019-07-20 01:31 PM
Post a minimal code demonstrating your problem.
JW
2019-07-20 10:25 PM
2019-07-20 11:12 PM
// 4) wait till LSI is ready when LSIRDY is set
while(1)
{
if((RCC->CSR & RCC_CSR_LSIRDY)==1)
break;
}
// 5) Enable LSI clock by LSION bit in RCC_CSR
RCC->CSR|=1UL; //Enable LSI clock by enabling LSION bit in RCC_CSR
You must enable clock first and then wait for it to become stable (ready). Also look at LSI oscillator characteristics in datasheet. It has 17-47 kHz frequency "accuracy"... And that loop can be written as simple as:
while (!(RCC->CSR & RCC_CSR_LSIRDY));
2019-07-21 02:42 AM
Thanks for the feed. I made the necessary changes you mentioned but still the write protection isn't disabling. Also even though I'm enabling LSI clock, the HSI clock bit is also enabling while debugging. Do you have any idea why?
2019-07-21 06:22 AM
//clear RSF flag
RTC->ISR |=(0x00<<5);
Do You understand that it's useless to shift a zero or make OR with it? This line is writing ISR register value to itself and the effect is unpredictable and definitely not what was intended. Anyway RSF bit is for reading values, not writing. Reference manual section 26.3.5 describes initialization and configuration very clearly. What is the problem implementing it as described there?
2019-07-21 04:24 PM
What is
rtc_device_apis
?
JW