<?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 PWM Generation for LED Brightness control in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/PWM-Generation-for-LED-Brightness-control/m-p/902801#M53087</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;I've got my KL25Z evaluation board a couple of weeks ago and I've decided not to use any of this HAL software like MCUexpresso or Kinetis SDK. I've been coding in Keil in bare metal. So, I have some problem with my PWM signal generation....I am not able to control the brightness of LED. The moment i power up my board the led is glowing with very feeble brightness that I could barely notice it glowing. I have attached my code here.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please do tell me what's so wrong in my code for controlling the brightness of LED?? Suggest me the correction, Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 May 2019 08:53:38 GMT</pubDate>
    <dc:creator>testuers234</dc:creator>
    <dc:date>2019-05-21T08:53:38Z</dc:date>
    <item>
      <title>PWM Generation for LED Brightness control</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/PWM-Generation-for-LED-Brightness-control/m-p/902801#M53087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;I've got my KL25Z evaluation board a couple of weeks ago and I've decided not to use any of this HAL software like MCUexpresso or Kinetis SDK. I've been coding in Keil in bare metal. So, I have some problem with my PWM signal generation....I am not able to control the brightness of LED. The moment i power up my board the led is glowing with very feeble brightness that I could barely notice it glowing. I have attached my code here.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please do tell me what's so wrong in my code for controlling the brightness of LED?? Suggest me the correction, Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 May 2019 08:53:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/PWM-Generation-for-LED-Brightness-control/m-p/902801#M53087</guid>
      <dc:creator>testuers234</dc:creator>
      <dc:date>2019-05-21T08:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: PWM Generation for LED Brightness control</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/PWM-Generation-for-LED-Brightness-control/m-p/902802#M53088</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;See &lt;A href="http://www.utasker.com/kinetis/FRDM-KL25Z.html" target="test_blank"&gt;http://www.utasker.com/kinetis/FRDM-KL25Z.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;"Emulated FAT and TSI Slider&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;The following µTasker V1.4 application uses two channels of the TSI (Touch Sensor Interface) to realise a slider control on the FRDM-KL25Z (SUPPORT_KEY_SCAN and USE_SLIDER). When the slider area is touched the green LED stops blinking and the LED color is controlled by PWM outputs instead. When the slider position is moved the LED color changes from blue to red (color mixture according to the position). When the slider is no longer touched the color is held for one second before the LED starts blinking green again.&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;The % slider position is shown on the debug output when the slider area is touched.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Furthermore, this application also includes emulated FAT, meaning that it appears as a hard drive to a PC host and allows viewing linear data content. The application is discussed in the document µTasker - FAT Emulation, although this configuration doesn't use a large area of the internal flash for data storage and formatted viewing (due to smaller size of Flash in the KL25) but instead allows a raw display of its entire internal Flash memory and a snap-shot of its internal RAM.&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;To achieve this configuration it uses (USB_INTERFACE, USE_USB_MSD and FAT_EMULATION)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uTaskerV1.4.10_FRDM-KL25Z_Slider_Em-FAT_8080.bin. Linked to 0x8080, this binary image can be loaded with drag-and-drop onto the upload disk that appears when the serial loader is operating or using the KBOOT loader's USB or UART connections. [34.6k]&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uTaskerV1.4.10_FRDM-KL25Z_Slider_Em-FAT.bin stand-alone version that can be loaded using the FRDM-KL25Z's USB-MSD (OpenSDA) boot loader [35.6k]"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can get its open source code, which includes Keil compatibility, at &lt;A href="https://github.com/uTasker/uTasker-Kinetis" target="test_blank"&gt;https://github.com/uTasker/uTasker-Kinetis&lt;/A&gt;&lt;BR /&gt;and allows simulation of the chip, the PWM, etc. in Visual Studio for ease of debugging, coding and learning.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some general HW timer/PWM tips at: &lt;A href="http://www.utasker.com/docs/uTasker/uTaskerHWTimers.PDF" target="test_blank"&gt;http://www.utasker.com/docs/uTasker/uTaskerHWTimers.PDF&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The problem with your code is that you haven't set up a clock to be used by the TPM in the &lt;STRONG&gt;SIM_SOPT2&lt;/STRONG&gt; register:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/83498iEAD9A199A97821DA/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_3.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/83499i60145676EDC6B292/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_3.png" alt="pastedImage_3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The default is disabled clock and so no operation.&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;/P&gt;&lt;P&gt;&lt;EM&gt;Complete Kinetis solutions for professional needs, training and support:http://www.utasker.com/kinetis.html&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Kinetis KL25:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;- &lt;A href="http://www.utasker.com/kinetis/FRDM-KL25Z.html" target="test_blank"&gt;http://www.utasker.com/kinetis/FRDM-KL25Z.html&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;- &lt;A href="http://www.utasker.com/kinetis/TWR-KL25Z48M.html" target="test_blank"&gt;http://www.utasker.com/kinetis/TWR-KL25Z48M.html&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;uTasker: supporting &amp;gt;1'000 registered Kinetis users get products faster and cheaper to market&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 May 2019 18:59:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/PWM-Generation-for-LED-Brightness-control/m-p/902802#M53088</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2019-05-21T18:59:30Z</dc:date>
    </item>
  </channel>
</rss>

