GD32F10x User Manual
335
And the DMA request will be assert, if CxCDE=1.
So the process can be divided to several steps as below:
Step1:
Clock configuration. Such as clock source, clock prescaler and so on.
Step2:
Compare mode configuration.
* Set the shadow enable mode by CHxCOMSEN
* Set the output mode (Set/Clear/Toggle) by CHxCOMCTL.
* Select the active high polarity by CHxP
* Enable the output by CHxEN
Step3:
Interrupt/DMA-request enables configuration by CHxIE/CxCDE
Step4:
Compare output timing configuration by TIMERx_CAR and TIMERx_CHxCV.
About the CHxVAL, you can change it on the go to meet the waveform you expected.
Step5:
Start the counter by CEN.
Figure 15-41. Output-compare in three modes
toggle/set/clear. CAR=0x63, CHxVAL=0x3
Figure 15-41. Output-compare in three modes
CEN
CNT_REG
00
01
02
03
04
05
.
62
63
Overflow
match toggle
CNT_CLK
OxCPRE
00
01
02
03
04
05
.
62
63
01
02
03
04
05
.
00
match set
match clear
OxCPRE
OxCPRE
Output PWM function
In the output PWM function (by setting the CHxCOMCTL
bits to 3’b110 (PWM mode0) or to
3’b 111(PWM mode1), the channel can outputs PWM waveform according to the
TIMERx_CAR registers and TIMERx_CHxCV registers.
Based on the counter mode, we have can also divide PWM into EAPWM (Edge aligned PWM)
Summary of Contents for GD32F10 Series
Page 63: ...GD32F10x User Manual 63 programmed during the chip production ...
Page 117: ...GD32F10x User Manual 117 010 1 0 011 0 9 ...
Page 416: ...GD32F10x User Manual 416 shadow register updates every update event ...
Page 427: ...GD32F10x User Manual 427 value ...
Page 518: ...GD32F10x User Manual 518 These bits are not used in SPI mode ...