Other Parts Discussed in Thread: C2000WARE
Tool/software: Code Composer Studio
Hi
I would like to ask about the example: "eqep_pos_speed_cpu01". I have imported from C2000Ware_1_00_01_00 and only change the PWM1 to PWM2, because I'm working on Launchpad F28377S..
I have everything connected like in the example description, but it seems that the interrupt doesn't occur and the data theta_raw is NULL.
The program is as follows:
#include "F28x_Project.h"
#include "Example_posspeed.h"
POSSPEED qep_posspeed=POSSPEED_DEFAULTS;
Uint16 Interrupt_Count = 0;
void initEpwm();
__interrupt void prdTick(void);
void main(void)
{
InitSysCtrl();
InitEQep1Gpio();
InitEPwm2Gpio();
EALLOW;
GpioCtrlRegs.GPADIR.bit.GPIO4 = 1;
GpioDataRegs.GPACLEAR.bit.GPIO4 = 1;
EDIS;
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EALLOW;
PieVectTable.EPWM2_INT= &prdTick;
EDIS;
initEpwm();
IER |= M_INT3;
PieCtrlRegs.PIEIER3.bit.INTx1 = 1;
EINT; // Enable Global __interrupt INTM
ERTM; // Enable Global realtime __interrupt DBGM
qep_posspeed.init(&qep_posspeed);
for(;;)
{
}
}
__interrupt void prdTick(void)
{
Uint16 i;
qep_posspeed.calc(&qep_posspeed);
Interrupt_Count++;
if (Interrupt_Count==1000)
{
EALLOW;
GpioDataRegs.GPASET.bit.GPIO4 = 1; // Pulse Index signal (1 pulse/rev.)
for (i=0; i<700; i++)
{
}
GpioDataRegs.GPACLEAR.bit.GPIO4 = 1;
Interrupt_Count = 0; // Reset count
EDIS;
}
PieCtrlRegs.PIEACK.all = PIEACK_GROUP3;
EPwm2Regs.ETCLR.bit.INT=1;
}
The Example_EPwmSetup.c is configured for EPWM2.
Maybe I have missed something?
Thank you very much for your time.
Tomasz
