timer callback latency issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

timer callback latency issue

Jump to solution
1,902 Views
vasudhevan
Contributor V

Hi,

    Board = imx rt 1064evk.

    If i run evkmimxrt1064_gpt_timer example code timer generating 1 second delay.

    Same code copied into my free rtos project but timer callback calling after 3-5 seconds delay.

GPT_GetDefaultConfig(&gptConfig);
    GPT_Init(ELMEASURE_GPT, &gptConfig);      /* Initialize GPT module */
    GPT_SetClockDivider(ELMEASURE_GPT, 3);    /* Divide GPT clock source frequency by 3 inside GPT module */
    gptFreq = ELMEASURE_GPT_CLK_FREQ;         /* Get GPT clock frequency */
    gptFreq /= 3;                             /* GPT frequency is divided by 3 inside module */
    GPT_SetOutputCompareValue(ELMEASURE_GPT, kGPT_OutputCompare_Channel1, gptFreq);  /* Set both GPT modules to 1 second duration */
    GPT_EnableInterrupts(ELMEASURE_GPT, kGPT_OutputCompare1InterruptEnable);    /* Enable GPT Output Compare1 interrupt */
    NVIC_SetPriority(GPT_IRQ_ID, 4U);/* Enable at the Interrupt */
    EnableIRQ(GPT_IRQ_ID);

    Why timer callback interrupt latency more ?

    How to solve this issue ?

 

    Thanks & Regards,

          Vasu

Labels (1)
0 Kudos
Reply
1 Solution
1,792 Views
vasudhevan
Contributor V

Hi jeremyzhou‌,

     GPT timer not working properly.

     Now i have used QTMR for generating 1sec callback function.

     QTMR timer working fine.

Thanks & Regards,

       Vasu

View solution in original post

3 Replies
1,791 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Vasudhevan G,

Thank you for your interest in NXP Semiconductor products and
for the opportunity to serve you.
I think the delay issue is caused by GPT interrupt handler be preempted by other tasks or interrupt handlers which have higher priority.
So I think you should increase the interrupt priority to assure it will be serviced immediately.

Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply
1,793 Views
vasudhevan
Contributor V

Hi jeremyzhou‌,

     GPT timer not working properly.

     Now i have used QTMR for generating 1sec callback function.

     QTMR timer working fine.

Thanks & Regards,

       Vasu

1,791 Views
vasudhevan
Contributor V

Hi jeremyzhou‌,

     Sorry for the late reply.

     Changed timer interrupt priority to 1.

     Still having same issue.

NVIC_SetPriority(GPT_IRQ_ID, 1U);/* Enable at the Interrupt */

 

Regards,

   Vasu 

0 Kudos
Reply