<?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 How to get the red led to work using pwm tpmo channel 0 on the kl25z board using keil ide in Other NXP Products</title>
    <link>https://community.nxp.com/t5/Other-NXP-Products/How-to-get-the-red-led-to-work-using-pwm-tpmo-channel-0-on-the/m-p/1582788#M16410</link>
    <description>&lt;P&gt;I was wondering why my code isnt working to turn the red led on using tpmo channel 0 with pwm. the code i have is:&lt;/P&gt;&lt;P&gt;SIM-&amp;gt;SCGC5 |= SIM_SCGC5_PORTB_MASK;&lt;BR /&gt;SIM-&amp;gt;SCGC6 |= SIM_SCGC6_TPM0_MASK;&lt;BR /&gt;&lt;BR /&gt;PORTB-&amp;gt;PCR[18] &amp;amp;=~PORT_PCR_MUX_MASK;&lt;BR /&gt;PORTB-&amp;gt;PCR[18] |=PORT_PCR_MUX(3);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;SIM-&amp;gt;SOPT2 &amp;amp;= ~SIM_SOPT2_PLLFLLSEL_MASK;&lt;BR /&gt;SIM-&amp;gt;SOPT2 |= SIM_SOPT2_TPMSRC(1);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;TPM0-&amp;gt;MOD = pwm_period-1;&lt;BR /&gt;&lt;BR /&gt;TPM0-&amp;gt;SC= TPM_SC_PS(0);&lt;BR /&gt;TPM0-&amp;gt;CONF |= TPM_CONF_DBGMODE(3);&lt;BR /&gt;&lt;BR /&gt;TPM0-&amp;gt;CONTROLS[0].CnSC = TPM_CnSC_ELSA_MASK;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;TPM0-&amp;gt;CONTROLS[0].CnV = 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;while(1)&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;TPM2-&amp;gt;CONTROLS[0].CnV = 30;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Any help on what i need to change would help as i am new and still learning things&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 15 Jan 2023 18:10:24 GMT</pubDate>
    <dc:creator>oc989</dc:creator>
    <dc:date>2023-01-15T18:10:24Z</dc:date>
    <item>
      <title>How to get the red led to work using pwm tpmo channel 0 on the kl25z board using keil ide</title>
      <link>https://community.nxp.com/t5/Other-NXP-Products/How-to-get-the-red-led-to-work-using-pwm-tpmo-channel-0-on-the/m-p/1582788#M16410</link>
      <description>&lt;P&gt;I was wondering why my code isnt working to turn the red led on using tpmo channel 0 with pwm. the code i have is:&lt;/P&gt;&lt;P&gt;SIM-&amp;gt;SCGC5 |= SIM_SCGC5_PORTB_MASK;&lt;BR /&gt;SIM-&amp;gt;SCGC6 |= SIM_SCGC6_TPM0_MASK;&lt;BR /&gt;&lt;BR /&gt;PORTB-&amp;gt;PCR[18] &amp;amp;=~PORT_PCR_MUX_MASK;&lt;BR /&gt;PORTB-&amp;gt;PCR[18] |=PORT_PCR_MUX(3);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;SIM-&amp;gt;SOPT2 &amp;amp;= ~SIM_SOPT2_PLLFLLSEL_MASK;&lt;BR /&gt;SIM-&amp;gt;SOPT2 |= SIM_SOPT2_TPMSRC(1);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;TPM0-&amp;gt;MOD = pwm_period-1;&lt;BR /&gt;&lt;BR /&gt;TPM0-&amp;gt;SC= TPM_SC_PS(0);&lt;BR /&gt;TPM0-&amp;gt;CONF |= TPM_CONF_DBGMODE(3);&lt;BR /&gt;&lt;BR /&gt;TPM0-&amp;gt;CONTROLS[0].CnSC = TPM_CnSC_ELSA_MASK;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;TPM0-&amp;gt;CONTROLS[0].CnV = 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;while(1)&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;TPM2-&amp;gt;CONTROLS[0].CnV = 30;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Any help on what i need to change would help as i am new and still learning things&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Jan 2023 18:10:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Other-NXP-Products/How-to-get-the-red-led-to-work-using-pwm-tpmo-channel-0-on-the/m-p/1582788#M16410</guid>
      <dc:creator>oc989</dc:creator>
      <dc:date>2023-01-15T18:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the red led to work using pwm tpmo channel 0 on the kl25z board using keil ide</title>
      <link>https://community.nxp.com/t5/Other-NXP-Products/How-to-get-the-red-led-to-work-using-pwm-tpmo-channel-0-on-the/m-p/1582799#M16411</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please download the&amp;nbsp;&lt;STRONG&gt;SDK_&lt;WBR /&gt;2.2.0_&lt;WBR /&gt;FRDM-KL25Z &lt;/STRONG&gt;from&amp;nbsp;&lt;A href="https://mcuxpresso.nxp.com/en/welcome" target="_self"&gt;MCUXpresso SDK Builder&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;The&amp;nbsp;&lt;STRONG&gt;simple_pwm&lt;/STRONG&gt;&amp;nbsp;example in &lt;STRONG&gt;SDK_&lt;WBR /&gt;2.2.0_&lt;WBR /&gt;FRDM-KL25Z &lt;/STRONG&gt;will show you how to light&amp;nbsp;LEDRGB_GREEN(PTB19) TPM2_CH1. (The example is located at ...\SDK_2_2_0_FRDM-KL25Z\boards\frdmkl25z\driver_examples\tpm\simple_pwm\mdk)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="simple_pwm MDK.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/207365iB8044D683CE81CC9/image-size/large?v=v2&amp;amp;px=999" role="button" title="simple_pwm MDK.png" alt="simple_pwm MDK.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The red led&amp;nbsp;LEDRGB_RED is connect to PTB18 which is&amp;nbsp;TPM2_CH0, please enable the clock gate of TPM2 instead of TPM0.&lt;/P&gt;
&lt;P&gt;The&amp;nbsp;Schematics of FRDM-KL25Z can be found here:&amp;nbsp;&lt;A href="https://www.nxp.com/design/development-boards/freedom-development-boards/mcu-boards/freedom-development-platform-for-kinetis-kl14-kl15-kl24-kl25-mcus:FRDM-KL25Z" target="_self"&gt;Freedom Development Platform for Kinetis® KL14, KL15, KL24, KL25 MCUs&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;Robin&lt;BR /&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;
&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2023 01:23:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Other-NXP-Products/How-to-get-the-red-led-to-work-using-pwm-tpmo-channel-0-on-the/m-p/1582799#M16411</guid>
      <dc:creator>Robin_Shen</dc:creator>
      <dc:date>2023-01-16T01:23:16Z</dc:date>
    </item>
  </channel>
</rss>

