BCM20737S, month always set to January

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
KoM_2154881
Level 3
Level 3
First like received First like given

I have a problem setting the current time to BCM20737S. Everything is set correctly except for the month.

The month always resets to January, no matter what value I send. I am pretty sure that the time structure is set properly

and I cannot figure out what could be the problem. I am using the rtc_setRTCTime function to set the time.

Any ideas on what may be happening?

0 Likes
1 Solution
JacobT_81
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

In order for the new SDK to solve the problem you must include the patch in your app's makefile as is done in the sample app. Did you try this?

Jacob

View solution in original post

0 Likes
10 Replies
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

Can you post your code to the discussion.  I seem to recall that there was an issue setting the date, but I cannot find the previous posts.

Also, which sample application are you using? 

0 Likes

At this point I can't say that I am using a sample application.

This is the code I am using and it is pretty straightforward.

I fill the current time structure with the data from the time service characteristic and call

the rtc_setRTCTime.

Am I missing something?

Also, I found a post that mentions a problem with 2016 being a leap year. Could this be related?

BOOL on_write_current_time_service_current_time(int len, UINT8 *attrPtr)

{

    RtcTime current_time;

    unsigned char *cp;

   

    rtc_getRTCTime(&current_time); // fill in

    cp = attrPtr;

    current_time.year=*(cp++);

    current_time.year+=((unsigned int)*(cp++))<<8;

    current_time.month=(*(cp++))-1;

    current_time.day=*(cp++);

    current_time.hour =*(cp++);

    current_time.minute =*(cp++);

    current_time.second=*(cp++);   

    rtc_setRTCTime(&current_time); 

    return FALSE;

}

0 Likes

That's the one I was thinking of....

It's here: rtc_RtcTime2Sec() returns wrong seconds when RtcTime.year is 2016

Can you use the same Kevin provided to check to see if the problem is still present.

0 Likes

It looks like that this is the problem. Using 2017 it worked. I will try the code in that post and I will let you know if that fixed the problem.

0 Likes

Thanks kmichalopoulos

0 Likes
KoM_2154881
Level 3
Level 3
First like received First like given

I tried the code you have in the other post but it won't work.

I guess the rest of the functions using the rtc_RtcTime2Sec() must be updated as well.

Let me know if you have a way to achieve to this.

0 Likes
JacobT_81
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

Hi kmichalopoulos

Which SDK are you operating on? It appears that there is a patch in the latest SDK 2.2.2 addressing this very problem. Additionally, there is a sample app included called rtc_sample which builds using the patch (see the makefile to see how it's done).

I've run the sample app with a date in 2016 and it appears to be updating fine for me. Please follow the method in the sample app and let us know if the problem persists.

Jacob

Ok. I am using SDK 2.2.2. 

I rechecked the problem and it persists. Using 04/06/2016 sets the month to January.

04/06/2017 and everything works as expected.

I will try the sample app because I am facing problems with the time that I get back as well.

It looks like the clock is ticking too fast and after a while I get values that are a couple of seconds

in the future (no matter which year I used).

0 Likes
JacobT_81
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

In order for the new SDK to solve the problem you must include the patch in your app's makefile as is done in the sample app. Did you try this?

Jacob

0 Likes

Actually, no. I'll try that first. Thank you, I'll let you know what happened.

Kostas

0 Likes