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.

Compiler/TMS320F28035: Cla1ForceTaskAndWait does not wait when other tasks are running

Part Number: TMS320F28035


Tool/software: TI C/C++ Compiler

Hi,

I think I already have a working solution to this issue but I wanted to make a post for others encountering this issue and to see if anyone can find an issue with my solution.

The problem I had was that when I called Cla1ForceTask8AndWait it would immediately return because (in my case) task 1 was running.  It helps to look at the definition:

#define Cla1ForceTask8andWait() __asm("  IACK  #0x0080");             \
                                __asm("  RPT #3 || NOP");             \
                                while(Cla1Regs.MIRUN.bit.INT8 == 1);

The macro only looks for MIRUN.bit.INT8.  If another task is running, task 8 goes into a pending state (INT8=0) and does not run until others are completed; meanwhile the code above has already returned to the caller.

My solution was to also check the MIFR flag register and wait if it is set.

#define Cla1ForceTask8andWaitFixed() __asm("  IACK  #0x0080");             \
                                __asm("  RPT #3 || NOP");             \
                                while(Cla1Regs.MIFR.bit.INT8 == 1);   \
                                while(Cla1Regs.MIRUN.bit.INT8 == 1);

Is there any issue with my approach that I am overlooking?

Thanks