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/TMS320F28335: f28335 epwm interrupt issue

Part Number: TMS320F28335

Tool/software: Code Composer Studio

Hi,

I am using TMS320F28335, ezdsp platform to generate pwm wave whose duty cycle is determined by output of ADC. And I am using epwm1 interrupt, intending to make the program enter interrupt at every rising edge of pwm wave. My problem is that besides every rising edge, the program also entered the interrupt function every 3.3us, which made me very confused. I tried different configuration of the pwm, but the problem still exist. Can anyone have a look at my code and give some possible causes of the problem? The software environment is CCS 3.3. Any help will be greatly appreciated.

Jianxiong 

7801.Main.c
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// DESCRIPTION:
//
// This example configures ePWM1, ePWM2, ePWM3 to produce an
// waveform with independant modulation on EPWMxA and
// EPWMxB.
//
// The compare values CMPA and CMPB are modified within the ePWM's ISR
//
// The TB counter is in upmode for this example.
//
// View the EPWM1A/B, EPWM2A/B and EPWM3A/B waveforms
// via an oscilloscope
//
//
//###########################################################################
// $TI Release: DSP2833x/DSP2823x C/C++ Header Files V1.31 $
// $Release Date: August 4, 2009 $
//###########################################################################
#include "DSP28x_Project.h" // Device Headerfile and Examples Include File
#include "DSP2833x_Device.h"
#define CollectNum 4
Uint16 Current1, Current2, Current3, Current4, Voltage_in, AdcRes0, AdcRes1, AdcRes2, AdcRes3, AdcRes4, CurrentSum;//, T1, T2, T3, NN;
Uint16 T1 = 252, T2 = 1200, T3 = 216, NN = 20;
Uint16 Start = 1;
//Uint16 CollectNum = 8
Uint16 Voltage_inTemp[CollectNum], Current1Temp[CollectNum];
Uint16 AdcRes[CollectNum];
Uint16 Duty1A, Duty1B, Duty2A, Duty2B, Duty3A, Duty3B, Duty4A, Duty4B;
//int Start = 0;
int N = 20;
int xx, yy;
int Trec = 1; //, T2rec = 0, T3rec = 0, NNrec = 0;
//Uint16 i;
int ii=0;
//int AdcSocPoint = 0;
Uint16 Pwm1Count = 0;
Uint16 sss = 0;
struct ECAN_REGS ECanaShadow;
// Prototype statements for functions found within this file.
void InitEPwm1Example(void);
void InitEPwm2Example(void);
void InitEPwm3Example(void);
void InitEPwm4Example(void);
Uint16 Digi_LPF();
interrupt void epwm1_isr(void);
//interrupt void epwm2_isr(void);
//interrupt void epwm3_isr(void);
//interrupt void epwm4_isr(void);
interrupt void cpu_timer0_isr(void);
interrupt void cpu_timer1_isr(void);
interrupt void cpu_timer2_isr(void);
//interrupt void adc_isr(void);
interrupt void ecan_rec_isr(void);
interrupt void ecan_rec_st_isr(void);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi Jianxiong,

    The code enters the ePWM ISR spuriously every 3.3us? This is the same ISR that is correctly being entered every ePWM cycle?

    What methods are you using to determine the ISR is entered? Are you looking at GPIO54 and seeing an extra toggle on a scope capture?

    My best guess is that this has something to do with

    "PieCtrlRegs.PIEIFR3.bit.INTx1 = 1; //NECESSARY???"

    setting the ISR flag via SW and causing the ISR to be entered.

    p.s.

    CCS3.3 and ezDSP is some pretty old HW/SW. If you are starting a new project I think you can get CCSv8 for free and I think that should work OK with F28335. We also now have much lower cost EVMs for newer devices e.g. F28379D launchpad XL
    (F28335 is still a great device for new development though if you need a really fast ADC)
  • Hi Devin! I fixed the problem. It is indeed related to PIEIFR register, I removed it and also modified some order of initialization, then the interrupt works.

    Personally I tend to use newer HW/SW, but this time it was chosen by the leader of my group. I will tried to use newer ones in the future.

    Thanks for your help.

    Jianxiong