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.

TMS320F280039: CLA not entering task

Part Number: TMS320F280039


Hi all,

My customer has a CLA problem. At first, CLA is running normally. After changing one piece of code in the CLA task, from:

for(i=0;i<1;i++);  // case 1

to

for(i=0;i<2;i++); // case 2

CLA doesn't enter task anymore. This is just an empty loop. Actually, the program will never reach this loop because there is "if" condition wrapping this loop and the condition will always be false. It seems that the only difference here is that the code is slightly larger.

Moreover, if the compile optimization is turned off, CLA will not enter task in both cases.

In case 2, I can see the MIFR bit and MIOVF bit is toggling, but the variable with incremental operator in the task is not increasing. 

The CLA task is triggered by ADC, at 55kHz. In case 1, it takes CLA 8us to finish the task. 

Any idea what might be the cause?

Thanks,

Hang,

  • Hang,

    I don't see how changing the upper limit on the variable in the for loop would keep the task from running. If the task is configured the same in case 1 and case 2 then it should start with the ADC trigger. 

    This is just an empty loop. Actually, the program will never reach this loop because there is "if" condition wrapping this loop and the condition will always be false.

    Are you saying the compiler optimizes the loop away? If the compiler determines that the outer "if" is always false then it may eliminate the inner "for" since it will never be executed.

    How are you determining the task is not running? Please try putting a debug breakpoint in the task and see if the task halts.

  • Hi Lori,

    I determine that the task is not running based on:

     1. Adding break point using MDEBUGSTOP to the task. In case 1, CLA halts at the break point. In case 2, CLA does not halt.

     2. There is an incrementing variable at a first line of the task, like "cnt++", this variable should increase by 1 every time the task executes. In case 1, this value increases, in case 2, it doesn't.

    Are you saying the compiler optimizes the loop away? I

    This is unlikely. After turning optimization from 0 to off, the task does not run even in case 1. Additionally, I checked size of CLA program in case 1 and case 2 (with optimization) , the code size of case 2 is slightly larger than case 1, by tens of bytes. This empty loop should remain in the compiled codes to make these two differences.

    Thought I determined that the task is not running in case 2 based on the above two facts, there is another fact that the MIFR bit and MIOVF bit is toggling. My interpretation is CLA has entered the "task", but it actually jumps to some other address. But when I check the MVECT register, they are the same as case 1.

    Regards,

    Hang. 

  • Hi Lori,

    My customer has found a solution. Their CLA program space covers RAMLS1-6 and part of RAMLS7, and data space covers rest of LS7. After limiting the program space to only RAMLS1-6, CLA is entering task normally in case 2.

    Thanks,

    Hang.