Skip to main content
l90mehdi
Associate III
August 20, 2017
Question

How to update the programmable alarm

  • August 20, 2017
  • 6 replies
  • 1424 views
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
This topic has been closed for replies.

6 replies

Tesla DeLorean
Guru
August 20, 2017
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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
l90mehdi
l90mehdiAuthor
Associate III
August 21, 2017
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

Tesla DeLorean
Guru
August 21, 2017
Posted on August 21, 2017 at 12:42

Use the DISABLE parameter? 

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

i should  write RTC->WPR=0xFF;

it is ok.