adl_rtcSetTime vs AT+CCLK


#1

Hi,

If I set the time via the adl_rtcSetTime function, then the WeekDay field (returned by the adl_rctGetTime function) is 0.
If I set the time via the AT+CCLK command then the WeekDay field (returned by the adl_rctGetTime function) is valid.

Is it a known issue ?
Or the sentence “when setting the RTC time SecondFracPart and WeekDay field are ignored” in the ADL user guide, indicates that the WeekDay becomes invalid when setting time via adl_rtcSetTime ?

Best regards


#2

Hi,

Does somebody have the same result ?

If I the only one I surely do something wrong :slight_smile: !


#3

Just for info: Same “bug” behaviour with R72 and R73.


#4

have u tried to put the traces into a buffer and then try to display it…??? I tried it and it was working fine… :smiley:
Try to do somethn like dis…

wm_sprintf(Ptr_OnTrace, "RTC sample : Time1 = %d/%d/%d %d:%d:%d %d",
                                    Time1.Day,
                                    Time1.Month,
                                    Time1.Year,
                                    Time1.Hour,
                                    Time1.Minute,
                                    Time1.Second,
                                    Time1.WeekDay );
        TRACE (( 1, Ptr_OnTrace ));

Hope this solves ur problem…
cheers… :smiley:


#5

I try it and the WeekDay value is 0.

The problem occured only if I update the time with the adl_rtcSetTime function…


#6

yah i remember the problem now… actually the computation of the date should be done by the Open AT OS, and it cannot be entered by the adl_rtcSetTime, as stated in ADL user guide… I tried thr RTC sample which does not use adl_rtcSetTime function and the sample worked fine… gave me the correct date… have you set the date by CCLK command before testing?? with the sample the week day value is fine…
See the traces:-

Trace	ADL	16	[ADL PORT] unsubs (1) : 0
Trace	ADL	1	RTC sample main
Trace	ADL	1	Mar 12 2009
Trace	ADL	1	13:33:23
Trace	ADL	2	RTC sample : Time1 = 12/3/2009 13:38:34
Trace	ADL	20	[ADL] tmr subs ; id 1 ; hdlr 10001000 ; val 50 ; cycl 2
Trace	ADL	2	RTC sample : Time2 = 12/3/2009 13:38:39
Trace	ADL	15	[ADL RTC] convert (0) : 0
Trace	ADL	15	[ADL RTC] convert (0) : 0
Trace	ADL	15	[ADL RTC] diff : -1
Trace	ADL	15	[ADL RTC] convert (1) : 0
Trace	ADL	2	RTC sample : Diff = 0:0:5
Trace	ADL	2	RTC sample : Time2 = 12/3/2009 13:38:45

:question:


#7

Well, here my test:

My first test:

1- boot
2- set the time1 via the adl_rtcSetTime function
3- get the time2 via adl_rctGetTime
4- read value of the time2.WeekDay => 0
=> Wrong time2.weekday

My second test:
1- boot
2- set the time1 via the AT+CCLK command
3- get the time2 via adl_rctGetTime
4- read value of the time2.WeekDay => 1 to 7
=> Valid time2.weekday


#8

Hi

I am running firmware 7.45 and having the same problem. Serious SW, this can’t be a hard fix in the firmware. Found something else there as well:

If I boot and set the time to just before midnight with adl_rtcSetTime, the weekday is 0, and when time passes to the next day, it becomes 1. So it does increment.

When using AT+CCLK to set the time to just before midnight, the weekday is correct, and when it passes to the next day, it is incremented correctly. The problem is when I set the time to Sunday night, just before midnight, the weekday is 7, until time passes to the next day, then weekday is incremented to 0. Surely it should then be 1, for Monday?? Silly mistake, which makes the weekday function rather useless.

FYI, I use the adl_rtcGetTime to get the weekday value.

I decided to just build my own weekday counter. It uses AT+CCLK to figure out what the weekday is when the time is set the first time, and increments itself at midnight, then stores to flash for incase of a reset. Work alright for what I am doing.


#9

One more thing. The AT Command guide says the following under the +CCLK section:

“If no back-up power supply is connected to the RTC pin, the date and time will be restored to the last value set with +CCLK when the embedded module is power cycled.”

That gave me the feeling that with a power reset the time goes back to the last value that you set with the AT+CCLK="" command, but my unit just keeps the time as it had it before the reset, it only loses the time that it was physically switched off. So it returns to the last value of the clock, not the last value set for the clock.