<?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>Kinetis Software Development KitのトピックDiscovering LPTMR frequency</title>
    <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Discovering-LPTMR-frequency/m-p/618157#M6444</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;On my KL27Z, I have configured LPTMR0 to source its clock&amp;nbsp;from&amp;nbsp;kLPTMR_PrescalerClock_0 (which is MCGIRCLK, right?) like this:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class=""&gt;lptmr_config_t&lt;/SPAN&gt; lptmrConfig;&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;LPTMR_GetDefaultConfig(&amp;amp;lptmrConfig);&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp; lptmrConfig.prescalerClockSource = &lt;SPAN class=""&gt;kLPTMR_PrescalerClock_0&lt;/SPAN&gt;;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class=""&gt;// MCGIRCLK?&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;LPTMR_Init(LPTMR0, &amp;amp;lptmrConfig);&lt;/P&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;What is the correct way to find its&amp;nbsp;frequency? &amp;nbsp;I could do something like this:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;uint64_t&lt;/SPAN&gt; clock_freq_in_hz = CLOCK_GetFreq(kCLOCK_McgInternalRefClk);&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;... but I'm not sure that kCLOCK_McgInternalRefClk is the right constant (though empirically it appears to be correct). &amp;nbsp;Is there a more dependable way to get the LPTMR's clock frequency, perhaps one that uses the actual state of its configuration registers?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 25 Mar 2017 00:39:22 GMT</pubDate>
    <dc:creator>robertpoor</dc:creator>
    <dc:date>2017-03-25T00:39:22Z</dc:date>
    <item>
      <title>Discovering LPTMR frequency</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Discovering-LPTMR-frequency/m-p/618157#M6444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;On my KL27Z, I have configured LPTMR0 to source its clock&amp;nbsp;from&amp;nbsp;kLPTMR_PrescalerClock_0 (which is MCGIRCLK, right?) like this:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class=""&gt;lptmr_config_t&lt;/SPAN&gt; lptmrConfig;&lt;/P&gt;&lt;P class=""&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;LPTMR_GetDefaultConfig(&amp;amp;lptmrConfig);&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp; lptmrConfig.prescalerClockSource = &lt;SPAN class=""&gt;kLPTMR_PrescalerClock_0&lt;/SPAN&gt;;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class=""&gt;// MCGIRCLK?&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;LPTMR_Init(LPTMR0, &amp;amp;lptmrConfig);&lt;/P&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;What is the correct way to find its&amp;nbsp;frequency? &amp;nbsp;I could do something like this:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;uint64_t&lt;/SPAN&gt; clock_freq_in_hz = CLOCK_GetFreq(kCLOCK_McgInternalRefClk);&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;... but I'm not sure that kCLOCK_McgInternalRefClk is the right constant (though empirically it appears to be correct). &amp;nbsp;Is there a more dependable way to get the LPTMR's clock frequency, perhaps one that uses the actual state of its configuration registers?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 25 Mar 2017 00:39:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Discovering-LPTMR-frequency/m-p/618157#M6444</guid>
      <dc:creator>robertpoor</dc:creator>
      <dc:date>2017-03-25T00:39:22Z</dc:date>
    </item>
    <item>
      <title>Re: Discovering LPTMR frequency</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Discovering-LPTMR-frequency/m-p/618158#M6445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;This is the LPTME clock source from the 5.7.5 LPTMR clocking in RM of Kl27:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;IMG alt="pastedImage_1.png" src="https://community.nxp.com/t5/image/serverpage/image-id/17294iD46A5C6B1A62B981/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_1.png" /&gt;&lt;/SPAN&gt;Hope it can help you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void LPTMR_Init(LPTMR_Type *base, const lptmr_config_t *config)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; assert(config);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) &amp;amp;&amp;amp; FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Ungate the LPTMR clock*/&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CLOCK_EnableClock(s_lptmrClocks[LPTMR_GetInstance(base)]);&lt;BR /&gt;#endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Configure the timers operation mode and input pin setup */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; base-&amp;gt;CSR = (LPTMR_CSR_TMS(config-&amp;gt;timerMode) | LPTMR_CSR_TFC(config-&amp;gt;enableFreeRunning) |&lt;BR /&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPTMR_CSR_TPP(config-&amp;gt;pinPolarity) | LPTMR_CSR_TPS(config-&amp;gt;pinSelect));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Configure the prescale value and clock source */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; base-&amp;gt;PSR = (LPTMR_PSR_PRESCALE(config-&amp;gt;value) | LPTMR_PSR_PBYP(config-&amp;gt;bypassPrescaler) |&lt;BR /&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPTMR_PSR_PCS(config-&amp;gt;prescalerClockSource));&lt;BR /&gt;}&lt;/P&gt;&lt;PRE&gt;lptmrConfig.prescalerClockSource is used to write PCS bits in LPTMRx_PSR register.&lt;/PRE&gt;&lt;P&gt;Hope it can help you&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;XiangJun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2020 13:52:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Discovering-LPTMR-frequency/m-p/618158#M6445</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2020-11-02T13:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: Discovering LPTMR frequency</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Discovering-LPTMR-frequency/m-p/618159#M6446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I understand the hardware that generates the clock signals. &amp;nbsp;What I don't understand is what compiler constants correspond to those signals.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, in figure 5-5 that you show above, which signal corresponds to&amp;nbsp;kCLOCK_McgInternalRefClk? &amp;nbsp;And does&amp;nbsp;kLPTMR_PrescalerClock_0 correspond to&amp;nbsp;MCGIRCLK in that diagram? &amp;nbsp;(I agree that the _0 suffix suggests that it's the mux 00 input, but I'm not sure.) &amp;nbsp;Is lptmrConfig.prescalerClockSource responsible for setting the LPTMRx_PSR[PCS] source?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Etc...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The relationship between these constants and the register settings must be documented somewhere, or is that "documentation" the source code itself?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Apr 2017 01:21:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Discovering-LPTMR-frequency/m-p/618159#M6446</guid>
      <dc:creator>robertpoor</dc:creator>
      <dc:date>2017-04-13T01:21:50Z</dc:date>
    </item>
  </channel>
</rss>

