<?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中的主题 Re: Pulse width modulator for LPC chip not auto-limiting</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Pulse-width-modulator-for-LPC-chip-not-auto-limiting/m-p/1345688#M46554</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;jDrum,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The Auto limit register is in&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;SCT configuration register-&amp;gt;&amp;nbsp;AUTOLIMIT, have you config it?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Alice_Yang_0-1632471101495.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/157246i744E9B0BF9B2654C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Alice_Yang_0-1632471101495.png" alt="Alice_Yang_0-1632471101495.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 24 Sep 2021 08:11:47 GMT</pubDate>
    <dc:creator>Alice_Yang</dc:creator>
    <dc:date>2021-09-24T08:11:47Z</dc:date>
    <item>
      <title>Pulse width modulator for LPC chip not auto-limiting</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Pulse-width-modulator-for-LPC-chip-not-auto-limiting/m-p/1342515#M46484</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;My code for the PWM (shown below) works OK &lt;U&gt;but does not auto limit.&lt;/U&gt;&amp;nbsp; That is: the MATCHREL[0].L = 65000 has no effect.&lt;/P&gt;&lt;P&gt;My guess is that the auto limit works only for the SCT clock and we are using the BUSCLK.&amp;nbsp; When I select SCT_CONFIG_CLKMODE_SCTCLK instead, there is no PWM activity.&lt;/P&gt;&lt;P&gt;The code references the "simple PWM" from AN11538_SCTimer_PWM_Cookbook v5.0.pdf.&lt;/P&gt;&lt;P&gt;What are we doing wrong?&lt;/P&gt;&lt;P&gt;jDrum&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//*********************&lt;BR /&gt;/* Chip specific SCT setup - clocks and peripheral reset&lt;BR /&gt;There are a lot of registers in the SCT peripheral. Performing&lt;BR /&gt;the reset allows the default states of the SCT to be loaded, so&lt;BR /&gt;we don't need to set them all and rely on defaults when needed. */&lt;BR /&gt;Chip_SCT_Init(LPC_SCT0);&lt;/P&gt;&lt;P&gt;/* SCT1_OUT3 on PIO1_13 mapped to FUNC2 Sample_Pump_Gate */&lt;BR /&gt;Chip_IOCON_PinMuxSet(LPC_IOCON, 1, 13, (IOCON_FUNC2 ));&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/* Configure the SCT as a 16 bit counter using the bus clock */&lt;BR /&gt;LPC_SCT0-&amp;gt;CONFIG = SCT_CONFIG_16BIT_COUNTER | SCT_CONFIG_CLKMODE_BUSCLK;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;LPC_SCT0-&amp;gt;CTRL_L |= ((12-1) &amp;lt;&amp;lt; 5); //prescaler is the number in parenthesis&lt;/P&gt;&lt;P&gt;LPC_SCT0-&amp;gt;MATCHREL[0].L = 65000; //AUTOMATIC LIMIT??&lt;BR /&gt;LPC_SCT0-&amp;gt;MATCHREL[1].L = 10000;&lt;/P&gt;&lt;P&gt;LPC_SCT0-&amp;gt;EVENT[0].STATE = 0xffffffff; //all states&lt;BR /&gt;LPC_SCT0-&amp;gt;EVENT[1].STATE = 0xffffffff; //all states&lt;/P&gt;&lt;P&gt;LPC_SCT0-&amp;gt;EVENT[0].CTRL = (1&amp;lt;&amp;lt;12); //condition 1 only&lt;BR /&gt;LPC_SCT0-&amp;gt;EVENT[1].CTRL = (1&amp;lt;&amp;lt;0) | (1&amp;lt;&amp;lt;12); //condition 1 only&lt;/P&gt;&lt;P&gt;LPC_SCT0-&amp;gt;OUT[3].SET = (1 &amp;lt;&amp;lt; 0); // event 0 will set SCTx_OUT0&lt;BR /&gt;LPC_SCT0-&amp;gt;OUT[3].CLR = (1 &amp;lt;&amp;lt; 1);&lt;BR /&gt;/* Initial CTOUT0 state is high */&lt;BR /&gt;LPC_SCT0-&amp;gt;OUTPUT = 0; //(8 &amp;lt;&amp;lt; 0);&lt;BR /&gt;LPC_SCT0-&amp;gt;RES = (1&amp;lt;&amp;lt;2); // CLEAR ON CONFLICT&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;LPC_SCT0 -&amp;gt; CTRL_L &amp;amp;= ~(1&amp;lt;&amp;lt;2); // un-halt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Sep 2021 14:06:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Pulse-width-modulator-for-LPC-chip-not-auto-limiting/m-p/1342515#M46484</guid>
      <dc:creator>jDrum</dc:creator>
      <dc:date>2021-09-18T14:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: Pulse width modulator for LPC chip not auto-limiting</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Pulse-width-modulator-for-LPC-chip-not-auto-limiting/m-p/1343543#M46505</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;SPAN&gt;jDrum,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Which chip? Please share your whole project , I will check it on my side, thanks.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;BR&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Alice&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 01:45:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Pulse-width-modulator-for-LPC-chip-not-auto-limiting/m-p/1343543#M46505</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2021-09-22T01:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: Pulse width modulator for LPC chip not auto-limiting</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Pulse-width-modulator-for-LPC-chip-not-auto-limiting/m-p/1343599#M46509</link>
      <description>&lt;P&gt;Hi Alice,&lt;/P&gt;&lt;P&gt;The chip is LPC11U68, and we are running on our own PCB using Link2.&lt;/P&gt;&lt;P&gt;The frequency of the PWM is 61Hz which corresponds to no auto limit. If we change the prescaler, the frequency changes by the expected factor of two. With the set up we sent, a duty cycle of 0 works OK. We did not test the upper range, but will stay in the ~10000 range (and also 0) for the duty cycle.&lt;/P&gt;&lt;P&gt;It would be nice to control the frequency by using the auto limit feature because we need to sync with other data acquire tasks.&lt;/P&gt;&lt;P&gt;We also tried to write to the timer but it didn't have any effect.&lt;/P&gt;&lt;P&gt;Thank you, jDrum&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 02:56:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Pulse-width-modulator-for-LPC-chip-not-auto-limiting/m-p/1343599#M46509</guid>
      <dc:creator>jDrum</dc:creator>
      <dc:date>2021-09-22T02:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: Pulse width modulator for LPC chip not auto-limiting</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Pulse-width-modulator-for-LPC-chip-not-auto-limiting/m-p/1345688#M46554</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;jDrum,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The Auto limit register is in&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;SCT configuration register-&amp;gt;&amp;nbsp;AUTOLIMIT, have you config it?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Alice_Yang_0-1632471101495.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/157246i744E9B0BF9B2654C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Alice_Yang_0-1632471101495.png" alt="Alice_Yang_0-1632471101495.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2021 08:11:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Pulse-width-modulator-for-LPC-chip-not-auto-limiting/m-p/1345688#M46554</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2021-09-24T08:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: Pulse width modulator for LPC chip not auto-limiting</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Pulse-width-modulator-for-LPC-chip-not-auto-limiting/m-p/1345924#M46555</link>
      <description>&lt;P&gt;Thank you Alice,&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;Looking at SCT_11U6x.h :&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;The .h file that is in our download&lt;U&gt; does not&lt;/U&gt; mention &lt;EM&gt;AUTOLIMIT_L&lt;/EM&gt;.&amp;nbsp; The closest topic I found had to do with setting the SCT count itself.&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt;* @brief Set lower count value in State Configurable Timer&lt;BR /&gt;* @param pSCT : The base of SCT peripheral on the chip&lt;BR /&gt;* @param count : The 16-bit count value&lt;BR /&gt;* @return Nothing&lt;BR /&gt;*/&lt;BR /&gt;STATIC INLINE void Chip_SCT_SetCountL(LPC_SCT_T *pSCT, uint16_t count)&lt;BR /&gt;{&lt;BR /&gt;pSCT-&amp;gt;COUNT_L = count;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;There is also a define:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;#define COUNTUP_TO_LIMIT_THEN_CLEAR_TO_ZERO 0 &amp;nbsp; &amp;nbsp; /*!&amp;lt; Direction for&amp;nbsp; counter */&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;I assume that this would be bit 0 (1&amp;lt;&amp;lt;0) in the -&amp;gt;CONFIG&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;We will try to get one of these to work.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;jDrum&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2021 13:46:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Pulse-width-modulator-for-LPC-chip-not-auto-limiting/m-p/1345924#M46555</guid>
      <dc:creator>jDrum</dc:creator>
      <dc:date>2021-09-24T13:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: Pulse width modulator for LPC chip not auto-limiting</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Pulse-width-modulator-for-LPC-chip-not-auto-limiting/m-p/1345933#M46556</link>
      <description>&lt;P&gt;&lt;FONT color="#993300"&gt;Also,&amp;nbsp;&amp;nbsp; setting the clock to SCT never worked.&amp;nbsp; We are using the BUS clock instead.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;LPC_SCT0-&amp;gt;CONFIG = SCT_CONFIG_16BIT_COUNTER | SCT_CONFIG_CLKMODE_BUSCLK;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;jDrum&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2021 13:57:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Pulse-width-modulator-for-LPC-chip-not-auto-limiting/m-p/1345933#M46556</guid>
      <dc:creator>jDrum</dc:creator>
      <dc:date>2021-09-24T13:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: Pulse width modulator for LPC chip not auto-limiting</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Pulse-width-modulator-for-LPC-chip-not-auto-limiting/m-p/1345996#M46560</link>
      <description>&lt;P&gt;&lt;FONT color="#993300"&gt;Hello Alice,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;Thank you for the help.&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;We added the line &lt;FONT color="#808000"&gt;LPC_SCT0-&amp;gt;CONFIG |= (1&amp;lt;&amp;lt;17);&amp;nbsp; //this is the autolimit flag&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;as you suggested.&amp;nbsp; The PWM routine now works.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;The .h file needs more entries.&amp;nbsp; The AN11538_SCTimer_PWM_Cookbook v5.0.pdf. also mentions this flag but without explanation.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2021 17:59:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Pulse-width-modulator-for-LPC-chip-not-auto-limiting/m-p/1345996#M46560</guid>
      <dc:creator>jDrum</dc:creator>
      <dc:date>2021-09-24T17:59:15Z</dc:date>
    </item>
  </channel>
</rss>

