RTC (Real Time Clock) on a ARM is super simple. Its so easy i mean it took me about 1 minute to learn what to do to get the data shown on my COM1 (serial port).

Im liking ARM more and more. RTC is very usefull. Especially for data logging.

There is really no need to make a program to config the RTC.

The main register is the CCR (Clock Control Register)

Its 8 bits wide. The User Manual states its 5 bits wide because the first 2 bits are used then the next 2 are not then the next one is and the last 3 are not.

Bit 0 = CLKEN – Clock Enable. A 1 here enables the clock.

Bit 1 = CTC Reset. A 1 here holds resets the clock tick counter and hold it in reset until 0.

Bit 2:3 = NA (must be 00)

Bit 4 = CLKSRC. A 1 here uses external clock from RTCX1/2 and a 0 uses the prescaller.

Bit 5:7 = NA (must be 000)

So you feed this register a 00010001 (0x11) and its ready!

Then you can simply access the registers like variables. SEC,HOUR,MIN,MONTH, etc…

They are all auto updated and time is kept if you have a battery installed. Time will reset if you loose power and dont have a battery or power to vbat.


The RTC on this ARM is nice also because it has tons of other registers like the CIIR – Counter Increment Interrupt Register. This register is 8 bits wide also.  All the bits do the same thing for different timing. Like for example:

Bit 0: When 1, an increment of the SECONDS value generates a interrupt. Meaning when 1  every second that passes will cause a interrupt. Which is nice.

Bit1: same thing but for minutes. Every minute a interrupt will occur.


There are also Alarm registers and such. Its really simple and cool!


About atomsoft

Starting a small company. Trying to build it from ground up. Only 2 employees so far. Nothing serious yet but soon!

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: