TMS320F280039C: 关于PWM CMPA的问题

Part Number: TMS320F280039C

你好,我在配置PWM时发现一个问题,模式是UP_DOWN,只用了CMPA确定上升沿及下降沿,我需要在占空比0-95%之间都需要开启PWM,目前使用示波器观测发现当占空比为0%的时候没有发波的我想问一下原因,及如何更改可以在占空比为0时也可以发波

EPWM_setPeriodLoadMode(base1, EPWM_PERIOD_SHADOW_LOAD);
EPWM_setTimeBasePeriod(base1, 750);
EPWM_setTimeBaseCounter(base1, 0);
EPWM_setPhaseShift(base1, 0);
EPWM_setTimeBaseCounterMode(base1, EPWM_COUNTER_MODE_UP_DOWN);
EPWM_setClockPrescaler(base1, EPWM_CLOCK_DIVIDER_1, EPWM_HSCLOCK_DIVIDER_1);

//
// Counter Compare Submodule Registers
//
EPWM_setCounterCompareValue(base1, EPWM_COUNTER_COMPARE_A,
375);
// EPWM_setCounterCompareValue(base1, EPWM_COUNTER_COMPARE_B,
// 188);

EPWM_setCounterCompareShadowLoadMode(base1, EPWM_COUNTER_COMPARE_A,
EPWM_COMP_LOAD_ON_CNTR_ZERO);
// EPWM_setCounterCompareShadowLoadMode(base1, EPWM_COUNTER_COMPARE_B,
// EPWM_COMP_LOAD_ON_CNTR_ZERO);

//
// to start don't configure the PWM to do anything
//
HWREGH(base1 + EPWM_O_AQCTLA) = 0;

//****PWMA ACTR output
//
// CTR = ZERO , set to 0
//
EPWM_setActionQualifierAction(base1, EPWM_AQ_OUTPUT_B ,
EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
//
// CTR = PRD , set to 1
//
EPWM_setActionQualifierAction(base1, EPWM_AQ_OUTPUT_B ,
EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
//
// CTR = PRD , set to 1
//
EPWM_setActionQualifierAction(base1, EPWM_AQ_OUTPUT_B ,
EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD);
//
// CTR = ZERO , set to 0
//
EPWM_setActionQualifierAction(base1, EPWM_AQ_OUTPUT_B ,
EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA);

  • 当占空比为0%时,PWM输出不就应该是全低电平吗?

    看你的配置,你产生的波形应该是这样的:

    随着CMPA值的变化,duty跟着变化,CMPA接近0时占空比最大,CMPA=750时,占空比为0,PWM输出就全为低电平了。