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.

RTI Tick Timer

Other Parts Discussed in Thread: HALCOGEN

Hello,

Using HALCOGEN 4.0.0 and CCS 6, I'm just looking to implement an interrupt every millisecond to keep time, etc.

It looks to me like using RTI is the best way to do this.

In sys_main.c I have

    /* initialize real time interrupt driver */
    rtiInit();

    /* Enable RTI Compare 0 interrupt notification */
    rtiEnableNotification(rtiNOTIFICATION_COMPARE0);

    /* Enable IRQ - Clear I flag in CPS register */
    /* Note: This is usually done by the OS or in an svc dispatcher */
	_enable_IRQ();

    /* Start RTI Counter Block 0 */
	rtiStartCounter(rtiCOUNTER_BLOCK0);

It looks like the timer is incrementing in RTIFRC0, and the RTICOMP0 register is updating appropriately. But I don't see how to get an interrupt to execute. I thought that calling rtiEnableNotification() enables that interrupt, so I put my desired ISR code in rtiNotification() in notification.c. But that isn't doing the trick.

Could anyone explain what it is that I'm missing or doing wrong? Do I have to use RTI in conjuction with VIM?

Thanks,

Matt

  • Matt,
    Yes in the VIM Channel 0-31 tab you have to enable the RTI compare0 interrupt and select a level (should be IRQ not FIQ).

    In general this is how interrupts work.  There may be an interrupt enable in the peripheral but all the device level interrupts go to the VIM.  The VIM has the ability to adjust the priority of interrupts, enable/disable them, and route them to the IRQ or FIQ level [although you should keep FIQ reserved for the ESM interrupt IMO since it is non-maskable and use IRQ for the rest of the interrupts.]  Of course the VIM also generates the final interrupt request to the CPU and provides it with a vector pointing to the correct ISR as well.

  • Thank you for the quick reply. I enabled rtiCompare0Interrupt as IRQ with HALCOGEN and call vimInit() from main at initialization. It wasn't working at first, but now I see I must call vimInit() after ritInit(), and it works just as expected!

    Thanks!

  • That's interesting - I have never called vimInit(). I usually go and make sure the intterupt handler is named (i.e not "phantomInterrupt") and make sure it's enabled in VIM channel 0-31. Did you also click the "enable RTI driver" in the driver enable tab?

    I guess it doesn't matter much since it works! 

  • Yes, I did enable RTI driver in HALCOGEN, and I did ensure the interrupt handler was named and enabled.

    But like you said, it works.