<?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>topic Re: LPTIMER Problem in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTIMER-Problem/m-p/1079998#M57504</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Now it's better. Runs several minutes then at some point it stops blinking ( timer not incremented) and after a while starts again. I thought it happens in interrupt but when I set a break point at interrupt I see it's not related. Can't catch where it stops.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Apr 2020 06:29:31 GMT</pubDate>
    <dc:creator>john71</dc:creator>
    <dc:date>2020-04-28T06:29:31Z</dc:date>
    <item>
      <title>LPTIMER Problem</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTIMER-Problem/m-p/1079991#M57497</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First I setup the timer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static uint32_t added_val = 0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void LPTMR_Setup(void)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lptmr_config_t lptmr_config;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lptmr_config.timerMode = kLPTMR_TimerModeTimeCounter;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lptmr_config.pinSelect = kLPTMR_PinSelectInput_0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lptmr_config.pinPolarity = kLPTMR_PinPolarityActiveHigh;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lptmr_config.enableFreeRunning = true;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lptmr_config.bypassPrescaler = true;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lptmr_config.prescalerClockSource = kLPTMR_PrescalerClock_1; //1Khz - 1ms&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lptmr_config.value = kLPTMR_Prescale_Glitch_0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPTMR_Init(LPTMR0, &amp;amp;lptmr_config);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPTMR_SetTimerPeriod(LPTMR0, 0xFFFF);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPTMR_EnableInterrupts(LPTMR0, kLPTMR_TimerInterruptEnable);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; EnableIRQ(LPTMR0_IRQn);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPTMR_StartTimer(LPTMR0);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uint32_t LPTMR_GetCount(void)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;uint32_t count = LPTMR_GetCurrentTimerCount(LPTMR0);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;uint32_t total_ms = count + added_val;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return total_ms;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;void LPTMR0_IRQHandler(void)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPTMR_ClearStatusFlags(LPTMR0, kLPTMR_TimerCompareFlag);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; added_val += 0xFFFF;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Workaround for TWR-KV58: because write buffer is enabled, adding&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; memory barrier instructions to make sure clearing interrupt flag completed&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; before go out ISR&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; __DSB();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; __ISB();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then&amp;nbsp; I check it&lt;/P&gt;&lt;P&gt;while(1)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;time_stamp = LPTMR_GetCount();&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (time_stamp &amp;gt;= t1)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;t1 = time_stamp + PERIOD_1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;GPIO_PortToggle(LED_PORT, (1&amp;lt;&amp;lt;LEDR_PIN));&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (time_stamp &amp;gt;= t2)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t2 = time_stamp + PERIOD_2;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GPIO_PortToggle(LED_PORT, (1&amp;lt;&amp;lt;LEDB_PIN));&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (time_stamp &amp;gt;= t3)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t3 = time_stamp + PERIOD_3;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GPIO_PortToggle(LED_PORT, (1&amp;lt;&amp;lt;LEDG_PIN));&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (time_stamp &amp;gt;= t4)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t4 = time_stamp + PERIOD_4;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GPIO_PortToggle(LED_PORT, (1&amp;lt;&amp;lt;LEDO_PIN));&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I see LEDs blinking at right intervals...till first interrupt occurs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the fix in the interrupt routine doesn't work?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Apr 2020 07:37:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTIMER-Problem/m-p/1079991#M57497</guid>
      <dc:creator>john71</dc:creator>
      <dc:date>2020-04-26T07:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: LPTIMER Problem</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTIMER-Problem/m-p/1079992#M57498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;uint32_t maximum value is 0xFFFFFFFF. So it takes 2^32 / 0xFFFF = 65535 interrupts to overflow uint32_t.&lt;/P&gt;&lt;P&gt;I set a breakpoint on added_val += 0xFFFF; and I see&lt;/P&gt;&lt;P&gt;1st interrupt - added_val = 65535 (0xFFFF * 1)&lt;/P&gt;&lt;P&gt;2nd interrupt - added_val = 131070 (0xFFFF * 2)&lt;/P&gt;&lt;P&gt;3d interrupt - added_val = 196605 (0xFFFF * 3)&lt;/P&gt;&lt;P&gt;In order to keep total milliseconds count I add a current value to the accumulated value uint32_t total_ms = count + added_val;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2020 06:44:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTIMER-Problem/m-p/1079992#M57498</guid>
      <dc:creator>john71</dc:creator>
      <dc:date>2020-04-27T06:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: LPTIMER Problem</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTIMER-Problem/m-p/1079993#M57499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;&lt;DIV class="" style="border: 0px; font-weight: inherit; margin: 20px 0px;"&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;Hi,&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;I am sorry that I mistake the max value. Can you explain your question in detail? What's your board,IDE and SDK?&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;&lt;/DIV&gt;&lt;DIV class="" style="border: 0px; font-weight: inherit; font-size: 14px; margin: 20px 0px 0px;"&gt;&lt;DIV class="" data-comment-id="1303793" style="color: #646464; border: 0px; font-weight: inherit; font-size: 0.8571rem;"&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2020 07:01:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTIMER-Problem/m-p/1079993#M57499</guid>
      <dc:creator>nxf56274</dc:creator>
      <dc:date>2020-04-27T07:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: LPTIMER Problem</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTIMER-Problem/m-p/1079994#M57500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My board - TWR-KV58F220M, the IDE - MCUExpresso. The problem - LEDs stop blinking after the first interrupt (also I see the interrupt occurs and added_val updated correctly).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2020 08:19:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTIMER-Problem/m-p/1079994#M57500</guid>
      <dc:creator>john71</dc:creator>
      <dc:date>2020-04-27T08:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: LPTIMER Problem</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTIMER-Problem/m-p/1079995#M57501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;Hi,&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;When the &lt;SPAN&gt;interrupt&lt;SPAN&gt;&amp;nbsp;runs over, what the &lt;SPAN style="background-color: #ffffff;"&gt;time_stamp&amp;nbsp;&lt;/SPAN&gt;value is. And what's the comparison result&amp;nbsp;with t1, t2 ,t3, t4?&amp;nbsp;If your&amp;nbsp; "&lt;SPAN style="background-color: #ffffff;"&gt;time_stamp"&amp;nbsp;is bigger than t1,t2,t3,t4, this may cause some problems.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2020 08:33:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTIMER-Problem/m-p/1079995#M57501</guid>
      <dc:creator>nxf56274</dc:creator>
      <dc:date>2020-04-27T08:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: LPTIMER Problem</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTIMER-Problem/m-p/1079996#M57502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When I set a break point to uint32_t count = LPTMR_GetCurrentTimerCount(LPTMR0); - count&amp;nbsp; doesn't change its value. LPTMR_GetCurrentTimerCount doesn't work correctly. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2020 09:40:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTIMER-Problem/m-p/1079996#M57502</guid>
      <dc:creator>john71</dc:creator>
      <dc:date>2020-04-27T09:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: LPTIMER Problem</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTIMER-Problem/m-p/1079997#M57503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;Hi,&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;lptmr_config.enableFreeRunning = true; Try to change it to false.&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2020 02:17:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTIMER-Problem/m-p/1079997#M57503</guid>
      <dc:creator>nxf56274</dc:creator>
      <dc:date>2020-04-28T02:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: LPTIMER Problem</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTIMER-Problem/m-p/1079998#M57504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Now it's better. Runs several minutes then at some point it stops blinking ( timer not incremented) and after a while starts again. I thought it happens in interrupt but when I set a break point at interrupt I see it's not related. Can't catch where it stops.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2020 06:29:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTIMER-Problem/m-p/1079998#M57504</guid>
      <dc:creator>john71</dc:creator>
      <dc:date>2020-04-28T06:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: LPTIMER Problem</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTIMER-Problem/m-p/1079999#M57505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;Hi,&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;&lt;SPAN&gt;"added_val" may overflow. "&lt;SPAN style="background-color: #ffffff;"&gt;&amp;nbsp;count + added_val&lt;/SPAN&gt;"&amp;nbsp; and "&lt;SPAN style="background-color: #ffffff;"&gt;&amp;nbsp;time_stamp + PERIOD_1&lt;/SPAN&gt;" may overflow. We should avoid. We would better reset these value in several interrupts. For example, after 100 interrupts, we reset these variable to initial value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;&lt;SPAN&gt;You means timer does not increase. We can test it without debug.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 15px;"&gt;static uint32_t preValue = 0;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 15px;"&gt;&lt;SPAN&gt;static uint32_t curValue = 0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 15px;"&gt;uint32_t LPTMR_GetCount(void)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;uint32_t count = LPTMR_GetCurrentTimerCount(LPTMR0);&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 15px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;curValue =&amp;nbsp;&lt;SPAN&gt;count&amp;nbsp;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 15px;"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(&lt;SPAN style="background-color: #ffffff;"&gt;curValue&amp;nbsp;!=&amp;nbsp;preValue&amp;nbsp;&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 15px;"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 15px;"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;preValue&amp;nbsp;=&amp;nbsp;curValue&amp;nbsp;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 15px;"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;count + added_val;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 15px;"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 15px;"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(&lt;SPAN style="background-color: #ffffff;"&gt;curValue&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&amp;nbsp; ==&amp;nbsp;preValue&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 15px;"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 15px;"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;PRINTF("value %x\r\n",count);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 15px;"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while(1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 15px;"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 15px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2020 06:59:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/LPTIMER-Problem/m-p/1079999#M57505</guid>
      <dc:creator>nxf56274</dc:creator>
      <dc:date>2020-04-28T06:59:16Z</dc:date>
    </item>
  </channel>
</rss>

