<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Tutorial for FRDM-KL25Z: Using the FRDM-KL25Z as Low Power Board</title><link>https://community.element14.com/products/devtools/kinetiskl2freedomboard/w/documents/16275/tutorial-for-frdm-kl25z-using-the-frdm-kl25z-as-low-power-board</link><description /><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>Tutorial for FRDM-KL25Z: Using the FRDM-KL25Z as Low Power Board</title><link>https://community.element14.com/products/devtools/kinetiskl2freedomboard/w/documents/16275/tutorial-for-frdm-kl25z-using-the-frdm-kl25z-as-low-power-board</link><pubDate>Fri, 08 Oct 2021 07:32:32 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:368e651c-9d23-4755-9c61-bf1eb34024f0</guid><dc:creator>FreescaleTools_and_Software</dc:creator><comments>https://community.element14.com/products/devtools/kinetiskl2freedomboard/w/documents/16275/tutorial-for-frdm-kl25z-using-the-frdm-kl25z-as-low-power-board#comments</comments><description>Current Revision posted to Documents by FreescaleTools_and_Software on 10/8/2021 7:32:32 AM&lt;br /&gt;
&lt;p style="margin:0;text-align:left;background-color:#ffffff;text-indent:0px;color:#333333;"&gt;&lt;span style="color:#ff6600;font-size:15px;font-family:tahoma, arial, helvetica, sans-serif;"&gt;&lt;em&gt;There will be a Freescale app note covering this topic, but in the meantime the tutorial below walks through the steps in lowering the power consumption of their Freedom board.&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;text-align:left;background-color:#ffffff;text-indent:0px;color:#333333;"&gt;&lt;span style="color:#ff6600;font-size:15px;font-family:tahoma, arial, helvetica, sans-serif;"&gt;&lt;em&gt;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;text-align:left;background-color:#ffffff;text-indent:0px;color:#333333;"&gt;&lt;span style="color:#ff6600;font-size:15px;font-family:tahoma, arial, helvetica, sans-serif;"&gt;&lt;em&gt;This tutorial was extracted from Erich Styger&amp;#39;s blog&lt;span class="Apple-converted-space" style="font-size:15px;"&gt;&lt;span class="Apple-converted-space" style="font-size:15px;"&gt;&lt;span class="Apple-converted-space" style="font-size:15px;"&gt;&lt;span class="Apple-converted-space" style="font-size:15px;"&gt;&lt;span class="Apple-converted-space" style="font-size:15px;"&gt;&lt;span class="Apple-converted-space"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;a class="jive-link-external-small" href="http://mcuoneclipse.wordpress.com/" rel="nofollow" style="color:#355491;font-size:15px;text-decoration:underline;" target="_blank"&gt;http://mcuoneclipse.wordpress.com&lt;/a&gt;&lt;span class="Apple-converted-space" style="font-size:15px;"&gt;&lt;span class="Apple-converted-space" style="font-size:15px;"&gt;&lt;span class="Apple-converted-space" style="font-size:15px;"&gt;&lt;span class="Apple-converted-space" style="font-size:15px;"&gt;&lt;span class="Apple-converted-space" style="font-size:15px;"&gt;&lt;span class="Apple-converted-space"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;with his agreement.&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="/servlet/JiveServlet/downloadImage/102-54862-1-160635/Freescale.bmp" style="color:#355491;font-size:12px;"&gt;&lt;span&gt;&lt;a href="https://community.element14.com/resized-image/__size/175x85/__key/communityserver-wikis-components-files/00-00-00-01-49/contentimage_5F00_28083.bmp"&gt;&lt;img alt="image" src="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-01-49/contentimage_5F00_28083.bmp" style="max-height: 85px;max-width: 175px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/a&gt;&lt;a href="/servlet/JiveServlet/downloadImage/102-54862-1-160636/Kinetis-L.jpg" style="color:#355491;font-size:12px;"&gt;&lt;span&gt;&lt;a href="https://community.element14.com/resized-image/__size/87x85/__key/communityserver-wikis-components-files/00-00-00-01-49/contentimage_5F00_28084.jpg"&gt;&lt;img loading="lazy" alt="image" src="https://community-storage.element14.com/communityserver-components-secureimagefileviewer/communityserver/wikis/components/files/00/00/00/01/49/contentimage_28084.jpg-87x85.jpg?sv=2016-05-31&amp;amp;sr=b&amp;amp;sig=SCRWYs5Yy2g%2F9Vit5%2FVQOeqsgHXlRlEzMcJra3zd8ig%3D&amp;amp;se=2026-08-25T23%3A59%3A59Z&amp;amp;sp=r&amp;amp;_=lw3vl9FqzfR9tHJgP7g6Lg==" style="max-height: 85px;max-width: 87px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;The FRDM-KL25Z is a great board: inexpensive (around US$15), small form factor, has easily accessible pins, and has a low power (capable, at least) microcontroller, and comes with an embedded debugging interface. So why not using this board right away ‘as is’ for a low power battery operated device? Great idea, you think? Yes, I thought too. Only to find out that the board needs 20 mA out of the box.&lt;/p&gt;&lt;p style="margin:0;"&gt;The good news is: It is possible on a week-end to get this 150 times better down to 132 μA, with an RTOS running all the time &lt;a href="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g"&gt;&lt;img loading="lazy" alt=":-)" class="jiveImage wp-smiley" src="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g" /&gt;&lt;/a&gt; . I invite you to join a journey with board modifications, jumpers, schematics and many multimeter pictures &lt;a href="http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif?m=1129645325g"&gt;&lt;img loading="lazy" alt=";-)" class="jiveImage wp-smiley" src="http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif?m=1129645325g" /&gt;&lt;/a&gt; ….&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/132-micro-amps.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="132 micro amps" class="jiveImage size-full wp-image-9659" src="http://mcuoneclipse.files.wordpress.com/2013/10/132-micro-amps.png?w=584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;132 micro amps!&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;h1&gt;Preface&lt;/h1&gt;&lt;p style="margin:0;"&gt;Why do I want to use the FRDM-KL25Z as a battery operated device? I’m working on a data logger/weather station project: It features a barometric absolute pressure sensor, and I²C external EEPROM and the &lt;a class="jive-link-external-small" href="http://mcuoneclipse.com/2013/07/20/tutorial-ultra-low-cost-2-4-ghz-wireless-transceiver-with-the-frdm-board/" rel="nofollow ugc noopener" target="_blank" title="Tutorial: Ultra Low Cost 2.4 GHz Wireless Transceiver with the FRDM Board"&gt;nRF24L01+&lt;/a&gt; wireless transceiver. The &lt;a class="jive-link-external-small" href="http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=FRDM-KL25Z" rel="nofollow ugc noopener" target="_blank"&gt;Freescale FRDM-KL25Z board&lt;/a&gt; is great to start with: it is small and provides easy access to all signals, so I can build up my design with bread boards:&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/data-logger-bread-boarding.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="Data Logger Bread Boarding" class="jiveImage wp-image-9606 size-full" height="439" src="http://mcuoneclipse.files.wordpress.com/2013/10/data-logger-bread-boarding.png?w=584&amp;amp;h=439" width="584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;Data Logger Bread Boarding&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;h1&gt;Bread Boarding the Data Logger System&lt;/h1&gt;&lt;p style="margin:0;"&gt;Yes, the wiring in the picture looks messy, but it allows quick prototyping and inspection of signals with a logic analyzer.&lt;/p&gt;&lt;blockquote class="jive-quote"&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://s0.wp.com/wp-includes/images/smilies/icon_idea.gif?m=1129645325g"&gt;&lt;img loading="lazy" alt=":idea:" class="jiveImage wp-smiley" src="http://s0.wp.com/wp-includes/images/smilies/icon_idea.gif?m=1129645325g" /&gt;&lt;/a&gt; I get frequent questions and requests about “my SCI, SPI or I2C communication is not working!”: A logic analyzer or oscilloscope is something you should own. Without a logic analyzer, you likely will waste many, many hours. If you do not want to spend around $100 for professional tools, then I recommend you buy at least a $15 FRDM-KL25Z board and use it as a logic analyzer, see &lt;a class="jive-link-external-small" href="http://mcuoneclipse.com/2013/03/24/freedom-logic-analyzer-with-dma/" rel="nofollow ugc noopener" target="_blank" title="Freedom Logic Analyzer with DMA"&gt;this post&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;p style="margin:0;"&gt;The system has following main parts:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Microchip &lt;a class="jive-link-external-small" href="http://mcuoneclipse.com/2013/08/18/driver-for-microchip-24xx-serial-eeprom/" rel="nofollow ugc noopener" target="_blank" title="Driver for Microchip 24xx Serial EEPROM"&gt;24AA external I²C EEPROM&lt;/a&gt; to store data values and configuration data. Data is stored in the EEPROM until it is transmitted over the wireless transceiver.&lt;/li&gt;&lt;li&gt;&lt;a class="jive-link-external-small" href="http://mcuoneclipse.com/2013/07/20/tutorial-ultra-low-cost-2-4-ghz-wireless-transceiver-with-the-frdm-board/" rel="nofollow ugc noopener" target="_blank" title="Tutorial: Ultra Low Cost 2.4 GHz Wireless Transceiver with the FRDM Board"&gt;Nordic Semiconductor nRF24L01+ wireless transceiver&lt;/a&gt; for connectivity.&lt;/li&gt;&lt;li&gt;&lt;a class="jive-link-external-small" href="http://www.meas-spec.com/product/pressure/MS5607-02BA03.aspx" rel="nofollow ugc noopener" target="_blank"&gt;MEAS MS5607&lt;/a&gt; I²C digital absolute pressure sensor.&lt;/li&gt;&lt;li&gt;ARM Cortex-M0+ processor on the FRDM-KL25Z.&lt;/li&gt;&lt;/ol&gt;&lt;p style="margin:0;"&gt;I want to use a Cortex M0+ because of the low power characteristics of my application: The KL25Z is over-powered for my final design, but gives me a powerful development platform. And with using Processor Expert as hardware abstraction it allows me to change the processor later very easily: it will be just a different configuration made with a few mouse click &lt;a href="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g"&gt;&lt;img loading="lazy" alt=":-)" class="jiveImage wp-smiley" src="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g" /&gt;&lt;/a&gt; .&lt;/p&gt;&lt;p style="margin:0;"&gt;The question is: how to use the FRDM-KL25Z to help with developing a battery operated low power embedded application?&lt;/p&gt;&lt;p style="margin:0;"&gt;My plan is the following:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Breadboard setup of the system with the FRDM-KL25Z: this allows me to develop the software with all the needed hardware.&lt;/li&gt;&lt;li&gt;Developing a simple ‘Arduino’ shield for the FRDM-KL25Z which has all the external parts (pressure sensor, EEPROM, transceiver) on it. This system will be battery operated and allows me to make long time measurement of the system.&lt;/li&gt;&lt;li&gt;And finally to develop my board with another microprocessor on it (most likely a KL02 or KL05). In this stage I do not need the FRDM-KL25Z any more.&lt;/li&gt;&lt;/ol&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;h1&gt;Low Power (not ‘Ultra-Low-Power’)&lt;/h1&gt;&lt;p style="margin:0;"&gt;The final system will be battery operated, so I need to make sure it uses as few energy as possible. Or better: that it uses as few energy as reasonable possible. And this means that the system shall consume less than 1 mA in average. Yes, this is not one of these ‘ultra-low-power’ applications. Silicon vendors advertise ‘nano-ampere’ solutions, but for many applications they are never achievable: to me these benchmarks are not realistic, as they assume that the processor is alive maybe one second every day? But my system needs to continuously measure and communicate several days a day. So a 99.9% inactivity is not achievable.&lt;/p&gt;&lt;p style="margin:0;"&gt;Silicon vendors build in multiple low power modes into their microcontroller: unfortunately many modes are easily usable waking up from the ultra-low-power modes is like a power-on-reset: all your SRAM is gone, and the peripherals and pin states are gone too. Such ultra-low-power modes are cool for a ‘dumb’ application, but were hard to deal with a more complex system where for example an operating system is running. Just to set the stage &lt;a href="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g"&gt;&lt;img loading="lazy" alt=":-)" class="jiveImage wp-smiley" src="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g" /&gt;&lt;/a&gt; .&lt;/p&gt;&lt;p style="margin:0;"&gt;There is a lot which can be done to cut the power consumption, without impacting the application functionality or usability. The wireless transceiver, pressure sensor and EEPROM do not have critical power consumption in my design. What is critical is the processor: I need to get it down to below 0.5 mA. And do not want to switch the processor completely off: it shall run the operating (FreeRTOS) RTOS all the time &lt;a href="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g"&gt;&lt;img loading="lazy" alt=":-)" class="jiveImage wp-smiley" src="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g" /&gt;&lt;/a&gt; .&lt;/p&gt;&lt;h1&gt;&lt;/h1&gt;&lt;h1&gt;&lt;/h1&gt;&lt;h1&gt;FRDM-KL25Z RevE&lt;/h1&gt;&lt;p style="margin:0;"&gt;For my experiments, I’m using the &lt;a class="jive-link-external-small" href="http://mcuoneclipse.com/2013/06/09/frdm-kl25z-reve-board-arrived/" rel="nofollow ugc noopener" target="_blank" title="FRDM-KL25Z RevE Board arrived"&gt;RevE version of the FRDM-KL25Z&lt;/a&gt; board. Compared to the earlier RevD it has a newer silicon plus jumpers to disconnect better parts on the board to reduce the power consumption. And I’m using &lt;a class="jive-link-external-small" href="http://mcuoneclipse.com/2013/09/23/new-codewarrior-for-mcu10-5/" rel="nofollow ugc noopener" target="_blank" title="New CodeWarrior for MCU10.5"&gt;CodeWarrior for MCU10.5&lt;/a&gt; with Processor Expert:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Processor Expert makes it easier to deal with the low power modes: no need to spend many hours reading to silicon reference manual to understand all the different low power modes. And it makes it really easy to move to another processor later.&lt;/li&gt;&lt;li&gt;CodeWarrior debugger nicely is able to debug low power modes. Unlike other debuggers, it keeps the connection with the target under debug even if the microcontroller is in low power modes.&lt;/li&gt;&lt;/ul&gt;&lt;h1&gt;&lt;/h1&gt;&lt;h1&gt;&lt;/h1&gt;&lt;h1&gt;Test Setup&lt;/h1&gt;&lt;p style="margin:0;"&gt;To keep things simple in a first phase, I measure only the power consumed by the FRDM-KL25Z (and ignore the external sensors/etc). &lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/test-setup.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="Test Setup" class="jiveImage size-full wp-image-9610" src="http://mcuoneclipse.files.wordpress.com/2013/10/test-setup.png?w=584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;Test Setup&lt;/p&gt;&lt;p style="margin:0;"&gt;In my system I use a microcontroller voltage of 3.3V. Reducing the Vdd voltage usually has positive (square) impact. In my experiments I’m not going to reduce the Vdd. I instead focus on disabling unused board components, reducing clock speed and using low power modes.&lt;/p&gt;&lt;p style="margin:0;"&gt;The FRDM-KL25Z board runs a stripped down version of my application (just without the sensor and wireless application pats. I’m using a technique with ‘platform macros’ to enable/disable application functions:&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;div class="syntaxhighlighter cpp"&gt;&lt;table border="0" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="gutter" style="border:0px solid black;"&gt;&lt;div class="number1 alt2 line index0"&gt;1&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="number2 alt1 index1 line" style="margin:0;"&gt;2&lt;/p&gt;&lt;p class="number3 index2 alt2 line" style="margin:0;"&gt;3&lt;/p&gt;&lt;p class="index3 number4 alt1 line" style="margin:0;"&gt;4&lt;/p&gt;&lt;p class="index4 alt2 number5 line" style="margin:0;"&gt;5&lt;/p&gt;&lt;p class="index5 alt1 line number6" style="margin:0;"&gt;6&lt;/p&gt;&lt;p class="number7 alt2 index6 line" style="margin:0;"&gt;7&lt;/p&gt;&lt;p class="index7 number8 alt1 line" style="margin:0;"&gt;8&lt;/p&gt;&lt;p class="number9 alt2 line index8" style="margin:0;"&gt;9&lt;/p&gt;&lt;p class="alt1 line index9 number10" style="margin:0;"&gt;10&lt;/p&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class="code" style="border:0px solid black;"&gt;&lt;p class="container" style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;div class="number1 alt2 line index0"&gt;&lt;code class="cpp preprocessor"&gt;#ifndef PLATFORM_H_&lt;/code&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="number2 alt1 index1 line" style="margin:0;"&gt;&lt;code class="cpp preprocessor"&gt;#define PLATFORM_H_&lt;/code&gt;&lt;/p&gt;&lt;p class="number3 index2 alt2 line" style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="index3 number4 alt1 line" style="margin:0;"&gt;&lt;code class="cpp preprocessor"&gt;#define PL_BOARD_IS_FRDM 1&lt;/code&gt;&lt;/p&gt;&lt;p class="index4 alt2 number5 line" style="margin:0;"&gt;&lt;code class="cpp preprocessor"&gt;#define PL_HAS_LOW_POWER 1&lt;/code&gt;&lt;/p&gt;&lt;p class="index5 alt1 line number6" style="margin:0;"&gt;&lt;code class="cpp preprocessor"&gt;#define PL_HAS_SHELL&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;/code&gt;&lt;/p&gt;&lt;p class="number7 alt2 index6 line" style="margin:0;"&gt;&lt;code class="cpp preprocessor"&gt;#define PL_HAS_LED&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/code&gt;&lt;/p&gt;&lt;p class="index7 number8 alt1 line" style="margin:0;"&gt;&lt;code class="cpp preprocessor"&gt;#define PL_HAS_RTOS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;/code&gt;&lt;/p&gt;&lt;p class="number9 alt2 line index8" style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="alt1 line index9 number10" style="margin:0;"&gt;&lt;code class="cpp preprocessor"&gt;#endif /* PLATFORM_H_ */&lt;/code&gt;&lt;/p&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;h1&gt;&lt;/h1&gt;&lt;h1&gt;Board Power Measurement Jumpers&lt;/h1&gt;&lt;p style="margin:0;"&gt;The FRDM-KL25Z RevE board has two jumpers (J3 and J4) to measure the power used by the KL25Z and/or the power used by the K20 for the OpenSDA debug interface:&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/j3-and-j4-on-frdm-kl25z.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="J3 and J4 on FRDM-KL25Z (Source: Freescale)" class="jiveImage wp-image-9618 size-full" height="199" src="http://mcuoneclipse.files.wordpress.com/2013/10/j3-and-j4-on-frdm-kl25z.png?w=584&amp;amp;h=199" width="584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;J3 and J4 on FRDM-KL25Z (Source: Freescale)&lt;/p&gt;&lt;p style="margin:0;"&gt;Both headers are not populated by default. J3 has a 0 Ohm and 10 Ohm resistor populated.&lt;/p&gt;&lt;blockquote class="jive-quote"&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://s0.wp.com/wp-includes/images/smilies/icon_idea.gif?m=1129645325g"&gt;&lt;img loading="lazy" alt=":idea:" class="jiveImage wp-smiley" src="http://s0.wp.com/wp-includes/images/smilies/icon_idea.gif?m=1129645325g" /&gt;&lt;/a&gt;&amp;nbsp; I guess the idea is to remove the 0 Ohm (R73) so the voltage across R81 (10 Ohm) could be measured by the KL25Z itself?&lt;/p&gt;&lt;/blockquote&gt;&lt;p style="margin:0;"&gt;On the RevD boards both headers hat a ‘cut trace’ between the jumper. I decided to remove all three resistors (R73, R81 and R74) so I can measure the current consumed.&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/r73-r81-and-r74-removed.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="R73 R81 and R74 removed" class="jiveImage size-full wp-image-9619" height="390" src="http://mcuoneclipse.files.wordpress.com/2013/10/r73-r81-and-r74-removed.png?w=584&amp;amp;h=390" width="584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;R73 R81 and R74 removed&lt;/p&gt;&lt;blockquote class="jive-quote"&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://s0.wp.com/wp-includes/images/smilies/icon_idea.gif?m=1129645325g"&gt;&lt;img loading="lazy" alt=":idea:" class="jiveImage wp-smiley" src="http://s0.wp.com/wp-includes/images/smilies/icon_idea.gif?m=1129645325g" /&gt;&lt;/a&gt; Removing SMD components without the proper equipment is challenging! It works best with SMD de-soldering iron tips. The RevD approach with cutting traces was more user-friendly.&lt;/p&gt;&lt;/blockquote&gt;&lt;h1&gt;Starting Point: 19.58 mA&lt;/h1&gt;&lt;p style="margin:0;"&gt;I’m not so much interested here about the current consumed by the KL25Z and K20 (OpenSDA), as I need to focus on the overall board consumption. For my experiments I measured the board current coming through the P3V3 on pin 8 of J9:&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/measured-board-current.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="Measured Board Current (Schematic Source: Freescale)" class="jiveImage wp-image-9620 size-full" height="218" src="http://mcuoneclipse.files.wordpress.com/2013/10/measured-board-current.png?w=584&amp;amp;h=218" width="584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;Measured Board Current (Schematic Source: Freescale)&lt;/p&gt;&lt;p style="margin:0;"&gt;I started my experiments with following starting point:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;KL25Z using 8 MHz external crystal (PEE mode, 48 CPU clock and 24 MHz bus clock)&lt;/li&gt;&lt;li&gt;FreeRTOS running SysTick for with 100 Hz RTOS tick counter&lt;/li&gt;&lt;li&gt;Shell command line interface through OpenSDA (38400 baud)&lt;/li&gt;&lt;li&gt;Blinking LED heartbeat so I can see that the application is running properly&lt;/li&gt;&lt;/ul&gt;&lt;p style="margin:0;"&gt;With this, the board consumes 19.58 mA: &lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/base-board-current-consumption1.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="Base Board Current Consumption" class="jiveImage wp-image-9628 size-full" src="http://mcuoneclipse.files.wordpress.com/2013/10/base-board-current-consumption1.png?w=584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;Base Board Current Consumption&lt;/p&gt;&lt;h1&gt;Disabling Accelerometer: 19.55 mA&lt;/h1&gt;&lt;p style="margin:0;"&gt;One rule of low power: disable what I do not use. The FRDM-KL25Z has the&amp;nbsp; &lt;a class="jive-link-external-small" href="http://mcuoneclipse.com/2013/04/13/extended-driver-for-the-mma8451q-accelerometer/" rel="nofollow ugc noopener" target="_blank" title="Extended Driver for the MMA8451Q Accelerometer"&gt;MM8451 accelerometer&lt;/a&gt; on the board, so I disabled it (disabled the accelerometer through the I²C interface/shell). But saving were minor. I guess only removing the accelerometer would bring some extra savings.&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/accelerometer-disabled1.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="Accelerometer disabled" class="jiveImage wp-image-9629 size-full" src="http://mcuoneclipse.files.wordpress.com/2013/10/accelerometer-disabled1.png?w=584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;Accelerometer disabled&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;h1&gt;Reduced Clock Speed: 11.91 mA&lt;/h1&gt;&lt;p style="margin:0;"&gt;Second rule of low power: slow down the clock speed. Current consumption usually is linear to the used clock speed. So reducing the clock speed should greatly reduce the current. I do not need that 48 MHz clock speed for my application. So I reduce the core clock to 2 MHz and the bus clock to 1 MHz:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;External Crystal 8 MHz&lt;/li&gt;&lt;li&gt;MCG settings to BLPE (Bypass Low Power External reference clock)&lt;/li&gt;&lt;/ul&gt;&lt;p class="alignnone wp-caption" style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/blpe-with-external-crystal.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="BLPE with external Crystal" class="jiveImage size-full wp-image-9615" height="668" src="http://mcuoneclipse.files.wordpress.com/2013/10/blpe-with-external-crystal.png?w=584&amp;amp;h=668" width="584" /&gt;&lt;/a&gt;BLPE with external Crystal&lt;/p&gt;&lt;p style="margin:0;"&gt;gives about 12 mA:&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/2-mhz-with-external-clock1.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="2 MHz with external clock" class="wp-image-9630 jiveImage size-full" src="http://mcuoneclipse.files.wordpress.com/2013/10/2-mhz-with-external-clock1.png?w=584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;2 MHz with external clock&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;h1&gt;Disabled OpenSDA: 7.23 mA&lt;/h1&gt;&lt;p style="margin:0;"&gt;I still have a lot of current consumed. And one part of this is the K20 microprocessor on the board used for OpenSDA. To get rid of that extra current:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Disconnect P3V3_SDA (remove R74 and remove jumper on J3) &lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/removed-power-to-k20.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="Removed Power to K20" class="wp-image-9623 jiveImage size-full" src="http://mcuoneclipse.files.wordpress.com/2013/10/removed-power-to-k20.png?w=584" /&gt;&lt;/a&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;Removed Power to K20&lt;/p&gt;&lt;/li&gt;&lt;li&gt;Disconnect OpenSDA reset line: for this cut the trace under J14 and install a jumper&lt;p class="alignnone wp-caption" style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/cut-j14-trace.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="Cut J14 Trace" class="jiveImage wp-image-9624 size-full" src="http://mcuoneclipse.files.wordpress.com/2013/10/cut-j14-trace.png?w=584" /&gt;&lt;/a&gt;Cut J14 Trace&lt;/p&gt;&lt;p style="margin:0;"&gt;Remove the J14 jumper to disconnect the reset line between the KL25Z and K20 OpenSDA, as otherwise current can flow between the K20 and KL25Z:&lt;/p&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/j14-disconnected-by-jumper.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="J14 disconnected by Jumper" class="jiveImage size-full wp-image-9625" height="372" src="http://mcuoneclipse.files.wordpress.com/2013/10/j14-disconnected-by-jumper.png?w=584&amp;amp;h=372" width="584" /&gt;&lt;/a&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;J14 disconnected by Jumper&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style="margin:0;"&gt;With this, the current went down to 7.2 mA:&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/disabled-opensda.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="Disabled OpenSDA" class="jiveImage wp-image-9631 size-full" src="http://mcuoneclipse.files.wordpress.com/2013/10/disabled-opensda.png?w=584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;Disabled OpenSDA&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;h1&gt;Cut J20: 3.55 mA&lt;/h1&gt;&lt;p style="margin:0;"&gt;Good progress so far: from 20 mA down to 7 mA. But what caused me a lot of head scratching: I would not have expected that 7 mA: it should be more in the 3-4 mA range. And indeed, measuring the current to the KL25Z microcontroller on J4 showed 3.4 mA:&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/kl25z-current-at-2-mhz.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="KL25Z current at 2 MHz" class="jiveImage wp-image-9633" height="136" src="http://mcuoneclipse.files.wordpress.com/2013/10/kl25z-current-at-2-mhz.png?w=269&amp;amp;h=136" width="269" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;KL25Z current at 2 MHz&lt;/p&gt;&lt;p style="margin:0;"&gt;So what is using all the excess current? My goal is to go below 1 mA, and somehow the board itself already uses 3.6 mA somewhere. It took me more head scratching (that’s why I’m getting bald &lt;a href="http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif?m=1129645325g"&gt;&lt;img loading="lazy" alt=";-)" class="jiveImage wp-smiley" src="http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif?m=1129645325g" /&gt;&lt;/a&gt; ). And after a while I realized that current must be flowing back into U1:&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/current-flowing-back-through-j20.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="Current flowing back through J20" class="jiveImage wp-image-9635 size-full" height="199" src="http://mcuoneclipse.files.wordpress.com/2013/10/current-flowing-back-through-j20.png?w=584&amp;amp;h=199" width="584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;Current flowing back through J20&lt;/p&gt;&lt;p style="margin:0;"&gt;With this, I decided to the trace under J20 and to install a jumper there to prevent that current:&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/cut-j20-trace.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="Cut J20 Trace" class="wp-image-9627 jiveImage size-full" src="http://mcuoneclipse.files.wordpress.com/2013/10/cut-j20-trace.png?w=584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;Cut J20 Trace&lt;/p&gt;&lt;p style="margin:0;"&gt;Now my board shows a current I expect &lt;a href="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g"&gt;&lt;img loading="lazy" alt=":-)" class="jiveImage wp-smiley" src="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g" /&gt;&lt;/a&gt; :&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/current-after-cutting-j20.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="Current after cutting J20" class="jiveImage size-full wp-image-9632" src="http://mcuoneclipse.files.wordpress.com/2013/10/current-after-cutting-j20.png?w=584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;Current after cutting J20&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;h1&gt;Using Internal Clock: 2.69 mA&lt;/h1&gt;&lt;p style="margin:0;"&gt;One general rule for low power is: using an external crystal uses less energy than using an internal (on chip) clock generator. However as the FRDM-KL25Z has a high frequency 8 MHz clock needed for its USB operation, it is probably better to use the internal (slower) clock generation module.&lt;/p&gt;&lt;p style="margin:0;"&gt;For this I disable the external crystal and change the mode from BLPE to BLPI (Bypass Low Power Internal):&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/disabled-oscillator-and-blpi-mode.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="Disabled Oscillator and BLPI mode" class="jiveImage wp-image-9642 size-full" height="500" src="http://mcuoneclipse.files.wordpress.com/2013/10/disabled-oscillator-and-blpi-mode.png?w=584&amp;amp;h=500" width="584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;Disabled Oscillator and BLPI mode&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/blpi-settings.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="BLPI Settings" class="jiveImage wp-image-9643 size-full" height="500" src="http://mcuoneclipse.files.wordpress.com/2013/10/blpi-settings.png?w=584&amp;amp;h=500" width="584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;BLPI Settings&lt;/p&gt;&lt;p style="margin:0;"&gt;And the result is again a reduced current consumption:&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/internal-clock.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="Internal Clock" class="jiveImage wp-image-9644" height="125" src="http://mcuoneclipse.files.wordpress.com/2013/10/internal-clock.png?w=262&amp;amp;h=125" width="262" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;Internal Clock&lt;/p&gt;&lt;blockquote class="jive-quote"&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://s0.wp.com/wp-includes/images/smilies/icon_question.gif?m=1129645325g"&gt;&lt;img loading="lazy" alt=":?:" class="jiveImage wp-smiley" src="http://s0.wp.com/wp-includes/images/smilies/icon_question.gif?m=1129645325g" /&gt;&lt;/a&gt; I did not expect that much reduction. Not sure why it has such a big impact. But it seems that this 8 MHz external crystal really is not good for low power applications?&lt;/p&gt;&lt;/blockquote&gt;&lt;h1&gt;&lt;/h1&gt;&lt;h1&gt;&lt;/h1&gt;&lt;h1&gt;Very Low Power Mode: 2.08 mA&lt;/h1&gt;&lt;p style="margin:0;"&gt;To enter the ‘Very Low Power Modes’, I enable the setting in the CPU component. But as the bus clock cannot exceed 800 kHz in this mode, I set it to the next closest value:&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/very-low-power-mode-settings.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="Very Low Power Mode Settings" class="jiveImage wp-image-9646 size-full" height="500" src="http://mcuoneclipse.files.wordpress.com/2013/10/very-low-power-mode-settings.png?w=584&amp;amp;h=500" width="584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;Very Low Power Mode Settings&lt;/p&gt;&lt;p style="margin:0;"&gt;With this, I’m close to 2 mA &lt;a href="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g"&gt;&lt;img loading="lazy" alt=":-)" class="jiveImage wp-smiley" src="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g" /&gt;&lt;/a&gt; . But still twice as high as where I want to be &lt;a href="http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif?m=1129645325g"&gt;&lt;img loading="lazy" alt=":-(" class="jiveImage wp-smiley" src="http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif?m=1129645325g" /&gt;&lt;/a&gt; .&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/very-low-power-enabled.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="Very Low Power Enabled" class="jiveImage size-full wp-image-9648" src="http://mcuoneclipse.files.wordpress.com/2013/10/very-low-power-enabled.png?w=584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;Very Low Power Enabled&lt;/p&gt;&lt;h1&gt;&lt;/h1&gt;&lt;h1&gt;&lt;/h1&gt;&lt;h1&gt;Where is my current going?&lt;/h1&gt;&lt;p style="margin:0;"&gt;To be clear: I’m down to 2.08 mA for the board, while the microprocessor is in RUN mode. So I not enter any of the special low power modes (yet). Still for 2 MHz CPU clock that 2.0 mA are too high to me?&lt;/p&gt;&lt;p style="margin:0;"&gt;So decided to do another measurement: measuring both the board current and the KL25Z current with the OpenSDA on the board enabled (J14 and P_SDA enabled).&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/kl25z-and-board-current.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="KL25Z and Board Current" class="jiveImage size-full wp-image-9651" src="http://mcuoneclipse.files.wordpress.com/2013/10/kl25z-and-board-current.png?w=584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;KL25Z and Board Current&lt;/p&gt;&lt;p style="margin:0;"&gt;That 6.65 mA for the board is no surprise: the K20 of the OpenSDA is active. However what is interesting to see is that the K25Z current is down to 0.754 mA with the OpenSDA active, while it is very close to the 2.083 mA if the OpenSDA is *not* active. This means that about 1.3 mA is going ‘somewhere’ from the KL25Z if the OpenSDA is deactivated. The question is: where, and why?&lt;/p&gt;&lt;h1&gt;&lt;/h1&gt;&lt;h1&gt;&lt;/h1&gt;&lt;h1&gt;OpenSDA Serial Interface&lt;/h1&gt;&lt;p style="margin:0;"&gt;I already have cut the reset line between OpenSDA and the KL25Z. But there is the OpenSDA Serial-to-USB CDC connection:&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/opensda-uart-connection.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="OpenSDA UART Connection" class="wp-image-9652 jiveImage size-full" height="242" src="http://mcuoneclipse.files.wordpress.com/2013/10/opensda-uart-connection.png?w=584&amp;amp;h=242" width="584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;OpenSDA UART Connection&lt;/p&gt;&lt;p style="margin:0;"&gt;And I’m using a UART0 in my application: I’m using it to communicate through OpenSDA to the host machine. But now I have OpenSDA disconnected, and there could be a current flowing from the KL25Z to the K20 (which is unpowered). So I turned of the shell and UART, and look at this &lt;a href="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g"&gt;&lt;img loading="lazy" alt=":-)" class="jiveImage wp-smiley" src="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g" /&gt;&lt;/a&gt; :&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/uart0-and-opensda-disabled.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="UART0 and OpenSDA disabled" class="jiveImage wp-image-9653 size-full" src="http://mcuoneclipse.files.wordpress.com/2013/10/uart0-and-opensda-disabled.png?w=584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;UART0 and OpenSDA disabled&lt;/p&gt;&lt;p style="margin:0;"&gt;I’m getting definitely better &lt;a href="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g"&gt;&lt;img loading="lazy" alt=":-)" class="jiveImage wp-smiley" src="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;h1&gt;&lt;/h1&gt;&lt;h1&gt;&lt;/h1&gt;&lt;h1&gt;Processor Expert Low Power Modes&lt;/h1&gt;&lt;p style="margin:0;"&gt;So far I’m not using any low power modes. The cool thing with Processor Expert is, that it makes usage of low power modes really easy. Calling SetOperationMode() changes between the different low power modes:&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/setoperationmode.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="SetOperationMode" class="jiveImage size-full wp-image-9636" height="237" src="http://mcuoneclipse.files.wordpress.com/2013/10/setoperationmode.png?w=584&amp;amp;h=237" width="584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;SetOperationMode&lt;/p&gt;&lt;p style="margin:0;"&gt;There are several settings inside the CPU component which deal with low power. First is the ‘&lt;strong&gt;Low power mode settings&lt;/strong&gt;‘ group:&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/low-power-mode-settings.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="Low Power Mode Settings" class="jiveImage size-full wp-image-9637" src="http://mcuoneclipse.files.wordpress.com/2013/10/low-power-mode-settings.png?w=584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;Low Power Mode Settings&lt;/p&gt;&lt;p style="margin:0;"&gt;In above dialog I specify which modes are allowed, and which interrupt/events bring me out of Low Leakage mode (LLWU = Low Leakage Wakeup Unit): Usually I use the Low Power Timer (LPTMR) to wake me up.&lt;/p&gt;&lt;p style="margin:0;"&gt;In the Operation mode settings I can specify&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Which mode shall be entered with SetOperationMode()&lt;/li&gt;&lt;li&gt;What should happen after the wake-up interrupt&lt;/li&gt;&lt;/ol&gt;&lt;p class="alignnone wp-caption" style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/operation-mode-settings.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="Operation Mode Settings" class="wp-image-9638 jiveImage size-full" src="http://mcuoneclipse.files.wordpress.com/2013/10/operation-mode-settings.png?w=584" /&gt;&lt;/a&gt;Operation Mode Settings&lt;/p&gt;&lt;h1&gt;&lt;/h1&gt;&lt;h1&gt;&lt;/h1&gt;&lt;h1&gt;Entering Low Power Mode: WAIT down to 0.155 mA&lt;/h1&gt;&lt;p style="margin:0;"&gt;With this, everything is ready to use low power modes from the application.&lt;/p&gt;&lt;p style="margin:0;"&gt;In my application I have a variable LP_mode:&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;div class="syntaxhighlighter cpp"&gt;&lt;table border="0" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="gutter" style="border:0px solid black;"&gt;&lt;div class="number1 alt2 line index0"&gt;1&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="number2 alt1 index1 line" style="margin:0;"&gt;2&lt;/p&gt;&lt;p class="number3 index2 alt2 line" style="margin:0;"&gt;3&lt;/p&gt;&lt;p class="index3 number4 alt1 line" style="margin:0;"&gt;4&lt;/p&gt;&lt;p class="index4 alt2 number5 line" style="margin:0;"&gt;5&lt;/p&gt;&lt;p class="index5 alt1 line number6" style="margin:0;"&gt;6&lt;/p&gt;&lt;p class="number7 alt2 index6 line" style="margin:0;"&gt;7&lt;/p&gt;&lt;p class="index7 number8 alt1 line" style="margin:0;"&gt;8&lt;/p&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class="code" style="border:0px solid black;"&gt;&lt;p class="container" style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;div class="number1 alt2 line index0"&gt;&lt;code class="keyword cpp bold"&gt;typedef&lt;/code&gt; &lt;code class="keyword cpp bold"&gt;enum&lt;/code&gt; &lt;code class="cpp plain"&gt;{&lt;/code&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="number2 alt1 index1 line" style="margin:0;"&gt;&lt;code class="spaces cpp"&gt;&amp;nbsp; &lt;/code&gt;&lt;code class="cpp plain"&gt;LP_RUN,&lt;/code&gt;&lt;/p&gt;&lt;p class="number3 index2 alt2 line" style="margin:0;"&gt;&lt;code class="spaces cpp"&gt;&amp;nbsp; &lt;/code&gt;&lt;code class="cpp plain"&gt;LP_WAIT,&lt;/code&gt;&lt;/p&gt;&lt;p class="index3 number4 alt1 line" style="margin:0;"&gt;&lt;code class="spaces cpp"&gt;&amp;nbsp; &lt;/code&gt;&lt;code class="cpp plain"&gt;LP_SLEEP,&lt;/code&gt;&lt;/p&gt;&lt;p class="index4 alt2 number5 line" style="margin:0;"&gt;&lt;code class="spaces cpp"&gt;&amp;nbsp; &lt;/code&gt;&lt;code class="cpp plain"&gt;LP_STOP&lt;/code&gt;&lt;/p&gt;&lt;p class="index5 alt1 line number6" style="margin:0;"&gt;&lt;code class="cpp plain"&gt;} LP_PowerMode;&lt;/code&gt;&lt;/p&gt;&lt;p class="number7 alt2 index6 line" style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="index7 number8 alt1 line" style="margin:0;"&gt;&lt;code class="keyword cpp bold"&gt;static&lt;/code&gt; &lt;code class="cpp plain"&gt;LP_PowerMode LP_mode;&lt;/code&gt;&lt;/p&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p style="margin:0;"&gt;which is defining the current active low power mode. To switch into a low power mode I use SetOperationMode():&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;div class="syntaxhighlighter cpp"&gt;&lt;table border="0" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="gutter" style="border:0px solid black;"&gt;&lt;div class="number1 alt2 line index0"&gt;1&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="number2 alt1 index1 line" style="margin:0;"&gt;2&lt;/p&gt;&lt;p class="number3 index2 alt2 line" style="margin:0;"&gt;3&lt;/p&gt;&lt;p class="index3 number4 alt1 line" style="margin:0;"&gt;4&lt;/p&gt;&lt;p class="index4 alt2 number5 line" style="margin:0;"&gt;5&lt;/p&gt;&lt;p class="index5 alt1 line number6" style="margin:0;"&gt;6&lt;/p&gt;&lt;p class="number7 alt2 index6 line" style="margin:0;"&gt;7&lt;/p&gt;&lt;p class="index7 number8 alt1 line" style="margin:0;"&gt;8&lt;/p&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class="code" style="border:0px solid black;"&gt;&lt;p class="container" style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;div class="number1 alt2 line index0"&gt;&lt;code class="keyword cpp bold"&gt;if&lt;/code&gt; &lt;code class="cpp plain"&gt;(LP_mode==LP_WAIT) {&lt;/code&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="number2 alt1 index1 line" style="margin:0;"&gt;&lt;code class="spaces cpp"&gt;&amp;nbsp; &lt;/code&gt;&lt;code class="cpp plain"&gt;Cpu_SetOperationMode(DOM_WAIT, NULL, NULL); &lt;/code&gt;&lt;code class="cpp comments"&gt;/* next interrupt will wake us up */&lt;/code&gt;&lt;/p&gt;&lt;p class="number3 index2 alt2 line" style="margin:0;"&gt;&lt;code class="cpp plain"&gt;} &lt;/code&gt;&lt;code class="keyword cpp bold"&gt;else&lt;/code&gt; &lt;code class="keyword cpp bold"&gt;if&lt;/code&gt; &lt;code class="cpp plain"&gt;(LP_mode==LP_SLEEP) {&lt;/code&gt;&lt;/p&gt;&lt;p class="index3 number4 alt1 line" style="margin:0;"&gt;&lt;code class="spaces cpp"&gt;&amp;nbsp; &lt;/code&gt;&lt;code class="cpp plain"&gt;Cpu_SetOperationMode(DOM_SLEEP, NULL, NULL); &lt;/code&gt;&lt;code class="cpp comments"&gt;/* next interrupt will wake us up */&lt;/code&gt;&lt;/p&gt;&lt;p class="index4 alt2 number5 line" style="margin:0;"&gt;&lt;code class="cpp plain"&gt;} &lt;/code&gt;&lt;code class="keyword cpp bold"&gt;else&lt;/code&gt; &lt;code class="keyword cpp bold"&gt;if&lt;/code&gt; &lt;code class="cpp plain"&gt;(LP_mode==LP_STOP) {&lt;/code&gt;&lt;/p&gt;&lt;p class="index5 alt1 line number6" style="margin:0;"&gt;&lt;code class="spaces cpp"&gt;&amp;nbsp; &lt;/code&gt;&lt;code class="cpp plain"&gt;Cpu_SetOperationMode(DOM_STOP, NULL, NULL); &lt;/code&gt;&lt;code class="cpp comments"&gt;/* next interrupt will wake us up */&lt;/code&gt;&lt;/p&gt;&lt;p class="number7 alt2 index6 line" style="margin:0;"&gt;&lt;code class="cpp plain"&gt;}&lt;/code&gt;&lt;/p&gt;&lt;p class="index7 number8 alt1 line" style="margin:0;"&gt;&lt;code class="cpp comments"&gt;/* interrupt will wake us up, and we are back in RUN mode */&lt;/code&gt;&lt;/p&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p style="margin:0;"&gt;WAIT is really easy to use: basically it stops the core clock, while interrupts are still active. And a perfect place to enter that low power mode is from the FreeRTOS Idle task hook:&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;div class="syntaxhighlighter cpp"&gt;&lt;table border="0" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="gutter" style="border:0px solid black;"&gt;&lt;div class="number1 alt2 line index0"&gt;1&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="number2 alt1 index1 line" style="margin:0;"&gt;2&lt;/p&gt;&lt;p class="number3 index2 alt2 line" style="margin:0;"&gt;3&lt;/p&gt;&lt;p class="index3 number4 alt1 line" style="margin:0;"&gt;4&lt;/p&gt;&lt;p class="index4 alt2 number5 line" style="margin:0;"&gt;5&lt;/p&gt;&lt;p class="index5 alt1 line number6" style="margin:0;"&gt;6&lt;/p&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class="code" style="border:0px solid black;"&gt;&lt;p class="container" style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;div class="number1 alt2 line index0"&gt;&lt;code class="keyword cpp bold"&gt;void&lt;/code&gt; &lt;code class="cpp plain"&gt;FRTOS1_vApplicationIdleHook(&lt;/code&gt;&lt;code class="keyword cpp bold"&gt;void&lt;/code&gt;&lt;code class="cpp plain"&gt;)&lt;/code&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="number2 alt1 index1 line" style="margin:0;"&gt;&lt;code class="cpp plain"&gt;{&lt;/code&gt;&lt;/p&gt;&lt;p class="number3 index2 alt2 line" style="margin:0;"&gt;&lt;code class="spaces cpp"&gt;&amp;nbsp; &lt;/code&gt;&lt;code class="cpp comments"&gt;/* Called when the RTOS is idle (from the IDLE task).&lt;/code&gt;&lt;/p&gt;&lt;p class="index3 number4 alt1 line" style="margin:0;"&gt;&lt;code class="spaces cpp"&gt;&amp;nbsp; &lt;/code&gt;&lt;code class="cpp comments"&gt;Here would be a good place to put the CPU into low power mode. */&lt;/code&gt;&lt;/p&gt;&lt;p class="index4 alt2 number5 line" style="margin:0;"&gt;&lt;code class="spaces cpp"&gt;&amp;nbsp; &lt;/code&gt;&lt;code class="cpp plain"&gt;LP_EnterLowPower();&lt;/code&gt;&lt;/p&gt;&lt;p class="index5 alt1 line number6" style="margin:0;"&gt;&lt;code class="cpp plain"&gt;}&lt;/code&gt;&lt;/p&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p style="margin:0;"&gt;Just doing the WAIT mode I get down to 0.155 mA &lt;a href="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g"&gt;&lt;img loading="lazy" alt=":-)" class="jiveImage wp-smiley" src="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g" /&gt;&lt;/a&gt; :&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/wait-mode-enabled.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="WAIT mode enabled" class="jiveImage size-full wp-image-9655" src="http://mcuoneclipse.files.wordpress.com/2013/10/wait-mode-enabled.png?w=584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;WAIT mode enabled&lt;/p&gt;&lt;blockquote class="jive-quote"&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://s0.wp.com/wp-includes/images/smilies/icon_exclaim.gif?m=1129645325g"&gt;&lt;img loading="lazy" alt=":!:" class="jiveImage wp-smiley" src="http://s0.wp.com/wp-includes/images/smilies/icon_exclaim.gif?m=1129645325g" /&gt;&lt;/a&gt; With the above setup, I have only one task running and a blinking LED. The application with all the sensors will have two more tasks added, so the power consumption will go up again.&lt;/p&gt;&lt;/blockquote&gt;&lt;h1&gt;&lt;/h1&gt;&lt;h1&gt;&lt;/h1&gt;&lt;h1&gt;FreeRTOS Tickless Idle Mode: 0.132 mA&lt;/h1&gt;&lt;p style="margin:0;"&gt;FreeRTOS comes with a cool low power feature: the &lt;a class="jive-link-external-small" href="http://mcuoneclipse.com/2013/07/06/low-power-with-freertos-tickless-idle-mode/" rel="nofollow ugc noopener" target="_blank" title="Low Power with FreeRTOS: Tickless Idle Mode"&gt;Tickless Idle Mode&lt;/a&gt;. I have enabled it along with using the &lt;a class="jive-link-external-small" href="http://mcuoneclipse.com/2013/08/30/optimized-freertos-stack-check-and-systick-for-arm-cortex-cores/" rel="nofollow ugc noopener" target="_blank" title="Optimized FreeRTOS: Stack Check and SysTick for ARM Cortex Cores"&gt;special Systick Prescaler&lt;/a&gt;:&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/freertos-tickless-idle-mode.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="FreeRTOS Tickless Idle Mode" class="wp-image-9656 jiveImage size-full" src="http://mcuoneclipse.files.wordpress.com/2013/10/freertos-tickless-idle-mode.png?w=584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;FreeRTOS Tickless Idle Mode&lt;/p&gt;&lt;p style="margin:0;"&gt;With this, the RTOS will delay the SysTick interrupts as long as possible, extending the low power idle modes and reducing the interrupt load. And this is what I get as board current &lt;a href="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g"&gt;&lt;img loading="lazy" alt=":-)" class="jiveImage wp-smiley" src="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g" /&gt;&lt;/a&gt;&amp;nbsp; :&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;a href="http://mcuoneclipse.files.wordpress.com/2013/10/wait-with-freertos-tickless-idle-mode.png" rel="nofollow ugc noopener" target="_blank"&gt;&lt;img loading="lazy" alt="WAIT with FreeRTOS Tickless Idle Mode" class="jiveImage wp-image-9657 size-full" src="http://mcuoneclipse.files.wordpress.com/2013/10/wait-with-freertos-tickless-idle-mode.png?w=584" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="wp-caption-text" style="margin:0;"&gt;WAIT with FreeRTOS Tickless Idle Mode&lt;/p&gt;&lt;h1&gt;&lt;/h1&gt;&lt;h1&gt;&lt;/h1&gt;&lt;h1&gt;Summary&lt;/h1&gt;&lt;p style="margin:0;"&gt;The week-end is over, and I need to stop here at the WAIT mode. I have not explored the more advanced SLEEP and STOP modes, but on the other hand I’m now well below my target of 1 mA for the board anyway &lt;a href="http://s2.wp.com/wp-includes/images/smilies/icon_mrgreen.gif?m=1129645325g"&gt;&lt;img loading="lazy" alt=":mrgreen:" class="jiveImage wp-smiley" src="http://s2.wp.com/wp-includes/images/smilies/icon_mrgreen.gif?m=1129645325g" /&gt;&lt;/a&gt;&amp;nbsp; .&lt;/p&gt;&lt;p style="margin:0;"&gt;Modern microcontroller come with many advanced low power modes. Unfortunately for many applications most extreme low power modes are not usable as they completely shut down the processor, making it hard to use with an application e.g. using an operating system. The Freescale KL25Z processor is no exception to this. But even with ‘moderate’ power saving settings I’m able a reasonable power reduction. Still, there are a lot of settings, and I it is definitely not easy to find my way through the endless and complicated settings the silicon designers have invented. But at least with Processor Expert things are easier to find and configure.&lt;/p&gt;&lt;p style="margin:0;"&gt;Development boards are great for development or evaluation. They are usually not designed for low power usage, because they have too much components on it consuming energy. However, as shown with the FRDM-KL25Z it is possible to get into a working solution:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Disable by software any external devices not used (e.g. Accelerometer)&lt;/li&gt;&lt;li&gt;Disable any on-board debugging devices (e.g. OpenSDA). Do not only cut power, disable as well any other debugging signals (e.g. Reset).&lt;/li&gt;&lt;li&gt;Carefully check the changed current flow if not using the on board regulators (e.g. prevent current flowing back to the regulators).&lt;/li&gt;&lt;li&gt;Make sure that there is no current through connection lines to unused devices (e.g. UART0 to K20 OpenSDA).&lt;/li&gt;&lt;li&gt;Using an RTOS like FreeRTOS does not mean it cannot use low power modes. A mode like WAIT already greatly reduces the power consumption. The tickless idle mode of FreeRTOS is helping to reduce the power consumption too.&lt;/li&gt;&lt;li&gt;I would not have been able to reach this in such a short time without the help of Processor Expert &lt;a href="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g"&gt;&lt;img loading="lazy" alt=":-)" class="jiveImage wp-smiley" src="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g" /&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style="margin:0;"&gt;The project I have used for my testing is available &lt;a class="jive-link-external-small" href="https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/FRDM-KL25Z/Freedom_LowPower" rel="nofollow ugc noopener" target="_blank"&gt;on GitHub here&lt;/a&gt;. Hope this is useful, and helps your battery powering a FRDM-KL25Z. So far I have reached my goals with a board consumption less than 1 mA &lt;a href="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g"&gt;&lt;img loading="lazy" alt=":-)" class="jiveImage wp-smiley" src="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g" /&gt;&lt;/a&gt; . But as soon as I find time, I’ll explore the more advanced low power modes. Until then, have a look at the Freescale web site for any documenation about how to use the low power modes for the KL25Z (or any other ARM Cortex-M0+).&lt;/p&gt;&lt;p style="margin:0;"&gt;Happy Low-Powering &lt;a href="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g"&gt;&lt;img loading="lazy" alt=":-)" class="jiveImage wp-smiley" src="http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif?m=1129645325g" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: freescale, frdm-kl25z, freedom&lt;/div&gt;
</description></item></channel></rss>