cancel
Showing results for 
Search instead for 
Did you mean: 

How to edit RTC Alarm parameters

DJeze.1
Associate II

Hi, I use RTC alarm to wake up from STOP mode I have STM32F030C8T6. During initialization I have set 5s and everything works as it should. But I would need to change the interval to maybe 30s while the program is running. The problem is that the change will not be overwritten. I found that I need to change the ALRAWF register set to 1 in RTC_ISR, but I don't know how to do it. I will be glad for help.
Thank you.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Issamos
Lead II

Hello @DJeze.1 

To do this you have to:

  • Diable the alarm by putting to 0 the ALRAE bit in the RTC_CR.
  • Change the time to 30s (or whatever you want)
  • Put back the ALRAE bit to 1.
  • Write 0 to clear the ALRAWF bit in the RTC_ISR registre.

That will do the job.

Best regards.

II

View solution in original post

2 REPLIES 2
Issamos
Lead II

Hello @DJeze.1 

To do this you have to:

  • Diable the alarm by putting to 0 the ALRAE bit in the RTC_CR.
  • Change the time to 30s (or whatever you want)
  • Put back the ALRAE bit to 1.
  • Write 0 to clear the ALRAWF bit in the RTC_ISR registre.

That will do the job.

Best regards.

II

DJeze.1
Associate II

I DON'T know what I'm doing wrong, but I can't reset the registry bit:
RTC->CR &= ~(1 << 8);
RTC->CR &= ~(1 << RTC_CR_ALRAE_Pos);
I'm doing something wrong. Neither will do anything.