RTC weakup interrupt does not work
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-07-31 11:47 AM
Posted on July 31, 2015 at 20:47
I have used CubeMx to generate code for stm32f407
Set RTC internal weakupand enabled the NVICbut the RTC_WKUP_IRQHandler() never got called!code:/* RTC init function */void MX_RTC_Init(void){ RTC_TimeTypeDef sTime; RTC_DateTypeDef sDate; RTC_AlarmTypeDef sAlarm; /**Initialize RTC and set the Time and Date */ hrtc.Instance = RTC; hrtc.Init.HourFormat = RTC_HOURFORMAT_24; hrtc.Init.AsynchPrediv = 127; hrtc.Init.SynchPrediv = 255; hrtc.Init.OutPut = RTC_OUTPUT_DISABLE; hrtc.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH; hrtc.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN; HAL_RTC_Init(&hrtc); sTime.Hours = 0; sTime.Minutes = 0; sTime.Seconds = 0; sTime.SubSeconds = 0; sTime.TimeFormat = RTC_HOURFORMAT12_AM; sTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE; sTime.StoreOperation = RTC_STOREOPERATION_RESET; HAL_RTC_SetTime(&hrtc, &sTime, FORMAT_BIN); sDate.WeekDay = RTC_WEEKDAY_MONDAY; sDate.Month = RTC_MONTH_JANUARY; sDate.Date = 1; sDate.Year = 0; HAL_RTC_SetDate(&hrtc, &sDate, FORMAT_BIN); /**Enable the Alarm A */ sAlarm.AlarmTime.Hours = 0; sAlarm.AlarmTime.Minutes = 0; sAlarm.AlarmTime.Seconds = 0; sAlarm.AlarmTime.SubSeconds = 0; sAlarm.AlarmTime.TimeFormat = RTC_HOURFORMAT12_AM; sAlarm.AlarmTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE; sAlarm.AlarmTime.StoreOperation = RTC_STOREOPERATION_RESET; sAlarm.AlarmMask = RTC_ALARMMASK_MINUTES; sAlarm.AlarmSubSecondMask = RTC_ALARMSUBSECONDMASK_ALL; sAlarm.AlarmDateWeekDaySel = RTC_ALARMDATEWEEKDAYSEL_DATE; sAlarm.AlarmDateWeekDay = 1; sAlarm.Alarm = RTC_ALARM_A; HAL_RTC_SetAlarm_IT(&hrtc, &sAlarm, FORMAT_BIN); /**Enable the WakeUp */ HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 0, RTC_WAKEUPCLOCK_CK_SPRE_16BITS);} #wakeup
Labels:
- Labels:
-
Power
This discussion is locked. Please start a new topic to ask your question.
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-07-31 12:44 PM
Posted on July 31, 2015 at 21:44
For those playing along at home..
What board are you using?What clock source are you using for the RTC?Does the RTC seem be ticking along normally otherwise?Are you setting the Alarm to some time in the future?How far in the future?
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-07-31 12:52 PM
Posted on July 31, 2015 at 21:52
-I am using customized board with stm32f407, I have external 32k crystal
-RTC seem be ticking along normally (when I do polling like this I see the RTC updates normally every seconds:while(1) { LCD_Display_Time(); HAL_RTCEx_PollForWakeUpTimerEvent(&hrtc,HAL_MAX_DELAY); } I did not set any alarms I just set the WakeUpTimer for every 1 secondsNevertheless, When I set the Alarm for 5 seconds, I get interrupt normallythe only problem is with WakeUpOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-04-14 8:13 AM
Posted on April 14, 2016 at 17:13
Hi SamTheMan,
This issue is now fixed in the new release by adding inside MX_RTC_Init(): __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(); Before the call to: HAL_RTCEx_SetWakeUpTimer_IT();-Hannibal-
