Introduction to RTC in n3292 Series

Source: Internet
Author: User

Introduction to RTC in n3292 Series

1 RTC features

? Has time counters (seconds, minutes, hours) and calendar counters, used to calculate the time

? Absolute timing function (seconds, minutes, hours, days, months, and years)

? Relative timing Function

? Supports 12-hour/24-hour Mode

? Automatically recognize a leap year

? Weekly counter

? Frequency Calibration

? Supports the clock drop interrupt function

? Supports the wake-up function.

Power-down wake-up function

Suspend wake-up function

2 RTC function introduction 2.1 RTC Initialization

When the RTC is powered on, the software needs to write a key value (0xa5eb1357) to the inir register to reset the RTC.

? After the RTC is powered on, you only need to initialize the RTC once. (This operation has been done in the IBR of n3292)

? The software can obtain the RTC status information by reading the inir value.

2 bit 0: RTC initialization status

2 bit 1: Level Shift enabling status

Note:Even if you only use rtcYou must also press the powerkeyTo enable level shift.

2.2 Register Access

Register read/write password-0xa965

2. The software can read the bit 16 (ENF) of AER to determine whether the RTC register can be accessed.

2. Access to RTC can be disabled by writing a password-not value to AER.

2. After each write operation on the RTC register, you must wait until the reg_flag position is 1 before you can write the RTC register.

2.3 RTC Calibration

RTC calibration function: When the 32 K crystal oscillator is not punctual, the calibration function is used to calibrate the RTC counter.

2 The RTC engine uses the APB clock to sample the RC oscillator clock.

2 The user needs to use the external crystal oscillator and the internal RC Shock Calibration counter (osc_32k_cnt) to calculate the FCR calibration value.

Calculation formula:

Rtc_1hz_cnt is used to calculate the RTC clock.

RTC-_ clock_rate = (pclk/rtc_1hz_cnt) * 32768

Fcr_int = RTC-_ clock_rate integer part-1

Fcr_frac = RTC-_ clock_rate decimal part * 60-1

For example:

Assume that rtc_1hz_cnt = 50103132

Rtc_clock_rate = (500000/50103132) * 32768 = 32700.5505

Fcr_int= 32699

Fcr_frac = 0.5505*60-1 = 32

2.4 Time and calendar

CLR: Calendar register

Tar: Time Register

2.5 time and calendar alarms

? Car: Calendar alarm register

Year shield/month shield/day shield/week Shield

? Tar: Time Alarm register

Time Blocking/minute blocking/second Blocking

2.6 24-hour/12-hour Mode Selection

Bit0 of the tssr register:

U 1: 24-hour Mode

Ü 0: 12-hour Mode

2.7 weeks and leap years

? RTC supports the week function DWR

? RTC supports the leap year Indication Function LIR

Ü years (read-only)

Ü note:

Do not check the date condition when setting the RTC time

For example, if the current date is 2009 and you want to set the date

Lir indicates a leap year from time to time. 2/29 is invalid

However, 2012 is a leap year, And 2/29 is legal.

2.8 RTC clock drops

The clock drops are used to request an interruption (TTR)

The interrupt cycle can be: 1/128 S, 1/64 s, 1/32 s, 1/16 s, 1/8 s, 1/4S, 1/2 s and 1 s

2.9 interrupt enable and interrupt Status Register (rier/riir)

Ü alarm interruption (absolute)

Alarm_en (pwron [3]) must be enabled

When CLR = car and LR = tar, the RTC alarm is interrupted.

Ü time drop interruption

Ü power switch interruption

Ü alarm interruption (relative)

Rel_alarm_en (pwron [4]) must be enabled

When relative_time [11: 0] is set, the internal counter starts counting from 0. When the Count reaches relative_time [11: 0], the RTC timed alarm is interrupted (relative)

Ü after the system is powered off, the interruption status will not be maintained

2.10 registers for software use

RTC provides two 32-bit registers for software use.

Ü when only RTC is powered, the value of the Register remains unchanged. (Dummy0/dummy1)


3 Power Control Function 3.1 RTC power control supports power-on and power-off Functions

? Start

Power key boot

Start RTC alarm

? Shutdown

2. Hardware Shutdown

Even if the software crashes, you can press the power key for a certain period of time to shut down the system.

2 software shutdown

When the software detects that the power key is pressed, the software can shut down

3.2 Definitions

2 power key (pwrkey)

Keys used by pwrkey to switch on/off the server

2 power control signal (pwce)

Pwce is the control signal of the control power supply part.

2 power key status (pwr_key)

2 software status (sw_status)

RTC provides 8-bit data to store software information.

2 hardware shutdown enabling (hw_pclr_en)

RTC provides the hardware shutdown function, which can be turned off even if the software crashes.

This one is used to enable the hardware shutdown Function

2 Power Control Signal Delay Time (power_key_duration_length)

At least the press time is required for power keys during system startup.

Minimum powerkey press time = 0.25 * (power_key_duartion + 1) seconds

2 power key trigger mode

L edge triggering

When the RTC is powered on, press the power key to exceed the delay time, and then open

L Level Trigger

When the RTC is powered on, pressing the power key exceeds the delay.

2. Hardware shutdown time (pclr_time)

If you press the power key longer than this time, the system will shut down

2 power on (pwr_on)

This bit is used to control pwce to control the power supply of the system.

Ü when the power key is pressed, The pwce will change from 0 to 1.

Ü when the power key is not pressed, pwce changes from 1 to 0.

2 power-down mode

Power off all except rtc

2. Interruption enabling and interruption status

Ü RTC provides four interruptions (the interrupted state cannot be maintained when the power is down)

Ü alarm interruption (aier/AI and raier/RAI)

Ü time drop interruption (Tier and Ti)

Ü power switch interruption (pswier and pswi)

Indicates that the power key has been pressed.

3.3 system boot control process

? Start with power key

2. When the user presses the power key, the power control signal pwce is set to high.

2. After the pwr_on bit is set, the pwce can remain unchanged. In this case, the power key can be opened. When the system powers on, IBR first sets the pwr_on bit to lock pwce.

2 If the pwr_on bit is not set to 1, pwce will return to the low level when the power key is released

2 RTC provides a function to delay the pwce signal, so that the changes in the pwce signal relative to the power key have a delay time (power_key_duration_length)

Minimum time that the power key must be pressed at startup

Minimum power key retention time = 0.25 * (power_key_duration + 1) seconds

? Started through RTC alarm

2 in power-down mode, if RTC alarm occurs, RTC sets pwce to high by holding an internal alarm_hold signal.

2. After pwr_on is set, the alarm_hold signal is cleared and pwr_on maintains the pwce signal. When the system is started, IBR will first set pwr_on

3.4 system shutdown control process

? Software shutdown

2. If you cannot figure out the power key to shut down, you can clear the pwr_on bit at any time. For example, Timed Shutdown

? Strong hardware Shutdown

2 RTC provides a strong hardware shutdown function. you can disable the system even if the software crashes.

2. When the hardware strong shutdown function (hw_pclr_en) is enabled, the system will be shut down by pressing the powerkey for a certain period of time.

3.3 example of system switch control

? Normal Shutdown Process

2. After a user receives a power switch interruption, the user can decide whether to execute the shutdown process.

2. If you want to perform the shutdown process, you only need to set sw_pclr to immediately shut down the system.

? Shutdown Process when software is busy/crashed

2. Assume that the hardware shutdown time is set to 6 seconds.

2. The software can decide whether to execute the shutdown process within 3 seconds.

2. If the software does not execute the shutdown process, the hardware will be shut down in 1 second.

Introduction to RTC in n3292 Series

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.