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.
Tool/software:
Dear Team.
When a waveform is input through the CMPIN1P pin using the CMPSS register, a reference voltage is applied to the CMPIN1N pin and compared to create a waveform that adjusts the EPWM duty according to the reference voltage.
We plan to receive input from the trip zone of the EPWM X-bar. After passing the signal from the digital compare module to the time-base submodule, we plan to use a method in which the duty is determined according to the cmpa value.
Currently, I am checking the waveform by giving input to CMPIN1P with a signal generator and applying a reference voltage to CMPIN1N with a power supply, but there is no output.
I hope to solve this issue.
There is my code.
// Compartor 1,2 initialization
EALLOW;
CpuSysRegs.PCLKCR14.all |= 1; // enable clock to CMPSS1
Cmpss1Regs.COMPCTL.bit.COMPLSOURCE = 0; // COMPCTL COMPLSOURCE 0
Cmpss1Regs.COMPCTL.bit.COMPLINV = 1; // COMPCTL COMPLINV 1
Cmpss1Regs.COMPCTL.bit.CTRIPLSEL = 0; //ASYNCL
EDIS;
// Pwm X-Bar initialization: CMPSS1.CTRIPL as TRIP4 input
EALLOW;
EPwmXbarRegs.TRIP4MUX0TO15CFG.all &= ~0x3UL;
EPwmXbarRegs.TRIP4MUX0TO15CFG.all |= 0; // Set CMPSS1.CTRIPL as TRIP4 input
// 2,3bit 00
EPwmXbarRegs.TRIP4MUXENABLE.all |= 1; // enable that mux input
EDIS;
// Pwm X-Bar TRIP4: do not invert
EALLOW;
EPwmXbarRegs.TRIPOUTINV.all &= ~1UL; // do not invert
EDIS;
EALLOW;
EPwm1Regs.DCTRIPSEL.bit.DCAHCOMPSEL = 3; //TRIP4 Input
EPwm1Regs.TZDCSEL.bit.DCAEVT1 = 2; //DCAH = high, DCAL = don't care
EPwm1Regs.DCACTL.bit.EVT1SYNCE = 1; //SYNC Generation Enabled, Sync function enable
EPwm1Regs.DCACTL.bit.EVT1SRCSEL = 0; //0:Source Is DCAEVT1 Signal; 1:Source is DCEVTFILT Signal
EPwm1Regs.TZCTL.bit.DCAEVT1 = 3;
EDIS;
/* Filter
EPwm1Regs.DCFCTL.bit.PULSESEL = 1; //Time-base counter equal to zero
EPwm1Regs.DCFCTL.bit.BLANKINV = 0; //Blanking window not inverted
EPwm1Regs.DCFCTL.bit.BLANKE = 1; //Blanking window is enabled
EPwm1Regs.DCFCTL.bit.SRCSEL = 0; //Source is DCAEVT1 Signal
EPwm1Regs.DCFOFFSET = 810; //Blanking Window Offset 9us
EPwm1Regs.DCFWINDOW = 180; //Blanking Window Width 2us
*/
EALLOW;
EPwm1Regs.CMPCTL.bit.SHDWAMODE = 0; // Shadow Mode
EPwm1Regs.CMPCTL.bit.LOADAMODE = 1; // Time-base counter equal to period (TBCTR = TBPRD)
EPwm1Regs.CMPCTL.bit.LOADASYNC = 2; // Shadow to Active Load of CMPA:CMPAHR occurs only when a SYNC is received
EPwm1Regs.CMPCTL.bit.SHDWAFULL = 1;
EDIS;
EPwm1Regs.CMPA.bit.CMPA = 720;
EPwm1Regs.AQCTLA.bit.CBU = AQ_SET;
EPwm1Regs.AQCTLA.bit.CAU = AQ_CLEAR;
EALLOW;
GpioCtrlRegs.GPBMUX1.bit.GPIO42 = 3;
GpioCtrlRegs.GPBMUX1.bit.GPIO43 = 3;
GpioCtrlRegs.GPBGMUX1.bit.GPIO42 = 3;
GpioCtrlRegs.GPBGMUX1.bit.GPIO43 = 3;
EDIS;
//
// Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
//
DINT;
//
// Initialize PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the F2837xD_PieCtrl.c file.
//
InitPieCtrl();
//
// Disable CPU interrupts and clear all CPU interrupt flags
//
IER = 0x0000;
IFR = 0x0000;
//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example. This is useful for debug purposes.
// The shell ISR routines are found in F2837xD_DefaultIsr.c.
// This function is found in F2837xD_PieVect.c.
//
InitPieVectTable();
Sincerely,
Junyeong
Hi Junyeong,
To clarify, you saying you see no EPWM output at all? Also, have you been referencing any of our C2000Ware EPWM or CMPSS examples yet (and if so, which ones)?
Best Regards,
Allison
Yes, there is no output at all. I edit source code based on Example_F28379D_LaunchPadDemo.c in Resource Explorer. I referenced function of digital compare based on this link.(https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1066082/tms320f28377d-how-to-use-the-digital-compare-dc-submodule). I referenced function of CMPSS based on this link.(https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/763230/tms320f28379d-about-pwm-dc-cycle-by-cycle-action). I tried to edit source code by referring to the datasheet based on these links.
Sincerely,
Junyeong
Hi Junyeong,
Did you start by just generating a PWM output first? Where are the rest of your EPWM configuration initializations (e.g. TBCTL settings)? Please be sure to reference our EPWM C2000Ware examples to view working EPWM initialization references:
Our CMPSS expert is currently on leave until 6/10. Please allow until then for a response on that side. Thanks for the patience!
Best Regards,
Allison
PWM operation using trip-zone was confirmed with source code called 'epwm_trip_zone' of a bitfield-based example.
I am trying to implement this by receiving a sine waveform from cmpss to CMPINxP, applying a reference voltage to CMPINxN, changing CMPA according to the size of the reference voltage, and converting the waveform input to CMPINxP to epwm duty form. So, I am trying to connect the cmpss output to the epwm xbar and the xbar output to the Time-Base submodule of the digital compare submodule of the epwm module.
And after setting the register to be used for the shadow load of the epwm counter-compare submodule, we want to set the cmpa to change every time when DCAEVT1.sync is input. In other words, I am trying to implement a change in the duty of the PWM waveform according to the reference voltage by receiving the ADC waveform.
Currently, I am checking by inputting the signal through the function generator and applying the reference voltage through the power supply, but the pwm waveform is not coming out.
Junyeong,
Our expert is currently out of office, please expect a reply in about 1 week.
Also, the information for ADC, CMPSS, EPWM are all in the TRM, and we do have many examples for each of these.
Best Regards,
Ben Collier