cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F407 ALARM A AND B problem with Standby

ASSAAD.ASSAAD
Associate II
Posted on July 26, 2017 at 10:49

Hello ALL 

I cant use alarm B  when the alalrm occurs the device stuck and need a hardware reset . 

Alarm A is working 

we have 2 software : one the USB boot for upgrade ; the other is the main program 

here is the code example for Alarm A ; we use same for alarm B but we change teh register names 

what is 

RTC_AlarmMask_Hours ? for example I can set any hour to wake up ? 

please guide me if I forget something and thank you in advanced .

code : 

RTC_AlarmCmd(RTC_Alarm_A, DISABLE);

RTC_AlarmStructure.RTC_AlarmTime.RTC_H12 = RTC_H12_PM;

RTC_AlarmStructure.RTC_AlarmTime.RTC_Hours =2;

RTC_AlarmStructure.RTC_AlarmTime.RTC_Minutes =0;

RTC_AlarmStructure.RTC_AlarmTime.RTC_Seconds = 0;

RTC_AlarmStructure.RTC_AlarmDateWeekDay = 1;

RTC_AlarmStructure.RTC_AlarmDateWeekDaySel = RTC_AlarmDateWeekDaySel_Date;

RTC_AlarmStructure.RTC_AlarmMask = RTC_AlarmMask_DateWeekDay;//|RTC_AlarmMask_Hours ;

RTC_SetAlarm(RTC_Format_BIN, RTC_Alarm_A, &RTC_AlarmStructure);

PWR_WakeUpPinCmd(DISABLE);

RTC_ITConfig(RTC_IT_ALRA, DISABLE);

RTC_AlarmCmd(RTC_Alarm_A, DISABLE);

/* Clear RTC Alarm Flag */

RTC_ClearFlag(RTC_FLAG_ALRAF);

PWR_ClearFlag(PWR_FLAG_WU);

PWR_ClearFlag(PWR_FLAG_SB);

RTC_ITConfig(RTC_IT_ALRA, ENABLE);

/* Enable the Alarm A */

RTC_AlarmCmd(RTC_Alarm_A, ENABLE);

/* Clear RTC Alarm Flag */

//-----------------------------------------------

//set_alarm_b( );

PWR_WakeUpPinCmd(ENABLE);

/* Request to enter STANDBY mode (Wake Up flag is cleared in PWR_EnterSTANDBYMode function) */

PWR_EnterSTANDBYMode();
0 REPLIES 0