AnsweredAssumed Answered

STM32F030 RTC

Question asked by mike.s on Jan 21, 2016
Latest reply on Feb 18, 2016 by mike.s
I'm having an issue with the HAL_RTC_SetTime() function setting the RTC clock.  I'm using MXCube to generate the RTC settings for IAR compiler.

I use the following code to set the clock to 1 hour
  sTime.Hours = 0x1;
  sTime.Minutes = 0x0;
  sTime.Seconds = 0x0;
  sTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE;
  sTime.StoreOperation = RTC_STOREOPERATION_RESET;
  HAL_RTC_SetTime(&hrtc, &sTime, FORMAT_BCD);

When I use 

HAL_RTC_GetTime(&hrtc, sTime, FORMAT_BCD);
HAL_RTC_GetDate(&hrtc, sTime, FORMAT_BCD); //must read date after time

All I see is the RTC time since last power cycle so 0hrs 20mins XXseconds

I have tried using HAL_RTC_DeInit() followed by MX_RTC_INIT() but it always shows the RTC time from the last power cycle and not from the SetTime (even when MX_RTC_INIT is supposed to set the time to 0hr 0min 0sec 0subsec).

Is there a special call I need to make before I set the time of the RTC?

Outcomes