cancel
Showing results for 
Search instead for 
Did you mean: 

RTC ALLARM A and B selected

MBosc.2
Associate II
 
2 REPLIES 2
MBosc.2
Associate II

Hi all,

i use STM32F407 and program the internal RTC, data time work perfectly.

But i have problem to set the allarm.

Work only if set data in allarm A and allarm B, why don't possible to set only allarm A ? or only allarm B ?

This is my code for programming allarm, now set allarm when the seconds is the same the interrup is generated in void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc), and after repeat allarm every minuts.. and so on.

                               sAlarm.AlarmTime.Hours = RTC_ByteToBcd2(n_Hour);

                               sAlarm.AlarmTime.Minutes = RTC_ByteToBcd2(n_Minute);

                               sAlarm.AlarmTime.Seconds = RTC_ByteToBcd2(n_Second);

                               sAlarm.AlarmTime.SubSeconds = 0x0;

                               sAlarm.AlarmTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE;

                               sAlarm.AlarmTime.StoreOperation = RTC_STOREOPERATION_RESET;

                               sAlarm.AlarmMask = RTC_ALARMMASK_DATEWEEKDAY|RTC_ALARMMASK_HOURS|RTC_ALARMMASK_MINUTES;//|RTC_ALARMMASK_SECONDS;

                               sAlarm.AlarmSubSecondMask = RTC_ALARMSUBSECONDMASK_ALL;

                               sAlarm.AlarmDateWeekDaySel = RTC_ALARMDATEWEEKDAYSEL_DATE;

                               sAlarm.AlarmDateWeekDay = RTC_ByteToBcd2(n_Day);

                               //

                               sAlarm.AlarmDateWeekDaySel = RTC_ALARMDATEWEEKDAYSEL_WEEKDAY;

                               sAlarm.AlarmDateWeekDay = BinToBCD(n_Day);

                               sAlarm.Alarm = RTC_ALARM_A;

                               if (HAL_RTC_SetAlarm_IT(&hrtc, &sAlarm, RTC_FORMAT_BCD) != HAL_OK)

                               {

                                 Error_Handler();

                               }

                               sAlarm.Alarm = RTC_ALARM_B;

                               if (HAL_RTC_SetAlarm_IT(&hrtc, &sAlarm, RTC_FORMAT_BCD) != HAL_OK)

                               {

                                 Error_Handler();

                               }

What did i forget for enabled only allarm A , for examples ?

thanks

MBosc.2
Associate II

has anyone ever had to set alarm A other than allarne B?