<?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: Coldfire : timer reset every 256 ms. in ColdFire/68K Microcontrollers and Processors</title>
    <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Coldfire-timer-reset-every-256-ms/m-p/933030#M13794</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Everything is wrong with your code. It has at least one bug per line of code. You should read the Reference Manual carefully as this timer does not work the way you think it does.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; TPM2CNT = 0 ; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This register is *READ ONLY*. You can't write to it.&lt;BR /&gt; &amp;gt; TPM2SC_TOF = 0 ;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This bit is *READ ONLY* You can't write to it. It clears when you READ TPM2SC&lt;BR /&gt; &amp;gt; TPM2SC_CLKSx = 0x2;&amp;nbsp; This does not reset-and-start the timer. It stops-and-restarts&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Keep re-reading the chapter until you understand how this timer works. It is far more powerful and useful than the older ones that "count and reset". Otherwise, use the "Modulo Timer" which probably works the way you expect.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Jun 2019 23:35:34 GMT</pubDate>
    <dc:creator>TomE</dc:creator>
    <dc:date>2019-06-20T23:35:34Z</dc:date>
    <item>
      <title>Coldfire : timer reset every 256 ms.</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Coldfire-timer-reset-every-256-ms/m-p/933028#M13792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I use Codewarrior 10.6 with a coldifre MCF51CN128 and a multilink universal , and, when i use my 100 ms timer (defined well), it resets at 256 ms : here i toggle a led every 100 ms using that timer :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/87259iD495BAB741CEDCB1/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;as you can see , it stays 150 ms high instead of 100ms.The problem seems to come from a reset of the module after 256 ms.&lt;/P&gt;&lt;P&gt;my code looks like this :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TPM2CNT = 0 ; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt; TPM2SC_TOF = 0 ;&lt;BR /&gt; TPM2SC_CLKSx = 0x2;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//start 100 ms timer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LedBusy = 1 ;&amp;nbsp;&amp;nbsp;&amp;nbsp;// led set to high&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;while (TPM2SC_TOF != 1 ){}&amp;nbsp;&amp;nbsp;&amp;nbsp;// wait for the timer to end&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;TPM2SC_TOF = 0 ;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;//clear flag&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;TPM2SC_CLKSx = 0 ;&amp;nbsp;&amp;nbsp;&amp;nbsp;//stop timer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;LedBusy = 0 ;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// led set to&amp;nbsp;low&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;TPM2CNT = 0 ;&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;TPM2SC_TOF = 0 ;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TPM2SC_CLKSx = 0x2;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//start 100 ms timer&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;while (TPM2SC_TOF&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;!= 1 ){}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;// wait for the timer to end&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;TPM2SC_TOF = 0 ;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//clear flag&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;TPM2SC_CLKSx = 0 ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any ideas of what could be the problem? thanks for your help !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Adrien Segura&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Jun 2019 08:58:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Coldfire-timer-reset-every-256-ms/m-p/933028#M13792</guid>
      <dc:creator>adrien_segura12</dc:creator>
      <dc:date>2019-06-17T08:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: Coldfire : timer reset every 256 ms.</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Coldfire-timer-reset-every-256-ms/m-p/933029#M13793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ops ! i forgot something ! , if we do not see the timer reset a second time on the screenshot after 256 ms, it's due to my scope which is kinda bad. The timer does reset a second time on the second high state :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/87260i9ACB4342BCA5867B/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;thanks for your help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Jun 2019 09:02:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Coldfire-timer-reset-every-256-ms/m-p/933029#M13793</guid>
      <dc:creator>adrien_segura12</dc:creator>
      <dc:date>2019-06-17T09:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: Coldfire : timer reset every 256 ms.</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Coldfire-timer-reset-every-256-ms/m-p/933030#M13794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Everything is wrong with your code. It has at least one bug per line of code. You should read the Reference Manual carefully as this timer does not work the way you think it does.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; TPM2CNT = 0 ; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This register is *READ ONLY*. You can't write to it.&lt;BR /&gt; &amp;gt; TPM2SC_TOF = 0 ;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This bit is *READ ONLY* You can't write to it. It clears when you READ TPM2SC&lt;BR /&gt; &amp;gt; TPM2SC_CLKSx = 0x2;&amp;nbsp; This does not reset-and-start the timer. It stops-and-restarts&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Keep re-reading the chapter until you understand how this timer works. It is far more powerful and useful than the older ones that "count and reset". Otherwise, use the "Modulo Timer" which probably works the way you expect.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jun 2019 23:35:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Coldfire-timer-reset-every-256-ms/m-p/933030#M13794</guid>
      <dc:creator>TomE</dc:creator>
      <dc:date>2019-06-20T23:35:34Z</dc:date>
    </item>
  </channel>
</rss>

