SDAA032 July   2025 TDA4VE-Q1

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction
  5. 2Understanding PWM Operation on TDA4x
    1. 2.1 PWM Architecture Overview
    2. 2.2 Counter-Compare Register and Duty Cycle Control
    3. 2.3 Action Qualifier and Output Behavior
    4. 2.4 Synchronization and Update Timing
  6. 3Unintended PWM Duty Cycle from Immediate CMPA Update
  7. 4Unintended PWM Duty Cycle from Up-Down Count Mode
  8. 5Best Practice for Seamless PWM Updates for LED Dimming Control
    1. 5.1 Use Shadow Registers for Duty Cycle Updates
    2. 5.2 Select the Appropriate Counter Mode
    3. 5.3 Register Configurations for Up-count Mode Under Shadowing
  9. 6Summary
  10. 7References

Register Configurations for Up-count Mode Under Shadowing

The following registers configuration can be used to generate 20% of PWM duty cycle in up count mode.

EPWM_TBPRD = 62500
EPWM_TBCTL.CTRMODE = 0 → Up count mode
EPWM_TBCTL.CLKDIV = 1
EPWM_CMPA = 12500 (= 62500 x 20%)
EPWM_CMPCTL.SHDWAMODE = 0 → Shadow mode
EPWM_CMPCTL.LOADAMODE = 0 → Load on TBCNT = 0 when shadow mode is enabled.
EPWM_AQCTLA.CAU = 0x3 → Toggle EPWM output
EPWM_AQCTLA.ZRO = 0x2 → Force EPWM output HIGH

Then, there can be no unintended PWM duty cycle regardless the instance of writing a value into CMPA. Figure 5-1 is PWM signal probed when changing PWM duty cycle from 20% to 80%.

 Probe PWM Changes With Shadow Mode in Up Count ModeFigure 5-1 Probe PWM Changes With Shadow Mode in Up Count Mode
 Analyze PWM Duty Cycle Change with Shadow Mode in Up Count ModeFigure 5-2 Analyze PWM Duty Cycle Change with Shadow Mode in Up Count Mode

This can be analyzed as in the following.

  • Current duty cycle is 20%.
    Equation 9. Duty = 100 × 1250012500 + 50000 = 20%
  • Software writes 50000 into CMPA register in between ① and ②
  • CMPA register is shadowed and is updated at TBCNT = 0.
  • PWM toggles at the instance of ② when TBCNT = 0 and this makes duty cycle 80%.
    Equation 10. Duty = 100 × 5000050000 + 12500 = 80% 
  • For the following PWM periods, PWM duty cycle stays at 80%.

This is just an example to show how to control PWM duty cycle especially for LED dimming without unintended brightness.