<?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>8-bit MicrocontrollersのトピックTPM3 Pulse generation in MC9S08AC60 - minimum pulse width issue</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/TPM3-Pulse-generation-in-MC9S08AC60-minimum-pulse-width-issue/m-p/629895#M22251</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to create single pulse output of between 100nanosec - 200nanosec width, at a fairly precisely timed 62 microsecond interval as part of porting a product code from the now obsolete MC908GP32 with older generation Timer module.&amp;nbsp; In the original MC908GP32 code, setting a target value of "0" width would still cause a 1-clock wide pulse to occur at the Timer modulo rollover.&amp;nbsp; So, running the bus clock at 7.34MHz with a Timer modulo setting of 430 could produce approximately 130-150nsec wide pulse at about 62microsecond intervals.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After making code changes to account for TPMV3 in the AC60, I end up with setting the match value = MODULO-1 for the individual Timer channel so that the pulse should only be 1 clock before modulo reset.&amp;nbsp; I find that the pulse width is 240 nanoseconds when running at the same 7.34MHz bus clock rate for TPM clock source.&amp;nbsp; 240nanoseconds is at least 40 ns too wide, so I increase the bus clock rate to 8.4MHz to see if it will help.&amp;nbsp; Leaving the modulo count values the same, I observe that the overall period is shortened by the expected 13.5% from&amp;nbsp; the 7.34MHz clock rate, but the pulse width remains at 240 nanoseconds.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I *must* have a pulse width of at least 100 ns and no more than 200 ns.&amp;nbsp; Is there another way I can use the timers to implement this which can produced narrower pulses, or is the minimum pulse width of the TPM V3 module approx 240 nanoseconds?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TPM1SC = 0x00;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Stop Main Timer1&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;TPM1MODH = 0x01; // Modulo 430 counts&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;TPM1MODL = 0xCC; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;TPM1C4VH = 0x01; // Match value at 429 counts&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;TPM1C4VL = 0xCB;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;TPM1C4SC = (unsigned char)(TPMXCNSC_CHNMSNB|TPMXCNSC_CHNELSNA);&amp;nbsp; // Configure pulse output&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;TPM1SC = (TPMXSC_CLKSA);&amp;nbsp; // Start Timer&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;do&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; // Wait for rollover to proceed to next step &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;d = TPM1SC;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;} while(((volatile)d &amp;amp; TPMXCNSC_CHNF) != TPMXCNSC_CHNF );&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{Edit}&amp;nbsp; As another experiment, I increased the ICG Clock rate to 18.886MHz (BusClock=9.4MHz) and I did observe some improvement in the pulse width -- it reduced down to approximately 213nsecs, so it appears to be approximately 2 clock cycles wide (TBusclk = 105.9nsecs) - if this is likely the best that it can do, I may have to do some more changes to the code and application.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Nov 2016 16:38:05 GMT</pubDate>
    <dc:creator>mfugere</dc:creator>
    <dc:date>2016-11-29T16:38:05Z</dc:date>
    <item>
      <title>TPM3 Pulse generation in MC9S08AC60 - minimum pulse width issue</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/TPM3-Pulse-generation-in-MC9S08AC60-minimum-pulse-width-issue/m-p/629895#M22251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to create single pulse output of between 100nanosec - 200nanosec width, at a fairly precisely timed 62 microsecond interval as part of porting a product code from the now obsolete MC908GP32 with older generation Timer module.&amp;nbsp; In the original MC908GP32 code, setting a target value of "0" width would still cause a 1-clock wide pulse to occur at the Timer modulo rollover.&amp;nbsp; So, running the bus clock at 7.34MHz with a Timer modulo setting of 430 could produce approximately 130-150nsec wide pulse at about 62microsecond intervals.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After making code changes to account for TPMV3 in the AC60, I end up with setting the match value = MODULO-1 for the individual Timer channel so that the pulse should only be 1 clock before modulo reset.&amp;nbsp; I find that the pulse width is 240 nanoseconds when running at the same 7.34MHz bus clock rate for TPM clock source.&amp;nbsp; 240nanoseconds is at least 40 ns too wide, so I increase the bus clock rate to 8.4MHz to see if it will help.&amp;nbsp; Leaving the modulo count values the same, I observe that the overall period is shortened by the expected 13.5% from&amp;nbsp; the 7.34MHz clock rate, but the pulse width remains at 240 nanoseconds.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I *must* have a pulse width of at least 100 ns and no more than 200 ns.&amp;nbsp; Is there another way I can use the timers to implement this which can produced narrower pulses, or is the minimum pulse width of the TPM V3 module approx 240 nanoseconds?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TPM1SC = 0x00;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Stop Main Timer1&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;TPM1MODH = 0x01; // Modulo 430 counts&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;TPM1MODL = 0xCC; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;TPM1C4VH = 0x01; // Match value at 429 counts&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;TPM1C4VL = 0xCB;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;TPM1C4SC = (unsigned char)(TPMXCNSC_CHNMSNB|TPMXCNSC_CHNELSNA);&amp;nbsp; // Configure pulse output&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;TPM1SC = (TPMXSC_CLKSA);&amp;nbsp; // Start Timer&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;do&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; // Wait for rollover to proceed to next step &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;d = TPM1SC;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;} while(((volatile)d &amp;amp; TPMXCNSC_CHNF) != TPMXCNSC_CHNF );&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{Edit}&amp;nbsp; As another experiment, I increased the ICG Clock rate to 18.886MHz (BusClock=9.4MHz) and I did observe some improvement in the pulse width -- it reduced down to approximately 213nsecs, so it appears to be approximately 2 clock cycles wide (TBusclk = 105.9nsecs) - if this is likely the best that it can do, I may have to do some more changes to the code and application.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Nov 2016 16:38:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/TPM3-Pulse-generation-in-MC9S08AC60-minimum-pulse-width-issue/m-p/629895#M22251</guid>
      <dc:creator>mfugere</dc:creator>
      <dc:date>2016-11-29T16:38:05Z</dc:date>
    </item>
  </channel>
</rss>

