Other Parts Discussed in Thread: CONTROLSUITE
Dear Champs,
I am running HVPM_Sensorless_2833x demo on HVmotor Kit and confusing with the PWM_INIT_MACRO in <f2833xpwm.h>. The file path is C:\ti\controlSUITE\libs\app_libs\motor_control\drivers\f2833x_v2.0
This Macro set *ePWM[chx].TBCTL.bit.PHSEN=1 firstly and then let ' *ePWM[chx]).TBCTL.all = PWM_INIT_STATE' while the PWM_INIT_STATE not contained PHSEN.
could you please kindly help to let me know why using this way? thanks a lot!
#define PWM_INIT_MACRO(ch1,ch2,ch3,v) \ /* Setup Sync*/ \ (*ePWM[ch1]).TBCTL.bit.SYNCOSEL = 0; /* Pass through*/ \ (*ePWM[ch2]).TBCTL.bit.SYNCOSEL = 0; /* Pass through*/ \ (*ePWM[ch3]).TBCTL.bit.SYNCOSEL = 0; /* Pass through*/ \ \ /* Allow each timer to be sync'ed*/ \ (*ePWM[ch1]).TBCTL.bit.PHSEN = 1; \ (*ePWM[ch2]).TBCTL.bit.PHSEN = 1; \ (*ePWM[ch3]).TBCTL.bit.PHSEN = 1; \ \ /* Init Timer-Base Period Register for EPWM1-EPWM3*/ \ (*ePWM[ch1]).TBPRD = v.PeriodMax; \ (*ePWM[ch2]).TBPRD = v.PeriodMax; \ (*ePWM[ch3]).TBPRD = v.PeriodMax; \ \ /* Init Timer-Base Phase Register for EPWM1-EPWM3*/ \ (*ePWM[ch1]).TBPHS.half.TBPHS = 0; \ (*ePWM[ch2]).TBPHS.half.TBPHS = 0; \ (*ePWM[ch3]).TBPHS.half.TBPHS = 0; \ \ /* Init Timer-Base Control Register for EPWM1-EPWM3*/ \ (*ePWM[ch1]).TBCTL.all = PWM_INIT_STATE; \ (*ePWM[ch2]).TBCTL.all = PWM_INIT_STATE; \ (*ePWM[ch3]).TBCTL.all = PWM_INIT_STATE; \ \
/*---------------------------------------------------------------------------- Initialization constant for the F2833X Time-Base Control Registers for PWM Generation. Sets up the timer to run free upon emulation suspend, count up-down mode prescaler 1. ----------------------------------------------------------------------------*/ #define PWM_INIT_STATE ( FREE_RUN_FLAG + \ PRDLD_IMMEDIATE + \ TIMER_CNT_UPDN + \ HSPCLKDIV_PRESCALE_X_1 + \ CLKDIV_PRESCALE_X_1 + \ PHSDIR_CNT_UP + \ CNTLD_DISABLE )