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.

Code Composer Studio v6.0.1 not producing correct results inside CpuTimer0 ISR

Other Parts Discussed in Thread: TMS320F28335, CONTROLSUITE

Dear All,


I am using Code Composer Studio v6.0 for developing embedded application on TMS320F28335 platform.

I am using CpuTimer0 to schedule an event. Inside CpuTimer0 ISR, i am setting a flag immediately after entering ISR. This flag is detected in while(1) super-loop for further processing. Flag doesn't sets immediately after entering ISR and hence processing doesn't starts after entering while(1) super-loop.

However, if a add a delay of one instruction cycle immediately after entering ISR and before setting flag, the flag is detected in while(1) super-loop and further processing starts.

Why is the delay required immediately after entering ISR and before setting the flag, so that the flag can be detected correctly in while(1) super-loop ?

I have pasted  the code below.

Thank you,

Sunil Sawant

/*----------------------- ISR code without delay - Start ------------------------- */

// INT1.7
interrupt void  TINT0_ISR(void)      // CPU-Timer 0
{
    // Insert ISR Code here
    tTMS320F2812ECanaTransactionStatusFlags.TransactionCycle.bit.b1CanTxnCycleStart = TRUE;

    // Clear Timer0 interrupt flag
    CpuTimer0Regs.TCR.bit.TIF = 1;

    // To receive more interrupts from this PIE group, acknowledge this interrupt
    PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
    IER |= M_INT1;    // Enable INT1
    EINT;
    return;


    // Next two lines for debug only to halt the processor here
    // Remove after inserting ISR Code
    //asm ("      ESTOP0");
    //for(;;);
}

/*----------------------- ISR code without delay - End ------------------------- */

/*----------------------- ISR code with delay - Start ------------------------- */

// INT1.7
interrupt void  TINT0_ISR(void)      // CPU-Timer 0
{
    // Insert ISR Code here

    // This is delay
    GpioDataRegs.GPBTOGGLE.bit.GPIOB0 = 1;


    tTMS320F2812ECanaTransactionStatusFlags.TransactionCycle.bit.b1CanTxnCycleStart = TRUE;

    // Clear Timer0 interrupt flag
    CpuTimer0Regs.TCR.bit.TIF = 1;

    // To receive more interrupts from this PIE group, acknowledge this interrupt
    PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
    IER |= M_INT1;    // Enable INT1
    EINT;
    return;


    // Next two lines for debug only to halt the processor here
    // Remove after inserting ISR Code
    //asm ("      ESTOP0");
    //for(;;);
}

/*----------------------- ISR code with delay - End ------------------------- */

  • Hello,
    Have you tried CPU Timer example from ControlSuite (controlSUITE\device_support\f2833x\v1xx\DSP2833x_examples_ccsv4\cpu_timer)? Does it work well?
    How about you put your code (setting your flag) in this example, is your flag detected in main loop like you expect?

    I am also wondering, why do you need to setup the interrupt again inside the ISR?
    These lines what I mean:
    IER |= M_INT1; // Enable INT1
    EINT;

    Another thing, do you set ERTM?

    Best regards,
    Maria
  • Hi Maria,




    Thank you for your reply to my post.


    I am using in my application, CpuTimer0 example from ControlSuite. Its working fine independently. However, after integrating CpuTimer0 with other peripherals, problems crop-up.

    I will explain you my application in brief, so that you will get clarity about my

    application and problem.

    I want to transmit CAN messages using eCAN peripheral every 130 microseconds.
    i am using CpuTimer0 for scheduling message transmission every 130 microseconds.
    After CpuTimer0 times-out, an interrupt is generated and ISR is invoked. I am setting a

    flag in the ISR, clearing CpuTimer0 interrupt flag TIF and exiting ISR.
    The program control will now return to while(1) super-loop. In the super-loop, i am

    polling 130 microseconds time-out flag and if set, a state machine transmits CAN message

    using eCAN peripheral. CAN ISR is invoked after successful message transmission. In CAN

    ISR, TA.n flag is cleared and CAN ISR is exited. This cycle repeats every 130

    microseconds.


    My observation is :

    CpuTimer0 interrupt and eCAN interrupt are contending. Hence CAN message transmission

    halts. How to resolve the interrupt contention ? Is there any intrrupt profiler in Code

    Composer Studio v3.3 or v6.0 ? Or Is there any other method to analyse task/interrupt

    execution sequence ?


    Regarding your question :

    Flag is set in CpuTimer0 ISR.


    Thank you again for highlighting interrupt enable inside CpuTimer0 ISR.
    I do not need nested interrupts. I will disable nested interrupts and test appplication.

    As you asked, I am not setting ERTM.




    Thank you,

    Sunil Sawant
  • SUNIL SAWANT said:
    CpuTimer0 interrupt and eCAN interrupt are contending

    I think in my observation, the interrupts are contended because you use  PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;

    You should use  PieCtrlRegs.PIEACK.all |= PIEACK_GROUP1;

    Can you try and tell me what the result is by using  PieCtrlRegs.PIEACK.all |= PIEACK_GROUP1; ?

    Thanks!

    Oh, also, please use ERTM just like the one in CPU TIMER ControlSuite example.

    Best regards,

    Maria