<?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: i.mx28 system timer/clock problem in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/i-mx28-system-timer-clock-problem/m-p/236970#M18990</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;thanks for your answers,&lt;/P&gt;&lt;P&gt;that's exactly what I am locking for.&lt;/P&gt;&lt;P&gt;I changed the clock source and got a better resolution!&lt;/P&gt;&lt;P&gt;And yes, good point, I should protect my code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 27 Apr 2013 14:57:02 GMT</pubDate>
    <dc:creator>bernhardr_</dc:creator>
    <dc:date>2013-04-27T14:57:02Z</dc:date>
    <item>
      <title>i.mx28 system timer/clock problem</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-mx28-system-timer-clock-problem/m-p/236967#M18987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While testing the real-time ability of my imx287 I came across some problems.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First I created a latency histogram with cyclictest. The histogram I got looked like a comb.&lt;/P&gt;&lt;P&gt;Between 100 and 640us there were vertical lines with a distance of 32us to each other.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I tried to use ftrace, to get some more latency values.&lt;/P&gt;&lt;P&gt;I got this result:&lt;/P&gt;&lt;P&gt;function_graph: duration 0.000 or 10000.00us&lt;/P&gt;&lt;P&gt;irqsoff:&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; time 0us or 200000us&lt;/P&gt;&lt;P&gt;sched_event:&amp;nbsp;&amp;nbsp;&amp;nbsp; timestamp xxx0000&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The last interesting thing I found out was the result of a simple c-program.&lt;/P&gt;&lt;P&gt;I took two timestamps and calculated the difference:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="c++" name="code"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; struct timeval start, stop, diff; &amp;nbsp;&amp;nbsp;&amp;nbsp; gettimeofday(&amp;amp;start,NULL); &amp;nbsp;&amp;nbsp;&amp;nbsp; gettimeofday(&amp;amp;stop, NULL); &amp;nbsp;&amp;nbsp;&amp;nbsp; timersub(&amp;amp;stop, &amp;amp;start, &amp;amp;diff); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; clock_gettime(CLOCK_MONOTONIC, &amp;amp;start); &amp;nbsp;&amp;nbsp;&amp;nbsp; clock_gettime(CLOCK_MONOTONIC, &amp;amp;stop); &amp;nbsp;&amp;nbsp;&amp;nbsp; diff = time_diff(start, stop);&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;I run this program on different machines with this result:&lt;/P&gt;&lt;P&gt;TX28(i.mx287):&amp;nbsp;&amp;nbsp; mostly 0ns, sometimes 32250ns&lt;/P&gt;&lt;P&gt;RaspberryPi:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1000-5000ns&lt;/P&gt;&lt;P&gt;I7-870:&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; 200-500ns&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It looks like a 32us resolution to me.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The TX28-Starterkit is simular to the imx28evk. &lt;/P&gt;&lt;P&gt;I use the mainline kernel 3.3 with the tx28 patch. &lt;/P&gt;&lt;P&gt;It seems the patch doesn't change clock/timer code.&lt;/P&gt;&lt;P&gt;Is this phenomenon right for the i.mx28 or is there a bug in the kernel (port)?&lt;/P&gt;&lt;P&gt;Has anybody else recognised this problem using i.mx28?&lt;/P&gt;&lt;P&gt;Maybe someone could try this on the imx28evk.&lt;/P&gt;&lt;P&gt;Where could be the problem?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-336232" rel="nofollow noopener noreferrer" target="_blank"&gt;trace_timer_output.txt.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Mar 2013 17:57:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-mx28-system-timer-clock-problem/m-p/236967#M18987</guid>
      <dc:creator>bernhardr_</dc:creator>
      <dc:date>2013-03-22T17:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: i.mx28 system timer/clock problem</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-mx28-system-timer-clock-problem/m-p/236968#M18988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Bernhard&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Is it possible that the big difference you got on i.MX287 is caused by kernel scheduler? I meant when finishing the collection of start time, then this process is scheduled out, then when it scheduled back, the end time will be much larger. If so, can you try to add some protection to make sure there is no task switch between them, you can try to disable interrupt before executing this code piece. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Apr 2013 02:10:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-mx28-system-timer-clock-problem/m-p/236968#M18988</guid>
      <dc:creator>AnsonHuang</dc:creator>
      <dc:date>2013-04-12T02:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: i.mx28 system timer/clock problem</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-mx28-system-timer-clock-problem/m-p/236969#M18989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: helvetica, arial; font-size: 12px; background-color: #f8f8f8;"&gt;That is normal because &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: helvetica, arial; font-size: 12px; background-color: #f8f8f8;"&gt;&lt;SPAN class="GINGER_SOFATWARE_correct GINGER_SOFATWARE_noSuggestion"&gt;gettimeofday&lt;/SPAN&gt; in imx28 has 31.25&lt;SPAN class="GINGER_SOFATWARE_correct"&gt;usec&lt;/SPAN&gt; resolution.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: helvetica, arial; font-size: 12px; background-color: #f8f8f8;"&gt;The timer is sourced from 32000Hz clock, see mx28_timer_init&lt;SPAN class="GINGER_SOFATWARE_correct"&gt;(&lt;/SPAN&gt;) in kernel code.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: helvetica, arial; font-size: 12px; background-color: #f8f8f8;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: helvetica, arial; font-size: 12px; background-color: #f8f8f8;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: helvetica, arial; font-size: 12px; background-color: #f8f8f8;"&gt;Jacky&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Apr 2013 07:01:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-mx28-system-timer-clock-problem/m-p/236969#M18989</guid>
      <dc:creator>JackyAtFreescal</dc:creator>
      <dc:date>2013-04-26T07:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: i.mx28 system timer/clock problem</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-mx28-system-timer-clock-problem/m-p/236970#M18990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;thanks for your answers,&lt;/P&gt;&lt;P&gt;that's exactly what I am locking for.&lt;/P&gt;&lt;P&gt;I changed the clock source and got a better resolution!&lt;/P&gt;&lt;P&gt;And yes, good point, I should protect my code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Apr 2013 14:57:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-mx28-system-timer-clock-problem/m-p/236970#M18990</guid>
      <dc:creator>bernhardr_</dc:creator>
      <dc:date>2013-04-27T14:57:02Z</dc:date>
    </item>
    <item>
      <title>Re: i.mx28 system timer/clock problem</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-mx28-system-timer-clock-problem/m-p/236971#M18991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A _jive_internal="true" class="font-color-normal" href="https://community.nxp.com/people/bernhardr."&gt;Bernhard R. &lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are facing same issue!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you plz provide details on how you have changed clock source?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956969942ns&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance,&lt;/P&gt;&lt;P&gt;Pradip.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jun 2015 12:45:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-mx28-system-timer-clock-problem/m-p/236971#M18991</guid>
      <dc:creator>pradipk</dc:creator>
      <dc:date>2015-06-04T12:45:46Z</dc:date>
    </item>
  </channel>
</rss>

