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: tms320f28335 ccs compiler

Part Number: TMS320F28335

Tool/software: Code Composer Studio

Hello all,
I am debugging my code in the tms320f28335 platform, in my code, there are 8 tasks, their execting periods are 62.5us,125us,250us,625us,1ms,10ms,330ms and 1second respectively.The 62.5us task priority is highest and 1second task priorty is lowest.
In my code, I declare 8 Uint32 variables(counts) for every task, when one task is executed,the respective variable(count) will be add one.After some minutes or hours, these varibles(counts) are not correct. The times of some tasks exetuted are larger than they should be executed. The attached is the data that I calaculed and sampled,count3 she be 31209,but MCU run this task 31211 times.
I study assembly code and find some CPU registers (such as DP) are not pushed into stack when enter interrupt. Can I configure CCS to push all of cpu register into stack when enter interrupt.The following is part of my code.

detail description please refer my another thread,

CCS/TMS320F28335: context saved when enter interrupt,disassembly code

interrupt void epwm_timer_isr(void)
{
mainCnt++;
EPwm1Regs.ETCLR.bit.INT = 1;
#if(1 == _SAMPLE_)
EPwm2Regs.ETCLR.bit.INT = 1;
#endif
//Acknowledge this interrupt to receive more interrupts from group 3
IER |= M_INT3;
PieCtrlRegs.PIEACK.all |= PIEACK_GROUP3;
rtTaskTimerUpdate();
EINT;
//62.5us task
scheduleRt();
}

disassembly code

epwm_timer_isr():
008d3d: 761B ASP
008d3e: FFF0 PUSH RB
008d3f: 0005 PUSH AR1H:AR0H
008d40: ABBD MOVL *SP++, XT
008d41: A8BD MOVL *SP++, XAR4
008d42: A0BD MOVL *SP++, XAR5
008d43: C2BD MOVL *SP++, XAR6
008d44: C3BD MOVL *SP++, XAR7
008d45: E20000BD MOV32 *SP++, STF
008d47: E20300BD MOV32 *SP++, R0H
008d49: E20301BD MOV32 *SP++, R1H
008d4b: E20302BD MOV32 *SP++, R2H
008d4d: E20303BD MOV32 *SP++, R3H
008d4f: E6300600 SETFLG RNDF32=1,RNDF64=1
008d51: FF69 SPM #0
008d52: 2942 CLRC OVM|PAGE0
008d53: 5616 CLRC AMODE
202 mainCnt++;
008d54: 0201 MOVB ACC, #1
008d55: 761F0320 MOVW DP, #0x320
008d57: 56010020 ADDL @0x20, ACC

void scheduleRt(void)
{
////////////125us task////////////
if(rtTaskTimer[0].flag)
{
DINT;
rtTaskTimer[0].flag = 0;
if(taskStatus.task0Busy)
{
taskStatus.task0Reen = 1;
}
else
{
taskStatus.task0Busy = 1;
}
EINT;
{
spdCount++;

//task1

}
DINT;
taskStatus.task0Busy = 0;
EINT;
}
//////////250us task//////////
if(rtTaskTimer[1].flag)
{
if(taskStatus.task0Busy)
{
return;
}
DINT;
rtTaskTimer[1].flag = 0;
if(taskStatus.task1Busy)
{
taskStatus.task1Reen = 1;
}
else
{
taskStatus.task1Busy = 1;
}
EINT;
{
posCount++;

//task2

}
DINT;
taskStatus.task1Busy = 0;
EINT;
}
//////////////////625us task///////////////////
if(rtTaskTimer[2].flag)
{
if(taskStatus.task1Busy)
{
return;
}
DINT;
rtTaskTimer[2].flag = 0;
if(taskStatus.task2Busy)
{
taskStatus.task2Reen = 1;
}
else
{
taskStatus.task2Busy = 1;
}
EINT;
{
count0++;

//task3

}
DINT;
taskStatus.task2Busy = 0;
EINT;
}
/////////////////////1ms task/////////////////////
if(rtTaskTimer[3].flag)
{
if(taskStatus.task2Busy)
{
return;
}
DINT;
rtTaskTimer[3].flag = 0;
if(taskStatus.task3Busy)
{
taskStatus.task3Reen = 1;
}
else
{
taskStatus.task3Busy = 1;
}
EINT;
{
count1++;

//task4

}
DINT;
taskStatus.task3Busy = 0;
EINT;
}
//////////////////10mstask//////////////////////
if(rtTaskTimer[4].flag)
{
if(taskStatus.task3Busy)
{
return;
}
DINT;
rtTaskTimer[4].flag = 0;
if(taskStatus.task4Busy)
{
taskStatus.task4Reen = 1;
}
else
{
taskStatus.task4Busy = 1;
}
EINT;
{
count2++;

//task5
}
DINT;
taskStatus.task4Busy = 0;
EINT;
}
//////////////////330msask///////////////////
if(rtTaskTimer[5].flag)
{
if(taskStatus.task4Busy)
{
return;
}
DINT;
rtTaskTimer[5].flag = 0;
if(taskStatus.task5Busy)
{
taskStatus.task5Reen = 1;
}
else
{
taskStatus.task5Busy = 1;
}
EINT;
{
count3++;

//task6
}
DINT;
taskStatus.task5Busy = 0;
EINT;
}
/////////////////1stask //////////////////
if(rtTaskTimer[6].flag)
{
if(taskStatus.task5Busy)
{
return;
}
DINT;
rtTaskTimer[6].flag = 0;
if(taskStatus.task6Busy)
{
taskStatus.task6Reen = 1;
}
else
{
taskStatus.task6Busy = 1;
}
EINT;
{

count4++;

//task7

}
DINT;
taskStatus.task6Busy = 0;
EINT;
}
}

