<?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>LPC Microcontrollers中的主题 LPC824 pwm polarity bug</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC824-pwm-polarity-bug/m-p/574155#M18971</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by atilla grammer on Wed Feb 25 04:18:33 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I have an application where a button interrupt adjusts my PWM duty cycle, and systick interrupt which turns PWM on and off. Here is how they look:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;background-color:#cacaca;border:1px solid black;"&gt; &lt;PRE&gt;
void PININT7_IRQHandler(void)
{
Chip_PININT_ClearIntStatus(LPC_PININT, PININTCH7);
out_dp += 5;
if(out_dp &amp;gt; 90 ) {
out_dp = 0;
}
DEBUGOUT("duty cycle: %d\r\n",out_dp);
}
void SysTick_Handler(void)
{
static int state = 0;

switch(state)
{
case 0:
Chip_SCTPWM_Start(SCT_PWM);
break;
case 1:
Chip_SCTPWM_Stop(SCT_PWM);
break;
default:
break;
}

state++;
state %= 5;
}

&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is, once the duty cycle passes a certain threshold, the polarity of the PWM signal changes, and the signal becomes as shown in the attachment. For example, the threshold is ~70% when PWM frequency is 20kHz, and ~50% when the frequency is 15kHz, and this is doesn't happen at 10kHz. This only happens only if I stop and start the PWM after setting the duty cycle.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Did anyone notice similar behaviour on PWM?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 20:13:51 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T20:13:51Z</dc:date>
    <item>
      <title>LPC824 pwm polarity bug</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC824-pwm-polarity-bug/m-p/574155#M18971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by atilla grammer on Wed Feb 25 04:18:33 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I have an application where a button interrupt adjusts my PWM duty cycle, and systick interrupt which turns PWM on and off. Here is how they look:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;background-color:#cacaca;border:1px solid black;"&gt; &lt;PRE&gt;
void PININT7_IRQHandler(void)
{
Chip_PININT_ClearIntStatus(LPC_PININT, PININTCH7);
out_dp += 5;
if(out_dp &amp;gt; 90 ) {
out_dp = 0;
}
DEBUGOUT("duty cycle: %d\r\n",out_dp);
}
void SysTick_Handler(void)
{
static int state = 0;

switch(state)
{
case 0:
Chip_SCTPWM_Start(SCT_PWM);
break;
case 1:
Chip_SCTPWM_Stop(SCT_PWM);
break;
default:
break;
}

state++;
state %= 5;
}

&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is, once the duty cycle passes a certain threshold, the polarity of the PWM signal changes, and the signal becomes as shown in the attachment. For example, the threshold is ~70% when PWM frequency is 20kHz, and ~50% when the frequency is 15kHz, and this is doesn't happen at 10kHz. This only happens only if I stop and start the PWM after setting the duty cycle.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Did anyone notice similar behaviour on PWM?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:13:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC824-pwm-polarity-bug/m-p/574155#M18971</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:13:51Z</dc:date>
    </item>
  </channel>
</rss>

