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/TMS320F280049C: TMS320F280049C

Part Number: TMS320F280049C

Tool/software: Code Composer Studio

I am using the TI CLA code example "cla_ex1_background_task" project to model my code.  Task7 is a one time initialization task which work fine.  Task1 is a data acquisition task which will read a sample from an external ADC whne the hardware is ready.  Currently I am generating a data sample in Task1.  Task8 is a Background Task that processes the data acquired in Task1.  The Background Task is interrupted by Task1 every 33.3.uS.  The structure of the Background Task is a While loop with an if statement as such:

while(1)

  If (dataready)  //dataready is set in Task1 when a sample is read/generated

   {

    my processing code here (not sophisticated). There are some while loop conditional statements that are also not working.

   }

}

This code does not work. No matter what the state of the "dataready" variable is, the code falls through the if statement.  Maybe interrupting the Background Task is causing the problem?

The dataready variable is a global CLA variable. When I purposely set dataready to false/0, it still falls through.  Anyone have any ideas.  I'm missing something.  I have the algorithm working in CPU code.  Are there limitations in CLA code that I am not aware of?

Thanks

Steve Hadad

Ametek Aerospace

  • Steve,

    Is the variable dataready volatile?  If I understand it is modified in Task 1 which is outside of the context of Task 8 so it should be volatile or the compiler will try to optimize reading the variable out.

    Regards

    Lori

  • Hi Steve,

    I haven't heard back from you in a week so I am assuming the issue has been resolved.  If it has, please let me know by pressing the "verified answer" button.  If it has not, please respond back with additional information.

    If you have a new question, please start a new post.

    Thank you & Regards

    Lori

  • Sorry for the delay.  I didn't see your response.  The DataReady variable is global in the *.cla file.  The CLA file conytains all 3 tasks, Task1, Task7 and Task8(Background Task).  You think that the compiler will try to optimize this variable out.  How about if I shut off all optimizations?.

    Do you think this would also be true for variables placed in Cla->CPU RAM or CPU->Cla RAM?

    I am trying to code a State Machine into the Background task with tight loop floating point comparisons.  Change in voltage levels drive the State Machine form state-to-state.

    I am also have trouble seeing the value of variables placed in CLA DATA RAM when using the debugger connected to the CLA. I also cannot return the debugger to  the CPU after having connected to the CLA.

    I'll try your suggestion.

    Thanks

    Steve Haddad

    Ametek Aerospace

  • Steve,

    Rather than turn off all optimizations, it is better to identify variables that can be modified outside of the scope of a function by using volatile. The modification typically occurs by hardware, in an ISR or by another CPU/master (ex DMA or CLA). 

    You can flip off optimizations to experiment, however it will result in fairly poor code.  No optimizations really hampers the compiler's ability to be smart. We typically suggest setting --02 which leads to some nice optimizations and code that can be debugged.

    Regards

    Lori

  • Steve,

    I haven't heard back from you in a while so I am assuming the issue has been resolved.  If it has, please let me know by pressing the "verified answer" button.  If it has not, please respond back with additional information.

    If you have a new question, please start a new post.

    Thank you & Regards

    Lori

  • Lori,

    Thanks for your response.

    Steve Haddad

    Ametek Aerospace