cancel
Showing results for 
Search instead for 
Did you mean: 

Problem stm32f429 RTC initialization.

Mmml.1
Associate

Hi

I use hal functions HAL_RTC_SetTime and HAL_RTC_SetDate for set date and time in RTS.

After set date and time RTC works correctly.

Problem appiars after reset.

After reset time and date read by functions HAL_RTC_GetTime and HAL_RTC_GetDate don't correspond to current time. After reset time is 00:00:00. Date is 01 jan 00 year.

Why?

What's reset time and date?

I use this function for init RTC:

void MX_RTC_Init(void)

{

hrtc.Instance = RTC;

if (HAL_RTCEx_BKUPRead(&hrtc, RTC_BKP_DR0) == 0x32F2) 

return;

HAL_RTCEx_BKUPWrite(&hrtc,RTC_BKP_DR0,0x32F2);

 RTC_Status = 0;

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;

 if (HAL_RTC_Init(&hrtc) != HAL_OK)

 {

  configASSERT(0);

 }

}

Second question.

What is purpose of StoreOperation fild in the RTC_TimeTypeDef?

How does it use?

0 REPLIES 0