TI中文支持网
TI专业的中文技术问题搜集分享网站

TMS320F280049C: 使用HRPWM,周期出现2*TBCLK抖动,在20KHz频率下出现8Hz的频率抖动,抖动无法接受,请问怎么解决?

Part Number:TMS320F280049C

uint16_t period;period = DEVICE_SYSCLK_FREQ / frq;// Enable ePWMx clockSysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_EPWM1);// Enable HRPWM clockSysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_HRPWM);// Disable sync(Freeze clock to PWM as well)SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);// Set AQHRPWM_setActionQualifierAction(PSFB_X_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);HRPWM_setActionQualifierAction(PSFB_X_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);HRPWM_setActionQualifierAction(PSFB_X_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);HRPWM_setActionQualifierAction(PSFB_X_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);// Set up TBPRDEPWM_setTimeBasePeriod(PSFB_X_BASE, period - 1);EPWM_setTimeBaseCounter(PSFB_X_BASE, 0U);EPWM_setClockPrescaler(PSFB_X_BASE, EPWM_CLOCK_DIVIDER_1, EPWM_HSCLOCK_DIVIDER_1);// Set compare valueEPWM_setCounterCompareValue(PSFB_X_BASE, EPWM_COUNTER_COMPARE_A, period >> 1);// Set counter mode UPEPWM_setTimeBaseCounterMode(PSFB_X_BASE, EPWM_COUNTER_MODE_UP);// Set period load mode shadowingEPWM_setPeriodLoadMode(PSFB_X_BASE, EPWM_PERIOD_SHADOW_LOAD);// Set compare value load mode shadowingEPWM_setCounterCompareShadowLoadMode(PSFB_X_BASE, EPWM_COUNTER_COMPARE_A, EPWM_COMP_LOAD_ON_CNTR_PERIOD);// Enable auto-conversionHRPWM_enableAutoConversion(PSFB_X_BASE);// Set MEP control on both edgesHRPWM_setMEPEdgeSelect(PSFB_X_BASE, HRPWM_CHANNEL_A, HRPWM_MEP_CTRL_RISING_AND_FALLING_EDGE);// Enable phase shift loadEPWM_enablePhaseShiftLoad(PSFB_X_BASE);HRPWM_enablePhaseShiftLoad(PSFB_X_BASE);// Enable high-resolution period controlHRPWM_enablePeriodControl(PSFB_X_BASE);// Enable sync(Freeze clock to PWM as well)SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);// Calling SFO() updates the HRMSTEP register with calibrated MEP_ScaleFactor.// HRMSTEP must be populated with a scale factor value prior to enabling// high resolution period control.while(status == SFO_INCOMPLETE){status = SFO();if(status == SFO_ERROR){ESTOP0;// SFO function returns 2 if an error occurs & # of MEP}// steps/coarse step exceeds maximum of 255.}// Force a software sync pulseEPWM_forceSyncPulse(PSFB_X_BASE);

Green Deng:

你好,问题已收到,我会跟其他同事确认一下之后尽快回复你。

,

Green Deng:

需要在 CMPAU 上SET 并在 CMPAD 上CLEAR ,需要以 CTR=PRD 事件为中心。

赞(0)
未经允许不得转载:TI中文支持网 » TMS320F280049C: 使用HRPWM,周期出现2*TBCLK抖动,在20KHz频率下出现8Hz的频率抖动,抖动无法接受,请问怎么解决?
分享到: 更多 (0)