基本定时器
简介
基本定时器(Basic Timer)为一款简洁高效的 32 位定时外设,采用纯 32 位计数器架构,不包含预分频功能。定时器在使能后从初始值开始向上计数,当计数值达到用户配置的重载寄存器值时,自动产生更新事件,并将计数器清零重新开始计数,以此实现自动重载、连续循环计时功能。
特性
基本定时器的功能特性如下所列。
分辨率为 32 位
计数模式为向上计数
支持中断
支持自动重载
名称 |
LS: TIM0 ~ TIM7 |
HP: TIM10 ~ TIM13 |
|---|---|---|
时钟源 |
SDM32kHz |
XTAL40MHz |
备注
TIM10 ~ TIM13 的时钟源源自 XTAL40MHz,经过 40 分频。
名称 |
TIM0 ~ TIM7 |
TIM10 ~ TIM14 |
|---|---|---|
时钟源 |
SDM32kHz |
XTAL40MHz |
备注
TIM10 ~ TIM14 的时钟源源自 XTAL40MHz,经过 40 分频。
名称 |
TIM0 ~ TIM7 |
TIM10 ~ TIM14 |
|---|---|---|
时钟源 |
SDM32kHz |
XTAL40MHz |
备注
TIM10 ~ TIM14 的时钟源源自 XTAL40MHz,经过 40 分频。
名称 |
TIM0 ~ TIM7 |
TIM10 ~ TIM14 |
|---|---|---|
时钟源 |
SDM32kHz |
XTAL40MHz |
备注
TIM10 ~ TIM14 的时钟源源自 XTAL40MHz,经过 40 分频。
名称 |
TIM0 ~ TIM7 |
TIM10 ~ TIM14 |
|---|---|---|
时钟源 |
SDM32kHz |
XTAL40MHz |
备注
TIM10 ~ TIM14 的时钟源源自 XTAL40MHz,经过 40 分频。
名称 |
TIM0 ~ TIM7 |
TIM10/TIM11 |
|---|---|---|
时钟源 |
SDM32kHz |
XTAL40MHz |
备注
TIM10 和 TIM11 的时钟源源自 XTAL40MHz,经过 40 分频。
名称 |
TIM0 ~ TIM3 |
|---|---|
时钟源 |
SDM32kHz(默认)或 XTAL40MHz |
名称 |
TIM0 ~ TIM3 |
|---|---|
时钟源 |
SDM32kHz(默认)或 XTAL40MHz |
框图
基本定时器主要由 32 位计数器和预加载寄存器构成,框图如下所示。
功能描述
向上计数模式
该 Timer 是一个 32 位计数器,具有相关的自动重载寄存器。计数器以及自动重载寄存器都可以被软件读写。即使计数器正在运行,也可以进行读写操作。
时基单元包括:
计数器寄存器(TIMx_CNT)
自动重载寄存器(TIMx_ARR)
Timer 工作在向上计数模式,计数器从 0 计数到自动重载值(TIMx_ARR 寄存器的内容)。当计数器达到自动重载值时,会产生计数器溢出事件。
预加载自动重载寄存器
自动重载寄存器支持预加载机制,对该寄存器的读写操作,实际访问的是对应的预加载寄存器。预加载寄存器中的数值传输至影子寄存器的时机,由定时器控制寄存器 TIMx_CR 中的自动重载预加载使能位 ARPE 控制:若 ARPE 置位,预加载值仅在每次更新事件(UEV)发生时传输至影子寄存器;若 ARPE 清零,预加载值将立即写入影子寄存器。
更新事件(UEV)的触发条件分为硬件触发与软件触发两类,操作生效的前提是 TIMx_CR 寄存器中的更新禁止位 UDIS 为 0,即全部更新功能使能。
硬件触发:计数器工作于向上计数模式,当计数值达到溢出状态时,硬件自动产生更新事件;
软件触发:通过软件置位定时器事件产生寄存器 TIMx_EGR 中的更新产生位 UG 实现,该操作生效的前提是 TIMx_CR 寄存器中的更新请求源位 URS 为 0,即软件更新功能未被屏蔽。
通过置位 TIMx_CR 寄存器中的 UDIS 位,可全局禁止更新事件的产生,避免在向预加载寄存器写入新的重载值时,影子寄存器被同步更新,保证配置写入的稳定性。在 UDIS 位清零之前,任何触发条件均不会产生更新事件。
当更新事件有效发生时,定时器相关寄存器将完成更新,同时自动重载影子寄存器将加载预加载寄存器 TIMx_ARR 中的当前数值,完成重载值的同步更新。
中断事件
中断事件可通过 TIMx_DIER 寄存器配置使能。当 UIE 位为 1 时,若有中断事件发生,会触发系统中断。 硬件溢出和软件触发更新,都会产生中断。对应中断状态可以通过 TIMx_SR 中的 UIF 查看,并可以通过写 UIF 清除对应中断。
安全属性
基本定时器外设并非以单个定时器为单位独立占用外设端口,其端口资源通常由多个定时器共用同一外设端口,对应同一个 PPC 外设权限控制器。由于共用端口的安全属性由 PPC 统一配置,无法实现单个定时器安全属性的独立配置。为支持单个基本定时器安全属性的灵活配置,每个基本定时器均集成专用的安全控制寄存器。 该安全控制寄存器包含安全使能位,用于独立配置对应定时器的安全属性,且仅允许安全域访问,非安全域无法对其执行读写操作。 当定时器安全使能位置位时,该定时器配置为安全定时器,其所有寄存器仅可通过安全地址访问,非安全地址访问被禁止;当安全使能位清零时,该定时器配置为非安全定时器,除安全控制寄存器外,其余所有寄存器均可通过安全地址与非安全地址访问。
寄存器
Base Address:
TIMER0_REG : 0x41017000
TIMER1_REG : 0x41017200
TIMER2_REG : 0x41017400
TIMER3_REG : 0x41017600
TIMER4_REG : 0x41017800
TIMER5_REG : 0x41017A00
TIMER6_REG : 0x41017C00
TIMER7_REG : 0x41017E00
TIMER10_REG : 0x41100400
TIMER11_REG : 0x41100600
Name |
Address offset |
Access |
Description |
|---|---|---|---|
000h |
R/W |
Users can configure and observe the counter operation. |
|
004h |
R/W |
This register is about the update operation. |
|
008h |
R/W |
This is the interrupt enable register. |
|
00Ch |
R/W |
This register is about timer interrupt and update status. |
|
010h |
R/W |
This register is about update generation, and is user defined. |
|
014h |
R |
This is the timer count register. |
|
01Ch |
R/W |
This is the auto-reload value register. |
|
020h |
R/W |
This register is about security status. |
|
024h |
R/W |
REG_TIM_EN
Name: TIM enable register
Size: 32
Address offset: 000h
Read/write access: R/W
Users can configure and observe the counter operation.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:17 |
RSVD |
R |
- |
Reserved |
16 |
CNT_EN |
R |
0x0 |
Counter working status
|
15:9 |
RSVD |
R |
- |
Reserved |
8 |
CNT_RUN |
R |
0x0 |
Counter run status
|
7:2 |
RSVD |
R |
- |
Reserved |
1 |
CNT_STOP |
R/W |
0x0 |
Disable the counter Poll CNT_RUN to see the counter status. If CNT_RUN is 0, it means that the counter has been disabled internally. |
0 |
CNT_START |
R/W |
0x0 |
Enable the counter Poll CNT_RUN to see the counter status. If CNT_RUN is 1, it means that the counter has been enabled internally. |
REG_TIM_CR
Name: TIM control register
Size: 32
Address offset: 004h
Read/write access: R/W
This register is about the update operation.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:5 |
RSVD |
R |
- |
Reserved |
4 |
ARPE |
R/W |
0x0 |
Enable auto-reload preloading
|
3 |
RSVD |
R |
- |
Reserved |
2 |
URS |
R/W |
0x0 |
Update request source
|
1 |
UDIS |
R/W |
0x0 |
Disable UEV Shadow registers keep their values. Otherwise, buffered registers are then loaded with their preload values when UEV happens. |
0 |
RSVD |
R |
- |
Reserved |
REG_TIM_DIER
Name: TIM interrupt enable register
Size: 32
Address offset: 008h
Read/write access: R/W
This is the interrupt enable register.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:1 |
RSVD |
R |
- |
Reserved |
0 |
UIE |
R/W |
0x0 |
Enable update interrupt |
REG_TIM_SR
Name: TIM status register
Size: 32
Address offset: 00Ch
Read/write access: R/W
This register is about timer interrupt and update status.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31 |
UG_DONE |
R |
0x1 |
UG operation status This bit is cleared by hardware when the UG bit in the TIMx_EGR register is set. When the UG operation is done, hardware set this bit to '1'. So, software can poll this bit to see the UG operation status. |
30:1 |
RSVD |
R |
- |
Reserved |
0 |
UIF |
R/W |
0x0 |
Update interrupt flag |
REG_TIM_EGR
Name: TIM event generation register
Size: 32
Address offset: 010h
Read/write access: R/W
This register is about update generation, and is user defined.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:1 |
RSVD |
R |
- |
Reserved |
0 |
UG |
R/W |
0x0 |
Update generation Re-initialize the counter and generate an update of registers. Note that the prescaler counter is cleared too. (anyway the prescaler ratio is not affected) |
REG_TIM_CNT
Name: TIM counter register
Size: 32
Address offset: 014h
Read/write access: R
This is the timer count register.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:0 |
CNT |
R |
0x0 |
Counter value |
REG_TIM_ARR
Name: TIM auto-reload register
Size: 32
Address offset: 01Ch
Read/write access: R/W
This is the auto-reload value register.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:0 |
ARR |
R/W |
0xFFFFFFFF |
The value to be loaded in the actual auto-reload register. It can be preloaded by setting ARPE bit in TIM_CR. |
REG_TIM_SEC
Name: TIM security control register
Size: 32
Address offset: 020h
Read/write access: R/W
This register is about security status.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:1 |
RSVD |
R |
- |
Reserved |
0 |
SEC |
R/W |
0x0 |
Secure timer enable
|
REG_TIM_BASIC_DUMMY
Name: Timer Basic Dummy Register
Size: 32
Address offset: 024h
Read/write access: R/W
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:0 |
DUMMY |
R/W |
ffffh |
Dummy register |
Base Address:
TIMER0_REG : 0x41018000
TIMER1_REG : 0x41018200
TIMER2_REG : 0x41018400
TIMER3_REG : 0x41018600
TIMER4_REG : 0x41018800
TIMER5_REG : 0x41018A00
TIMER6_REG : 0x41018C00
TIMER7_REG : 0x41018E00
TIMER10_REG : 0x41019400
TIMER11_REG : 0x41019600
TIMER12_REG : 0x41019800
TIMER13_REG : 0x41019A00
TIMER14_REG : 0x41019C00
Name |
Address offset |
Access |
Description |
|---|---|---|---|
000h |
R/W |
User can configure and observe the counter operation. |
|
004h |
R/W |
This is the register about update operation. |
|
008h |
R/W |
||
00Ch |
R/W |
This is the register about timer interrupt and update status. |
|
010h |
R/W |
Update generation, user defined |
|
014h |
R |
||
01Ch |
R/W |
||
020h |
R/W |
This is the register about security status. |
|
024h |
R/W |
REG_TIM_EN
Name: TIM enable register
Size: 32
Address offset: 000h
Read/write access: R/W
User can configure and observe the counter operation.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:17 |
RSVD |
R |
- |
Reserved |
16 |
CNT_EN |
R |
0x0 |
Counter working status
|
15:9 |
RSVD |
R |
- |
Reserved |
8 |
CNT_RUN |
R |
0x0 |
Counter run status
|
7:2 |
RSVD |
R |
- |
Reserved |
1 |
CNT_STOP |
R/W |
0x0 |
Disable the counter. Poll CNT_RUN to see the counter status. If CNT_RUN is 0, it means that the counter has been disabled internally. |
0 |
CNT_START |
R/W |
0x0 |
Enable the counter. Poll CNT_RUN to see the counter status. If CNT_RUN is 1, it means that the counter has been enabled internally. |
REG_TIM_CR
Name: TIM control register
Size: 32
Address offset: 004h
Read/write access: R/W
This is the register about update operation.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:5 |
RSVD |
R |
- |
Reserved |
4 |
ARPE |
R/W |
0x0 |
Enable auto-reload preloading
|
3 |
RSVD |
R |
- |
Reserved |
2 |
URS |
R/W |
0x0 |
Update request source
|
1 |
UDIS |
R/W |
0x0 |
Disable UEV Shadow registers keep their values. Otherwise, buffered registers are then loaded with their preload values when UEV happens. |
0 |
RSVD |
R |
- |
Reserved |
REG_TIM_DIER
Name: TIM interupt enable register
Size: 32
Address offset: 008h
Read/write access: R/W
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:1 |
RSVD |
R |
- |
Reserved |
0 |
UIE |
R/W |
0x0 |
Enable update interrupt |
REG_TIM_SR
Name: TIM status register
Size: 32
Address offset: 00Ch
Read/write access: R/W
This is the register about timer interrupt and update status.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31 |
UG_DONE |
R |
0x1 |
UG operation status This bit is cleared by hardware when the UG bit in the TIMx_EGR register is set. When the UG operation is done, hardware sets this bit to '1'. So, software can poll this bit to see the UG operation status. |
30:1 |
RSVD |
R |
- |
Reserved |
0 |
UIF |
R/W |
0x0 |
Update interrupt flag |
REG_TIM_EGR
Name: TIM event generation register
Size: 32
Address offset: 010h
Read/write access: R/W
Update generation, user defined
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:1 |
RSVD |
R |
- |
Reserved |
0 |
UG |
R/W |
0x0 |
Update generation. Re-initialize the counter and generate an update of registers. Note that the prescaler counter is cleared too. (Anyway the prescaler ratio is not affected) |
REG_TIM_CNT
Name: TIM counter register
Size: 32
Address offset: 014h
Read/write access: R
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:0 |
CNT |
R |
0x0 |
Counter value |
REG_TIM_ARR
Name: TIM auto-reload register
Size: 32
Address offset: 01Ch
Read/write access: R/W
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:0 |
ARR |
R/W |
0xFFFFFFFF |
The value to be loaded in the actual auto-reload register. It can be preloaded by setting ARPE bit in TIM_CR. |
REG_TIM_SEC
Name: TIM security control register
Size: 32
Address offset: 020h
Read/write access: R/W
This is the register about security status.
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:1 |
RSVD |
R |
- |
Reserved |
0 |
SEC |
R/W |
0x0 |
Secure timer enable
|
REG_TIM_BASIC_DUMMY
Name: Timer Baisc Dummy Register
Size: 32
Address offset: 024h
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:
TIMER0_REG : 0x4200B000
TIMER1_REG : 0x4200B200
TIMER2_REG : 0x4200B400
TIMER3_REG : 0x4200B600
TIMER4_REG : 0x4200B800
TIMER5_REG : 0x4200BA00
TIMER6_REG : 0x4200BC00
TIMER7_REG : 0x4200BE00
TIMER10_REG : 0x4100A400
TIMER11_REG : 0x4100A600
TIMER12_REG : 0x4100A800
TIMER13_REG : 0x4100AA00
Name |
Address offset |
Access |
Description |
|---|---|---|---|
000h |
R/W |
||
004h |
R/W |
||
008h |
R/W |
||
00Ch |
R/W |
||
010h |
R/W |
||
014h |
R |
||
01Ch |
R/W |
||
020h |
R/W |
REG_TIM_EN
Name: TIM enable register
Size: 32
Address offset: 000h
Read/write access: R/W
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:17 |
RSVD |
R |
- |
Reserved |
16 |
CNT_EN |
R |
0x0 |
Counter working status
|
15:9 |
RSVD |
R |
- |
Reserved |
8 |
CNT_RUN |
R |
0x0 |
Counter run status
|
7:2 |
RSVD |
R |
- |
Reserved |
1 |
CNT_STOP |
R/W |
0x0 |
Disable the counter. Poll cnt_run to see the counter status. If cnt_run is 0, it means that the counter has been disabled internally. |
0 |
CNT_START |
R/W |
0x0 |
Enable the counter. Poll cnt_run to see the counter status. If cnt_run is 1, it means that the counter has been enabled internally. |
REG_TIM_CR
Name: TIM control register
Size: 32
Address offset: 004h
Read/write access: R/W
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:5 |
RSVD |
R |
- |
Reserved |
4 |
ARPE |
R/W |
0x0 |
Enable auto-reload preloading
|
3 |
RSVD |
R |
- |
Reserved |
2 |
URS |
R/W |
0x0 |
Update request source
|
1 |
UDIS |
R/W |
0x0 |
Disable uev. Shadow registers keep their values. Otherwise, buffered registers are then loaded with their preload values when uev happen. |
0 |
RSVD |
R |
- |
Reserved |
REG_TIM_DIER
Name: TIM interupt enable register
Size: 32
Address offset: 008h
Read/write access: R/W
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:1 |
RSVD |
R |
- |
Reserved |
0 |
UIE |
R/W |
0x0 |
Enable update interrupt |
REG_TIM_SR
Name: TIM status register
Size: 32
Address offset: 00Ch
Read/write access: R/W
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31 |
UG_DONE |
R |
0x1 |
Ug operation status.This bit is cleared by hardware when the ug bit in the timx_egr register is set. When the ug operation is done, hardware set this bit to '1'. So, software can poll this bit to see the ug operation status. |
30:1 |
RSVD |
R |
- |
Reserved |
0 |
UIF |
R/W |
0x0 |
Update interrupt flag |
REG_TIM_EGR
Name: TIM event generation register
Size: 32
Address offset: 010h
Read/write access: R/W
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:1 |
RSVD |
R |
- |
Reserved |
0 |
UG |
R/W |
0x0 |
Update generation. Re-initialize the counter and generate an update of registers. Note that the prescaler counter is cleared too.(anyway the prescaler ratio is not affected) |
REG_TIM_CNT
Name: TIM counter
Size: 32
Address offset: 014h
Read/write access: R
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:0 |
CNT |
R |
0x0 |
Counter value |
REG_TIM_ARR
Name: TIM auto-reload register
Size: 32
Address offset: 01Ch
Read/write access: R/W
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:0 |
ARR |
R/W |
0xFFFFFFFF |
The value to be loaded in the actual auto-reload register. It can be preloaded by setting arpe bit in tim_cr. |
REG_TIM_SEC
Name: TIM security control register
Size: 32
Address offset: 020h
Read/write access: R/W
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:1 |
RSVD |
R |
- |
Reserved |
0 |
SEC |
R/W |
0x0 |
Secure timer enable.
|
Base Address:
TIMER0_REG : 0x40819000
TIMER1_REG : 0x40819200
TIMER2_REG : 0x40819400
TIMER3_REG : 0x40819600
Name |
Address offset |
Access |
Description |
|---|---|---|---|
000h |
R/W |
User can configure and observe the counter operation |
|
004h |
R/W |
Registers about the update operation |
|
008h |
R/W |
Interrupt enable |
|
00Ch |
R/W |
Registers about timer interrupt and update status |
|
010h |
R/W |
Update generation user defined |
|
014h |
R |
Timer count |
|
01Ch |
R/W |
Auto-reload value |
|
020h |
R/W |
Security status |
|
024h |
R/W |
Dummy register |
REG_TIM_EN
Name: TIM enable register
Size: 32
Address offset: 000h
Read/write access: R/W
User can configure and observe the counter operation
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:17 |
RSVD |
R |
- |
Reserved |
16 |
CNT_EN |
R |
0x0 |
Counter working status
|
15:9 |
RSVD |
R |
- |
Reserved |
8 |
CNT_RUN |
R |
0x0 |
Counter run status
|
7:2 |
RSVD |
R |
- |
Reserved |
1 |
CNT_STOP |
R/W |
0x0 |
Disable the counter. Poll CNT_RUN to see the counter status. If CNT_RUN is 0, it means that the counter has been disabled internally. |
0 |
CNT_START |
R/W |
0x0 |
Enable the counter. Poll CNT_RUN to see the counter status. If CNT_RUN is 1, it means that the counter has been enabled internally. |
REG_TIM_CR
Name: TIM control register
Size: 32
Address offset: 004h
Read/write access: R/W
Registers about the update operation
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:5 |
RSVD |
R |
- |
Reserved |
4 |
ARPE |
R/W |
0x0 |
Enable auto-reload preloading
|
3 |
RSVD |
R |
- |
Reserved |
2 |
URS |
R/W |
0x0 |
Update request source
|
1 |
UDIS |
R/W |
0x0 |
Disable UEV. Shadow registers keep their values. Otherwise, buffered registers are then loaded with their preload values when UEV happen. |
0 |
RSVD |
R |
- |
Reserved |
REG_TIM_DIER
Name: TIM interupt enable register
Size: 32
Address offset: 008h
Read/write access: R/W
Interrupt enable
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:1 |
RSVD |
R |
- |
Reserved |
0 |
UIE |
R/W |
0x0 |
Enable update interrupt |
REG_TIM_SR
Name: TIM status register
Size: 32
Address offset: 00Ch
Read/write access: R/W
Registers about timer interrupt and update status
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31 |
UG_DONE |
R |
0x1 |
UG operation status This bit is cleared by hardware when the UG bit in the TIMx_EGR register is set. When the UG operation is done, hardware set this bit to '1'. So, software can poll this bit to see the UG operation status. |
30:1 |
RSVD |
R |
- |
Reserved |
0 |
UIF |
R/W |
0x0 |
Update interrupt flag |
REG_TIM_EGR
Name: TIM event generation register
Size: 32
Address offset: 010h
Read/write access: R/W
Update generation user defined
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:1 |
RSVD |
R |
- |
Reserved |
0 |
UG |
R/W |
0x0 |
Update generation. Re-initialize the counter and generate an update of registers. Note that the prescaler counter is cleared too.(anyway the prescaler ratio is not affected) |
REG_TIM_CNT
Name: TIM counter
Size: 32
Address offset: 014h
Read/write access: R
Timer count
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:0 |
CNT |
R |
0x0 |
Counter value |
REG_TIM_ARR
Name: TIM auto-reload register
Size: 32
Address offset: 01Ch
Read/write access: R/W
Auto-reload value
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:0 |
ARR |
R/W |
0xFFFFFFFF |
The value to be loaded in the actual auto-reload register. It can be preloaded by setting ARPE bit in TIM_CR. |
REG_TIM_SEC
Name: TIM security control register
Size: 32
Address offset: 020h
Read/write access: R/W
Security status
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:1 |
RSVD |
R |
- |
Reserved |
0 |
SEC |
R/W |
0x0 |
Secure timer enable.
|
REG_TIM_BASIC_DUMMY
Name: Timer Baisc Dummy Register
Size: 32
Address offset: 024h
Read/write access: R/W
Dummy register
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:0 |
DUMMY |
R/W |
ffffh |
Dummy register |
Base Address:
TIMER0_REG : 0x40808000
TIMER1_REG : 0x40808200
TIMER2_REG : 0x40808400
TIMER3_REG : 0x40808600
Name |
Address offset |
Access |
Description |
|---|---|---|---|
000h |
R/W |
User can configure and observe the counter operation |
|
004h |
R/W |
Registers about the update operation |
|
008h |
R/W |
Interrupt enable |
|
00Ch |
R/W |
Registers about timer interrupt and update status |
|
010h |
R/W |
Update generation user defined |
|
014h |
R |
Timer count |
|
01Ch |
R/W |
Auto-reload value |
|
020h |
R/W |
Security status |
|
024h |
R/W |
Dummy register |
REG_TIM_EN
Name: TIM enable register
Size: 32
Address offset: 000h
Read/write access: R/W
User can configure and observe the counter operation
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:17 |
RSVD |
R |
- |
Reserved |
16 |
CNT_EN |
R |
0x0 |
Counter working status
|
15:9 |
RSVD |
R |
- |
Reserved |
8 |
CNT_RUN |
R |
0x0 |
Counter run status
|
7:2 |
RSVD |
R |
- |
Reserved |
1 |
CNT_STOP |
R/W |
0x0 |
Disable the counter. Poll CNT_RUN to see the counter status. If CNT_RUN is 0, it means that the counter has been disabled internally. |
0 |
CNT_START |
R/W |
0x0 |
Enable the counter. Poll CNT_RUN to see the counter status. If CNT_RUN is 1, it means that the counter has been enabled internally. |
REG_TIM_CR
Name: TIM control register
Size: 32
Address offset: 004h
Read/write access: R/W
Registers about the update operation
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:5 |
RSVD |
R |
- |
Reserved |
4 |
ARPE |
R/W |
0x0 |
Enable auto-reload preloading
|
3 |
RSVD |
R |
- |
Reserved |
2 |
URS |
R/W |
0x0 |
Update request source
|
1 |
UDIS |
R/W |
0x0 |
Disable UEV. Shadow registers keep their values. Otherwise, buffered registers are then loaded with their preload values when UEV happen. |
0 |
RSVD |
R |
- |
Reserved |
REG_TIM_DIER
Name: TIM interupt enable register
Size: 32
Address offset: 008h
Read/write access: R/W
Interrupt enable
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:1 |
RSVD |
R |
- |
Reserved |
0 |
UIE |
R/W |
0x0 |
Enable update interrupt |
REG_TIM_SR
Name: TIM status register
Size: 32
Address offset: 00Ch
Read/write access: R/W
Registers about timer interrupt and update status
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31 |
UG_DONE |
R |
0x1 |
UG operation status This bit is cleared by hardware when the UG bit in the TIMx_EGR register is set. When the UG operation is done, hardware set this bit to '1'. So, software can poll this bit to see the UG operation status. |
30:1 |
RSVD |
R |
- |
Reserved |
0 |
UIF |
R/W |
0x0 |
Update interrupt flag |
REG_TIM_EGR
Name: TIM event generation register
Size: 32
Address offset: 010h
Read/write access: R/W
Update generation user defined
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:1 |
RSVD |
R |
- |
Reserved |
0 |
UG |
R/W |
0x0 |
Update generation. Re-initialize the counter and generate an update of registers. Note that the prescaler counter is cleared too.(anyway the prescaler ratio is not affected) |
REG_TIM_CNT
Name: TIM counter
Size: 32
Address offset: 014h
Read/write access: R
Timer count
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:0 |
CNT |
R |
0x0 |
Counter value |
REG_TIM_ARR
Name: TIM auto-reload register
Size: 32
Address offset: 01Ch
Read/write access: R/W
Auto-reload value
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:0 |
ARR |
R/W |
0xFFFFFFFF |
The value to be loaded in the actual auto-reload register. It can be preloaded by setting ARPE bit in TIM_CR. |
REG_TIM_SEC
Name: TIM security control register
Size: 32
Address offset: 020h
Read/write access: R/W
Security status
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:1 |
RSVD |
R |
- |
Reserved |
0 |
SEC |
R/W |
0x0 |
Secure timer enable.
|
REG_TIM_BASIC_DUMMY
Name: Timer Baisc Dummy Register
Size: 32
Address offset: 024h
Read/write access: R/W
Dummy register
Bit |
Symbol |
Access |
INI |
Description |
|---|---|---|---|---|
31:8 |
RSVD |
R |
- |
Reserved |
7:0 |
DUMMY |
R/W |
8'hf0 |
Dummy register |