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: cannot get into ISR by keeping pressing F5

Part Number: TMS320F28335
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.

  • Ivan,

    From what you have explained, it seems that your ISR may not be configured correctly. I will recommend checking out the epwm_timer_interrupts and sw_prioritized_interrupts examples in C2000Ware in order to get a better understanding of how to configure your ISR for your use case.

    Here is an additional resource to consider: processors.wiki.ti.com/.../Interrupt_FAQ_for_C2000

    Regards,
    Ozino
  • Hi Ozino,

    Thank you for your time and pointing me to the C2000ware examples, as it can narrow down the issues.

    I downloaded the C2000ware, and repeat my experiment with one of the examples.

    4.14 ePWM Timer Interrupt (epwm_timer_interrupts)

    Project name: Example_2833xEPwmTimerInt, from the directory: C:\ti\c2000\C2000Ware_1_00_05_00\device_support\f2833x\examples\epwm_timer_interrupts.

    Here is my experiment with F5 and F8. I did not change anything in the example code.

    (1) double click to the left of the ISR of ePWM1 interrupt (line 328, Example_2833xEPwmTimerInt.c) to create a break point.

    (2) start debugging by clicking the button in the following picture.

    (3) by pressing F8, it stops at the break point. Repeat, it always stops at the break point. It is the expected behaviour.

    (4) keep pressing F5, after it finishes the ISR, it is always in the forever loop below. Even if the ePWM1 counter becomes 0 again, after it reaches the peak. (It takes a while). Nor it will enter any other ISRs for other ePWM modules.

        //
        // Step 6. IDLE loop. Just sit and loop forever (optional)
        //
        for(;;)
        {
            __asm("          NOP");
            for(i=1;i<=10;i++)
            {
               
            }
        }
    }

    (5) if you press F8, it enters the ISR and stops at the break point as expected.

    Clearly, F8 is working properly, but F5 is not.

    My questions is, according to my understanding, F5 is used when I want to execute the code line by line. Using F5 in the above way, it should go back into the ISR when the time has come. But in my experiment, it is not. Is there any setting I have missed, or I should not use F5 in this way?

    As I have explained before, I try to use F5 in this way, because I want to see in my project, why it takes 900 cycles to enter an ISR.

    I am using CCS8.2 and TI F28335 experimental kit.

  • Interrupts are not active when you single-step code. You can press F5 all day and you will never get an interrupt. The minute you hit run (F8) you take the highest priority pending interrupt.

    Regards,
    David
  • Thank you for letting me know that. I thought F5 is just a step-by-step operation of F8. Thanks.