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.

Question Regarding Example_2802xCpuTimer.c Example - on Piccolo Control Stick

Hello All,

When putting a watch (and breakpoint) on CpuTimer2.InterruptCount++; - instead of seeing the expected increment by 1 - I am seeing this increment by 2:

interrupt void cpu_timer2_isr(void)
{  EALLOW;
   CpuTimer2.InterruptCount++;
   // The CPU acknowledges the interrupt.
   PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
   EDIS;
}

That isn't what I expected.

Is there something I am missing here?

Thanks,
jwest

 

 

  • OK - CpuTimer2.InterruptCount++; instead of CpuTimer2.InterruptCount ...  :)

  • John -

    This is unusual behavior. One question I have is  are you running the examples as is? You should not need a PIEACK line for cpu timer 2, as it is tied to a CPU interrupt and not a PIE interrupt. From the example, the ISR's are as follows (only CPU Timer 0 needs to acknowlege the PIE):


    interrupt void cpu_timer0_isr(void)
    {
       CpuTimer0.InterruptCount++;

       // Acknowledge this interrupt to receive more interrupts from group 1
       PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
    }

    interrupt void cpu_timer1_isr(void)
    {
       CpuTimer1.InterruptCount++;
       // The CPU acknowledges the interrupt.
       EDIS;
    }

    interrupt void cpu_timer2_isr(void)
    {  EALLOW;
       CpuTimer2.InterruptCount++;
       // The CPU acknowledges the interrupt.
       EDIS;
    }

     

    Try setting your breakpoint AFTER the CpuTimer2.InterruptCount++; line (i.e. on the EDIS;)

  • CChang,

    I grabbed the ++ at the end of the variable - that was the real issue.

    I am using a Piccolo Control Stick - TMX '27 - seems somewhat slow to start but maybe that is the initial writing to FLASH - not 100% sure yet - but other than that the code is running - and yes, I have taken the demo code - have combined a few of the demos and have added an RTOS - still working on details but I do have the timer interrupts running.

    Thanks,
    johnw