寄存器

请查看 寄存器访问类型 ,了解 Access 列缩写的含义。

RTL8721Dx:

Base Address: 0x41100000

Name

Address offset

Access

Description

REG_TIM_EN

000h

varies

Users can configure and observe the counter operation.

REG_TIM_CR

004h

varies

This is the register about the update operation and the work mode configuration.

REG_TIM_DIER

008h

varies

This is the interrupt Enable register.

REG_TIM_SR

00Ch

varies

This is the register about timer interrupt and update status.

REG_TIM_EGR

010h

varies

This is the register about update generation, and is user-defined.

REG_TIM_CNT

014h

varies

This is the register about timer count.

REG_TIM_PSC

018h

varies

This is the register about prescaler value.

REG_TIM_ARR

01Ch

varies

This is the register about auto-reload value.

REG_RSVD

020h

This is a security register for TIM 0~7.

REG_TIM_CCR0

024h

varies

Refer to register 24h

REG_TIM_CCR1

028h

varies

Refer to register 24h

REG_TIM_CCR2

02Ch

varies

Refer to register 24h

REG_TIM_CCR3

030h

varies

Refer to register 24h

REG_TIM_CCR4

034h

varies

Refer to register 24h

REG_TIM_CCR5

038h

varies

Refer to register 24h

REG_TIM_CCR6

03Ch

varies

Refer to register 24h

REG_TIM_CCR7

040h

varies

Refer to register 24h

REG_TIM_PSYNC0

044h

varies

Refer to register 44h

REG_TIM_PSYNC1

048h

varies

Refer to register 44h

REG_TIM_PSYNC2

04Ch

varies

Refer to register 44h

REG_TIM_PSYNC3

050h

varies

Refer to register 44h

REG_TIM_PSYNC4

054h

varies

Refer to register 44h

REG_TIM_PSYNC5

058h

varies

Refer to register 44h

REG_TIM_PSYNC6

05Ch

varies

Refer to register 44h

REG_TIM_PSYNC7

060h

varies

Refer to register 44h

REG_TIM_PHASECNT0

064h

varies

Refer to register 64h

REG_TIM_PHASECNT1

068h

varies

Refer to register 64h

REG_TIM_PHASECNT2

06Ch

varies

Refer to register 64h

REG_TIM_PHASECNT3

070h

varies

Refer to register 64h

REG_TIM_PHASECNT4

074h

varies

Refer to register 64h

REG_TIM_PHASECNT5

078h

varies

Refer to register 64h

REG_TIM_PHASECNT6

07Ch

varies

Refer to register 64h

REG_TIM_PHASECNT7

080h

varies

Refer to register 64h

REG_TIM_PWM_DUMMY

084h

R/W

REG_TIM_EN

  • Name: TIM enable register

  • Size: 32

  • Address offset: 000h

  • Read/write access: varies

Users can configure and observe the counter operation.

31:17 RSVD 16 CNT_EN 15:9 RSVD 8 CEN 7:2 RSVD 1 CNT_STOP 0 CNT_START

Bit

Symbol

Access

INI

Description

31:17

RSVD

-

Reserved

16

CNT_EN

R

0x0

Counter working status

  • 0: Counter is stopped

  • 1: Counter is working

15:9

RSVD

-

Reserved

8

CEN

R

0x0

Counter run status

  • 0: Counter is disabled

  • 1: Counter is enabled

7:2

RSVD

-

Reserved

1

CNT_STOP

WA0

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

WA0

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: varies

This is the register about the update operation and the work mode configuration.

31:10 RSVD 9:8 ETP 7:5 RSVD 4 ARPE 3 OPM 2 URS 1 UDIS 0 RSVD

Bit

Symbol

Access

INI

Description

31:10

RSVD

-

Reserved

9:8

ETP

R/W

0x0

External trigger polarity (TRGI)

  • 0: Positive edge is active

  • 1: Negative edge is active

  • 2 or 3: Both edge is active

