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.

CCS/TMS320F28069M: How to change the epwm source in Example_2806xEqep_pos_speed?

Part Number: TMS320F28069M

Tool/software: Code Composer Studio

Hello

I am using Example_2806xEqep_pos_speed to read the angle and speed of a motor. From what I understand the counter and interrupts are based on EPwm1, however I want to change it to EPwm4. How should I do it?

So far I have changed the Example_EpwmSetup.c file (EPwm1Regs to EPwm4Regs) and changed the following codes:

   PieCtrlRegs.PIEIER3.bit.INTx4= 1;


__interrupt void prdTick(void)                  // EPWM1 Interrupts once every 4 QCLK counts (one period)
{
   // Position and Speed measurement
   qep_posspeed.calc(&qep_posspeed);

   // Control loop code for position control & Speed contol
   Interrupt_Count++;


   // Acknowledge this interrupt to receive more interrupts from group 1
   PieCtrlRegs.PIEACK.all = PIEACK_GROUP3;
   EPwm4Regs.ETCLR.bit.INT=1;
}

but it doesn't seem to work. 

  • In what way is it not working? If you put a breakpoint in prdTick() do you not hit it? Did you update the line that writes to PieVectTable.EPWM1_INT to write the ISR address to the EPWM4 vector instead?

    I'm guessing you're using actual encoder inputs at this point instead of the simulated ones from the ePWM, correct? If not, have you updated the pin muxing for EPWM4?

    Whitney