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/TMS320F28379D: Changing the CLA TASK SOURCE during the execution

Part Number: TMS320F28379D

Tool/software: Code Composer Studio

Hi everyone!

I'm getting some problems with my code, some context: 

Currently i'm using a ePWM (50khz) to trigger the ADC, and the End Of Conversion trigger the CLA task.

In my code, i have a Finite State Machine (with 6 states), and, in the state 2 i need to run only the task 2, and in the state 3, i need to run only the task 7. in the other states, i don't need the CLA.

The FMS seems like that:

case sync_pll:
                        sw1 = 0;
                        sw2 = 0;
                        if (DmaClaSrcSelRegs.CLA1TASKSRCSEL1.bit.TASK2 == 0)
                        {
                            EALLOW;
                            DmaClaSrcSelRegs.CLA1TASKSRCSEL1.bit.TASK2 = 1;
                            DmaClaSrcSelRegs.CLA1TASKSRCSEL2.bit.TASK7 = 0;
                            EDIS;
                        }
                        if ((vg_q1 > -1)&(vg_q1 <1))
                        {
                            estado = pre_charge;
                            vg_q1 = 10;
                        }
                    break;
                    case pre_charge:
                        sw1 = 1;
                        sw2 = 0;

                        if (fault == 1)
                        {
                            estado = fault_mode;
                        }

                        if ((vdc > 528)&(fault == 0))
                        {
                            estado = normal_mode;
                        }
                    break;
                    case normal_mode:
                        sw1 = 1;
                        sw2 = 1;
                        if (DmaClaSrcSelRegs.CLA1TASKSRCSEL2.bit.TASK7 == 0)
                        {
                            EALLOW;
                            DmaClaSrcSelRegs.CLA1TASKSRCSEL1.bit.TASK2 = 0;
                            DmaClaSrcSelRegs.CLA1TASKSRCSEL2.bit.TASK7 = 1;
                            EDIS;
                        }
                        if (fault == 1)
                        {
                            estado = fault_mode;
                        }
                        if ((boton_2 == 1)&(fault == 0))
                        {
                            estado = apagado;
                            boton_2 = 0;
                        }
                    break;

If i debug the code state by state from the beggening, it works, but my problem start when i turn off all the task (because in the other states i don't need that operations), so, when the state turn on the task again, it doesn't response. I don't know what is the problem, is something like if the CLA doesn't recognize the ADC_EOC trigger, so, never get into the task, i don´t know if i can change the task source over the execution of the code.

Any idea about what is happening??

i don't know if this is the worth way to do the FSM with a separately CLA task, turning on and off each task.

Any idea will be helpful
Thanks!!