备注

These bits are only valid in one-pulse mode.

7:5

RSVD

-

Reserved

4

ARPE

R/W

0x0

Enable auto-reload preloading

  • 0: TIM_ARR register is not buffered

  • 1: TIM_ARR register is buffered

3

OPM

R/W

0x0

One-pulse mode

  • 0: Counter is not stopped at UEV

  • 1: Counter stops counting at next UEV

2

URS

R/W

0x0

Update request source

  • 0: Counter overflow and setting the UG bit

  • 1: Counter overflow

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

-

Reserved

REG_TIM_DIER

  • Name: TIM interrupt enable register

  • Size: 32

  • Address offset: 008h

  • Read/write access: varies

This is the interrupt Enable register.

31:24 RSVD 23 UIE7 22 UIE6 21 UIE5 20 UIE4 19 UIE3 18 UIE2 17 UIE1 16 UIE0 15:9 RSVD 8 CC7IE 7 CC6IE 6 CC5IE 5 CC4IE 4 CC3IE 3 CC2IE 2 CC1IE 1 CC0IE 0 UIE

Bit

Symbol

Access

INI

Description

31:24

RSVD

-

Reserved

23

UIE7

R/W

0x0

Enable channel 7 update interrupt

22

UIE6

R/W

0x0

Enable channel 6 update interrupt

21

UIE5

R/W

0x0

Enable channel 5 update interrupt

20

UIE4

R/W

0x0

Enable channel 4 update interrupt

19

UIE3

R/W

0x0

Enable channel 3 update interrupt

18

UIE2

R/W

0x0

Enable channel 2 update interrupt

17

UIE1

R/W

0x0

Enable channel 1 update interrupt

16

UIE0

R/W

0x0

Enable channel 0 update interrupt

15:9

RSVD

-

Reserved

8

CC7IE

R/W

0x0

Enable Capture/Compare 7 interrupt

7

CC6IE

R/W

0x0

Enable Capture/Compare 6 interrupt

6

CC5IE

R/W

0x0

Enable Capture/Compare 5 interrupt

5

CC4IE

R/W

0x0

Enable Capture/Compare 4 interrupt

4

CC3IE

R/W

0x0

Enable Capture/Compare 3 interrupt

3

CC2IE

R/W

0x0

Enable Capture/Compare 2 interrupt

2

CC1IE

R/W

0x0

Enable Capture/Compare 1 interrupt

1

CC0IE

R/W

0x0

Enable Capture/Compare 0 interrupt

0

UIE

R/W

0x0

Enable counter update interrupt

REG_TIM_SR

  • Name: TIM status register

  • Size: 32

  • Address offset: 00Ch

  • Read/write access: varies

This is the register about timer interrupt and update status.

31 UG_DONE 30:24 RSVD 23 UIF7 22 UIF6 21 UIF5 20 UIF4 19 UIF3 18 UIF2 17 UIF1 16 UIF0 15:9 RSVD 8 CC7IF 7 CC6IF 6 CC5IF 5 CC4IF 4 CC3IF 3 CC2IF 2 CC1IF 1 CC0IF 0 UIF

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:24

RSVD

-

Reserved

23

UIF7

RW1C

0x0

Refer to UIF0 description

22

UIF6

RW1C

0x0

Refer to UIF0 description

21

UIF5

RW1C

0x0

Refer to UIF0 description

20

UIF4

RW1C

0x0

Refer to UIF0 description

19

UIF3

RW1C

0x0

Refer to UIF0 description

18

UIF2

RW1C

0x0

Refer to UIF0 description

17

UIF1

RW1C

0x0

Refer to UIF0 description

16

UIF0

RW1C

0x0

Update interrupt flag of channel 0

This flag is set by hardware when the UIE0 bit in the TIMx_EGR register is set, and update interrupt of channel 0 happens.

15:9

RSVD

-

Reserved

8

