RTC week day not changing

HI 

 

  I am working on syneregy S7 mcu, and using the rtc driver with sub-clock and its backed by battery. the date and time change properly no issues in that. But if i set the week day  dateandtime.tm_wday=0-7;   

in return i only get 0 irrespective of what ever value i set as weekday the date and time counter works fine but the weekday counter starts from 0 only not able to set the value in it. 

using SSP1.6.0  e2 studioVersion: 7.3.0

  • What is the code you are using to set tm_wday value? The day of the week should be in the range of 0 to 6.

  • In reply to Jeremy:

    Hi

    this is the code i used

    dateandtime.tm_wday=5;
    dateandtime.tm_mday=9;
    dateandtime.tm_mon=8;
    dateandtime.tm_year=119;
    dateandtime.tm_hour=16;
    dateandtime.tm_min=5;
    dateandtime.tm_sec=1;
    g_rtc0.p_api->calendarCounterStop(g_rtc0.p_ctrl);
    g_rtc0.p_api->calendarTimeSet(g_rtc0.p_ctrl,&dateandtime,true);
    R_RTC->RWKCNT=5;
    R_RTC->RCR2_b.HR24 = 1;

    This code seems to work now setting the RWKCNT register directly sets the required week day.