part of disassembly code

scheduleRt():
30512f: FE04 ADDB SP, #4
39 if(rtTaskTimer[0].flag)
305130: 761F0321 MOVW DP, #0x321
305132: 9218 MOV AL, @0x18
305133: 6140 SB C$L5, EQ
41 DINT;
305134: 3B10 SETC INTM
42 rtTaskTimer[0].flag = 0;
305135: 2B18 MOV @0x18, #0
43 if(taskStatus.task0Busy)
305136: 761F031A MOVW DP, #0x31a
305138: 9232 MOV AL, @0x32
305139: 6104 SB C$L1, EQ
45 taskStatus.task0Reen = 1;
30513a: 56BF0139 MOVB @0x39, #0x01, UNC
46 }
30513c: 6F03 SB C$L2, UNC
49 taskStatus.task0Busy = 1;
C$L1:
30513d: 56BF0132 MOVB @0x32, #0x01, UNC
51 EINT;
C$L2:
30513f: 2910 CLRC INTM
53 spdCount++;
305140: 0201 MOVB ACC, #1
305141: 5601002E ADDL @0x2e, ACC
54 DTS2 = 1;
305143: 761F01BF MOVW DP, #0x1bf
305145: 1A010008 OR @0x1, #0x0008
55 mtDrvSpdTrqCtrl();
305147: FF69 SPM #0
305148: 76703CEF LCR mtDrvSpdTrqCtrl
56 spdFbkRpm = _IQmpy(speed1.Speed,SPDBASERPM);
30514a: 761F0319 MOVW DP, #0x319
30514c: 8F002EE0 MOVL XAR4, #0x002ee0
30514e: 872E MOVL XT, @0x2e
30514f: 761F0314 MOVW DP, #0x314
305151: 566300A4 QMPYL ACC, XT, @XAR4
305153: 560500A4 IMPYL P, XT, @XAR4
305155: 56A7 LSL64 ACC:P, 8
305156: 9602 MOV @0x2, AL
57 if((spdFbkRpm < rangZeroSpd)&&(spdFbkRpm > -rangZeroSpd))
305157: 761F0317 MOVW DP, #0x317
305159: 9224 MOV AL, @0x24
30515a: 761F0314 MOVW DP, #0x314
30515c: 5402 CMP AL, @0x2
30515d: 6509 SB C$L3, LEQ
30515e: FF5C NEG AL
30515f: 5402 CMP AL, @0x2
305160: 6306 SB C$L3, GEQ
59 sysStatus.bits.zeroSpd = 1;
305161: 761F0313 MOVW DP, #0x313
305163: 1A220020 OR @0x22, #0x0020
60 }
305165: 6F05 SB C$L4, UNC
63 sysStatus.bits.zeroSpd = 0;
C$L3:
305166: 761F0313 MOVW DP, #0x313
305168: 1822FFDF AND @0x22, #0xffdf
65 DTS2 = 0;
C$L4:
30516a: 761F01BF MOVW DP, #0x1bf
30516c: 1801FFF7 AND @0x1, #0xfff7
67 DINT;
30516e: 3B10 SETC INTM
68 taskStatus.task0Busy = 0;
30516f: 761F031A MOVW DP, #0x31a
305171: 2B32 MOV @0x32, #0
69 EINT;
305172: 2910 CLRC INTM
72 if(rtTaskTimer[1].flag)
C$L5:
305173: 761F0321 MOVW DP, #0x321
305175: 921B MOV AL, @0x1b
305176: FFE100A4 B C$L15, EQ
74 if(taskStatus.task0Busy)
305178: 761F031A MOVW DP, #0x31a
30517a: 9232 MOV AL, @0x32
30517b: FFE003F9 B C$L57, NEQ
78 DINT;
30517d: 3B10 SETC INTM
79 rtTaskTimer[1].flag = 0;
30517e: 761F0321 MOVW DP, #0x321
305180: 2B1B MOV @0x1b, #0
80 if(taskStatus.task1Busy)
305181: 761F031A MOVW DP, #0x31a
305183: 9233 MOV AL, @0x33
305184: 6104 SB C$L6, EQ
82 taskStatus.task1Reen = 1;
305185: 56BF013A MOVB @0x3a, #0x01, UNC
83 }
305187: 6F03 SB C$L7, UNC
86 taskStatus.task1Busy = 1;
C$L6:
305188: 56BF0133 MOVB @0x33, #0x01, UNC
88 EINT;
C$L7:
30518a: 2910 CLRC INTM
90 posCount++;
30518b: 0201 MOVB ACC, #1
30518c: 5601002A ADDL @0x2a, ACC
91 DTS1 = 1;
30518e: 761F01BF MOVW DP, #0x1bf
305190: 1A010004 OR @0x1, #0x0004
92 if(600 != udcMan)
305192: 8F000258 MOVL XAR4, #0x000258
305194: 761F0314 MOVW DP, #0x314
305196: 0E05 MOVU ACC, @0x5
305197: 0FA4 CMPL ACC, @XAR4
305198: 6110 SB C$L8, EQ