cancel
Showing results for 
Search instead for 
Did you mean: 

How to update the programmable alarm

l90mehdi
Associate II
Posted on August 20, 2017 at 19:15

Hi every one 

I want update the programmable alarm in stm32f4 series .

according to reference manual :

Programming the alarm

A similar procedure must be followed to program or update the programmable alarm (Alarm

A or Alarm B):

1. Clear ALRAE or ALRBIE in RTC_CR to disable Alarm A or Alarm B.

2. Poll ALRAWF or ALRBWF in RTC_ISR until it is set to make sure the access to alarm

registers is allowed. This takes 1 to 2 RTCCLK clock cycles (due to clock

synchronization).

3. Program the Alarm A or Alarm B registers (RTC_ALRMASSR/RTC_ALRMAR or

RTC_ALRMBSSR/RTC_ALRMBR).

4. Set ALRAE or ALRBIE in the RTC_CR register to enable Alarm A or Alarm B again.

Note: Each change of the RTC_CR register is taken into account after 1 to 2 RTCCLK clock cycles

due to clock synchronization.

problem is here that RTC_CR values do not change .

so I can not update the alarm .

please help me .

thank you. 

#programable #alarm #rtc #update-alarm #alarm-b #alarm-a
6 REPLIES 6
Posted on August 20, 2017 at 20:40

Do you unlock the RTC?

/* Enable the PWR clock */

RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);

/* Allow access to RTC */

PWR_BackupAccessCmd(ENABLE);
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
l90mehdi
Associate II
Posted on August 21, 2017 at 10:42

yes 

i unlock the RTC register.

and now i can write new and update value to RTC register.

now my question is that 

How can i lock the RTC register?

thank you

Posted on August 21, 2017 at 12:42

Use the DISABLE parameter? 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on August 21, 2017 at 16:20

i should  write RTC->WPR=0xFF;

it is ok.

Posted on August 21, 2017 at 17:21

Or clear the DBP bit in PWR->CR ?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on September 03, 2017 at 09:50

My problem has been resolved

thank you