BCM20737S RTC clock and setReferenceTime

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

Hi,

I am working with BCM20737S and I am using an external 32K crystal.

I am able to set the device to deep sleep and keep the clock running. My code follows the rtc_sample code and it is working fine for the basic case.

The workflow of the system regarding the clock  creates an issue which I am not sure if I understand correctly.

- So, when the device boots it has  a reference time of 2010. Going in and out of deep sleep everything works fine and the time remains correct.

- The system is designed so that the actual time is provided by an external device via the time characteristic. When that happens the time changes

to the current time. The time is set using the rtc_setRTCTime function. So, the correct time is provided to the system after N seconds.

The given time is stored in the NVRAM and will be used as reference time for the next time the system gets out of deep sleep.

- After that when the device goes out of deep sleep and calls the rtc_setReferenceTime the new time is off by N seconds, which is the time the clock was running before

it get the new time. I have to subtract the same N seconds every time a new time is set by the host, after that.

To solve this issue, I store the difference in seconds N and correct the reference time every time a new time is set. This is working but

I am wondering if there is a more straightforward way to reset the rtc_clock so I won't have to go to all this trouble. Maybe, I am missing something obvious here.

Let me know what you think,

Kostas

0 Likes
1 Solution
AnjanaM_61
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 5 questions asked

Hi Kostas,

Please have a look at the following thread: Resetting RTC internal counter

This may be helpful.

Regards,
Anjana

View solution in original post

0 Likes
3 Replies
AnjanaM_61
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 5 questions asked

Hi Kostas,

I don't think if there is any other way. Will check and update.

Thanks,
Anjana

0 Likes
AnjanaM_61
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 5 questions asked

Hi Kostas,

Please have a look at the following thread: Resetting RTC internal counter

This may be helpful.

Regards,
Anjana

0 Likes

So what I am doing is pretty much the way to go. There isn't a better way.

Thank you,

Kostas

0 Likes