<?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>S12 / MagniV MicrocontrollersのトピックRe: About PWM output</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/About-PWM-output/m-p/1509412#M18797</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hi &lt;/SPAN&gt;Daniel,&lt;/P&gt;&lt;P&gt;Thanks for your reply.The waveform is as follow:&lt;/P&gt;&lt;P&gt;Cycle A (second cycle)is right PWM, with a cycle of 10ms and a duty cycle of 2%.&lt;/P&gt;&lt;P&gt;Enable PWM for the first time at D, in the first cycle, a waveform of B + C appears.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I think there should be only B but no C.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="图片3.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/190854iC42B4DA4BA79262D/image-size/large?v=v2&amp;amp;px=999" role="button" title="图片3.png" alt="图片3.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In addition, clear the counter register before enabling PWM, the waveform is correct.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could you tell me why is the duty cycle register buffered?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I know this register is double buffered, but I don't know what it means to be buffered.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Xqq&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 22 Aug 2022 09:28:11 GMT</pubDate>
    <dc:creator>Xuqq</dc:creator>
    <dc:date>2022-08-22T09:28:11Z</dc:date>
    <item>
      <title>About PWM output</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/About-PWM-output/m-p/1508609#M18790</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello everyone,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;While using s12zvl to output PWM, the PWM duty output can be set to 0 in following two ways:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Way 1: The value of the PWM0DTY23 register is set to 0, That is, set the duty ratio register to 0 without disable the PWM output.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Way 2: The value of the PWM0E register is set to 0, That is, disable PWM output.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Both Ways can control PWM off, but when PWM is started (duty: 2%), it is found that the duty of the first PWM cycle is incorrect in the case of way1, The cycle of PWM in the first cycle of way2 is correct.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I want to know the difference between the two ways。&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="图片1.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/190680i24AB39EA3046D2CC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="图片1.png" alt="图片1.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 07:13:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/About-PWM-output/m-p/1508609#M18790</guid>
      <dc:creator>Xuqq</dc:creator>
      <dc:date>2022-08-19T07:13:28Z</dc:date>
    </item>
    <item>
      <title>Re: About PWM output</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/About-PWM-output/m-p/1509315#M18796</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/194240"&gt;@Xuqq&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;What does it mean the PWM is incorrect?&lt;/P&gt;
&lt;P&gt;Can you show some waveforms?&lt;/P&gt;
&lt;P&gt;If the channel stays enabled, the duty register is buffered - that would be the difference.&lt;/P&gt;
&lt;P&gt;You can write 0x00 to the counter to sychronize it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR, Daniel&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2022 08:02:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/About-PWM-output/m-p/1509315#M18796</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2022-08-22T08:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: About PWM output</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/About-PWM-output/m-p/1509412#M18797</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi &lt;/SPAN&gt;Daniel,&lt;/P&gt;&lt;P&gt;Thanks for your reply.The waveform is as follow:&lt;/P&gt;&lt;P&gt;Cycle A (second cycle)is right PWM, with a cycle of 10ms and a duty cycle of 2%.&lt;/P&gt;&lt;P&gt;Enable PWM for the first time at D, in the first cycle, a waveform of B + C appears.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I think there should be only B but no C.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="图片3.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/190854iC42B4DA4BA79262D/image-size/large?v=v2&amp;amp;px=999" role="button" title="图片3.png" alt="图片3.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In addition, clear the counter register before enabling PWM, the waveform is correct.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could you tell me why is the duty cycle register buffered?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I know this register is double buffered, but I don't know what it means to be buffered.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Xqq&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2022 09:28:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/About-PWM-output/m-p/1509412#M18797</guid>
      <dc:creator>Xuqq</dc:creator>
      <dc:date>2022-08-22T09:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: About PWM output</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/About-PWM-output/m-p/1509435#M18798</link>
      <description>&lt;P&gt;It is explained in the RM shown below, basically, it allows changing the duty-cycle at the end of the period (typical use case) not at the time the register is written.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="danielmartynek_0-1661161369153.png" style="width: 691px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/190857i7E8C2DB045FB3572/image-dimensions/691x442?v=v2" width="691" height="442" role="button" title="danielmartynek_0-1661161369153.png" alt="danielmartynek_0-1661161369153.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The polarity bit is set to 1, right?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="danielmartynek_1-1661161570175.png" style="width: 674px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/190858i9A85B6010980AF6C/image-dimensions/674x118?v=v2" width="674" height="118" role="button" title="danielmartynek_1-1661161570175.png" alt="danielmartynek_1-1661161570175.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Since it is double-buffered, and the last value is 0, it does not go down in the first cycle.&lt;/P&gt;
&lt;P&gt;You need to synchronize it by writing 0 to the counter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR, Daniel&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2022 09:49:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/About-PWM-output/m-p/1509435#M18798</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2022-08-22T09:49:01Z</dc:date>
    </item>
    <item>
      <title>Re: About PWM output</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/About-PWM-output/m-p/1509800#M18801</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Daniel,&lt;/P&gt;&lt;P&gt;Thanks for your help. The polarity bit is set to 1. Writing 0 to the counter register can solve this problem.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Write a non-zero value to the duty register. After closing the PWM output, there is no problem to restart the waveform. However, write 0 to the duty register. After closing the PWM output, if you do not write 0 to the counter register, there will be a problem.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is it a special operation to write 0 to the duty register?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is the asynchronization of the counter register due to the random disable the PWM output? Are there other reasons?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Xqq&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2022 01:51:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/About-PWM-output/m-p/1509800#M18801</guid>
      <dc:creator>Xuqq</dc:creator>
      <dc:date>2022-08-23T01:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: About PWM output</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/About-PWM-output/m-p/1510889#M18814</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/194240"&gt;@Xuqq&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;I can't reproduce it.&lt;/P&gt;
&lt;P&gt;I used this example:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.nxp.com/t5/S12-MagniV-Microcontrollers/PWM-example-code-for-S12ZVL/ta-p/1120954" target="_blank"&gt;https://community.nxp.com/t5/S12-MagniV-Microcontrollers/PWM-example-code-for-S12ZVL/ta-p/1120954&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And added this code:&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;enable_PWMs();

delay = 1000;
while(delay--){}

PWMDTY0 = 0x00;

delay = 10;
while(delay--){}

PWMDTY0 = 0x02;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PWM0 (PP0):&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="danielmartynek_0-1661341068092.png" style="width: 605px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/191133i4ED88A5E7518E415/image-dimensions/605x147?v=v2" width="605" height="147" role="button" title="danielmartynek_0-1661341068092.png" alt="danielmartynek_0-1661341068092.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you test it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR, Daniel&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Aug 2022 11:38:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/About-PWM-output/m-p/1510889#M18814</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2022-08-24T11:38:13Z</dc:date>
    </item>
    <item>
      <title>Re: About PWM output</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/About-PWM-output/m-p/1536852#M18910</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;SPAN&gt;Daniel,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am sorry for&amp;nbsp;the late reply，this problem has been solved, thank you&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 06:37:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/About-PWM-output/m-p/1536852#M18910</guid>
      <dc:creator>Xuqq</dc:creator>
      <dc:date>2022-10-13T06:37:36Z</dc:date>
    </item>
  </channel>
</rss>