CC7IF

RW1C

0x0

Refer to CC0IF description

7

CC6IF

RW1C

0x0

Refer to CC0IF description

6

CC5IF

RW1C

0x0

Refer to CC0IF description

5

CC4IF

RW1C

0x0

Refer to CC0IF description

4

CC3IF

RW1C

0x0

Refer to CC0IF description

3

CC2IF

RW1C

0x0

Refer to CC0IF description

2

CC1IF

RW1C

0x0

Refer to CC0IF description

1

CC0IF

RW1C

0x0

Capture/Compare 0 interrupt flag

Channel CC0 configured as output: This flag is set by hardware when the counter TIM_CNT value matches the value of TIM_CCR0 register. It is cleared by software.

Channel CC0 configured as input: This flag is set by hardware and the counter value has been captured in CCR0 field of TIM_CCR0 register when an active edge has been detected. It is cleared by software.

0

UIF

RW1C

0x0

Update interrupt flag

REG_TIM_EGR

  • Name: TIM event generation register

  • Size: 32

  • Address offset: 010h

  • Read/write access: varies

This is the register about update generation, and is user-defined.

31:9 RSVD 8 CC7G 7 CC6G 6 CC5G 5 CC4G 4 CC3G 3 CC2G 2 CC1G 1 CC0G 0 UG

Bit

Symbol

Access

INI

Description

31:9

RSVD

-

Reserved

8

CC7G

WA0

0x0

Refer to CC0G description

7

CC6G

WA0

0x0

Refer to CC0G description

6

CC5G

WA0

0x0

Refer to CC0G description

5

CC4G

WA0

0x0

Refer to CC0G description

4

CC3G

WA0

0x0

Refer to CC0G description

3

CC2G

WA0

0x0

Refer to CC0G description

2

CC1G

WA0

0x0

Refer to CC0G description

1

CC0G

WA0

0x0

Capture/Compare 0 generation

This bit is set by software and is automatically cleared by hardware.

Channel CC0 configured as output: The CC0IF flag is set, the corresponding interrupt or request is sent if enabled.

Channel CC0 configured as input: The current value of counter is capture in CCR0 field of TIM_CCR0 register. The CC0IF flag is set, the corresponding interrupt or request is sent if enabled.

0

UG

WA0

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: varies

This is the register about timer count.

31:16 RSVD 15:0 CNT

Bit

Symbol

Access

INI

Description

31:16

RSVD

-

Reserved

15:0

CNT

R

0x0

Counter value

REG_TIM_PSC

  • Name: TIM prescaler register

  • Size: 32

  • Address offset: 018h

  • Read/write access: varies

This is the register about prescaler value.

31:16 RSVD 15:0 PSC

Bit

Symbol

Access

INI

Description

31:16

RSVD

-

Reserved

15:0

PSC

R/W

0x0

Prescaler value

PSC contains the value to be loaded in the actual prescaler register at each UEV (including when the counter is cleared through UG bit of TIM_EGR register).

REG_TIM_ARR

  • Name: TIM auto-reload register

  • Size: 32

  • Address offset: 01Ch

  • Read/write access: varies

This is the register about auto-reload value.

31:16 RSVD 15:0 ARR

Bit

Symbol

Access

INI

Description

31:16

RSVD

-

Reserved

15:0

ARR

R/W

0xFFFF

The value to be loaded in the actual auto-reload register. It can be preloaded by setting ARPE bit in the TIM_CR register.

REG_RSVD

  • Name: Reserved register

  • Size: 32

  • Address offset: 020h

  • Read/write access: -

This is a security register for TIM 0~7.

31:0 RSVD

Bit

Symbol

Access

INI

Description

31:0

RSVD

-

Reserved

REG_TIM_CCRx

  • Name: TIM Capture/Compare register x

  • Size: 32

  • Address offset: 024h + 04h * x (x=0, 1, 2, 3, 4, 5, 6, 7)

  • Read/write access: varies

