
M0A21/M0A23 Series
May 06, 2022
Page
348
of 746
Rev 1.02
M0
A21
/M
0
A
2
3
SE
RIES
TEC
H
NICAL
RE
FEREN
C
E
M
ANUAL
Figure 6.10-12 PWM Double Buffering Illustration
6.10.5.8 Period Loading Mode
When immediately loading mode and center loading mode are disabled that IMMLDENn
(PWM_CTL0[21:16]) and CTRLDn (PWM_CTL0[5:0]) are set to 0, PWM operates at period Loading
mode. In period Loading mode, PERIOD(PWM_PERIODn[15:0]) and CMP(PWM_CMPDATn[15:0]) will
all load to their active PBUF and CMPBUF registers while each period is completed. For example, after
PWM counter up counts from zero to PERIOD in the up-counter operation or down counts from PERIOD
to zero in the down-counter operation or counts up from 0 to PERIOD and then counts down to 0 in the
up-down counter operation.
Figure 6.10-13 shows period loading timing of up-count operation, where PERIOD DATA0 denotes the
initial data of PERIOD, PERIOD DATA1 denotes the first updated PERIOD data by software and so on.
CMPDAT also follows this rule. The following describes steps sequence of Figure 6.10-13. User can
know the PERIOD and CMPDAT update condition, by watching PWM period and CMPU event.
1. Software writes CMPDAT DATA1 to CMPDAT at point 1.
2. Hardware loads CMPDAT DATA1 to CMPBUF at the end of PWM period at point 2.
3. Software writes PERIOD DATA1 to PERIOD at point 3.
4. Hardware loads PERIOD DATA1 to PBUF at the end of PWM period at point 4.
5. Software writes PERIOD DATA2 to PERIOD at point 5.
6. Hardware loads PERIOD DATA2 to PBUF at the end of PWM period at point 6.
CMPDAT DATA0
CMPU
CMPDAT DATA1
PERIOD DATA0
PERIOD DATA1
PERIOD DATA2
CNT
Write
Load
Note:
CMPDAT
PERIOD
PERIOD DATA0
PERIOD DATA1
CMPDAT DATA1
PBUF
PERIOD DATA0
PERIOD DATA1
CMPBUF
CMPDAT DATA1
PERIOD DATA2
PERIOD DATA2
point 1
point 2
point 3 point 4
point 5
point 6
Figure 6.10-13 Period Loading in Up-Count Mode
6.10.5.9 Immediately Loading Mode
If the IMMLDENn (PWM_CTL0[21:16]) bit is set to 1, PWM operates at immediately loading mode. In
immediately loading mode, when user update PERIOD (PWM_PERIODn[15:0]) or CMP
(PWM_CMPDATn[15:0]), PERIOD or CMPDAT will be load to active PBUF (PWM_PBUFn[15:0]) or
CMPBUF (PWM_CMPBUFn[15:0]) after current counter count is completed. If the updated PERIOD
value is less than current counter value, counter will count to 0xFFFF. When counter counts to 0xFFFF
and prescale also counts to 0, the flag CNTMAXF(PWMx_STATUS[5:0]) will raise. And then counter
will count wraparound. Immediately loading mode has the highest priority. If IMMLDENn has been set,