2015-05-07 12:38 PM
Hi,
I have a big problem with waking up the 32F429IDISCOVERY board from STANDBY mode by RTC alarm and I dont see any solutions...The problem is that the board wakes up only sometimes from the RTC Alarm. Usually like 3 times in a row and then stops. Waking up by user button is fine...I found some topics regarding same problems but reading them all I think that I am doing everything right...The operation itself should be simple...I manually set up RTC alarm and get to STANDBY mode and after that the MCU wakes up does something and then goes back to STANDBY in a loop until I interupt it manually by button...Manual set up looks like this:// Load time and date values from RTCRTC_AWU_GetDateTime(&time, RTC_AWU_Format_BIN);// Set up RTC alarmalarm_time.hours = time.hours;alarm_time.minutes = time.minutes;alarm_time.seconds = time.seconds + 5;alarm_time.alarmtype = RTC_AWU_AlarmType_DayInWeek;alarm_time.day = 1;RTC_AWU_SetAlarm(RTC_AWU_Alarm_B, &alarm_time, RTC_AWU_Format_BIN);/* Power down */// Disable wakeup pin (BUTTON = PA0)PWR_WakeUpPinCmd(DISABLE);// Clear standby/wakeup flagPWR_ClearFlag(PWR_FLAG_SB | PWR_FLAG_WU);// Enable wakeup pin (BUTTON = PA0)PWR_WakeUpPinCmd(ENABLE);// Go to standby modePWR_EnterSTANDBYMode();Then the loop exacly the same:// RTC init (PWR_BackupAccessCmd(ENABLE) present here)RTC_AWU_Init(RTC_AWU_ClockSource_External);if (RTC_GetITStatus(RTC_IT_ALRB) != RESET){ /*Some code here*/ // Load time and date values from RTC RTC_AWU_GetDateTime(&time, RTC_AWU_Format_BIN); // Set up RTC alarm alarm_time.hours = time.hours; alarm_time.minutes = time.minutes; alarm_time.seconds = time.seconds + 5; alarm_time.alarmtype = RTC_AWU_AlarmType_DayInWeek; alarm_time.day = 1; RTC_AWU_SetAlarm(RTC_AWU_Alarm_B, &alarm_time, RTC_AWU_Format_BIN); /* Power down */ // Disable wakeup pin (BUTTON = PA0) PWR_WakeUpPinCmd(DISABLE); // Clear standby/wakeup flag PWR_ClearFlag(PWR_FLAG_SB | PWR_FLAG_WU); // Enable wakeup pin (BUTTON = PA0) PWR_WakeUpPinCmd(ENABLE); // Go to standby mode PWR_EnterSTANDBYMode();}The RTC_AWU_SetAlarm function looks like this...// Disable Alarm BRTC_AlarmCmd(RTC_Alarm_B, DISABLE);// Disable Alarm B interruptRTC_ITConfig(RTC_IT_ALRB, DISABLE);// Clear Alarm B pending bitRTC_ClearFlag(RTC_IT_ALRB);// Clear RTC Alarm pending bitEXTI_ClearITPendingBit(EXTI_Line17);// Configure EXTI 17 as interruptEXTI_InitStruct.EXTI_Line = EXTI_Line17;EXTI_InitStruct.EXTI_Mode = EXTI_Mode_Interrupt;EXTI_InitStruct.EXTI_Trigger = EXTI_Trigger_Rising;EXTI_InitStruct.EXTI_LineCmd = ENABLE;EXTI_Init(&EXTI_InitStruct);// Configure the RTC Alarm InterruptNVIC_InitStruct.NVIC_IRQChannel = RTC_Alarm_IRQn;NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = 0;NVIC_InitStruct.NVIC_IRQChannelSubPriority = 0;NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE;NVIC_Init(&NVIC_InitStruct);// Set RTC alarm settings// Set alarm timeRTC_AlarmStruct.RTC_AlarmTime.RTC_Hours = DataTime->hours;RTC_AlarmStruct.RTC_AlarmTime.RTC_Minutes = DataTime->minutes;RTC_AlarmStruct.RTC_AlarmTime.RTC_Seconds = DataTime->seconds;RTC_AlarmStruct.RTC_AlarmMask = RTC_AlarmMask_DateWeekDay;etc...// Configure the RTC Alarm BRTC_SetAlarm(format, RTC_Alarm_B, &RTC_AlarmStruct);// Clear Alarm B pending bitRTC_ClearFlag(RTC_IT_ALRB);// Enable Alarm B interruptRTC_ITConfig(RTC_IT_ALRB, ENABLE);// Enable Alarm BRTC_AlarmCmd(RTC_Alarm_B, ENABLE);Thanks very much for your help... #rtc #stm32f4 #standby #alarm2015-05-07 01:14 PM
Do you have an LSE crystal on this board? By default it and it's associated components are not present. Pretty sure LSI isn't in the low power domain.
2015-05-08 05:37 AM
Yeah, I am using LSE...I added it mainly becuase of RTC accuracy...
The RTC is obviously fine because when MCU doesnt wake up and I leave it for example +10 min alone and then wake it up by USER button then the clock is really +10 min...I think I have same problem as described here: [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Leaving%20Standby%20by%20WakeUp%20pin%20and%20RTC%20Alarm&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=497]topic ...2015-05-15 05:38 AM
Hi problem was with this line....alarm_time.seconds = time.seconds + 5;
Basically an overflow of the usable range...I thought that the RTC modifies the data before using...