This is the register about the configuration of input capture and output compare work mode.

31:30 RSVD 29 OPM_DLx 28 RSVD 27 CCxM 26 CCxP 25 OCxPE 24 CCxE 23:16 RSVD 15:0 CCRx

Bit

Symbol

Access

INI

Description

31:30

RSVD

-

Reserved

29

OPM_DLx

R/W

0x0

One-pulse mode default level

  • 0: Default level is 0

  • 1: Default level is 1

This bit takes effect only in PWM output one-pulse mode.

28

RSVD

-

Reserved

27

CCxM

R/W

0x0

CCx working mode

  • 0: PWM mode

  • 1: Input capture mode

26

CCxP

R/W

0x0

CCx channel configured as output:

  • 0: OCx active high

  • 1: OCx active low

CCx channel configured as input:

  • 0: Positive edge of TRGI is active for capture

  • 1: Negative edge of TRGI is active for capture

25

OCxPE

R/W

0x0

Enable output capture x preload

  • 0: Disable preload register on CCRx. CCRx can be written at any time, the new value is taken into account immediately.

  • 1: Enable preload register on CCRx. Read/Write operations access the preload register. CCRx preload value is loaded in the active register at each UEV.

24

CCxE

R/W

0x0

Enable CCx

23:16

RSVD

-

Reserved

15:0

CCRx

R/W/ES

0x0

Capture/Compare x value

CCx channel configured as output: CCRx is the value to be loaded in the actual capture/compare x register (preload value). It is loaded permanently if the preload feature is not selected in the OCxPE bit. Else the preload value is copied in the active capture/compare x register when an UEV occurs. The active capture/compare x register contains the value to be compared to the counter TIM_CNT and signalled on OCx output.

CCx channel configured as pulse mode 1: CCRx is the counter value transferred by the last input capture event (TRGI)

REG_TIM_PSYNCx

  • Name: TIM Phase Synchronization register x

  • Size: 32

  • Address offset: 044h + 04h * x (x=0, 1, 2, 3, 4, 5, 6, 7)

  • Read/write access: varies

This is the register about the configuration of phase deviation for PWM output.

31:28 RSVD 27 SYNCENx 26 SYNCDIRx 25 SYNCPEx 24:16 RSVD 15:0 SYNCPHASEx

Bit

Symbol

Access

INI

Description

31:28

RSVD

-

Reserved

27

SYNCENx

R/W

0x0

Enable phase sync function in channel x. Phase sync takes effect only in output PWM mode.

26

SYNCDIRx

R/W

0x0

Phase sync direction to the reference counter

  • 0: Delay to the reference counter

  • 1: Ahead to the reference counter

25

SYNCPEx

R/W

0x0

Enable sync phase parameter preload

  • 0: Disable preload register on PSYNCx. PSYNCx can be written at any time, the new value is taken into account immediately.

  • 1: Enable preload register on PSYNCx. Read/Write operations access the preload register. PSYNCx preload value is loaded in the active

Register at each UEV.

24:16

RSVD

-

Reserved

15:0

SYNCPHASEx

R/W

0x0

The deviation value of channel x to the reference counter

REG_TIM_PHASECNTx

  • Name: TIM phase counter register x

  • Size: 32

  • Address offset: 064h + 04h * x (x=0, 1, 2, 3, 4, 5, 6, 7)

  • Read/write access: varies

This is the register about phase counter.

31:16 RSVD 15:0 CNTx

Bit

Symbol

Access

INI

Description

31:16

RSVD

-

Reserved

15:0

CNTx

R

0x0

Phase counter value of channel x

REG_TIM_PWM_DUMMY

  • Name: Timer PWM Dummy Register

  • Size: 32

  • Address offset: 084h

  • Read/write access: R/W

31:0 DUMMY

Bit

Symbol

Access

INI

Description

31:0

DUMMY

R/W

ffffh

Dummy register