SDAA032 July 2025 TDA4VE-Q1
In LED dimming applications using PWM, maintaining intended brightness transitions is important. However, when using the up-down count mode to generate PWM, the PWM is center aligned and this causes unintended duty cycle, consequently unintended brightness flicker or glitches can appear during duty cycle changes. Let's try to understand and analyze how this issue can happen with up-down count mode by changing the duty cycle from 20% to 80%, and also applying shadowing register update as well.
Up-down count mode uses two events from Action Qualifier (AQ) module. PWM signal can toggle when TBCNT = CMPA but this event occurs two times in one PWM period, at up-counting and at down-counting.
The following registers configuration can be used to generate 20% of PWM duty cycle in up-down count mode.
EPWM_TBPRD = 62500
EPWM_TBCTL.CTRMODE = 0x2 → Up-down count mode
EPWM_CMPA = 12500 (= 62500 x 20%)
EPWM_CMPCTL.SHDWAMODE = 0 → Shadow modeMake 80% of PWM duty cycle by updating CMPA register as shown in the following.
EPWM_CMPA = 50000 (= 62500 x 80%)Figure 4-1 is a PWM waveform probed by logic analyzer.
Figure 4-1 Probe PWM Changes During Updating CMPA Register in Up-Down Count ModeThe expectations is that duty cycle comes from 20% to 80% directly but there is 71% duty which is not intended.
Figure 4-2 Analyze PWM Duty Cycle Change From 20% to 80% in Up-Down Count ModeThis is analyzed as in the following.
In Figure 4-2, PWM duty cycle is being changed by updating CMPA register value, and CMPA register value is updated using shadowing technique accordingly. This means that CMPA register value is updated deterministically, and this happens at the event of TBCNT is zero.
Even though shadow mode is used, PWM duty cycle is transitioning from 20%, 25% and then 80%. This is inevitable and is the nature of center-aligned PWM generation and this can cause unintended result such as LED flicker in LED dimming control application.