AnsweredAssumed Answered

STM32F4 RTC Alarm problem

Question asked by s.esat on Apr 28, 2013
Latest reply on Apr 30, 2013 by s.esat
I am trying to setup he alarim to wakeup my MCU from standby everyday at 12:00 but it seems that some times the alarm nor occurs and some it occurs .. what i miss in my code?
    RTC_AlarmCmd(RTC_Alarm_A, DISABLE);
    RTC_GetTime(RTC_Format_BIN, &RTC_TimeStructure);
    /* Set the alarm to current time + 5s */
    RTC_AlarmStructure.RTC_AlarmTime.RTC_H12     = RTC_H12_PM;
    RTC_AlarmStructure.RTC_AlarmTime.RTC_Hours   =12; 
    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_SetAlarm(RTC_Format_BIN, RTC_Alarm_A, &RTC_AlarmStructure);
   /* Enable RTC Alarm A Interrupt: this Interrupt will wake-up the system from
       STANDBY mode (RTC Alarm IT not enabled in NVIC) */
    /* Enable the Alarm A */
    RTC_AlarmCmd(RTC_Alarm_A, ENABLE);
    /* Clear RTC Alarm Flag */ 
    /* Request to enter STANDBY mode (Wake Up flag is cleared in PWR_EnterSTANDBYMode function) */

here the start of my code :
     RTC_AlarmCmd(RTC_Alarm_A, DISABLE);

The  second problem that i could not find its solution is :
#define r77  75.0f
#define r78  10.0f
#define rtotal  r77+r78 
#define vref  3.0f 
unsigned short  temp;
float volt,vbat;
volt= (float)temp * vref;
volt= volt/4094;
vbat = (rtotal* volt);
rtotal must be 85 but it get very diffirent valuels
for debug i used a float RR=rtotal i can see very diffirent value here ..diffirent from 85.
what is wrong here ?

Thank you in advanced