AnsweredAssumed Answered

I-Cube LRWAN 1.1.4 RTC set

Question asked by Mislav Kulas on Mar 14, 2018

Hy I want to reconfigure rtc from default to current time and date and this is the code but always code get stuck in function HAL_RTC_SetTime and this function callin in infinite loop __weak uint32_t HAL_GetTick(void)
{
return uwTick;
}

 

 

this is the code which i write to change time and date from default values.

HW_RTC_Init();
RTC_TimeTypeDef RTC_Time;
RTC_DateTypeDef RTC_Date;
RTC_HandleTypeDef hrtc;
RTC_Time.Hours = 8;
RTC_Time.Minutes = 25;
RTC_Time.Seconds = 45;
HAL_RTC_SetTime(&hrtc , &RTC_Time, RTC_FORMAT_BIN);
RTC_Date.Date = 13;
RTC_Date.Month = RTC_MONTH_MARCH;
RTC_Date.WeekDay = RTC_WEEKDAY_TUESDAY;

;
RTC_Date.Year = 18;
HAL_RTC_SetDate(&hrtc , &RTC_Date, RTC_FORMAT_BIN);

HAL_RTC_GetTime(&hrtc , &RTC_Time, RTC_FORMAT_BIN);
HAL_RTC_GetDate(&hrtc , &RTC_Date, RTC_FORMAT_BIN);
timeAr[0]=RTC_Time.Hours;
timeAr[1]=RTC_Time.Minutes;
timeAr[2]=RTC_Time.Seconds;
timeAr[3]=RTC_Date.Date;
timeAr[4]=RTC_Date.Month;
timeAr[5]=RTC_Date.Year;
timeAr[6]=RTC_Date.WeekDay;

Outcomes