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/LAUNCHXL-F28069M: Forcing/manually trigger CPU-Timer interrupt in the C28x

Part Number: LAUNCHXL-F28069M
Other Parts Discussed in Thread: C2000WARE

Tool/software: TI C/C++ Compiler

Hello Community,

I'm working the LAUNCHXL-F28069M and need to trigger a CPU-Timer by software using the following code:

    CpuTimer2Regs.TCR.bit.TRB=1;
    EALLOW;
    ENABLE__GLOBAL_INT();
    IFR |= 0x2000;
    //_asm(" OR	IFR,#0x2000");

As you can see, I reload the count on the CPU-timer  enable global interruption then it's corresponding interrupt flag in the IFR register. 
But, interrupt is not assert it. 

Any idea?

Regards,

Francisco 

  • Hi Francisco,

    I am not sure if you have configured PIE Vector table and interrupt enable is set properly.

     

    There is an example in C2000ware for CPU timer. Please import and try the example.

    C:\ti\C2000Ware_3_01_00_00\device_support\f2806x\examples\c28\cpu_timer

  • Hi Santosh,

    Let me give you wider view of my code. The CPU-Timer and PIE vector table is correctly configured, the CPU-timer sets its interrupt flag and the PIC vector table asserts the ISR_handler function periodically, nevertheless I want to assert or trigger the CPU-Timer interrupt flag manually, I don't care if  CPU-timer's count register has reach 0 counts.

    What I'm trying to do, in the code I shared in my first post, is to set the INT14 flag in the CPU's IFR register using a the following operation: (IFR OR 0x2000)
    This operation sets the flag  but the CPU does not assert the ISR function.

    Regards,

    Francisco

  • Francisco,

    There really isn't much to go wrong.  Providing INTM and IER are configured correctly the PC will go the the interrupt vector.

    Please set a break-point on the line:

    IFR |= 0x2000;

    Run to it, and check that INTM = 0 (check this bit in ST1 in the registers window) and that bit 14 in IER = 1.

    Regards,

    Richard 

  • Correction: IER bit 13 = 1.

  • Hi Richard,

    I agree with you, setting the INTM and IER to enable INT14 ( CPUT-timer2) and then, setting the bit13 inside the IFR register to trigger the Interrupt, it is the way;
    but, it did not triggers the interrupt... 

    So, I read the SPRU430F (CPU and instruction Set) on age 53, it saids: 

    On the C28x, interrupts can be triggered by software (the INTR, OR IFR, or TRAP instruction) 

    I decided to go for he first instruction the documents saids, INTR, and it works.

    Here it is the code that works

    CpuTimer2Regs.TCR.bit.TRB=1;		//Reload CPU-Timer 2 counter
    EALLOW;
    __asm(" INTR	INT14");			//Software trigger 
    //__asm(" OR	IFR,#0x2000");

    Regards