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.

Can interrupt assigned by Timer_create be configured?



Hello,

I am working with a C6670. I want a 10mS timer to trigger periodic processing so I have set up a timer as follows:

   Error_Block eb;
   Timer_Params timerParams;
   Timer_Handle timerHandle = 0;
   SSP_RESULT ret = SSP_OK;

   Error_init(&eb);
   Timer_Params_init(&timerParams);
   timerParams.period = 10000; /* 10 ms */
   timerHandle = Timer_create(Timer_ANY, TimerTickFunction, &timerParams, &eb);
   if (timerHandle == NULL)
   {
      PRINT_ERROR("Timer create failed\n");
      ret = TARGET_INTERRUPT_MANAGER_TIMER_CREATE_FAIL;
      TARGET_HLL_SetErrorEvent(&ret);
      return ret;
   }

   return ret;

The call to Timer_create was failing. Debugging showed that another interrupt assigned to interrupt number 4 was causing this problem:

Hwi_create(4, TempAlarmIsrHandler, &hwiParams, &eb);

If the interrupt number in this call to Hwi_create was changed from 4 to 6 then the timer was successfully created. After the call to Timer_create, this new field appeared in the ROV Hwi view: IntNum = 4, fxn = TImerTickFunction, eventId = 65 (Data manual shows that event 65 is TINTHn6 Local Timer interrupt high).

My question is why Timer_create uses IntNum = 4.  Is this configurable? I haven't been able to find a description of the default interrupt number in the timer documentation which I have looked through.

Thanks,
Geraldine

  • Geraldine,

    The following thread discussed the similar situation and it seems the default INT vector number of Timer module could be changed in "timerParams.intNum" field. There is some more info in the thread below:

    http://e2e.ti.com/support/embedded/bios/f/355/t/94262.aspx

    You may get more prompt response if you post the BIOS related questions to the BIOS forum. Hope it could help.

  • Thanks Steven, I have opened a new post in the BIOS forum. I cannot find a timerParams.intNum field. My new post is here: http://e2e.ti.com/support/embedded/bios/f/355/t/285430.aspx

    Regards,
    Geraldine

  • The question in the BIOS forum was answered (details below) but we have a follow-up question which I think belongs here because it is no longer about generic timers but about device-specific timers:

    NEW QUESTIONS

    Can you please confirm that this is correct: Using the device specific timer, is it correct to assume that all the timers created in an application use a single HW source?

    If this is correct, can I create as many timers as I want but only one HWI will be used for all the timers?

    Is it correct that the single hardware timer will update the intervals of all SYS/BIOS timers (created using Timer_create) every time a "tick" happens?

    RESPONSE TO POST IN BIOS FORUM

    Yes, the interrupt number for the timer is configurable.

    However you must use the device specific Timer module rather than the generic hal Timer module to achieve this.

    For your device, it appears to me that you need to use the ti.sysbios.timers.timer64.Timer module.

    This Timer module adds device specific functionality to the generic Timer module interface provided by the ti.sysbios.hal.Timer module.

    The Timer.Params of the timer64.Timer module does have an intNum field.

    Thanks,
    Geraldine

  • Geraldine,

    I think "Timer_create()" is trying to configure the real HW Timer specified by argument input "id":

    id — Timer id ranging from 0 to a platform specific value, or ANY.

    In C6670, there are 8 Timers available. If you want to create multiple Timer instances in application, you may need to specify different "id" numbers, which are targeting to different HW Timer resource. I think if you use same id for multiple Timer instances, the same HW Timer resource will be re-configured every time and you could not use those instances simultaneously.  
    If you want to use single HWI for multiple Timer events, you may need to use the combined event configuration in the CorePac interrupt controller. You may want to refer to the BIOS user guide for the implementation detail or post thread on BIOS forum, since it is still related to the BIOS application implementation details in my opinion.