<?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 MicrocontrollersのトピックCallback Overhead in KL03 running at 48 Mhz</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Callback-Overhead-in-KL03-running-at-48-Mhz/m-p/402106#M22367</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been trying to get an application to work which uses CMP0 to generate interrupt calls to the associated callback.&lt;/P&gt;&lt;P&gt;It is a bare metal application so no OS whatsoever. The only thing i am using is the generated code from the Processor expert to set up the CMP0 component and defining the call back function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to be able to measure the timing between respective falling and rising edges with a 1μs resolution, the shortest period between 2 edges is +/- 6 μs. the longest +/- 100 μs.&lt;/P&gt;&lt;P&gt;The 1 μs resolution is trivial, I use a TPM module set up as a free running counter counting at 1 MHz and read the current value using the "TPM_DRV_CounterRead" function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have checked that it does effectively work, when I apply a 1 kHz signal to my signal input It duly measures 500 μs ( +/- 1 ) between each rising and falling edge of the signal.&lt;/P&gt;&lt;P&gt;However, when I try to measure the much faster signals I need the minimal measured difference is +/- 20 μs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other than determining the difference between two edges my Callback function does little else so I guess that is not the problem.&lt;/P&gt;&lt;P&gt;Therefore I think there is a pretty large amount of overhead in calling the CallBack function. Does anyone have an idea as to how much overhead there is on a KL03 running at 48 MHz ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help very much appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 Apr 2015 14:12:16 GMT</pubDate>
    <dc:creator>filipdossche</dc:creator>
    <dc:date>2015-04-13T14:12:16Z</dc:date>
    <item>
      <title>Callback Overhead in KL03 running at 48 Mhz</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Callback-Overhead-in-KL03-running-at-48-Mhz/m-p/402106#M22367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been trying to get an application to work which uses CMP0 to generate interrupt calls to the associated callback.&lt;/P&gt;&lt;P&gt;It is a bare metal application so no OS whatsoever. The only thing i am using is the generated code from the Processor expert to set up the CMP0 component and defining the call back function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to be able to measure the timing between respective falling and rising edges with a 1μs resolution, the shortest period between 2 edges is +/- 6 μs. the longest +/- 100 μs.&lt;/P&gt;&lt;P&gt;The 1 μs resolution is trivial, I use a TPM module set up as a free running counter counting at 1 MHz and read the current value using the "TPM_DRV_CounterRead" function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have checked that it does effectively work, when I apply a 1 kHz signal to my signal input It duly measures 500 μs ( +/- 1 ) between each rising and falling edge of the signal.&lt;/P&gt;&lt;P&gt;However, when I try to measure the much faster signals I need the minimal measured difference is +/- 20 μs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other than determining the difference between two edges my Callback function does little else so I guess that is not the problem.&lt;/P&gt;&lt;P&gt;Therefore I think there is a pretty large amount of overhead in calling the CallBack function. Does anyone have an idea as to how much overhead there is on a KL03 running at 48 MHz ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help very much appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Apr 2015 14:12:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Callback-Overhead-in-KL03-running-at-48-Mhz/m-p/402106#M22367</guid>
      <dc:creator>filipdossche</dc:creator>
      <dc:date>2015-04-13T14:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: Callback Overhead in KL03 running at 48 Mhz</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Callback-Overhead-in-KL03-running-at-48-Mhz/m-p/402107#M22368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Filip&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are about 40 clocks overhead for the device to handle an interrupt and so I would expect about +/2us resolution for sampling to be possibe.&lt;/P&gt;&lt;P&gt;However it is generally recommended to use DMA to capture the samples to a buffer and then you will achieve the HW's resolution withot and potential interrupt response time issues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kinetis: &lt;A href="http://www.utasker.com/kinetis.html" title="http://www.utasker.com/kinetis.html"&gt;µTasker Kinetis support&lt;/A&gt;&lt;/P&gt;&lt;P&gt;KL03: &lt;A href="http://www.utasker.com/kinetis/FRDM-KL03Z.html" title="http://www.utasker.com/kinetis/FRDM-KL03Z.html"&gt;µTasker FRDM-KL03Z support&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;For the complete "out-of-the-box" Kinetis experience and faster time to market&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Apr 2015 16:00:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Callback-Overhead-in-KL03-running-at-48-Mhz/m-p/402107#M22368</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2015-04-13T16:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: Callback Overhead in KL03 running at 48 Mhz</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Callback-Overhead-in-KL03-running-at-48-Mhz/m-p/402108#M22369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't KNOW that the part you mention HAS the connection of CPM0 to FTM 'capture', but I expect Mark is EXPECTING you to be using that function, and hooking the capture-interrupts to DMA for 'fast servicing'.&amp;nbsp; You might get some insight into using "dual-edge-capture from a Comparator-feed" in my post on QEI and 'index capture' (although there repetition-rate was not a concern, so no DMA -- and the index pass through the comparator was 'undesirable but unavoidable'):&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/304806"&gt;QEI inputs, and index capture&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Apr 2015 16:56:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Callback-Overhead-in-KL03-running-at-48-Mhz/m-p/402108#M22369</guid>
      <dc:creator>egoodii</dc:creator>
      <dc:date>2015-04-13T16:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: Callback Overhead in KL03 running at 48 Mhz</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Callback-Overhead-in-KL03-running-at-48-Mhz/m-p/402109#M22370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Filip,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are using KL03, I have checked the website of KL03, it seems that Kl03 does not have DMA module.&lt;/P&gt;&lt;P&gt;In the case, I do not suggest you use callback function to read the TPM_CnV register once a capture events happen, the callback function is lengthy, so the callback function take a long time. I suggest you write the interrupt service routine yourself, do not use callback function. In the ISR of capture event, you just need to clear the TPM status register, read the TPM_CnV register, the code is simple, take less time.&lt;/P&gt;&lt;P&gt;I copy the code I develop based on K40 which use FTM, you can refer to it.&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;"&gt;void&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt; &lt;STRONG&gt;singleCapture&lt;/STRONG&gt;(&lt;/SPAN&gt;&lt;STRONG style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;"&gt;void&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: #3f7f5f;"&gt;//enable FTM0 clock&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt;SIM_SCGC6|=0x03000000; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: #3f7f5f;"&gt;//enable FTM0 and FTM0 module clock&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt;SIM_SCGC5=SIM_SCGC5|0x3E00; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: #3f7f5f;"&gt;//enable port A/B/C/D/E clock &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt;FTM0_SC=0x00;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt;FTM0_C0SC|=0x04;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: #3f7f5f;"&gt;//Capture on Rising Edge Only&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt;FTM0_COMBINE=0x00; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: #3f7f5f;"&gt;//clear &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: #3f7f5f;"&gt;//enable capture interrupt&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt;FTM0_C0SC|=0x40;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: #3f7f5f;"&gt;//enable CH0 interrupt&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt;FTM0_SC|=0x08;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: #3f7f5f;"&gt;//in ISR of capture interrupt, read the FTM_c0V register to get the capture value&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;"&gt;Void FTM0_ISR(void)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;"&gt;if&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt;(FTM0_STATUS&amp;amp;0x01)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;"&gt;if&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt;(FTM0_STATUS&amp;amp;0x01)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&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; tempPrev=temp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&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; temp=FTM0_C0V; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: #3f7f5f;"&gt;//read FTM0 counter register&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&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; diff=temp-tempPrev;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&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; FTM0_STATUS&amp;amp;=0xFE;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&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; &lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: #3f7f5f;"&gt;//read Hall sensor logic&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: #3f7f5f;"&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; //The FTM0_CH0 channel is multiplexed with GPIOC1, read GPIOC1 logic&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&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; var0=GPIOC_PDIR;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&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; GPIOC_PTOR=0x80;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&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; &lt;STRONG style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;"&gt;asm&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: #2a00ff;"&gt;"&lt;SPAN style="text-decoration: underline;"&gt;nop&lt;/SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt;); &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: #3f7f5f;"&gt;//set a break point here&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: Consolas; color: black;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0 0 1.0pt 0;"&gt; You have to configure the pin assignment.&lt;/P&gt;&lt;P style="padding: 0 0 1.0pt 0;"&gt;Hope it can help you.&lt;/P&gt;&lt;P style="padding: 0 0 1.0pt 0;"&gt;BR&lt;/P&gt;&lt;P style="padding: 0 0 1.0pt 0;"&gt;XiangJun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2015 02:46:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Callback-Overhead-in-KL03-running-at-48-Mhz/m-p/402109#M22370</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2015-04-14T02:46:03Z</dc:date>
    </item>
    <item>
      <title>Re: Callback Overhead in KL03 running at 48 Mhz</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Callback-Overhead-in-KL03-running-at-48-Mhz/m-p/402110#M22371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for all the info. I'll write my own ISR function and it will probably help a lot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While testing this I found another weird thing, I have simplified reading the TPM counter value just to make sure there is no overhead in that either.&lt;/P&gt;&lt;P&gt;I ended up with this bit of test code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static uint32_t NewCount = 0, PrevCount = 0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void CheckTimeDifference( void )&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; NewCount = TPM0_CNT; // get the latest microsecond counter value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; PrevCount = NewCount;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; NewCount = TPM0_CNT;&amp;nbsp; // get the latest microsecond counter value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; NewCount = TPM0_CNT;&amp;nbsp; // get the latest microsecond counter value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; NewCount = TPM0_CNT;&amp;nbsp; // get the latest microsecond counter value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; NewCount = TPM0_CNT;&amp;nbsp; // get the latest microsecond counter value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; NewCount = TPM0_CNT;&amp;nbsp; // get the latest microsecond counter value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; PrevCount = NewCount;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I put a breakpoint on the last line I end up with PrevCount holding the first counter value and NewCount holding the last value read.&lt;/P&gt;&lt;P&gt;the intermediate read operations are just there to evaluate the execution speed.&lt;/P&gt;&lt;P&gt;I know for sure that the core clock is at 48 MHz and the bus/flash clock is at 24 MHz.&lt;/P&gt;&lt;P&gt;I am equally sure that my TPM0 counter counts at a rate of 1 Microsecond, I have done plenty of testing to be 100% certain.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would expect the few single cycle read and store operations (at 48/24 MHz) to take well below 1 microsecond to execute but strangely enough they always end up taking 3 microseconds. &lt;/P&gt;&lt;P&gt;So: I think something is slowing down the processor but I have no idea what it might be.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2015 09:13:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Callback-Overhead-in-KL03-running-at-48-Mhz/m-p/402110#M22371</guid>
      <dc:creator>filipdossche</dc:creator>
      <dc:date>2015-04-14T09:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: Callback Overhead in KL03 running at 48 Mhz</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Callback-Overhead-in-KL03-running-at-48-Mhz/m-p/402111#M22372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xiangjun,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I implemented it just like you suggested and it makes a world of difference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am still not getting the full required performance though, instead of getting a minimum time of 20 microseconds between CMP0 interrupts I am getting near to +/- 5 microseconds.&lt;/P&gt;&lt;P&gt;As soon as I add some extra functionality to the ISR the minimum interval gets bigger again. To speed things up I have eliminated every sort of abstraction and I am reading peripheral registers directly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I could find a solution for the processor performance issue I think I could get something that actually works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In any case: thanks for the info, at least I ma partially there.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2015 11:51:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Callback-Overhead-in-KL03-running-at-48-Mhz/m-p/402111#M22372</guid>
      <dc:creator>filipdossche</dc:creator>
      <dc:date>2015-04-14T11:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: Callback Overhead in KL03 running at 48 Mhz</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Callback-Overhead-in-KL03-running-at-48-Mhz/m-p/402112#M22373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Whenever you are trying to count instructions, it is necessary to look at the raw assembly result of such a routine.&amp;nbsp; Can you give us that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2015 15:18:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Callback-Overhead-in-KL03-running-at-48-Mhz/m-p/402112#M22373</guid>
      <dc:creator>egoodii</dc:creator>
      <dc:date>2015-04-14T15:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: Callback Overhead in KL03 running at 48 Mhz</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Callback-Overhead-in-KL03-running-at-48-Mhz/m-p/402113#M22374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Filip,&lt;/P&gt;&lt;P&gt;Regarding the void CheckTimeDifference( void ) function, it is dependent on the FTM driving clock setting and the assembly code which the NewCount = TPM0_CNT; generated. If you set up the CLKS as 01 and PS as 000 in FTM_SC register, the 48MHz system clock will drive both the core and the FTM counter. The C instruction NewCount = TPM0_CNT is not a single instruction in assembly, it compile to multiple assembly instruction, you can see the assembly code in debugger.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it can help you explain "something is slowing down the processor".&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>Wed, 15 Apr 2015 03:56:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Callback-Overhead-in-KL03-running-at-48-Mhz/m-p/402113#M22374</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2015-04-15T03:56:02Z</dc:date>
    </item>
  </channel>
</rss>

