<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>i.MX Processors中的主题 Re: imx8mp Cortex-M7 interrupt jitter</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/imx8mp-Cortex-M7-interrupt-jitter/m-p/1331750#M179328</link>
    <description>&lt;P&gt;Hi Doug&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for FreeRTOS interupt latencies on M cores one can look at AN12078&amp;nbsp; &lt;A id="relatedDocsClick_29" href="https://www.nxp.com/docs/en/application-note/AN12078.pdf" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;Measuring Interrupt Latency&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;and post issue (if necessary) on dedicated FreeRTOS forums:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.freertos.org/t/cortex-m0-interrupt-latency/1949" target="_blank" rel="noopener"&gt;https://forums.freertos.org/t/cortex-m0-interrupt-latency/1949&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Also for latency critical applications one can consider Real-time Edge Software&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.nxp.com/design/software/development-software/real-time-edge-software:REALTIME-EDGE-SOFTWARE" target="_blank"&gt;https://www.nxp.com/design/software/development-software/real-time-edge-software:REALTIME-EDGE-SOFTWARE&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards&lt;BR /&gt;igor&lt;/P&gt;</description>
    <pubDate>Mon, 30 Aug 2021 11:25:59 GMT</pubDate>
    <dc:creator>igorpadykov</dc:creator>
    <dc:date>2021-08-30T11:25:59Z</dc:date>
    <item>
      <title>imx8mp Cortex-M7 interrupt jitter</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/imx8mp-Cortex-M7-interrupt-jitter/m-p/1329789#M179108</link>
      <description>&lt;P&gt;I have a very simple program running on the M7 in the imx8mp using FreeRTOS from the the NXP 2.10.0 SDK.&amp;nbsp; I have GPT1 triggering an interrupt at 600 KHz and then inside the interrupt I set a GPIO.&amp;nbsp; The problem is the huge variability in servicing the the interrupt and setting the GPIO.&amp;nbsp; In the capture below the top channel is the GPT compare toggle output (which looks great).&amp;nbsp; The bottom channel is the GPIO which is set in the interrupt handler.&amp;nbsp; The latency fluctuates between 125ns and 325ns.&amp;nbsp; Since the M7 is running at 800 MHz (0.8 cycles/ns) this 200ns difference means sometimes there are 250 extra cycles used?&amp;nbsp; Something seems wrong.&lt;/P&gt;&lt;P&gt;Are there any tricks to reduce the variability.&amp;nbsp; I actually don't care if the latency is high but it has to be consistent.&amp;nbsp; For my application it would be fine if the latency was always 325ns.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot from 2021-08-25 13-47-31.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/154116i81B4C68BC462F2A7/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot from 2021-08-25 13-47-31.png" alt="Screenshot from 2021-08-25 13-47-31.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here is the code.&amp;nbsp; I don't believe any other interrupts besides the GPT are enabled.&amp;nbsp; Adding &lt;FONT face="courier new,courier" size="2"&gt;NVIC_SetPriority(GPT_IRQ_ID, 1U); &lt;/FONT&gt;had no effect.&amp;nbsp; The main() loop just sits in &lt;FONT face="courier new,courier" size="2"&gt;__WFI()&lt;/FONT&gt;.&amp;nbsp; This is a pretty simple program and don't see what is causing the interrupt variability.&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;volatile uint32_t data[255];&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;volatile uint8_t idx = 0;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;/*******************************************************************************&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;* Code&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;******************************************************************************/&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;void EXAMPLE_GPT_IRQHandler(void)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; EXAMPLE_LED_GPIO-&amp;gt;DR = data[idx];&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; GPT_ClearStatusFlags(EXAMPLE_GPT, kGPT_OutputCompare1Flag);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; idx++;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; __DSB();&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;/*!&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;* @brief Main function&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;*/&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;int main(void)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; gpt_config_t gptConfig;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; gpio_pin_config_t led_config = {kGPIO_DigitalOutput, 0, kGPIO_NoIntmode};&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; /* M7 has its local cache and enabled by default,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; * need to set smart subsystems (0x28000000 ~ 0x3FFFFFFF)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; * non-cacheable before accessing this address region */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; BOARD_InitMemory();&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; BOARD_RdcInit();&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; BOARD_InitBootPins();&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; BOARD_BootClockRUN();&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; CLOCK_SetRootMux(kCLOCK_RootGpt1, kCLOCK_GptRootmuxSysPll1Div2); /* Set GPT1 source to&amp;nbsp; SYSTEM PLL1 DIV2 400MHZ */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; CLOCK_SetRootDivider(kCLOCK_RootGpt1, 1U, 4U); /* Set root clock to 400MHZ / 4 = 100MHZ */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; GPT_GetDefaultConfig(&amp;amp;gptConfig);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; GPT_Init(EXAMPLE_GPT, &amp;amp;gptConfig);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; GPT_SetClockDivider(EXAMPLE_GPT, 1);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; GPT_SetOutputOperationMode(EXAMPLE_GPT, kGPT_OutputCompare_Channel1, kGPT_OutputOperation_Toggle); &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; GPT_SetOutputCompareValue(EXAMPLE_GPT, kGPT_OutputCompare_Channel1, 81);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; GPT_EnableInterrupts(EXAMPLE_GPT, kGPT_OutputCompare1InterruptEnable);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; //NVIC_SetPriority(GPT_IRQ_ID, 1U);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; EnableIRQ(GPT_IRQ_ID);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; GPT_StartTimer(EXAMPLE_GPT);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; GPIO_PinInit(EXAMPLE_LED_GPIO, EXAMPLE_LED_GPIO_PIN, &amp;amp;led_config);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; uint32_t val = 0;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; for(int i=0; i&amp;lt;255; i++) {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; data[i] = val;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; val = val == 0 ? (1&amp;lt;&amp;lt;20) : 0;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; }&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; while (true)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; __WFI();&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; }&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;}&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Aug 2021 21:31:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/imx8mp-Cortex-M7-interrupt-jitter/m-p/1329789#M179108</guid>
      <dc:creator>dcraw</dc:creator>
      <dc:date>2021-08-25T21:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: imx8mp Cortex-M7 interrupt jitter</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/imx8mp-Cortex-M7-interrupt-jitter/m-p/1331750#M179328</link>
      <description>&lt;P&gt;Hi Doug&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for FreeRTOS interupt latencies on M cores one can look at AN12078&amp;nbsp; &lt;A id="relatedDocsClick_29" href="https://www.nxp.com/docs/en/application-note/AN12078.pdf" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;Measuring Interrupt Latency&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;and post issue (if necessary) on dedicated FreeRTOS forums:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.freertos.org/t/cortex-m0-interrupt-latency/1949" target="_blank" rel="noopener"&gt;https://forums.freertos.org/t/cortex-m0-interrupt-latency/1949&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Also for latency critical applications one can consider Real-time Edge Software&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.nxp.com/design/software/development-software/real-time-edge-software:REALTIME-EDGE-SOFTWARE" target="_blank"&gt;https://www.nxp.com/design/software/development-software/real-time-edge-software:REALTIME-EDGE-SOFTWARE&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards&lt;BR /&gt;igor&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 11:25:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/imx8mp-Cortex-M7-interrupt-jitter/m-p/1331750#M179328</guid>
      <dc:creator>igorpadykov</dc:creator>
      <dc:date>2021-08-30T11:25:59Z</dc:date>
    </item>
  </channel>
</rss>

