请教一下,每次的pwm波形输出有延时。蓝色的为切换相,黄色的为pwm波,不知道问题出在哪里?

请教一下,每次的pwm波形输出有延时。蓝色的为切换相,黄色的为pwm波,不知道问题出在哪里?

此问题尚无答案
All Replies
  • 秀才50分

    #define BLDCPWM_UCMP_MACRO(ch1,ch2,ch3,v) /* */\
    /* Convert "Period" (Q15) modulation function to Q0 */\
    Tmp = (int32)v.PeriodMax*(int32)v.MfuncPeriod; /* Q15 = Q0xQ15 */\
    Period = (int16)(Tmp>>15); /* Q15 -> Q0 (Period) */\
    /* */\
    /* Check PwmActive setting */\
    if (v.PwmActive==1) /* PWM active high */\
    GPR0_BLDC_PWM = 0x7FFF - v.DutyFunc; /* */\
    /* */\
    else if (v.PwmActive==0) /* PWM active low */\
    GPR0_BLDC_PWM = v.DutyFunc; /* */\
    /* */\
    /* Convert "DutyFunc" or "GPR0_BLDC_PWM" (Q15) duty modulation function to Q0 */\
    Tmp = (int32)Period*(int32)GPR0_BLDC_PWM; /* Q15 = Q0xQ15 */\

    if (v.CmtnPointer==0) /* */ \
    { /* */\

    /* (*ePWM[ch1]).AQCSFRC.bit.CSFA = 2; */\
    (*ePWM[ch1]).AQCSFRC.bit.CSFA = 0; /* Forcing disabledd on output A of EPWM1 */\
    (*ePWM[ch1]).AQCTLA.bit.CAU = 1; /* Set high when CTR = CMPA on UP-count */\
    (*ePWM[ch1]).AQCTLA.bit.CAD = 2; /* Set low when CTR = Zero */\
    (*ePWM[ch1]).CMPA.half.CMPA = (int16)(Tmp1);/* PWM signal on output A of EPWM1 (Q15 -> Q0) */\
    (*ePWM[ch1]).AQCSFRC.bit.CSFB = 2; /* Forcing a continuous High on output B of EPWM1 */\
    \
    (*ePWM[ch2]).AQCSFRC.bit.CSFA = 2; /* Forcing a continuous High on output A of EPWM2 */\
    (*ePWM[ch2]).AQCSFRC.bit.CSFB = 1; /* Forcing a continuous Low on output A of EPWM2 */\
    \
    (*ePWM[ch3]).AQCSFRC.bit.CSFA = 2; /* Forcing a continuous High on output A of EPWM3 */\
    (*ePWM[ch3]).AQCSFRC.bit.CSFB = 2; /* Forcing a continuous LHighow on output B of EPWM3 */\
    } /* */\
    /* */\
    /* State s2: current flows to motor windings from phase A->C, de-energized phase = B */\
    else if (v.CmtnPointer==1) /* */\
    { /* */\

    /* (*ePWM[ch1]).AQCSFRC.bit.CSFA = 2; */\
    (*ePWM[ch1]).AQCSFRC.bit.CSFA = 0; /* Forcing disabledd on output A of EPWM1 */\
    (*ePWM[ch1]).AQCTLA.bit.CAU = 1; /* Set high when CTR = CMPA on UP-count */\
    (*ePWM[ch1]).AQCTLA.bit.CAD = 2; /* Set low when CTR = Zero */\
    (*ePWM[ch1]).CMPA.half.CMPA = (int16)(Tmp1); /* PWM signal on output A of EPWM1 (Q15 -> Q0) */\
    (*ePWM[ch1]).AQCSFRC.bit.CSFB = 2; /* Forcing a continuous Low on output B of EPWM1 */\
    /* */\
    (*ePWM[ch2]).AQCSFRC.bit.CSFA = 2; /* Forcing a continuous High on output A of EPWM2 */\
    (*ePWM[ch2]).AQCSFRC.bit.CSFB = 2; /* Forcing a continuous High on output B of EPWM2 */\
    /* */\
    (*ePWM[ch3]).AQCSFRC.bit.CSFA = 2; /* Forcing a continuous High on output A of EPWM3 */\
    (*ePWM[ch3]).AQCSFRC.bit.CSFB = 1; /* Forcing a continuous Low on output B of EPWM3 */\
    } /* */\
    /* */\
    /* State s3: current flows to motor windings from phase B->C, de-energized phase = A */\
    else if (v.CmtnPointer==2) /* */\
    { /* */\

    /* (*ePWM[ch2]).AQCSFRC.bit.CSFA = 2;*/\
    (*ePWM[ch2]).DBCTL.all = BLDCPWM_DBCTL_INIT_STATE; /* */ \
    (*ePWM[ch2]).AQCSFRC.bit.CSFA = 0; /* Forcing disabled on output A of EPWM2 */\
    (*ePWM[ch2]).AQCTLA.bit.CAU = 1; /* Set high when CTR = CMPA on UP-count */\
    (*ePWM[ch2]).AQCTLA.bit.CAD = 2; /* Set low when CTR = Zero */\
    (*ePWM[ch2]).CMPA.half.CMPA = (int16)(Tmp1); /* PWM signal on output A of EPWM2 (Q15 -> Q0) */\
    (*ePWM[ch2]).AQCSFRC.bit.CSFB = 2; /* Forcing a continuous High on output B of EPWM2 */\
    /* */\
    (*ePWM[ch3]).AQCSFRC.bit.CSFA = 2; /* Forcing a continuous High on output A of EPWM3 */\
    (*ePWM[ch3]).AQCSFRC.bit.CSFB = 1; /* Forcing a continuous Low on output B of EPWM3 */\
    } /* */\
    /* */\
    /* State s4: current flows to motor windings from phase B->A, de-energized phase = C */\
    else if (v.CmtnPointer==3) /* */\
    { /* */\

    /* (*ePWM[ch2]).AQCSFRC.bit.CSFA = 2; */ \

    (*ePWM[ch2]).AQCSFRC.bit.CSFA = 0; /* Forcing disabled on output A of EPWM2 */ \
    (*ePWM[ch2]).AQCTLA.bit.CAU = 1; /* Set high when CTR = CMPA on UP-count */ \
    (*ePWM[ch2]).AQCTLA.bit.CAD = 2; /* Set low when CTR = Zero */ \
    (*ePWM[ch2]).CMPA.half.CMPA = (int16)(Tmp1); /* PWM signal on output A of EPWM2 (Q15 -> Q0) */ \
    (*ePWM[ch2]).AQCSFRC.bit.CSFB = 2; /* Forcing a continuous High on output B of EPWM2 */ \
    /* */ \
    (*ePWM[ch3]).AQCSFRC.bit.CSFA = 2; /* Forcing a continuous High on output A of EPWM3 */ \
    (*ePWM[ch3]).AQCSFRC.bit.CSFB = 2; /* Forcing a continuous High on output B of EPWM3 */ \
    } /* */ \
    /* */ \
    /* State s5: current flows to motor windings from phase C->A, de-energized phase = B */ \
    else if (v.CmtnPointer==4) /* */ \
    { /* */ \
    (*ePWM[ch1]).AQCSFRC.bit.CSFA = 2; /* Forcing a continuous High on output A of EPWM1 */ \
    (*ePWM[ch1]).AQCSFRC.bit.CSFB = 1; /* Forcing a continuous Low on output B of EPWM1 */ \
    /* */ \
    (*ePWM[ch2]).AQCSFRC.bit.CSFA = 2; /* Forcing a continuous High on output A of EPWM2 */ \
    (*ePWM[ch2]).AQCSFRC.bit.CSFB = 2; /* Forcing a continuous High on output B of EPWM2 */ \
    /* */ \

    /* (*ePWM[ch3]).AQCSFRC.bit.CSFA = 2;*/\
    (*ePWM[ch3]).AQCSFRC.bit.CSFA = 0; /* Forcing disabled on output A of EPWM3 */ \
    (*ePWM[ch3]).AQCTLA.bit.CAU = 1; /* Set high when CTR = CMPA on UP-count */ \
    (*ePWM[ch3]).AQCTLA.bit.CAD = 2; /* Set low when CTR = Zero */ \
    (*ePWM[ch3]).CMPA.half.CMPA = (int16)(Tmp1); /* PWM signal on output A of EPWM3 (Q15 -> Q0) */ \
    (*ePWM[ch3]).AQCSFRC.bit.CSFB = 2; /* Forcing a continuous High on output B of EPWM3 */ \
    } /* */ \
    /* */ \
    /* State s6: current flows to motor windings from phase C->B, de-energized phase = A */ \
    else if (v.CmtnPointer==5) /* */ \
    { /* */ \

    (*ePWM[ch1]).AQCSFRC.bit.CSFA = 2; /* Forcing a continuous High on output A of EPWM1 */ \
    (*ePWM[ch1]).AQCSFRC.bit.CSFB = 2; /* Forcing a continuous High on output B of EPWM1 */ \
    /* */ \
    (*ePWM[ch2]).AQCSFRC.bit.CSFA = 2; /* Forcing a continuous High on output A of EPWM2 */ \
    (*ePWM[ch2]).AQCSFRC.bit.CSFB = 1; /* Forcing a continuous Low on output B of EPWM2 */ \
    /* */ \

    /* (*ePWM[ch3]).AQCSFRC.bit.CSFA = 2;*/\
    (*ePWM[ch3]).AQCSFRC.bit.CSFA = 0; /* Forcing disabled on output A of EPWM3 */ \
    (*ePWM[ch3]).AQCTLA.bit.CAU = 1; /* Set high when CTR = CMPA on UP-count */ \
    (*ePWM[ch3]).AQCTLA.bit.CAD = 2; /* Set low when CTR = Zero */ \
    (*ePWM[ch3]).CMPA.half.CMPA = (int16)(Tmp1); /* PWM signal on output A of EPWM3 (Q15 -> Q0) */ \
    (*ePWM[ch3]).AQCSFRC.bit.CSFB = 2; /* Forcing a continuous High on output B of EPWM3 */ \
    }

    #endif // __F2803X_BLDCPWM_H__

  • 进士4070分

    您好,示波器的波形看的不是太清,可以描述详细些吗?

  • 秀才50分

    你好。

    用这个dsp做电机控制程序,电机转速小于4000转的情况,电机平稳运行,高了(4000转)之后,电机转的不稳出现抖动。dsp频率设定为20k。因此查一查pwm是否存在什么问题。

    为了测试pwm信号的输出是否有延时,用蓝色信号捕捉换向信号(程序中执行toggle指令),当蓝色信号翻转时pmw应该有输出,用示波器看到pwm输出有延时。

  • 进士4350分
    能否把图弄得具体一点?
  • 秀才50分

    谢谢,问题找到了。