<?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: PWM Duty Cycle Issue - Kinetis L ( MKL26Z128 ) in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/PWM-Duty-Cycle-Issue-Kinetis-L-MKL26Z128/m-p/304205#M12862</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear&amp;nbsp;&lt;A _jive_internal="true" data-content-finding="Community" data-userid="11074" data-username="mjbcswitzerland" href="https://community.nxp.com/people/mjbcswitzerland" style="color: #3d9ce7; background-color: #ffffff; border: 0px; font-weight: 200; text-decoration: none; font-size: 1.286rem;"&gt;Mark Butcher&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp; &amp;nbsp;I meet the issue like this , KL02Z for PWM Using&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;When C0V write 1 then Error happened , i has already send this community to Customer and tell them avoid 1 in CnV , solve the issue .but they hope NXP can provide a document to explain this .&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Could you provide me Errata document ? and is this issue will make other module error ?&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Which other Kinetis parts has the same issue ?&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Thanks !!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 01 Oct 2018 02:48:39 GMT</pubDate>
    <dc:creator>ellenlin</dc:creator>
    <dc:date>2018-10-01T02:48:39Z</dc:date>
    <item>
      <title>PWM Duty Cycle Issue - Kinetis L ( MKL26Z128 )</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/PWM-Duty-Cycle-Issue-Kinetis-L-MKL26Z128/m-p/304203#M12860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everyone!&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to use TPM2 timer (Edge-Aligned PWM Mode) as DAC for audio generating. &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;The reason for this solution is that I need more than one channel for my application (simple Wave player and tone generator). &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need at least two channels and I haven't been able to successfully multiplex output of DAC (there is only one channel in MKL26Z128).&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Issue:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've written easy app for generating sine wave with dev kit FRDM-KL25Z (very similar processor). In this application I'm using two timers TPM1 and TPM2:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- TPM1 is used for PWM duty cycle changing with sampling frequency 8 KHz.&lt;/P&gt;&lt;P&gt;- TPM2 is used in Edge-Aligned PWM Mode, counting with frequency c. 93 Khz.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Everything works fine except one state. When I want to set CnV ( PWM compare register ) with value 1, there is unexpected glitch in PWM duty cycle. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;PWM duty cycle should be close to 0%, but sometimes instead of 0%, there is PWM duty cycle 100%.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;The result of this glitch is shown in figure below.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="11987_11987.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/119807i996E78F004A9BE0C/image-size/large?v=v2&amp;amp;px=999" role="button" title="11987_11987.png" alt="11987_11987.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="sine.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/43753i9D437221FC3A8E95/image-size/large?v=v2&amp;amp;px=999" role="button" title="sine.png" alt="sine.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Also I've attached whole project, where I'm generating sine wave. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;In combination with PWM I'm using R C low pass filter (R = 10k, C = 100n). Output of PWM is on pins PTE23 and PTE22.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are there any rules, for setting TPMx_CnV register? What am I doing wrong?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ugly, but simple solution to this is instead of 1 set CnV with value 2, but I don't really want this.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jan&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-337475"&gt;pwm.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 May 2014 09:33:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/PWM-Duty-Cycle-Issue-Kinetis-L-MKL26Z128/m-p/304203#M12860</guid>
      <dc:creator>merlin69</dc:creator>
      <dc:date>2014-05-23T09:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: PWM Duty Cycle Issue - Kinetis L ( MKL26Z128 )</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/PWM-Duty-Cycle-Issue-Kinetis-L-MKL26Z128/m-p/304204#M12861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is something strange with the way that the TPM updates the value written to CnV when the value there is already very small.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In edge aligned mode your write won't immediately update the value in the register since this is synchronised to the counter match (that is, the value becomes only valid at the end of the PWM period so that the counter value can't already be higher than the new value, for example).&lt;/P&gt;&lt;P&gt;The problem only occurs when you already have 1 in the CnV register and you write "another" 1 - it is not that there is a 100% duty-cycle period taking place because the error is not large enought (there would be a bigger jump) but the PWM duty cycle value does somehow glitch.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is possibly an errata that hasn't been reported/documented yet but there is a simple workaround:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before writing a new value, check whether it is the same as the one already there and if it is, do nothing - then you should find that also writing 1 (which works the first time) when 1 is already there can't disturb.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Therefore, in the routine that is writing the new CnV value do&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if (new_value != CnV) {&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CnV = new_value;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and you should find your sine wave will then be glitch free!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Note however that this will work in the case of a sine wave with a few values of 1 at the lowest wave crest where the write can be filtered. In the case of code writing 1,2,1,2,1,2 the filtering is not possible and the effect is also seen. Therefore the only complete workaround is indeed to avoid writing the value 1 (or 0) and scale the signal range to be (2..max. + 1), which is also not usually a big deal&lt;/EM&gt;&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;&lt;/P&gt;&lt;P&gt;&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 May 2014 01:01:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/PWM-Duty-Cycle-Issue-Kinetis-L-MKL26Z128/m-p/304204#M12861</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-05-24T01:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: PWM Duty Cycle Issue - Kinetis L ( MKL26Z128 )</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/PWM-Duty-Cycle-Issue-Kinetis-L-MKL26Z128/m-p/304205#M12862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear&amp;nbsp;&lt;A _jive_internal="true" data-content-finding="Community" data-userid="11074" data-username="mjbcswitzerland" href="https://community.nxp.com/people/mjbcswitzerland" style="color: #3d9ce7; background-color: #ffffff; border: 0px; font-weight: 200; text-decoration: none; font-size: 1.286rem;"&gt;Mark Butcher&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp; &amp;nbsp;I meet the issue like this , KL02Z for PWM Using&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;When C0V write 1 then Error happened , i has already send this community to Customer and tell them avoid 1 in CnV , solve the issue .but they hope NXP can provide a document to explain this .&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Could you provide me Errata document ? and is this issue will make other module error ?&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Which other Kinetis parts has the same issue ?&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Thanks !!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Oct 2018 02:48:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/PWM-Duty-Cycle-Issue-Kinetis-L-MKL26Z128/m-p/304205#M12862</guid>
      <dc:creator>ellenlin</dc:creator>
      <dc:date>2018-10-01T02:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: PWM Duty Cycle Issue - Kinetis L ( MKL26Z128 )</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/PWM-Duty-Cycle-Issue-Kinetis-L-MKL26Z128/m-p/304206#M12863</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;You can get errata from &lt;A class="link-titled" href="https://www.nxp.com/products/processors-and-microcontrollers/arm-based-processors-and-mcus/kinetis-cortex-m-mcus/l-seriesultra-low-powerm0-plus/kinetis-kl0x-48-mhz-entry-level-ultra-low-power-microcontrollers-mcus-based-on-arm-cortex-m0-plus-core:KL0x?tab=Documentation_Tab" title="https://www.nxp.com/products/processors-and-microcontrollers/arm-based-processors-and-mcus/kinetis-cortex-m-mcus/l-seriesultra-low-powerm0-plus/kinetis-kl0x-48-mhz-entry-level-ultra-low-power-microcontrollers-mcus-based-on-arm-cortex-m0-plus-core:KL0x?tab=Documentation_Tab"&gt;Arm® Cortex®-M0+|Ultra-Low Power Kinetis® KL0x MCUs|NXP&lt;/A&gt; but this effect is not included.&lt;/P&gt;&lt;P&gt;I expect that it is present in all Kinetis parts with TPM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For an official response you could create a service request.&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Oct 2018 16:50:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/PWM-Duty-Cycle-Issue-Kinetis-L-MKL26Z128/m-p/304206#M12863</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2018-10-01T16:50:41Z</dc:date>
    </item>
  </channel>
</rss>

