Writing RTC registers

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Writing RTC registers

1,042 Views
LordMark
Contributor IV

Hi everyone.

 

I'm working on a board based on MCF52259. I was having problems with seconds and hourmin registers messing up randomly. I just noticed that it may be caused by a write to alarm registers while the RTC is in the ON state and running. I avoided that writing and it seems to work now. Do you confirm such a thing?

Labels (1)
0 Kudos
Reply
4 Replies

400 Views
vier_kuifjes
Senior Contributor I

I've had similar problems writing the 52259 RTC in the past. You have to first disable the RTC, then write to it's registers, and then re-enable it. Otherwise the registers may be completely messed up.

0 Kudos
Reply

400 Views
LordMark
Contributor IV

I should set different alarm every day, but I'd like to avoid to disable and re-enable the RTC. Maybe I should wait for 1Hz interrupt to be served?

0 Kudos
Reply

400 Views
vier_kuifjes
Senior Contributor I

I would say - try it and find out if it works. I have tried similar tricks when writing the RTC but to no avail. It's actually a bit odd that writing the alarm registers can mess up the time registers.

 

But on the other hand - disabling the RTC, writing the registers and re-enabling takes next to no time, so it shouldn't really be a problem if you ask me...

0 Kudos
Reply

400 Views
LordMark
Contributor IV

Surelly stoppint the RTC and then restarting takes only nanoseconds, but I don't like it so much. I'll use this solution as last if I can't find anything better. :smileywink:

0 Kudos
Reply