Bruno KANT

RTC_ISR1/INITF never raises

Discussion created by Bruno KANT on May 14, 2018
Latest reply on May 15, 2018 by Bruno KANT



I'm trying to setup the RTC of a stm8l151f3. I think the code to access the RTC registers is:


1 .  RTC_WPR = 0xCA;
2.   RTC_WPR = 0x53;

3.   RTC_ISR1 |= (1 << 7); // Enter initialization mode
4.   while (!(RTC_ISR1 & 0x40)); //Check INITF


Using the STDV debug tool, I see RTC_ISR1/INIT is raised by line 3. But then, code hangs forever on line 4. With STDV debug tool, I see RTC_ISR1/SHPF is raised, maybe by line 1 or 2.... INITF never raises.


My clock is correct. I used either LSE (32k) or HSI, clocks being feed to every peripherals (CLK_PCKENR1/2 = 0xFF).


RTC_WPR is defined as DEF_8BIT_REG_AT(RTC_WPR,0x5159); not related to SHFP.


Did I miss something before those 4 lines of code?