Hello,
I want to use HRPWM for my application and it requires 6 PWM outputs A and B are inverted versions of one another.
My question is regarding the Jitter on the channels with regards to syncing
I am not changing the period but the duty cycle will be changed during every pwm cycle, from the datasheet note it seems that only phase or period control will introduce the jitter.
However in the driverlib function setMEPcontrolMode it is set as Period and Duty control. Does this mean that the jitter will be introduced with duty control as well?
I have followed the HRPWM examples for HRPWM_EX3_PRDUPDOWN_SFO_V8.c
I however am not using the SFO and am just manually converting the fractional to the correct CMPA:HR value.
When I scope the outputs of the 3 waveforms with CMPA:HR cycling between all steps I do not see any changes in the waveform.
I leave EPWM1A alone and cycle EPWM2A and EPWM3A throught he CMPA:HR values and see no difference in the edge compared to EPWM1A
This is my initialization code
// Set-up TBCLK // set period to shadow load EPWM_setPeriodLoadMode(base, EPWM_PERIOD_DIRECT_LOAD); // set base period uint16_t HR_PERIOD = (uint16_t)UP_DOWN_PERIOD; EPWM_setTimeBasePeriod(base,HR_PERIOD); // Set-up TBCLK EPWM_setCounterCompareValue(base,EPWM_COUNTER_COMPARE_A,3U); // Set up shadowing to load on 0 EPWM_setCounterCompareShadowLoadMode(base, EPWM_COUNTER_COMPARE_A, EPWM_COMP_LOAD_ON_CNTR_ZERO); EPWM_setCounterCompareShadowLoadMode(base, EPWM_COUNTER_COMPARE_B, EPWM_COMP_LOAD_ON_CNTR_ZERO); // set phase shift to 0 HRPWM_setPhaseShift(base, 0U); // disable phase shift load HRPWM_disablePhaseShiftLoad(base); // reset time base counter HRPWM_setTimeBaseCounter(base, 0U); // Set up counter mode HRPWM_setTimeBaseCounterMode(base, EPWM_COUNTER_MODE_UP_DOWN); // set to count up down // configure clock pre-scaling HRPWM_setClockPrescaler(base, EPWM_CLOCK_DIVIDER_1, EPWM_HSCLOCK_DIVIDER_1); // Enable shadow mode for compare value HRPWM_setActionQualifierShadowLoadMode(base, EPWM_ACTION_QUALIFIER_A,EPWM_AQ_LOAD_ON_CNTR_ZERO); //HRPWM_setActionQualifierShadowLoadMode(base, EPWM_ACTION_QUALIFIER_B,EPWM_AQ_LOAD_ON_CNTR_ZERO); // Set actions // When EPWM1_A hits the compare value on an up count set output A low HRPWM_setActionQualifierAction(base, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA); // When EPWM1_A hits the compare value on a down count set output A high HRPWM_setActionQualifierAction(base, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA); // When EPWM1_A hits the compare value on an up count set output B high //EPWM_setActionQualifierAction(base, //EPWM_AQ_OUTPUT_B, //EPWM_AQ_OUTPUT_HIGH, //EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA); // When EPWM1_A hits the compare value on a down count set output B low //EPWM_setActionQualifierAction(base, //EPWM_AQ_OUTPUT_B, //EPWM_AQ_OUTPUT_LOW, //EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA); // Deadband Configuration // Use EPWMA as the input for both RED and FED HRPWM_setRisingEdgeDeadBandDelayInput(base, EPWM_DB_INPUT_EPWMA); HRPWM_setFallingEdgeDeadBandDelayInput(base, EPWM_DB_INPUT_EPWMA); // Set the RED and FED values HRPWM_setFallingEdgeDelayCount(base, 10); // TI used a value of 200 in there example code: Deadband needs to be 2.0us => 10ns*200=2us HRPWM_setRisingEdgeDelayCount(base, 10); // Invert only the Falling Edge delayed output (AHC) HRPWM_setDeadBandDelayPolarity(base, EPWM_DB_RED, EPWM_DB_POLARITY_ACTIVE_HIGH); HRPWM_setDeadBandDelayPolarity(base, EPWM_DB_FED, EPWM_DB_POLARITY_ACTIVE_LOW); // Use the delayed signals instead of the original signals HRPWM_setDeadBandDelayMode(base, EPWM_DB_RED, true); HRPWM_setDeadBandDelayMode(base, EPWM_DB_FED, true); // DO NOT Switch Output A with Output B HRPWM_setDeadBandOutputSwapMode(base, EPWM_DB_OUTPUT_A, false); HRPWM_setDeadBandOutputSwapMode(base, EPWM_DB_OUTPUT_B, false); ////////////// // Initialize HRPWM extension. HRPWM_setHiResTimeBasePeriodOnly(base,(uint16_t)MEP_SCALE_FACTOR); //ASSUMPTION 55 MEP STEPS PER PWM HRPWM_setHiResCounterCompareValueOnly(base,HRPWM_COUNTER_COMPARE_A,1U); HRPWM_setCounterCompareShadowLoadEvent(base, HRPWM_CHANNEL_A,HRPWM_LOAD_ON_CNTR_ZERO); HRPWM_setCounterCompareShadowLoadEvent(base, HRPWM_CHANNEL_B,HRPWM_LOAD_ON_CNTR_ZERO); //set HRPWM to control both edges of period HRPWM_setMEPEdgeSelect(base, HRPWM_CHANNEL_A, HRPWM_MEP_CTRL_FALLING_EDGE); HRPWM_setMEPControlMode(base, HRPWM_CHANNEL_A, HRPWM_MEP_DUTY_PERIOD_CTRL); HRPWM_setMEPEdgeSelect(base, HRPWM_CHANNEL_B, HRPWM_MEP_CTRL_FALLING_EDGE); HRPWM_setMEPControlMode(base, HRPWM_CHANNEL_B, HRPWM_MEP_DUTY_PERIOD_CTRL); // Set high resolution MEP (Micro Edge Positioner) step //MEP steps applied = TEPWMCLK /180 ps = 200Mhz^-1/180ps = 28 HRPWM_setMEPStep(base, MEP_SCALE_FACTOR); // Enables MEP (Micro Edge Positioner) automatic scale mode. HRPWM_disableAutoConversion(base); // enable HR period control HRPWM_disablePeriodControl(base);
This is followed by some syncing
EPWM_setSyncOutPulseMode(EPWM1_BASE, EPWM_SYNC_OUT_PULSE_ON_COUNTER_ZERO); EPWM_setSyncOutPulseMode(EPWM2_BASE, EPWM_SYNC_OUT_PULSE_ON_EPWMxSYNCIN); EPWM_setSyncOutPulseMode(EPWM3_BASE, EPWM_SYNC_OUT_PULSE_ON_EPWMxSYNCIN); //EPWM_enablePhaseShiftLoad(EPWM1_BASE); EPWM_enablePhaseShiftLoad(EPWM2_BASE); EPWM_enablePhaseShiftLoad(EPWM3_BASE);
Any help would be appreciated.
Cheers,
Kip