Other Parts Discussed in Thread: C2000WARE
Tool/software: Code Composer Studio
Hi,
I have a ADCISR, triggered by ePWM counter = 0, then ADC sequence, and then ADC interrupt.
When I am debugging ADCISR, I find that if I put a break point within ADCISR by double clicking on the left of the code, it stops at the break point as expected.
However, if I keep pressing F5 to execute the code line by line, after finishing the ADCISR, it never goes back to the ISR. The programme always runs within the following function in the main file.
while(1) SCH_runEvents();
void SCH_runEvents(void)
{
Uint16 schTime, elTime;
Uint16 i;
int (*eventFunc)(Uint64);
Uint16 elNewLastTime;
schTime = msecs;
elTime = schTime - lastSchTime;
eventFunc = NULL;
elNewLastTime = elTime; // assume only one event will need processing
for (i = 0; i < schLen; i++)
{
// find which event should be processed
if ((event[i].fireTime - lastSchTime) < elTime)
{
// find any starving events, defined as still waiting after one period
// if ( (schTime - event[i].fireTime) > event[i].period ) return (-((int)i+1));
// process the first event that has an elapased firetime
if (eventFunc == NULL)
{
event[i].fireTime += event[i].period;
eventFunc = event[i].func;
}
// find the new lastSchTime, the smaller of elTime, (event[i].fireTime - lastSchTime) for all i
if ((event[i].fireTime - lastSchTime) < elNewLastTime)
{
elNewLastTime = event[i].fireTime - lastSchTime;
}
}
}
// update lastSchTime
lastSchTime += elNewLastTime;
// call event handler function, should deal with the return value at some point
if (eventFunc != NULL) eventFunc(time);
}
Question 1:
In theory, if I keep pressing F5 for long enough time, when the next ADC interrupt comes, it should be able to get into the ADCISR. But it does not.
The strange thing is that if I click the green run button on the menu, the programmes runs into the ISR and stops at the break point. I can see when the ePWM counter reaches zero, the ADC sequence starts and ADC result registers get updated. When the ADC sequence is running, the ADCST is 0x0007, and when the sequence finishes it becomes 0x0003. But it does not enter the ISR by keeping pressing F5.
Do I miss something, or F5 should not be used in this way?
Question 2:
The reason why I want to use F5 to step through the whole code is that I find that if I put a break point at the beginning at the ADCISR, the ePWM counter is already 900. According to my setting, ADC sequence is triggered by ePWM counter = 0, and the ADC sequence is start/stop one which only has 10 channels to sample. I do not understand why it takes so long to enter the ADCISR. I can see the interrupt flag bit set at around ePWM counter = 500.
The clock frequency is 120MHz, and I set the ePWM clock the same as the high-frequency peripheral clock. How do I check why it is taking 900 cycles to enter the ADCISR?
Please help me.
Thank you in advance.
I am using CCS8.2 and TI F28335 experimental kit.