<?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>MQX Software SolutionsのトピックRe: MQX time between ticks</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-time-between-ticks/m-p/406028#M13604</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your answer. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It was not really obvious in the documentation.&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;Guillaume Tiffineau&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Apr 2015 15:57:00 GMT</pubDate>
    <dc:creator>guillaumetiffin</dc:creator>
    <dc:date>2015-04-15T15:57:00Z</dc:date>
    <item>
      <title>MQX time between ticks</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-time-between-ticks/m-p/406024#M13600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have questions about ticks in MQX.&lt;/P&gt;&lt;P&gt;I didn't find the time between two ticks in MQX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a k60 @100 MHz&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to know the time between two ticks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to know exactly the time elapsed between two ticks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to use the functions _time_delay_ticks and _time_diff_nanoseconds.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I call the function "_time_delay_ticks(10)", what is the real delay?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I want to measure times under the 5ms period, can I use the function _time_diff_nanoseconds()? Is it return the exact number of nanosecond elapsed or only a multiple of 5ms ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I have a resolution around 10 nanoseconds ?&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;Guillaume&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2015 09:35:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-time-between-ticks/m-p/406024#M13600</guid>
      <dc:creator>guillaumetiffin</dc:creator>
      <dc:date>2015-04-14T09:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: MQX time between ticks</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-time-between-ticks/m-p/406025#M13601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guillaume,&lt;/P&gt;&lt;P&gt;A couple of posts that I think answer your question.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/339004"&gt;Bug report: _time_delay() not the good delay.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/334266"&gt;elapsed time in nanoseconds&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cut-n-Paste from second post:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Every Kinetis device uses the SysTick timer as its master clock source.&amp;nbsp; Different Kinetis devices can be clocked at different frequencies.&amp;nbsp; K70 @120 or 150MHz, K60 @100, etc…&amp;nbsp; So the range is 50-150MHz depending on the device.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;In MQX the SysTick timer is clocked at the core frequency.&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Ex: Using the K70-120MHz as my example 120MHz has an 8.333 nanosecond/SysTick.&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;MQX calculates the SysTick timer count down value to generate an interrupt every 5ms.&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Ex: 5ms/8.333nanoseconds = 600024 SysTicks.&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;When you are calling the &lt;SPAN style="text-decoration: underline;"&gt;time&lt;/SPAN&gt;get_nanoseconds() function in the PSP time.c file, it is grabbing the SysTick counter value and scaling it to return a value in nanoseconds since the last MQX Tick occurred.&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;This value is based off of hardware so it is real.&amp;nbsp; But the resolution is based on the SysTick counting rate which ic equal to the process core frequency.&amp;nbsp; Faster processor core frequency means better resolution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;The accuracy of the &lt;SPAN style="text-decoration: underline;"&gt;time&lt;/SPAN&gt;get_microseconds() function call is better than the&lt;SPAN style="text-decoration: underline;"&gt;time&lt;/SPAN&gt;get_nanoseconds() function call since there are 120 SysTick clocks per microsecond.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;With respect to SW1.&amp;nbsp; I was just placing a breakpoint in the btn_kernel_isr() routine as a place to stop and then use IDE to inspect the variable window.&amp;nbsp; Nothing more.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;With respect to your code to get the TICKS from start of MQX I modified it to the following:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;#if 1&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //DES 1=test, 0=default code&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&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; MQX_TICK_STRUCT tickstruct;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&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; uint32 ticknum[2];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&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; &lt;SPAN style="text-decoration: underline;"&gt;time&lt;/SPAN&gt;get_elapsed_ticks(&amp;amp;tickstruct);&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&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; ticknum[0] = tickstruct.TICKS[0];&amp;nbsp; //DES lower 32-bits&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&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; ticknum[1] = tickstruct.TICKS[1];&amp;nbsp; //DES upper 32-bits&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&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; printf("\n ticknum64 = %u%u\n", ticknum[1], ticknum[0]);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //DES 64-bit TICKS value.&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;#endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2015 15:06:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-time-between-ticks/m-p/406025#M13601</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2015-04-14T15:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: MQX time between ticks</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-time-between-ticks/m-p/406026#M13602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I well understand the post, if my K60 is clocked at 100 MHz, I have a tick each 10 nanoseconds.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if I use the function _time_delay_ticks(10), I will have a delay of 100 nanoseconds. Is it right or not?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And if I use the function _time_diff_nanoseconds(), I will have an accuracy of 10 nanoseconds. Is it right or not?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because in some posts I understood that everithing is clocked with the minimum timer wich is 5 ms by default. So the minimum accuracy is 5 ms. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your post I understand that the accuracy is 10 nanoseconds. This is better for me if I want to measure elapsed time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you know in which case the things are clocked by the 5 ms timer?&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;Guillaume&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2015 15:28:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-time-between-ticks/m-p/406026#M13602</guid>
      <dc:creator>guillaumetiffin</dc:creator>
      <dc:date>2015-04-14T15:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: MQX time between ticks</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-time-between-ticks/m-p/406027#M13603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guillaume,&lt;/P&gt;&lt;P&gt;It's convoluted so hopefully I can clear it up correctly.&lt;/P&gt;&lt;P&gt;If K60 is configured for 100MHz core frequency the SysTick timer is clocked at that rate.&amp;nbsp; The resolution is 10ns.&lt;/P&gt;&lt;P&gt;The MQX RTOS TICK is setup to be 200 ticks/sec (a TICK every 5ms...i.e. the heart beat).&amp;nbsp; So the SysTick timer gets configured to count down to zero and generate TICK interrupt every 5ms.&amp;nbsp; &lt;/P&gt;&lt;P&gt;MQX function calls can read that high speed SysTick timer and return very accurate results.&lt;/P&gt;&lt;P&gt;The various _time_delay() MQX calls strictly are working off the TICK counter (the 5 ms heart beat).&amp;nbsp; &lt;/P&gt;&lt;P&gt;A _time_delay_ticks(10) will block the current task 10xTICK or 10x5ms=50ms.&lt;/P&gt;&lt;P&gt;A _time_delay(50) does the equivalent delay of 50ms.&lt;/P&gt;&lt;P&gt;So a _time_delay(1) really will round up to 1 TICK or 5ms.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2015 16:08:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-time-between-ticks/m-p/406027#M13603</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2015-04-14T16:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: MQX time between ticks</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-time-between-ticks/m-p/406028#M13604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your answer. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It was not really obvious in the documentation.&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;Guillaume Tiffineau&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Apr 2015 15:57:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-time-between-ticks/m-p/406028#M13604</guid>
      <dc:creator>guillaumetiffin</dc:creator>
      <dc:date>2015-04-15T15:57:00Z</dc:date>
    </item>
  </channel>
</rss>

