实时时钟(RTC)
简介
实时时钟(RTC)是一款独立的 BCD 格式定时器 / 计数器,作为芯片核心低功耗时间外设,具备持续计时、精准定时、安全防护等核心能力,可在芯片全工作状态下保持不间断运行,满足嵌入式设备时间管理、低功耗唤醒、定时触发等场景需求。
Ameba 系列 SoC 的 RTC 仅实现时间与日期计数,日历及年份管理由软件完成。支持时间数字校准功能,配备深度休眠模式下仍可保持数据的备份寄存器,并支持夏令时补偿、定时唤醒与周期唤醒功能。
特性
包含秒、分钟、小时(12/24 小时格式)、天硬件计数,年份及日历逻辑由软件实现
支持软件可编程的夏令时补偿
可编程闹钟,可由时间字段任意组合触发
可屏蔽中断/事件:
闹钟
天阈值
周期唤醒定时器
支持定时唤醒、周期性自动唤醒
内置数字校准电路
具备寄存器写保护机制,防止误写入访问
配备备份寄存器,深度休眠模式下数据保持不掉电
框图
RTC 模块以 SDM32K 作为时钟源,通过两级分频、校准产生时间基准,并提供时间计数、报警与多路时钟输出功能。
时钟链路
输入时钟
RTCCLK (32.768 kHz)首先经过异步预分频器(系数 128),输出 256 Hz 的clk_apre信号。clk_apre再进入带校准功能的同步预分频器(系数 256),最终产生 1 Hz 的clk_spre信号,作为时间计数器的基准时钟。同步预分频器支持频率校准,通过公式
(-1)^DCS * DC / ((PREDIV_S+1) * (CALP+1) * 60)对输出频率进行微调,补偿晶振误差。
时间计数与报警功能
时间计数器以
clk_spre (1 Hz)为时钟,按day:hh:mm:ss格式递增计数,维护系统时间。报警模块支持配置
day:hh:mm:ss格式的报警时间,当时间计数器与报警寄存器值匹配时,输出alarm_out信号,可用于触发中断或唤醒事件。
输出选择
RTC 模块的最终输出
RTC_OUT由OSEL[1:0]配置选择,可输出clk_spre (1 Hz)、clk_apre (256 Hz)或alarm_out信号,满足不同应用场景的时钟或事件输出需求。
RTC 系统框图如下所示
RTC 时钟选择图
供电
VDH_RTC 为 RTC_IO 模块的独立供电引脚,仅在部分封装中引出。用户可针对该引脚设计独立供电电路,当芯片主电源断电时,RTC 将周期性自动备份到 RTC_IO,当芯片主电源断电时,RTC_IO 会继续使用 OSC131K 时钟域继续计时。系统主电源恢复后,需要 SW 处理时间恢复,维持系统时间连续性。主系统断电运行期间,RTC 计时精度受限于 OSC131K 时钟的固有精度;该振荡器在上电阶段会由软件执行一次校准,但受其自身工艺特性影响,断电运行期间的实际计时误差可能高于校准时的标称值。
RTC_IO
简介
VDH_RTC 可以独立为 OSC131K 及 RTC_IO 电路供电,在系统主电源关闭时继续计时。RTC_IO 内部有一个存储器,用于存储从 RTC 获取的时间数据,同时还有一个计数器。RTC_IO 周期性地读取 RTC 时间数据并保存到 RTC_IO 模块的存储器中,同时也会 reset 计数器。 RTC_IO 检测到主电源掉电后,会停止读取 RTC 时间,并持续使用内部计数器计时。当系统再次上电以后,需要 SW 读回掉电前的 RTC 时间和计数器值,以还原系统 RTC 时间。
RTC 域如下图所示。
功能特性
rtc_sio 以 1/256s 的时间间隔将 RTC 时间数据传输到 RTC 模块中的 RTC_IO 模块。
RTC_IO 模块在掉电期间保持 RTC 时间数据和计数。
OSC32K 的校准值
LDO_RCAL可在 RTC_IO 域保持,以在掉电期间保持 OSC32K 校准功能。
操作流程
要将 LDO_RCAL 移入 RTC_IO 并从 RTC_IO 移出时间数据,请执行下表中说明的配置步骤。
步骤 |
操作内容 |
操作方法 |
|---|---|---|
1 |
手动使 RTC_IO 进入 rtc_mode(可选) |
向寄存器 rtc_io_ctrl[1:0] 写入 2'd2 |
2 |
获取 LDO_RCAL[5:0] 值 |
读取寄存器 LDO_BASE-> LDO_32K_OSC_CTRL[5:0] |
3 |
将数据准备到将要移入 RTC_IO 的寄存器中 |
将步骤 2 的值写入寄存器 rtc_io_test_din[63:58] |
4 |
进入 MODE_SHIFT_ENABLE 模式以开始移位操作 |
向寄存器 rtc_io_ctrl[1:0] 写入 2'd1 |
5 |
等待一段时间让 rtc_sio 发送命令到 RTC_IO |
等待 15ms |
6 |
读取存储的时间数据和计数器,以便进一步处理 |
读取寄存器 rtc_io_test_dout[127:0] |
7 |
进入 MODE_SHIFT_DISABLE 模式以允许 HW 恢复定期更新 RTC 时间数据到 shd_reg |
向寄存器 rtc_io_ctrl[1:0] 写入 2'd0 |
8 |
处理步骤 6 中读回的时间数据 |
获取从 rtc_io_test_dout 读取的时间数据 解析存储的时间并将其分为秒、分、时、日和年 解析掉电期间的计数器 计算新时间并将其设置到设备 |
要计算新时间,可以参考以下公式:
new_rtc_time_data = rtc_io_test_dout[33:0] + rtc_io_test_dout[83:59]
然而,需要考虑一些复杂情况,例如秒进位到分、分进位到时、闰年等。
备注
在步骤 4 中,rtc_sio 发送到 RTC_IO 的命令在 osc131k 没有频率偏差时需要 5.78ms。
如果 RTC 模块以 12 小时格式初始化时间格式,RTC_IO 模块会将其转换为 24 小时格式并存储。因此,在解析相应的时间字段并计算新时间时,需要考虑这种格式转换。
寄存器
名称 |
地址 |
位宽 |
描述 |
|---|---|---|---|
REG_AON_RTC_IO_CTRL |
0x41008048 |
32 bits |
0x41008048[4]: RTC IO 模式标志(只读)
|
0x41008048[1:0]: RTC IO 控制模式(读/写)
|
|||
rtc_io_test_din |
0x420080E0 |
128 bits |
0x410080E0[63:58]: LDO_RCAL 值
|
rtc_io_test_dout |
0x410080C0 |
128 bits |
0x410080C0[33:0]: 年/日/时/分/秒的二进制存储(例如:33 秒存储为 sec[5:0]=6'b10_0001)
|
0x410080C0[83:42]: 掉电期间的计数器,计数时钟为 OSC131K。 |
系统供电,无独立电源。
系统供电,无独立电源。
系统供电,无独立电源。
系统供电,无独立电源。
VDH_RTC 为 RTC 模块的独立供电引脚,仅在部分封装中引出。用户可针对该引脚设计独立供电电路,当芯片主电源断电时,RTC 会自动切换到 OSC131K/4 时钟继续计时。系统主电源恢复后,会自动切换到 SDM32K 时钟继续计时,维持系统时间连续性。主系统断电运行期间,RTC 计时精度受限于 OSC131K 时钟的固有精度;该振荡器在上电阶段会由软件执行一次校准,但受其自身工艺特性影响,主系统断电运行期间的实际计时误差会高于校准时的标称值。
功能描述
时钟和预分频器
一个可编程的预分频器阶段生成用于更新日历的 1Hz 时钟。为了最大限度地降低功耗,预分频器被分为 2 个可编程的预分频器。
一个 9 位异步预分频器,通过 RTC_PRER 寄存器的 PREDIV_A 位进行配置。
一个 9 位同步预分频器,通过 RTC_PRER 寄存器的 PREDIV_S 位进行配置。
备注
建议将异步预分频器配置为较高的值,以最大限度地降低功耗。
默认情况下,异步预分频器分频因子设置为 128,同步分频因子设置为 256,以 32.768kHz 作为 RTCCLK,获得 1Hz 的内部时钟频率 (clk_spre)。
fclk_apre 由以下公式给出:
f_clk_apre = f_RTCCLK / (PREDIV_A + 1)
fclk_spre 由以下公式给出:
f_clk_spre = f_clk_apre / (PREDIV_S + 1)
可编程闹钟
RTC 单元提供一个可编程闹钟。
可编程闹钟功能通过 RTC_CR 寄存器中的 ALME 位使能。当日历的秒、分、小时或日与闹钟寄存器 RTC_ALMR1L 和 RTL_ALMR1H 中编程的值匹配时,ALMF 被置为 '1'。每个日历字段可以通过 MSKx 位独立选择。闹钟中断通过 RTC_CR 寄存器中的 ALMIE 位使能。
闹钟(如果通过 RTC_CR 中的 OSEL [1:0] 位使能)可以路由到 RTC_OUT 输出,但在系统处于 deepsleep 模式时除外。闹钟输出是一个宽度为 1/RTCCLK 的脉冲。
写保护
RTC 域复位后,所有 RTC 寄存器都处于写保护状态。通过向 RTC_WPR 寄存器写入密钥来使能对 RTC 寄存器的写入操作。
要解除所有 RTC 寄存器的写保护(RTC_ISR 中的 ALMF 除外),需要执行以下步骤:
向 RTC_WPR 寄存器写入 '0xCA'。
向 RTC_WPR 寄存器写入 '0x53'。
写入错误的密钥会重新激活写保护。该保护机制不受系统复位的影响。
数字校准
数字校准可用于通过在异步预分频器输出 (clk_apre) 处添加(正校准)或屏蔽(负校准)时钟周期来补偿 RTCCLK 的不准确性。
正校准和负校准分别通过将 RTC_CALIBR 寄存器中的 DCS 位设置为 '0' 和 '1' 来选择。
当使能正校准时(DCS = '0'),每 (CALP + 1) 分钟添加 DC 个 clk_apre 周期,使日历更新提前,从而将有效 RTC 频率调整为稍高。
当使能负校准时(DCS = '1'),每 (CALP + 1) 分钟移除 DC 个 clk_apre 周期,使日历更新延后,从而将有效 RTC 频率调整为稍低。
DC 和 CALP 可以通过 RTC_CALIBR 寄存器进行配置。DC 必须小于 RTC_PRER 寄存器中的 PREDIV_S。
校准参数可以在运行中进行配置。校准分辨率由 clk_apre 的频率和校准周期决定。公式如下:
示例如下:
resolution = period_clk_apre / calp
CALP |
clk_apre (128Hz) |
clk_apre (256Hz) |
clk_apre (512Hz) |
|---|---|---|---|
1 min. |
130.2ppm |
65.1ppm |
32.55ppm |
2 min. |
65.1ppm |
32.55ppm |
16.27ppm |
4 min. |
32.55ppm |
16.27ppm |
8.14ppm |
8 min. |
16.27ppm |
8.14ppm |
4.07ppm |
运行中重新校准:
当 INITF = 0 时,可以按照以下步骤在运行中更新校准寄存器 RTC_CALIBR :
轮询 RECALPF (重新校准挂起标志)。
如果 RECALPF 被置为 0,则在必要时向 RTC_CALIBR 写入新值,RECALPF 随后自动置为 1。
在对 RTC_CALIBR 执行写操作后的三个 clk_apre 周期内,新的校准设置生效。
日阈值编程
RTC 为用户提供日中断功能。当需要使用日中断时,必须先在 RTC_CR 中编程 DAY_THRES [8:0],然后在 RTC_CR 中设置 DOVTHIE 位以使能日超阈值中断。
夏令时
夏令时管理通过 RTC_CR 寄存器的 SUBIH 、ADD1H 和 BKP 位来执行。
使用 SUB1H 或 ADD1H,软件可以在单次操作中从日历减去或增加一小时,而无需经过初始化流程。此外,软件可以使用 BKP 位来记录此操作。建议不要在日历小时递增期间更改小时值,因为这可能会屏蔽日历小时的递增操作。(硬件可以处理此情况,如果发生此情况,硬件会将 SUB1H 或 ADD1H 操作延迟 1 秒。)当 24 小时制的日历小时为 0 时,不支持 SUB1H。
RTC 输出
有两种类型的 RTC 输出引脚,它们位于不同的电源域中。一种类型位于 AON 域,在 active、sleep 和 deep sleep 模式下均有供电。另一种类型位于 SYSON 域,可以在 active 模式和 sleep 模式下输出,但在 deep sleep 模式下无供电且不能输出。如果之前有输出,从 deep sleep 唤醒后输出将继续。
rtc_out 的输出由 RTC_CR 中的 OSEL [1:0] 位决定。
周期性自动唤醒
唤醒功能通过设置 RTC_CR 寄存器中的 WUTE 位来使能。
唤醒定时器的时钟源为 ck_spre(通常为 1Hz 内部时钟)。当 ck_spre 频率为 1Hz 时,可以实现以 1 秒为分辨率的 1 秒到约 36 小时的唤醒时间。初始化序列完成后的 3 到 4 个唤醒定时器周期(参考 programming the wakeup timer),定时器开始倒计数。倒计数在低功耗模式下保持活动。此外,当计数达到 0 时,RTC_ISR 寄存器中的 WUTF 标志被置位,唤醒计数器自动重新加载其重载值(RTC_WUTR 寄存器值)。
WUTF 标志随后必须由软件清除。
当通过设置 RTC_CR 寄存器中的 WUTIE 位使能周期性唤醒中断时,可以使设备退出低功耗模式。
系统复位以及低功耗模式对唤醒定时器没有影响。
一旦唤醒定时器初始化并使能后,可以按照 programming the wakeup timer 中的步骤更改唤醒自动重载值。
每次使能唤醒定时器时,在唤醒定时器开始工作并实际开始计数之前需要 3 到 4 个唤醒定时器周期(通常为 3 到 4 秒)。因为使能命令在 APB 域中生成,需要 2 个 RTC 时钟同步到 RTC 域,另外需要 2 个唤醒定时器周期同步到唤醒定时器域,还需要一个额外的唤醒周期才能开始计数。WUTE 位的同步过程完成后,WUTRSF 标志位被置位,供用户检查。
备份寄存器
备份寄存器包含四个 32 位寄存器,用于 Realtek 和用户在复位发生之前保存一些数据。
下表说明了两种可以复位 RTC 模块和备份寄存器的复位类型,它们均位于 AON 域中。其他复位类型无法复位 RTC 和备份寄存器。
复位信号 |
复位类型 |
描述 |
|---|---|---|
por_rstb |
POR |
上电时产生的上电复位 |
pdr_rstb |
PDR |
当 CHIP_EN 引脚出现低电平时产生的掉电复位(外部复位) |
RTC 和备份寄存器的电源域如下所示。
项目 |
睡眠 (WoWLAN) |
深度休眠 |
|---|---|---|
RTC |
√ |
√ |
备份寄存器 |
√ |
√ |
备注
√ 表示该模块有电源供电。
寄存器
RTC 寄存器
Base Address: 0x41008A00
Name |
Address offset |
Access |
Description |
|---|---|---|---|
000h |
R/W |
This register is the calendar time shadow register. This register is write protected, and must be written in initialization mode only |
|
004h |
R/W |
This register is write protected. Bit[7] (FMT) of this register can be written in initialization mode only when INITF = 1. ADD1H and SUB1H changes are effective in 2~3 seconds. Don’t write this register continuously without any delay when RTC is in free run mode. Software can use the RSF bit in RTC_ISR register to handle the delay. |
|
008h |
R/W |
The ALMF/WUTF/DOVTHF bit can be written without unlocking the write protection. Two APB clock cycles after programming it to 1, this bit is cleaned. |
|
00Ch |
R/W |
This register is write protected, and must be written in initialization mode only. |
|
010h |
R/W |
This register is write protected, and can be dynamically configured when RTC is running. |
|
014h |
R/W |
This register is write protected, and can be written only when ALMWF is set to 1 in RTC_ISR register, or in initialization mode. |
|
018h |
R/W |
This register is write protected, and can be written only when ALMWF is set to 1 in RTC_ISR register, or in initialization mode |
|
01Ch |
R/W |
Write "0xCA" then write "0x53" to disable write protection, and write "0xFF" to enable write protection. |
|
020h |
R/W |
This register is controlled by software. |
|
024h |
R/W |
This register is used to set wakeup timer value. |
|
028h |
R/W |
REG_RTC_TR
Name: RTC Time Register
Size: 32
Address offset: 000h
Read/write access: R/W
This register is the calendar time shadow register. This register is write protected, and must be
written in initialization mode only
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:23 |
DAY |
R/W |
0 |
DAY in binary format |
22 |
PM |
R/W |
0 |
PM:AM/PM notation
|
21:20 |
HT |
R/W |
0 |
Hour tens in BCD format |
19:16 |
HU |
R/W |
0 |
Hour units in BCD format |
15 |
RSVD |
R |
- |
Reserved |
14:12 |
MNT |
R/W |
0 |
Minute tens in BCD format |
11:8 |
MNU |
R/W |
0 |
Minute units in BCD format |
7 |
RSVD |
R |
- |
Reserved |
6:4 |
ST |
R/W |
0 |
Second tens in BCD format |
3:0 |
SU |
R/W |
0 |
Second units in BCD format |
REG_RTC_CR
Name: RTC Control Register
Size: 32
Address offset: 004h
Read/write access: R/W
This register is write protected. Bit[7] (FMT) of this register can be written in initialization
mode only when INITF = 1. ADD1H and SUB1H changes are effective in 2~3 seconds. Don’t write this
register continuously without any delay when RTC is in free run mode. Software can use the RSF bit
in RTC_ISR register to handle the delay.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:23 |
DAY_THRES |
R |
1FFh |
Day threshold in binary format |
22:17 |
RSVD |
R |
- |
Reserved |
16 |
DOVTHIE |
R/W |
0 |
Day over threshold interrupt enable
|
15 |
RSVD |
R |
- |
Reserved |
14 |
WUTIE |
R/W |
0 |
Wakeup timer interrupt enable
|
13 |
RSVD |
R |
- |
Reserved |
12 |
ALMIE |
R/W |
0 |
Alarm interrupt enable
|
11 |
RSVD |
R |
- |
Reserved |
10 |
WUTE |
R/W |
0 |
Wakeup timer enable
|
9 |
RSVD |
R |
- |
Reserved |
8 |
ALME |
R/W |
0 |
Alarm enable
|
7 |
FMT |
R/W |
0 |
Hour format
|
6:5 |
OSEL |
R/W |
0 |
Output selection. These bits are used to select the flag to be routed to RTC_OUT output.
|
4 |
RSVD |
R |
- |
Reserved |
3 |
BYPSHAD |
R/W |
0 |
Bypass the shadow registers.
|
2 |
BKP |
R/W |
0 |
Backup This bit can be written by the user to memorize whether the daylight saving time change has been performed or not. |
1 |
SUB1H |
R/W |
0 |
Subtract one hour (winter time changes) When this bit is set outside initialization mode, 1 hour is subtracted to the calendar time if the current hour is not 0, and this bit is always read as 0.
|
0 |
ADD1H |
R/W |
0 |
Add one hour (summer time changes) When this bit is set outside initialization mode, 1 hour is added to the calendar time, and this bit is always read as 0.
|
REG_RTC_ISR
Name: RTC Init Mode and Status Register
Size: 32
Address offset: 008h
Read/write access: R/W
The ALMF/WUTF/DOVTHF bit can be written without unlocking the write protection. Two APB clock cycles
after programming it to 1, this bit is cleaned.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:17 |
RSVD |
R |
- |
Reserved |
16 |
RECALPF |
R |
0 |
Recalibration pending flag The RECALPF status flag is automatically set to '1' when software writes to the RTC_CALIBR register, indicating that the RTCCALIBR register is blocked. When the new calibration settings are taken into account, this bit returns to '0'. Refer to Re-calibration on-the-fly. |
15 |
DOVTHF |
R/W |
0 |
Day over threshold flag This flag is set by hardware when the Day in RTC_TR over the DAY_THRES set in RTC_CR register. |
14:11 |
RSVD |
R |
- |
Reserved |
10 |
WUTF |
R/W |
0 |
Wakeup timer flag This flag is set by hardware when the wakeup auto-reload counter reaches to. This flag must be cleared by software at least 2 RTCCLK periods before WUTF is set to '1' again. |
9 |
RSVD |
R |
- |
Reserved |
8 |
ALMF |
R/W |
0 |
Alarm flag This flag is set by hardware when the time register (RTC_TR) matches the Alarm registers (RTC_ALMR1L and RTC_ALMR1H). |
7 |
INIT |
R/W |
0 |
Initialization mode
|
6 |
INITF |
R |
0 |
Initialization flag. When this bit is set to '1', the RTC is in initialization state, and the time, date, and prescaler registers can be updated.
|
5 |
RSF |
R/W |
0 |
Registers synchronization flag. This bit is set by hardware each time the calendar registers are copied into the shadow registers (RTC_TR). This bit is cleared by hardware in initialization mode or when in bypass shadow register mode (BYPSHAD=1). This bit can also be cleared by software. It is cleared either by software or by hardware in initialization mode.
|
4 |
INITS |
R |
0 |
This bit is set by hardware when the calendar day field is different from 0 (RTC domain reset state).
|
3 |
RSVD |
R |
- |
Reserved |
2 |
WUTWF |
R |
0 |
Wakeup timer write flag This flag is set by hardware when WUT value can be changed, after the WUTE bit has been set to '0' in RTC_CR.
|
1 |
WUTRSF |
R/W |
0 |
This bit is set by hardware each time the WUTE bit is copied into the shadow register. This bit is cleared by hardware in initialization mode. This bit can also be cleared by software. It is cleared either by software or by hardware in initialization mode.
|
0 |
ALMWF |
R |
0 |
Alarm write flag This bit is set by hardware when Alarm values can be changed, after the ALME bit has been set to '0' in RTC_CR. It is cleared by hardware when ALME bit has been set to '1' in RTC_CR.
|
REG_RTC_PRER
Name: RTC Prescaler Register
Size: 32
Address offset: 00Ch
Read/write access: R/W
This register is write protected, and must be written in initialization mode only.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:25 |
RSVD |
R |
- |
Reserved |
24:16 |
PREDIV_A |
R/W |
7Fh |
Asynchronous prescaler factor This is the asynchronous division factor: clk_apre freq = RTCCLK freq/(PREDIV_A + 1) |
15:9 |
RSVD |
R |
- |
Reserved |
8:0 |
PREDIV_S |
R/W |
FFh |
Synchronous prescaler factor This is the synchronous division factor: clk_spre freq = clk_apre freq/(PREDIV_S + 1) |
REG_RTC_CALIBR
Name: RTC Calibration Register
Size: 32
Address offset: 010h
Read/write access: R/W
This register is write protected, and can be dynamically configured when RTC is running.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:19 |
RSVD |
R |
- |
Reserved |
18:16 |
CALP |
R/W |
0 |
Calibration period |
15 |
DCE |
R/W |
0 |
Digital calibration enable
|
14 |
DCS |
R/W |
0 |
Digital calibration signal
|
13:7 |
RSVD |
R |
- |
Reserved |
6:0 |
DC |
R/W |
0 |
Digital calibration |
REG_RTC_ALMR1L
Name: RTC Alarm 1 Register Low
Size: 32
Address offset: 014h
Read/write access: R/W
This register is write protected, and can be written only when ALMWF is set to 1 in RTC_ISR
register, or in initialization mode.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:24 |
RSVD |
R |
- |
Reserved |
23 |
MSK2 |
R/W |
0 |
Alarm hour mask
|
22 |
ALR_PM |
R/W |
0 |
AM/PM notation.
|
21:20 |
ALR_HT |
R/W |
0 |
Hour tens in BCD format |
19:16 |
ALR_HU |
R/W |
0 |
Hour units in BCD format |
15 |
MSK1 |
R/W |
0 |
Alarm minutes mask.
|
14:12 |
ALR_MNT |
R/W |
0 |
Minute tens in BCD format |
11:8 |
ALR_MNU |
R/W |
0 |
Minute units in BCD format |
7 |
MSK0 |
R/W |
0 |
Alarm seconds mask
|
6:4 |
ALR_ST |
R/W |
0 |
Second tens in BCD format |
3:0 |
ALR_SU |
R/W |
0 |
Second units in BCD format |
REG_RTC_ALMR1H
Name: RTC Alarm 1 Register High
Size: 32
Address offset: 018h
Read/write access: R/W
This register is write protected, and can be written only when ALMWF is set to 1 in RTC_ISR
register, or in initialization mode
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:10 |
RSVD |
R |
- |
Reserved |
9 |
MSK3 |
R/W |
0 |
Alarm day mask
|
8:0 |
ALR_DAY |
R/W |
0 |
DAY in binary format |
REG_RTC_WPR
Name: RTC Write Protection Register
Size: 32
Address offset: 01Ch
Read/write access: R/W
Write "0xCA" then write "0x53" to disable write protection, and write "0xFF" to enable write
protection.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:8 |
RSVD |
R |
- |
Reserved |
7:0 |
KEY |
R/W |
0 |
Write protection key This byte is written by software. Refer to RTC register write protection for a description of how to unlock RTC register write protection. |
REG_RTC_YEAR
Name: RTC Year Register
Size: 32
Address offset: 020h
Read/write access: R/W
This register is controlled by software.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31 |
RESTORE |
R/W |
0 |
Reset Flag. Indicates whether any reset conditions have occurred (except POR/PDR/BOD), so that the bit is set to '1' before reset, and then the global variable that determines whether the recovery time information is needed depending on whether the bit is '1'. |
30:8 |
RSVD |
R |
- |
Reserved |
7:0 |
YEAR |
R/W |
0 |
Year in binary format |
REG_RTC_WUTR
Name: RTC Wakeup Timer Register
Size: 32
Address offset: 024h
Read/write access: R/W
This register is used to set wakeup timer value.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:17 |
RSVD |
R |
- |
Reserved |
16:0 |
WUT |
R/W |
0 |
Wakeup auto-reload value bits When the wakeup timer is enabled (WUTE is set to '1'), the WUTF flag is set every (WUT[16:0]+1) cycles. The first assertion of WUTF occurs between WUT and (WUT+1) cycles after WUTE is set. |
REG_RTC_DUMMY
Name: RTC Dummy Register
Size: 32
Address offset: 028h
Read/write access: R/W
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:0 |
DUMMY |
R/W |
ffffh |
Dummy register |
Base Address: 0x4101B000
Name |
Address offset |
Access |
Description |
|---|---|---|---|
000h |
R/W |
This register is the calendar time shadow register. This register is write protected, and must be written in initialization mode only. |
|
004h |
R/W |
This register is write protected. Bit[7] (FMT) of this register can be written in initialization mode only when INITF = 1. ADD1H and SUB1H changes are effective in 2~3 seconds. Don’t write this register continuously without any delay when RTC is in free run mode. Software can use the RSF bit in RTC_ISR register to handle the delay. |
|
008h |
R/W |
The ALMF/WUTF/DOVTHF bit can be written without unlocking the write protection. Two APB clock cycles after programming it to 1, this bit is cleaned. |
|
00Ch |
R/W |
This register is write protected, and must be written in initialization mode only. |
|
010h |
R/W |
This register is write protected, and can be dynamically configured when RTC is running. |
|
014h |
R/W |
This register is write protected, and can be written only when ALMWF is set to 1 in RTC_ISR register, or in initialization mode. |
|
018h |
R/W |
This register is write protected, and can be written only when ALMWF is set to 1 in RTC_ISR register, or in initialization mode. |
|
01Ch |
R/W |
Write "0xCA"then write "0x53" to disable write protection, and write "0xFF" to enable write protection. |
|
020h |
R/W |
This register is controlled by software. |
|
024h |
R/W |
This register is used to set wakeup timer value. |
|
028h |
R/W |
REG_RTC_TR
Name: RTC Time Register
Size: 32
Address offset: 000h
Read/write access: R/W
This register is the calendar time shadow register. This register is write protected, and must be
written in initialization mode only.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:23 |
DAY |
R/W |
0 |
DAY in binary format |
22 |
PM |
R/W |
0 |
PM:AM/PM notation
|
21:20 |
HT |
R/W |
0 |
Hour tens in BCD format |
19:16 |
HU |
R/W |
0 |
Hour units in BCD format |
15 |
RSVD |
R |
- |
Reserved |
14:12 |
MNT |
R/W |
0 |
Minute tens in BCD format |
11:8 |
MNU |
R/W |
0 |
Minute units in BCD format |
7 |
RSVD |
R |
- |
Reserved |
6:4 |
ST |
R/W |
0 |
Second tens in BCD format |
3:0 |
SU |
R/W |
0 |
Second units in BCD format |
REG_RTC_CR
Name: RTC Ctrl Register
Size: 32
Address offset: 004h
Read/write access: R/W
This register is write protected. Bit[7] (FMT) of this register can be written in initialization
mode only when INITF = 1. ADD1H and SUB1H changes are effective in 2~3 seconds. Don’t write this
register continuously without any delay when RTC is in free run mode. Software can use the RSF bit
in RTC_ISR register to handle the delay.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:23 |
DAY_THRES |
R |
1FFh |
Day threshold in binary format |
22:17 |
RSVD |
R |
- |
Reserved |
16 |
DOVTHIE |
R/W |
0 |
Day over threshold interrupt enable
|
15 |
RSVD |
R |
- |
Reserved |
14 |
WUTIE |
R/W |
0 |
Wakeup timer interrupt enable
|
13 |
RSVD |
R |
- |
Reserved |
12 |
ALMIE |
R/W |
0 |
Alarm interrupt enable
|
11 |
RSVD |
R |
- |
Reserved |
10 |
WUTE |
R/W |
0 |
Wakeup timer enable
|
9 |
RSVD |
R |
- |
Reserved |
8 |
ALME |
R/W |
0 |
Alarm enable
|
7 |
FMT |
R/W |
0 |
Hour format
|
6:5 |
OSEL |
R/W |
0 |
Output selection. These bits are used to select the flag to be routed to RTC_OUT output.
|
4 |
RSVD |
R |
- |
Reserved |
3 |
BYPSHAD |
R/W |
0 |
Bypass the shadow registers
|
2 |
BKP |
R/W |
0 |
Backup This bit can be written by the user to memorize whether the daylight saving time change has been performed or not. |
1 |
SUB1H |
R/W |
0 |
Subtract one hour (winter time change) when this bit is set outside initialization mode, 1 hour is subtracted to the calendar time if the current hour is not 0, this bit is always read as 0.
|
0 |
ADD1H |
R/W |
0 |
Add one hour (summer time change) when this bit is set outside initialization mode, 1 hour is add to the calendar time, this bit is always read as 0.
|
REG_RTC_ISR
Name: RTC initialization and Status Register
Size: 32
Address offset: 008h
Read/write access: R/W
The ALMF/WUTF/DOVTHF bit can be written without unlocking the write protection. Two APB clock cycles
after programming it to 1, this bit is cleaned.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:17 |
RSVD |
R |
- |
Reserved |
16 |
RECALPF |
R |
0 |
Recalibration pending flag The RECALPF status flag is automatically set to '1' when software writes to the RTC_CALIBR register, indicating that the RTCCALIBR register is blocked. When the new calibration settings are taken into account, this bit returns to '0'. Refer to Re-calibration on-the-fly. |
15 |
DOVTHF |
R/W |
0 |
Day over threshold flag This flag is set by hardware when the Day in RTC_TR over the DAY_THRES set in RTC_CR register. |
14:11 |
RSVD |
R |
- |
Reserved |
10 |
WUTF |
R/W |
0 |
Wakeup timer flag This flag is set by hardware when the wakeup auto-reload counter reaches to. This flag must be cleared by software at least 2 RTCCLK periods before WUTF is set to '1' again. |
9 |
RSVD |
R |
- |
Reserved |
8 |
ALMF |
R/W |
0 |
Alarm flag This flag is set by hardware when the time register (RTC_TR) matches the Alarm registers (RTC_ALMR1L and RTC_ALMR1H). |
7 |
INIT |
R/W |
0 |
Initialization mode
|
6 |
INITF |
R |
0 |
Initialization flag When this bit is set to '1', the RTC is in initialization state, and the time, date, and prescaler registers can be updated.
|
5 |
RSF |
R/W |
0 |
Registers synchronization flag This bit is set by hardware each time the calendar registers are copied into the shadow registers (RTC_TR). This bit is cleared by hardware in initialization mode or when in bypass shadow register mode (BYPSHAD=1). This bit can also be cleared by software. It is cleared either by software or by hardware in initialization mode.
|
4 |
INITS |
R |
0 |
This bit is set by hardware when the calendar day field is different from 0 (RTC domain reset state).
|
3 |
RSVD |
R |
- |
Reserved |
2 |
WUTWF |
R |
0 |
Wakeup timer write flag This flag is set by hardware when WUT value can be changed, after the WUTE bit has been set to '0' in RTC_CR.
|
1 |
WUTRSF |
R/W |
0 |
This bit is set by hardware each time the WUTE bit is copied into the shadow register. This bit is cleared by hardware in initialization mode. This bit can also be cleared by software. It is cleared either by software or by hardware in initialization mode.
|
0 |
ALMWF |
R |
0 |
Alarm write flag This bit is set by hardware when Alarm values can be changed, after the ALME bit has been set to '0' in RTC_CR. It is cleared by hardware when ALME bit has been set to '1' in RTC_CR.
|
REG_RTC_PRER
Name: RTC Prescaler Register
Size: 32
Address offset: 00Ch
Read/write access: R/W
This register is write protected, and must be written in initialization mode only.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:25 |
RSVD |
R |
- |
Reserved |
24:16 |
PREDIV_A |
R/W |
7Fh |
Asynchronous prescaler factor This is the asynchronous division factor: clk_apre freq = RTCCLK freq/(PREDIV_A + 1) |
15:9 |
RSVD |
R |
- |
Reserved |
8:0 |
PREDIV_S |
R/W |
FFh |
Synchronous prescaler factor This is the synchronous division factor: clk_spre freq = clk_apre freq/(PREDIV_S + 1) |
REG_RTC_CALIBR
Name: RTC Calibration Register
Size: 32
Address offset: 010h
Read/write access: R/W
This register is write protected, and can be dynamically configured when RTC is running.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:19 |
RSVD |
R |
- |
Reserved |
18:16 |
CALP |
R/W |
0 |
Calibration period |
15 |
DCE |
R/W |
0 |
Digital calibration enable
|
14 |
DCS |
R/W |
0 |
Digital calibration signal
|
13:7 |
RSVD |
R |
- |
Reserved |
6:0 |
DC |
R/W |
0 |
Digital calibration |
REG_RTC_ALMR1L
Name: RTC Alarm 1 Register Low
Size: 32
Address offset: 014h
Read/write access: R/W
This register is write protected, and can be written only when ALMWF is set to 1 in RTC_ISR
register, or in initialization mode.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:24 |
RSVD |
R |
- |
Reserved |
23 |
MSK2 |
R/W |
0 |
Alarm hour mask
|
22 |
ALR_PM |
R/W |
0 |
AM/PM notation
|
21:20 |
ALR_HT |
R/W |
0 |
Hour tens in BCD format |
19:16 |
ALR_HU |
R/W |
0 |
Hour units in BCD format |
15 |
MSK1 |
R/W |
0 |
Alarm minutes mask.
|
14:12 |
ALR_MNT |
R/W |
0 |
Minute tens in BCD format |
11:8 |
ALR_MNU |
R/W |
0 |
Minute units in BCD format |
7 |
MSK0 |
R/W |
0 |
Alarm seconds mask
|
6:4 |
ALR_ST |
R/W |
0 |
Second tens in BCD format |
3:0 |
ALR_SU |
R/W |
0 |
Second units in BCD format |
REG_RTC_ALMR1H
Name: RTC Alarm 1 Register High
Size: 32
Address offset: 018h
Read/write access: R/W
This register is write protected, and can be written only when ALMWF is set to 1 in RTC_ISR
register, or in initialization mode.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:10 |
RSVD |
R |
- |
Reserved |
9 |
MSK3 |
R/W |
0 |
Alarm day mask
|
8:0 |
ALR_DAY |
R/W |
0 |
DAY in binary format |
REG_RTC_WPR
Name: RTC Write Protect Register
Size: 32
Address offset: 01Ch
Read/write access: R/W
Write "0xCA"then write "0x53" to disable write protection, and write "0xFF" to enable write
protection.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:8 |
RSVD |
R |
- |
Reserved |
7:0 |
KEY |
R/W |
0 |
Write protection key This byte is written by software. Refer to RTC register write protection for a description of how to unlock RTC register write protection. |
REG_RTC_YEAR
Name: RTC Year Register
Size: 32
Address offset: 020h
Read/write access: R/W
This register is controlled by software.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31 |
RESTORE |
R/W |
0 |
Reset Flag. Indicates whether any reset conditions have occurred (except POR/PDR/BOD), so that the bit is set to '1' before reset, and then the global variable that determines whether the recovery time information is needed depending on whether the bit is '1'. |
30:8 |
RSVD |
R |
- |
Reserved |
7:0 |
YEAR |
R/W |
0 |
Year in binary format |
REG_RTC_WUTR
Name: RTC Wakeup Timer Register
Size: 32
Address offset: 024h
Read/write access: R/W
This register is used to set wakeup timer value.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:17 |
RSVD |
R |
- |
Reserved |
16:0 |
WUT |
R/W |
0 |
Wakeup auto-reload value bits When the wakeup timer is enabled (WUTE is set to '1'), the WUTF flag is set every (WUT[16:0]+1) cycles. The first assertion of WUTF occurs between WUT and (WUT+1) cycles after WUTE is set. |
REG_RTC_DUMMY
Name: RTC Dummy Register
Size: 32
Address offset: 028h
Read/write access: R/W
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:0 |
DUMMY |
R/W |
ffffh |
Dummy register |
REGISTER_CONTENTS=RTL8720E
REGISTER_CONTENTS=RTL8720E
REGISTER_CONTENTS=RTL8720E
Base Address: 0x4200E000
Name |
Address offset |
Access |
Description |
|---|---|---|---|
000h |
R/W |
This register is the calendar time shadow register. This register is write protected, and must be written in initialization mode only |
|
004h |
R/W |
This register is write protected. Bit[7] (FMT) of this register can be written in initialization mode only when INITF = 1. ADD1H and SUB1H changes are effective in 2~3 seconds. Don’t write this register continuously without any delay when RTC is in free run mode. Software can use the RSF bit in RTC_ISR register to handle the delay. |
|
008h |
R/W |
RTC Initialization mode and status register,The ALMF bit can be written without unlocking the write protection. Two APB clock cycles after programming it to 1, this bit is cleaned. |
|
00Ch |
R/W |
This register is write protected, and must be written in initialization mode only. |
|
010h |
R/W |
This register is write protected, and can be dynamically configured when RTC is running |
|
014h |
R/W |
This register is write protected, and can be written only when ALMWF is set to 1 in RTC_ISR register, or in initialization mode. |
|
018h |
R/W |
This register is write protected, and can be written only when ALMWF is set to 1 in RTC_ISR register, or in initialization mode |
|
01Ch |
R/W |
RTC write protection register,write "0xCA"then write "0x53" disable write protect,write "0xFF" enable write protect |
|
020h |
R/W |
RTC year register,this register is controlled by software |
|
024h |
R/W |
RTC wakeup timer register,set wakeup timer value. |
REG_RTC_TR
Name: RTC Time Reg
Size: 32
Address offset: 000h
Read/write access: R/W
This register is the calendar time shadow register. This register is write protected, and must be
written in initialization mode only
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:23 |
DAY |
R/W |
0 |
DAY in binary format |
22 |
PM |
R/W |
0 |
PM:AM/PM notation
|
21:20 |
HT |
R/W |
0 |
Hour tens in BCD format |
19:16 |
HU |
R/W |
0 |
Hour units in BCD format |
15 |
RSVD |
R |
- |
Reserved |
14:12 |
MNT |
R/W |
0 |
Minute tens in BCD format |
11:8 |
MNU |
R/W |
0 |
Minute units in BCD format |
7 |
RSVD |
R |
- |
Reserved |
6:4 |
ST |
R/W |
0 |
Second tens in BCD format |
3:0 |
SU |
R/W |
0 |
Second units in BCD format |
REG_RTC_CR
Name: RTC Ctrl Reg
Size: 32
Address offset: 004h
Read/write access: R/W
This register is write protected. Bit[7] (FMT) of this register can be written in initialization
mode only when INITF = 1. ADD1H and SUB1H changes are effective in 2~3 seconds. Don’t write this
register continuously without any delay when RTC is in free run mode. Software can use the RSF bit
in RTC_ISR register to handle the delay.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:23 |
DAY_THRES |
R |
1FFh |
Day threshold in binary format |
22:17 |
RSVD |
R |
- |
Reserved |
16 |
DOVTHIE |
R/W |
0 |
Day over threshold interrupt enable
|
15 |
RSVD |
R |
- |
Reserved |
14 |
WUTIE |
R/W |
0 |
Wakeup timer interrupt enable
|
13 |
RSVD |
R |
- |
Reserved |
12 |
ALMIE |
R/W |
0 |
Alarm interrupt enable
|
11 |
RSVD |
R |
- |
Reserved |
10 |
WUTE |
R/W |
0 |
Wakeup timer enable
|
9 |
RSVD |
R |
- |
Reserved |
8 |
ALME |
R/W |
0 |
Alarm enable
|
7 |
FMT |
R/W |
0 |
Hour format
|
6:5 |
OSEL |
R/W |
0 |
Output selection.There bits are used to select the flag to be routed to RTC_OUT output.
|
4 |
RSVD |
R |
- |
Reserved |
3 |
BYPSHAD |
R/W |
0 |
Bypass the shadow registers.
|
2 |
BKP |
R/W |
0 |
Backup This bit can be written by the user to memorize whether the daylight saving time change has been performed or not. |
1 |
SUB1H |
R/W |
0 |
Subtract one hour(winter time change),when this bit is set outside initialization mode,1 hour is subtracted to the calendar time if the current hour is not 0,this bit is always read as 0.
|
0 |
ADD1H |
R/W |
0 |
Add one hour(summer time change),when this bit is set outside initialization mode,1 hour is add to the calendar time,this bit is always read as 0.
|
REG_RTC_ISR
Name: RTC Init And Status Reg
Size: 32
Address offset: 008h
Read/write access: R/W
RTC Initialization mode and status register,The ALMF bit can be written without unlocking the write
protection. Two APB clock cycles after programming it to 1, this bit is cleaned.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:17 |
RSVD |
R |
- |
Reserved |
16 |
RECALPF |
R |
0 |
Recalibration pending flag The RECALPF status flag is automatically set to '1' when software writes to the RTC_CALIBR register, indicating that the RTCCALIBR register is blocked. When the new calibration settings are taken into account, this bit returns to '0'. Refer to Re-calibration on-the-fly. |
15 |
DOVTHF |
R/W |
0 |
Day over threshold flag This flag is set by hardware when the Day in RTC_TR over the DAY_THRES set in RTC_CR register. |
14:11 |
RSVD |
R |
- |
Reserved |
10 |
WUTF |
R/W |
0 |
Wakeup timer flag This flag is set by hardware when the wakeup auto-reload counter reaches to. This flag must be cleared by software at least 2 RTCCLK periods before WUTF is set to '1' again. |
9 |
RSVD |
R |
- |
Reserved |
8 |
ALMF |
R/W |
0 |
Alarm flag This flag is set by hardware when the time register (RTC_TR) matches the Alarm registers (RTC_ALMR1L and RTC_ALMR1H). |
7 |
INIT |
R/W |
0 |
Initialization mode
|
6 |
INITF |
R |
0 |
Initialization flag. When this bit is set to '1', the RTC is in initialization state, and the time, date, and prescaler registers can be updated.
|
5 |
RSF |
R/W |
0 |
Registers synchronization flag. This bit is set by hardware each time the calendar registers are copied into the shadow registers (RTC_TR). This bit is cleared by hardware in initialization mode or when in bypass shadow register mode (BYPSHAD=1). This bit can also be cleared by software. It is cleared either by software or by hardware in initialization mode.
|
4 |
INITS |
R |
0 |
This bit is set by hardware when the calendar day field is different from 0 (RTC domain reset state).
|
3 |
RSVD |
R |
- |
Reserved |
2 |
WUTWF |
R |
0 |
Wakeup timer write flag This flag is set by hardware when WUT value can be changed, after the WUTE bit has been set to '0' in RTC_CR.
|
1 |
WUTRSF |
R/W |
0 |
This bit is set by hardware each time the WUTE bit is copied into the shadow register. This bit is cleared by hardware in initialization mode. This bit can also be cleared by software. It is cleared either by software or by hardware in initialization mode.
|
0 |
ALMWF |
R |
0 |
Alarm write flag This bit is set by hardware when Alarm values can be changed, after the ALME bit has been set to '0' in RTC_CR. It is cleared by hardware when ALME bit has been set to '1' in RTC_CR.
|
REG_RTC_PRER
Name: RTC Prescaler Reg
Size: 32
Address offset: 00Ch
Read/write access: R/W
This register is write protected, and must be written in initialization mode only.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:25 |
RSVD |
R |
- |
Reserved |
24:16 |
PREDIV_A |
R/W |
7Fh |
Asynchronous prescaler factor This is the asynchronous division factor: clk_apre freq = RTCCLK freq/(PREDIV_A + 1) |
15:9 |
RSVD |
R |
- |
Reserved |
8:0 |
PREDIV_S |
R/W |
FFh |
Synchronous prescaler factor This is the synchronous division factor: clk_spre freq = clk_apre freq/(PREDIV_S + 1) |
REG_RTC_CALIBR
Name: RTC Calibration Reg
Size: 32
Address offset: 010h
Read/write access: R/W
This register is write protected, and can be dynamically configured when RTC is running
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:19 |
RSVD |
R |
- |
Reserved |
18:16 |
CALP |
R/W |
0 |
Calibration period |
15 |
DCE |
R/W |
0 |
Digital calibration enable
|
14 |
DCS |
R/W |
0 |
Digital calibration signal
|
13:7 |
RSVD |
R |
- |
Reserved |
6:0 |
DC |
R/W |
0 |
Digital calibration |
REG_RTC_ALMR1L
Name: RTC Alarm 1 Reg Low
Size: 32
Address offset: 014h
Read/write access: R/W
This register is write protected, and can be written only when ALMWF is set to 1 in RTC_ISR
register, or in initialization mode.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:24 |
RSVD |
R |
- |
Reserved |
23 |
MSK2 |
R/W |
0 |
Alarm hour mask
|
22 |
ALR_PM |
R/W |
0 |
AM/PM notation.
|
21:20 |
ALR_HT |
R/W |
0 |
Hour tens in BCD format |
19:16 |
ALR_HU |
R/W |
0 |
Hour units in BCD format |
15 |
MSK1 |
R/W |
0 |
Alarm minutes mask.
|
14:12 |
ALR_MNT |
R/W |
0 |
Minute tens in BCD format |
11:8 |
ALR_MNU |
R/W |
0 |
Minute units in BCD format |
7 |
MSK0 |
R/W |
0 |
Alarm seconds mask
|
6:4 |
ALR_ST |
R/W |
0 |
Second tens in BCD format |
3:0 |
ALR_SU |
R/W |
0 |
Second units in BCD format |
REG_RTC_ALMR1H
Name: - RTC Alarm 1 Reg High
Size: 32
Address offset: 018h
Read/write access: R/W
This register is write protected, and can be written only when ALMWF is set to 1 in RTC_ISR
register, or in initialization mode
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:10 |
RSVD |
R |
- |
Reserved |
9 |
MSK3 |
R/W |
0 |
Alarm day mask
|
8:0 |
ALR_DAY |
R/W |
0 |
DAY in binary format |
REG_RTC_WPR
Name: RTC Write Protect Reg
Size: 32
Address offset: 01Ch
Read/write access: R/W
RTC write protection register,write "0xCA"then write "0x53" disable write protect,write "0xFF"
enable write protect
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:8 |
RSVD |
R |
- |
Reserved |
7:0 |
KEY |
R/W |
0 |
Write protection key This byte is written by software. Refer to RTC register write protection for a description of how to unlock RTC register write protection. |
REG_RTC_YEAR
Name: RTC Year Reg
Size: 32
Address offset: 020h
Read/write access: R/W
RTC year register,this register is controlled by software
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31 |
RESTORE |
R/W |
0 |
Reset Flag. Indicates whether any reset conditions have occurred (except POR/PDR/BOD), so that the bit is set to '1' before reset, and then the global variable that determines whether the recovery time information is needed depending on whether the bit is '1'. |
30:8 |
RSVD |
R |
- |
Reserved |
7:0 |
YEAR |
R/W |
0 |
Year in binary format |
REG_RTC_WUTR
Name: RTC Wakeup Timer Reg
Size: 32
Address offset: 024h
Read/write access: R/W
RTC wakeup timer register,set wakeup timer value.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:17 |
RSVD |
R |
- |
Reserved |
16:0 |
WUT |
R/W |
0 |
Wakeup auto-reload value bits When the wakeup timer is enabled (WUTE is set to '1'), the WUTF flag is set every (WUT[16:0]+1) cycles. The first assertion of WUTF occurs between WUT and (WUT+1) cycles after WUTE is set. |
Base Address: 0x4080AA00
Name |
Address offset |
Access |
Description |
|---|---|---|---|
000h |
R/W |
This register is the calendar time shadow register. This register is write protected, and must be written in initialization mode only |
|
004h |
R/W |
This register is write protected. Bit[7] (FMT) of this register can be written in initialization mode only when INITF = 1. ADD1H and SUB1H changes are effective in 2~3 seconds. Don’t write this register continuously without any delay when RTC is in free run mode. Software can use the RSF bit in RTC_ISR register to handle the delay. |
|
008h |
R/W |
RTC Initialization mode and status register,The ALMF/WUTF/DOVTHF bit can be written without unlocking the write protection. Two APB clock cycles after programming it to 1, this bit is cleaned. |
|
00Ch |
R/W |
This register is write protected, and must be written in initialization mode only. |
|
010h |
R/W |
This register is write protected, and can be dynamically configured when RTC is running |
|
014h |
R/W |
This register is write protected, and can be written only when ALMWF is set to 1 in RTC_ISR register, or in initialization mode. |
|
018h |
R/W |
This register is write protected, and can be written only when ALMWF is set to 1 in RTC_ISR register, or in initialization mode |
|
01Ch |
R/W |
RTC write protection register,write "0xCA"then write "0x53" disable write protect,write "0xFF" enable write protect |
|
020h |
R/W |
RTC year register,this register is controlled by software |
|
024h |
R/W |
RTC wakeup timer register,set wakeup timer value. |
|
028h |
R/W |
Dummy register |
REG_RTC_TR
Name: RTC Time Reg
Size: 32
Address offset: 000h
Read/write access: R/W
This register is the calendar time shadow register. This register is write protected, and must be
written in initialization mode only
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:23 |
DAY |
R/W |
0 |
DAY in binary format |
22 |
PM |
R/W |
0 |
PM:AM/PM notation
|
21:20 |
HT |
R/W |
0 |
Hour tens in BCD format |
19:16 |
HU |
R/W |
0 |
Hour units in BCD format |
15 |
RSVD |
R |
- |
Reserved |
14:12 |
MNT |
R/W |
0 |
Minute tens in BCD format |
11:8 |
MNU |
R/W |
0 |
Minute units in BCD format |
7 |
RSVD |
R |
- |
Reserved |
6:4 |
ST |
R/W |
0 |
Second tens in BCD format |
3:0 |
SU |
R/W |
0 |
Second units in BCD format |
REG_RTC_CR
Name: RTC Ctrl Reg
Size: 32
Address offset: 004h
Read/write access: R/W
This register is write protected. Bit[7] (FMT) of this register can be written in initialization
mode only when INITF = 1. ADD1H and SUB1H changes are effective in 2~3 seconds. Don’t write this
register continuously without any delay when RTC is in free run mode. Software can use the RSF bit
in RTC_ISR register to handle the delay.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:23 |
DAY_THRES |
R |
1FFh |
Day threshold in binary format |
22:18 |
RSVD |
R |
- |
Reserved |
17 |
CLKDIV2_EN |
R/W |
1 |
Rtc_clk/rtc_bclk use divided clock enable
|
16 |
DOVTHIE |
R/W |
0 |
Day over threshold interrupt enable
|
15 |
RSVD |
R |
- |
Reserved |
14 |
WUTIE |
R/W |
0 |
Wakeup timer interrupt enable
|
13 |
RSVD |
R |
- |
Reserved |
12 |
ALMIE |
R/W |
0 |
Alarm interrupt enable
|
11 |
RSVD |
R |
- |
Reserved |
10 |
WUTE |
R/W |
0 |
Wakeup timer enable
|
9 |
RSVD |
R |
- |
Reserved |
8 |
ALME |
R/W |
0 |
Alarm enable
|
7 |
FMT |
R/W |
0 |
Hour format
|
6:5 |
OSEL |
R/W |
0 |
Output selection.There bits are used to select the flag to be routed to RTC_OUT output.
|
4 |
RSVD |
R |
- |
Reserved |
3 |
BYPSHAD |
R/W |
0 |
Bypass the shadow registers.
|
2 |
BKP |
R/W |
0 |
Backup This bit can be written by the user to memorize whether the daylight saving time change has been performed or not. |
1 |
SUB1H |
R/W |
0 |
Subtract one hour(winter time change),when this bit is set outside initialization mode,1 hour is subtracted to the calendar time if the current hour is not 0,this bit is always read as 0.
|
0 |
ADD1H |
R/W |
0 |
Add one hour(summer time change),when this bit is set outside initialization mode,1 hour is add to the calendar time,this bit is always read as 0.
|
REG_RTC_ISR
Name: RTC Init And Status Reg
Size: 32
Address offset: 008h
Read/write access: R/W
RTC Initialization mode and status register,The ALMF/WUTF/DOVTHF bit can be written without
unlocking the write protection. Two APB clock cycles after programming it to 1, this bit is cleaned.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:17 |
RSVD |
R |
- |
Reserved |
16 |
RECALPF |
R |
0 |
Recalibration pending flag The RECALPF status flag is automatically set to '1' when software writes to the RTC_CALIBR register, indicating that the RTCCALIBR register is blocked. When the new calibration settings are taken into account, this bit returns to '0'. Refer to Re-calibration on-the-fly. |
15 |
DOVTHF |
R/W |
0 |
Day over threshold flag This flag is set by hardware when the Day in RTC_TR over the DAY_THRES set in RTC_CR register. |
14:11 |
RSVD |
R |
- |
Reserved |
10 |
WUTF |
R/W |
0 |
Wakeup timer flag This flag is set by hardware when the wakeup auto-reload counter reaches to. This flag must be cleared by software at least 2 RTCCLK periods before WUTF is set to '1' again. |
9 |
RSVD |
R |
- |
Reserved |
8 |
ALMF |
R/W |
0 |
Alarm flag This flag is set by hardware when the time register (RTC_TR) matches the Alarm registers (RTC_ALMR1L and RTC_ALMR1H). |
7 |
INIT |
R/W |
0 |
Initialization mode
|
6 |
INITF |
R |
0 |
Initialization flag. When this bit is set to '1', the RTC is in initialization state, and the time, date, and prescaler registers can be updated.
|
5 |
RSF |
R/W |
0 |
Registers synchronization flag. This bit is set by hardware each time the calendar registers are copied into the shadow registers (RTC_TR). This bit is cleared by hardware in initialization mode or when in bypass shadow register mode (BYPSHAD=1). This bit can also be cleared by software. It is cleared either by software or by hardware in initialization mode.
|
4 |
INITS |
R |
0 |
This bit is set by hardware when the calendar day field is different from 0 (RTC domain reset state).
|
3 |
RSVD |
R |
- |
Reserved |
2 |
WUTWF |
R |
0 |
Wakeup timer write flag This flag is set by hardware when WUT value can be changed, after the WUTE bit has been set to '0' in RTC_CR.
|
1 |
WUTRSF |
R/W |
0 |
This bit is set by hardware each time the WUTE bit is copied into the shadow register. This bit is cleared by hardware in initialization mode. This bit can also be cleared by software. It is cleared either by software or by hardware in initialization mode.
|
0 |
ALMWF |
R |
0 |
Alarm write flag This bit is set by hardware when Alarm values can be changed, after the ALME bit has been set to '0' in RTC_CR. It is cleared by hardware when ALME bit has been set to '1' in RTC_CR.
|
REG_RTC_PRER
Name: RTC Prescaler Reg
Size: 32
Address offset: 00Ch
Read/write access: R/W
This register is write protected, and must be written in initialization mode only.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:25 |
RSVD |
R |
- |
Reserved |
24:16 |
PREDIV_A |
R/W |
7Fh |
Asynchronous prescaler factor This is the asynchronous division factor: clk_apre freq = RTCCLK freq/(PREDIV_A + 1) |
15:9 |
RSVD |
R |
- |
Reserved |
8:0 |
PREDIV_S |
R/W |
FFh |
Synchronous prescaler factor This is the synchronous division factor: clk_spre freq = clk_apre freq/(PREDIV_S + 1) |
REG_RTC_CALIBR
Name: RTC Calibration Reg
Size: 32
Address offset: 010h
Read/write access: R/W
This register is write protected, and can be dynamically configured when RTC is running
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:19 |
RSVD |
R |
- |
Reserved |
18:16 |
CALP |
R/W |
0 |
Calibration period |
15 |
DCE |
R/W |
0 |
Digital calibration enable
|
14 |
DCS |
R/W |
0 |
Digital calibration signal
|
13:7 |
RSVD |
R |
- |
Reserved |
6:0 |
DC |
R/W |
0 |
Digital calibration |
REG_RTC_ALMR1L
Name: RTC Alarm 1 Reg Low
Size: 32
Address offset: 014h
Read/write access: R/W
This register is write protected, and can be written only when ALMWF is set to 1 in RTC_ISR
register, or in initialization mode.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:24 |
RSVD |
R |
- |
Reserved |
23 |
MSK2 |
R/W |
0 |
Alarm hour mask
|
22 |
ALR_PM |
R/W |
0 |
AM/PM notation.
|
21:20 |
ALR_HT |
R/W |
0 |
Hour tens in BCD format |
19:16 |
ALR_HU |
R/W |
0 |
Hour units in BCD format |
15 |
MSK1 |
R/W |
0 |
Alarm minutes mask.
|
14:12 |
ALR_MNT |
R/W |
0 |
Minute tens in BCD format |
11:8 |
ALR_MNU |
R/W |
0 |
Minute units in BCD format |
7 |
MSK0 |
R/W |
0 |
Alarm seconds mask
|
6:4 |
ALR_ST |
R/W |
0 |
Second tens in BCD format |
3:0 |
ALR_SU |
R/W |
0 |
Second units in BCD format |
REG_RTC_ALMR1H
Name: - RTC Alarm 1 Reg High
Size: 32
Address offset: 018h
Read/write access: R/W
This register is write protected, and can be written only when ALMWF is set to 1 in RTC_ISR
register, or in initialization mode
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:10 |
RSVD |
R |
- |
Reserved |
9 |
MSK3 |
R/W |
0 |
Alarm day mask
|
8:0 |
ALR_DAY |
R/W |
0 |
DAY in binary format |
REG_RTC_WPR
Name: RTC Write Protect Reg
Size: 32
Address offset: 01Ch
Read/write access: R/W
RTC write protection register,write "0xCA"then write "0x53" disable write protect,write "0xFF"
enable write protect
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:8 |
RSVD |
R |
- |
Reserved |
7:0 |
KEY |
R/W |
0 |
Write protection key This byte is written by software. Refer to RTC register write protection for a description of how to unlock RTC register write protection.RTC write protection register,write "0xCA"then write "0x53" disable write protect,write "0xFF" enable write protect |
REG_RTC_YEAR
Name: RTC Year Reg
Size: 32
Address offset: 020h
Read/write access: R/W
RTC year register,this register is controlled by software
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31 |
RESTORE |
R/W |
0 |
Reset Flag. Indicates whether any reset conditions have occurred (except POR/PDR/BOD), so that the bit is set to '1' before reset, and then the global variable that determines whether the recovery time information is needed depending on whether the bit is '1'. |
30:8 |
RSVD |
R |
- |
Reserved |
7:0 |
YEAR |
R/W |
0 |
Year in binary format |
REG_RTC_WUTR
Name: RTC Wakeup Timer Reg
Size: 32
Address offset: 024h
Read/write access: R/W
RTC wakeup timer register,set wakeup timer value.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:17 |
RSVD |
R |
- |
Reserved |
16:0 |
WUT |
R/W |
0 |
Wakeup auto-reload value bits When the wakeup timer is enabled (WUTE is set to '1'), the WUTF flag is set every (WUT[16:0]+1) cycles. The first assertion of WUTF occurs between WUT and (WUT+1) cycles after WUTE is set. |
REG_RTC_DUMMY
Name: RTC Dummy Register
Size: 32
Address offset: 028h
Read/write access: R/W
Dummy register
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:0 |
DUMMY |
R/W |
ffffh |
Dummy register |