free rtos gpt timer callback latency issue

cancel
Showing results for 
Search instead for 
Did you mean: 

free rtos gpt timer callback latency issue

292 Views
Contributor IV

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
8 Replies

92 Views
NXP TechSupport
NXP TechSupport

Hi Vasu:

 

For your gpt timer issue, I would suggest you check your gpt timer input clock source and  prescaler from regiter GPT_CR and GPT_PN.

In the official demo, the input clock source is ipg_clk.   The variable getFreq in the official demo is 75000000 .

If your project use the External clock as the input clock source, then the timer interrupt should be longer than 1 second.

 

Regards

Daniel

0 Kudos

96 Views
NXP TechSupport
NXP TechSupport

Hi Vasu:

Do you use the latest version SDK 2.7?

Regards

Daniel

0 Kudos

96 Views
Contributor IV

Any update ?

0 Kudos

96 Views
NXP TechSupport
NXP TechSupport

Hi  Vasu:

Sorry.

I copied the code into hello world example, and it works as expected.

pastedImage_2.png

Could you please attach your project here?

Regards

Daniel

0 Kudos

96 Views
Contributor IV

Hi Daniel,

      Sorry for the late reply.

      If run example code working fine.

      Same code copied into our free rtos based project timer callback function triggers every 2-5 seconds latency.

      Why timer callback function latency is more ?

Thanks & Regards,

         Vasu

0 Kudos

96 Views
NXP TechSupport
NXP TechSupport

Sorry I forgot to tell you,    my test result is ok to run the gpt timer in a freertos task.

For your case, I would suggest you toggle a LED in the gpt timer ISR to check the real result.

Or you can send me a simple project to me to reproduce your issue on my side.

Regards

Daniel

0 Kudos

96 Views
Contributor IV

Hi Daniel,

       Sorry for the late reply.

       timer callback latency issue This is my one thread.

       When i was using QTMR timer working fine for me.

       Still i am not able to find out why gpt timer is not working.

       I have checked all possible interrupt priority but still no success.

Thanks & Regards, 

      Vasu 

0 Kudos

96 Views
Contributor IV

Hi Daniel,

    I am using latest SDK 2.7.

Regards,

   Vasu

0 Kudos