AnsweredAssumed Answered

REAL TIME CLOCK (RTC)

Question asked by huy.truong on May 28, 2014
Latest reply on May 29, 2014 by Jack Peacock
hello everyone
today I try to use RTC in stm32f4 cube library and some errors occur.
So now I will show my code for all of you see:
void
dtime_bsp_open (const dtime_time_format_t fmt)
{
    /* Configure the RTC peripheral */
    g_h_rtc.Instance = RTC;
    if (fmt == DTIME_FORMAT_12H)
    {
        g_h_rtc.Init.HourFormat = RTC_HOURFORMAT_12;
    }
    else
    {
        g_h_rtc.Init.HourFormat = RTC_HOURFORMAT_24;
    }
    g_h_rtc.Init.AsynchPrediv = 0x007F; // datasheet rm_0090_stm32f4 22.3.9 page 544
    g_h_rtc.Init.SynchPrediv = 0x00FF;  // 22.6.5 page 559
    g_h_rtc.Init.OutPut = RTC_OUTPUT_DISABLE;
    g_h_rtc.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH ;
    g_h_rtc.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;

    /*Initialization*/
    if (HAL_RTC_Init(&g_h_rtc)!= HAL_OK)
    {
        while(1);
    }

}

and program was loop in red part. Can anyones help me about my configure is wrong??

Outcomes