This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi, My application will use high-resolution period control and high-resolution phase control together between EPWM1 and EPWM2.
Now I can get high-resolution period control and general(Coarse) phase control together between EPWM1 and EPWM2.
Bellow as Configuration : It has calculated out: pwmPeriod_ticks, dbRED_ticks, dbFED_ticks
// Time Base SubModule Registers
EPWM_setPeriodLoadMode(base1, EPWM_PERIOD_SHADOW_LOAD);
HWREG(base1 + HRPWM_O_TBPRDHR) = pwmPeriod_ticks;
EPWM_setTimeBaseCounter(base1, 0);
EPWM_setPhaseShift(base1, 0);
EPWM_setTimeBaseCounterMode(base1, EPWM_COUNTER_MODE_UP_DOWN);
// Counter Compare Submodule Registers, set duty 50% initially
HWREG(base1 + HRPWM_O_CMPA) = pwmPeriod_ticks >> 1;
//
// set as shadow mode
//
EPWM_setCounterCompareShadowLoadMode(base1, EPWM_COUNTER_COMPARE_A, EPWM_COMP_LOAD_ON_CNTR_ZERO_PERIOD);
//
// set as shadow mode
//
EPWM_setCounterCompareShadowLoadMode(base1, EPWM_COUNTER_COMPARE_B, EPWM_COMP_LOAD_ON_CNTR_ZERO_PERIOD);
HWREG(base1 + HRPWM_O_CMPB) = pwmPeriod_ticks >> 1;
EALLOW;
// Action Qualifier SubModule Registers
// CTR = CMPA@UP , xA set to 1
// CTR = CMPA@Down , xA set to 0
//
// Active high complementary PWMs - Set up the deadband
//
HWREG(base1 + HRPWM_O_DBFEDHR) = dbFED_ticks;
HWREG(base1 + HRPWM_O_DBREDHR) = dbRED_ticks;
//
// Hi-res PWM, MEP control on both edges.
//
HRPWM_setMEPEdgeSelect(base1, HRPWM_CHANNEL_A, HRPWM_MEP_CTRL_RISING_AND_FALLING_EDGE);
HRPWM_setCounterCompareShadowLoadEvent(base1, HRPWM_CHANNEL_A, HRPWM_LOAD_ON_CNTR_ZERO_PERIOD);
HRPWM_setMEPEdgeSelect(base1, HRPWM_CHANNEL_B, HRPWM_MEP_CTRL_RISING_AND_FALLING_EDGE);
HRPWM_setCounterCompareShadowLoadEvent(base1, HRPWM_CHANNEL_B, HRPWM_LOAD_ON_CNTR_ZERO_PERIOD);
HRPWM_setMEPControlMode(base1, HRPWM_CHANNEL_A, HRPWM_MEP_DUTY_PERIOD_CTRL);
HRPWM_setMEPControlMode(base1, HRPWM_CHANNEL_B, HRPWM_MEP_DUTY_PERIOD_CTRL);
HRPWM_setDeadbandMEPEdgeSelect(base1, HRPWM_DB_MEP_CTRL_RED_FED);
//
// Enable autoconversion
//
HRPWM_enableAutoConversion(base1);
//
// Turn on high-resolution period control.
//
HRPWM_enablePeriodControl(base1);
*************************************************
Then I have enabled PWM2 Phase Shift
EPWM_TBCTL_PHSEN = 1, EPWM_HRPCTL_TBPHSHRLOADE = 1
Hi YuChih,
Are you encountering issues with your current configuration? If so, could you describe the issue in more detail and provide oscilloscope shots of the PWM output?
Remember that when using HRPWM, you should not generate a sync pulse on every period. You should only generate a software sync pulse whenever TBPHS for EPWM2 or EPWM1 is updated.
I would recommend recreating your initialization in SysConfig, this will automatically flag any bad combinations of settings that you have configured.
Let me know if you have any questions on this.
Thank you,
Luke
Hi Luke,
Ok, Let me check What's Problem about this configuration.
Now this configuration using HRPWM with generate a sync pulse on every period of EPWM1.
Is this config make a mistake about High resolution Phase and High resolution Frequency implement together?
Thanks you.
Yuchih
Hi YuChih,
High-resolution period and high-resolution phase are not available in combination with specific configurations of HRPWM. I would recommend recreating your EPWM configuration in the SysConfig tool to catch any errors with your current configuration.
Let me know if you still encounter issues after replacing the repeated sync pulse on every period with a software sync pulse on changes to TBPHS only.
Thank you,
Luke
Hi Luke
When I use SysConfig tool , I found I can't set HRPWM in SysConfig tool.
So I could not reference EPWM configuration in the SysConfig tool.
And I found this config register in TMS320F280049.
It need select one mode of TBPRDHR and TBPHSHR as it describes.
So Can Implement high-resolution period control of EPWM1 and EPWM2 and high-resolution phase control between EPWM1 and EPWM2 at the same time on 280049?
Hi YuChih,
The C2000Ware_version\device_support\f2837xd\examples\cpu1\hrpwm_deadband_sfo_v8 example demonstrates proper usage of TBPHSHR and high-resolution period together. Note that TBPHSHR is controlled via the TRREM register. This example is not available for F28004x but the HRPWM implementation is identical between F2837xd and F28004x.
Let me know if you have any further questions.
Thank you,
Luke