The following document contains information on Cypress products. Colophon The products described in this document are designed, developed and manufactured as contemplated for general use, including without limitation, ordinary industrial use, general office use, personal use, and household use, but are not designed, developed and manufactured as contemplated (1) for any use that includes fatal risks or dangers that, unless extremely high safety is secured, could have a serious effect to the public, and could lead directly to death, personal injury, severe physical damage or other loss (i.e., nuclear reaction control in nuclear facility, aircraft flight control, air traffic control, mass transport control, medical life support system, missile launch control in weapon system), or (2) for any use where chance of failure is intolerable (i.e., submersible repeater and artificial satellite). Please note that Spansion will not be liable to you and/or any third party for any claims or damages arising in connection with above-mentioned uses of the products. Any semiconductor devices have an inherent chance of failure. You must protect against injury, damage or loss from such failures by incorporating safety design measures into your facility and equipment such as redundancy, fire protection, and prevention of over-current levels and other abnormal operating conditions. If any products described in this document represent goods or technologies subject to certain restrictions on export under the Foreign Exchange and Foreign Trade Law of Japan, the US Export Administration Regulations or the applicable laws of any other country, the prior authorization by the respective government entity will be required for export of those products. Trademarks and Notice The contents of this document are subject to change without notice. This document may contain information on a Spansion product under development by Spansion. Spansion reserves the right to change or discontinue work on any product without notice. The information in this document is provided as is without warranty or guarantee of any kind as to its accuracy, completeness, operability, fitness for particular purpose, merchantability, non-infringement of third-party rights, or any other warranty, express, implied, or statutory. Spansion assumes no liability for any damages of any kind arising out of the use of the information in this document. ® ® ® TM Copyright © 2013 Spansion Inc. All rights reserved. Spansion , the Spansion logo, MirrorBit , MirrorBit Eclipse , TM ORNAND and combinations thereof, are trademarks and registered trademarks of Spansion LLC in the United States and other countries. Other names used are for informational purposes only and may be trademarks of their respective owners. Fujitsu Semiconductor (Shanghai) Co., Ltd. Application Note MCU-AN-500074-E-13 F²MC-8FX FAMILY 8-BIT MICROCONTROLLER ALL SERIES LOW POWER CONSUMPTION STRATEGY APPLICATION NOTE Low Power Consumption Strategy V1.3 Revision History Revision History Date 2009-12-07 2009-01-08 2009-01-12 2009-01-14 Author Edison, Zhang Jacky, Zhou Jacky, Zhou Jacky, Zhou Change of Records V1.0, First draft V1.1, add detail description V1.2, add 3.3.4 V1.3, update incorrect expression This manual contains 18 pages. 1. The products described in this manual and the specifications thereof may be changed without prior notice. To obtain up-to-date information and/or specifications, contact your Fujitsu sales representative or Fujitsu authorized dealer. 2. Fujitsu will not be liable for infringement of copyright, industrial property right, or other rights of a third party caused by the use of information or drawings described in this manual. 3. The contents of this manual may not be transferred or copied without the express permission of Fujitsu. 4. The products contained in this document are not intended for use with equipment which require extremely high reliability such as aerospace equipment, undersea repeaters, nuclear control systems or medical equipment for life support. 5. Some of the products described in this manual may be strategic materials (or special technology) as defined by the Foreign Exchange and Foreign Trade Control Law. In such cases, the products or portions theory must not be exported without permission as defined under the law. © 2009 Fujitsu Semiconductor (Shanghai) Co., Ltd. MCU-AN-500074-E-13 – Page 2 Low Power Consumption Strategy V1.3 CONTENTS CONTENTS REVISION HISTORY .............................................................................................................. 2 CONTENTS ............................................................................................................................ 3 1 INTRODUCTION ................................................................................................................ 4 2 LOW POWER CONSUMPTION STRATEGY .................................................................... 5 3 HW STRATEGY ................................................................................................................. 6 3.1 Select Low Power Supply Voltage ............................................................................ 6 3.2 Select Low Power Consumption Clock ..................................................................... 7 3.2.1 Adopt Suitable Clock ................................................................................... 7 3.2.2 Switch among Clock Modes ........................................................................ 7 3.3 Select Low Power Consumption Mode ................................................................... 10 3.3.1 Internal Operating States for Standby Mode and Clock Mode .................. 10 3.3.2 Power Consumption of Standby Modes .................................................... 11 3.3.3 Switch among Different Standby Modes ................................................... 12 3.3.4 Clock Setting Example for Low Power Consumption ..................................... 13 4 SOFTWARE STRATEGY ................................................................................................ 14 4.1 Interrupt Instead of Inquire ...................................................................................... 14 4.2 Macro Instead of Subroutine ................................................................................... 14 4.3 Reduce Calculation ................................................................................................. 15 4.3.1 Inquire Table ............................................................................................. 15 4.3.2 Stop calculation when precision is satisfied .............................................. 15 4.3.3 Adopt Suitable Data Type ......................................................................... 15 4.3.4 Adopt Fujitsu Math API ............................................................................. 15 4.4 Close unused Module ............................................................................................. 16 5 ADDITIONAL INFORMATION ......................................................................................... 17 6 APPENDIX ....................................................................................................................... 18 6.1 List of Figures and Tables ....................................................................................... 18 MCU-AN-500074-E-13 – Page 3 Low Power Consumption Strategy V1.3 Chapter 1 Introduction 1 Introduction This application note describes strategy for low power consumption in all F²MC-8FX Family 8-Bit Microcontroller Series MCU. This application note mainly introduces method to reduce power consumption and provides investigation of LPC MCU power consumption. MCU-AN-500074-E-13 – Page 4 Low Power Consumption Strategy V1.3 Chapter 2 Low Power Consumption Strategy 2 Low Power Consumption Strategy Low power consumption mainly targets to reduce system cost and increase battery life in the embedded application, especially for portable device. For embedded application based on MCU, minimizing system power consumption can be implemented by both hardware and software method. MCU-AN-500074-E-13 – Page 5 Low Power Consumption Strategy V1.3 Chapter 3 HW Strategy 3 HW Strategy 3.1 Select Low Power Supply Voltage The power consumption can be implemented efficiently by reducing the power supply voltage of MCU. According to LPC MCU, it can work at a wide voltage range between 2.4V and 5.5V, as shown in Table 3-1. Table 3-1 Operation Conditions Description Value Unit Parameter Remarks Symbol Power supply voltage VCC Operating temperature TA Min Max 2.4 5.5 2.3 5.5 2.9 5.5 In normal operation 2.3 5.5 Hold condition in stop mode -40 +85 +5 +35 In normal operation V ℃ Hold condition in stop mode Other than onchip debug mode On-chip debug mode Other than on-chip debug function On-chip debug function System current will be reduced largely if low power supply is adopted, and the lower the power supply voltage is, the lower the power consumption will be. Therefore it’s better to select lower power supply voltage only if system requirement can be achieved. Now, power supply voltage of many MCU systems is 5V, in the last 5 years, quantity of 3V MCU system is increasing so much, quantity of 2V MCU system is also increasing, in future, quantity of low power supply voltage MCU system may be more than 5V. It’s an important trend to reduce the power supply voltage of MCU. MCU-AN-500074-E-13 – Page 6 Low Power Consumption Strategy V1.3 Chapter 3 HW Strategy 3.2 Select Low Power Consumption Clock 3.2.1 Adopt Suitable Clock For F²MC-8FX Family 8-Bit Microcontroller Series MCU, four kinds of clock source are available: Main clock, Main CR clock, Sub clock, Sub CR clock. ■ Main Clock Mode Main clock is used as the machine clock for the CPU and peripheral functions. The timebase timer operates using the main clock. The watch prescaler operates with the subclock (on the dual external clock product). ■ Sub Clock Mode (on Dual External Clock Product) Main clock oscillation is stopped and the sub clock is used as the machine clock for the CPU and peripheral functions. In this mode, the timebase timer stops as it requires the main clock for operation. ■ Main CR Clock Mode Main CR clock is used as the machine clock for the CPU and peripheral functions. The timebase timer and the watchdog timer operate using the main clock. The watch prescaler operates with the sub clock (on the dual external clock product). ■ Sub CR Clock Mode (on Dual External Clock Product) Main clock oscillation is stopped and the sub-CR clock is used as the machine clock for the CPU and peripheral functions. In this mode, the timebase timer stops as it requires the main clock for operation. The watch prescaler operates using the sub-CR clock. Using Main CR clock and Sub CR clock, the advantage is to economize external crystal, so it can reduce HW cost; the disadvantage is that the precision may be not high, and the power consumption may be high. For more details about how to select suitable clock, refer to related hardware manual and datasheet. 3.2.2 Switch among Clock Modes Sometimes, it may not satisfy requirement of system function and low power consumption if just adopting one clock mode. Therefore all four clock modes or part of four clock modes can be adopted by Fujitsu MCU, and MCU can switch among these modes to satisfy different requirements. Figure 3-1 and Figure 3-2 show switching between these modes. MCU-AN-500074-E-13 – Page 7 Low Power Consumption Strategy V1.3 Chapter 3 HW Strategy Figure 3-1 Clock Mode State Transition Diagram (Dual External Clock Product) MCU-AN-500074-E-13 – Page 8 Low Power Consumption Strategy V1.3 Chapter 3 HW Strategy Figure 3-2 Clock Mode State Transition Diagram (Single External Clock Product) MCU-AN-500074-E-13 – Page 9 Low Power Consumption Strategy V1.3 Chapter 3 HW Strategy 3.3 Select Low Power Consumption Mode For F²MC-8FX Family 8-Bit Microcontroller Series MCU, low power consumption mode (Standby mode), includes sleep mode, timebase timer mode, watch mode and stop mode. Power consumption in standby mode is less than in run mode. MCU can be simply divided into below modules: main clock, main CR clock, sub clock, sub CR clock, CPU, ROM, RAM, I/O ports, timebase timer, watch prescaler, external interrupt, hardware watchdog timer, software watchdog timer, low-voltage detection reset, and other peripheral Functions. 3.3.1 Internal Operating States for Standby Mode and Clock Mode When all these modules are working, the power consumption is the highest. In run mode, many of these modules are working, so the power consumption is high. Oppositely in standby mode, just parts of these modules are working, so the power consumption is low. Take MB95200/210 Series for example, Table 3-2 and Table 3-3 show operation states of different clock modes in both RUN and sleep mode. Table 3-2 Combinations of Standby Mode and Clock Mode and Internal Operating States (1) MCU-AN-500074-E-13 – Page 10 Low Power Consumption Strategy V1.3 Chapter 3 HW Strategy Table 3-3 Combinations of Standby Mode and Clock Mode and Internal Operating States (2) 3.3.2 Power Consumption of Standby Modes Take MB95F264 as example, the power consumption is not the same in different standby modes. Table 3-4 describes the power consumption of standby modes. Mode Name Table 3-4 Power Consumption of Standby Modes Voltage Clock Frequency Power Consumption Temperature Typ Max Sleep mode 5.5 mA 9 mA 5.5 VCC 32MHz +25℃ Stop mode 3.5μA 22.5μA 5.5 VCC 32kHz +25℃ Timebase timer mode 1.1 mA 3 mA 5.5 VCC 32MHz +25℃ 5μA 30μA 5.5 VCC 32kHz +25℃ Watch mode MCU-AN-500074-E-13 – Page 11 Low Power Consumption Strategy V1.3 Chapter 3 HW Strategy 3.3.3 Switch among Different Standby Modes Sometimes, it may not satisfy requirement of system function and low power consumption if just adopting one standby mode. So except run mode, all four standby modes or part of four clock modes can be adopted, and MCU can switch among these modes to satisfy different requirements. Figure 3-3 and figure 3-4 show switching between these modes. Figure 3-3 Standby Mode State Transition Diagram (Dual External Clock Product) MCU-AN-500074-E-13 – Page 12 Low Power Consumption Strategy V1.3 Chapter 3 HW Strategy Figure 3-4 Standby Mode State Transition Diagram (Single External Clock Product) 3.3.4 Clock Setting Example for Low Power Consumption Following are two simple examples: In car alarm, select main clock as MCLK when it works at normal status, and change to sub clock (32.768 KHz) when it enters into sleep mode. In smoke detector or other low frequency system, select a 200K sub CR as MCLK is enough. It is based on the fact that this kind of system only needs to work at very low frequency and doesn’t care real time function. MCU-AN-500074-E-13 – Page 13 Low Power Consumption Strategy V1.3 Chapter 4 Software Strategy 4 Software Strategy Suitable software can reduce power consumption, but it’s easy to ignore by users. For reducing power consumption, it’s not easy to find the defect on FW, and there is no strict standard to judge if FW has the feature of low power consumption. However, there are some ways to avoid unnecessary power consumption due to FW defect. 4.1 Interrupt Instead of Inquire For a simple application, it doesn’t matter to adopt interrupting or inquiring, however it’s important for lower power consumption system. When using interrupt, CPU needs to do nothing, even enter stop mode (lowest power consumption mode); while using inquire, CPU must access I/O registers continuously, so more additional power is consumed. 4.2 Macro Instead of Subroutine It’s well known that more power is consumed to access RAM than to access Flash. When using subroutine, four steps are necessary: 1 Store parameters in stack 2 Save registers in stack 3 Save result 4 Restore registers What’s more, all these four steps are to access RAM. To solve this problem, macro can be used instead of subroutine. In this way, the four steps to access RAM are not implemented any more. But there is a problem that the code size is increased. Fortunately for F²MC-8FX Family 8-Bit Microcontroller Series MCU, the Flash size is from 4K bytes to 60K bytes, and diversified MCU can be selected to satisfy different applications. MCU-AN-500074-E-13 – Page 14 Low Power Consumption Strategy V1.3 Chapter 4 Software Strategy 4.3 Reduce Calculation There are many ways to reduce MCU calculation. 4.3.1 Inquire Table Get the calculation data results beforehand, make them into a data table, and store the data table in Flash of MCU, then MCU will get them by inquiring the data table. In this way, many real time calculations will be reduced, so the power consumption is reduced. 4.3.2 Stop calculation when precision is satisfied Sometimes some real time calculations must be implemented, if there is requirement for precision, stop the calculation when the precision is satisfied. In this way, many unnecessary real time calculations will be reduced, so the power consumption is reduced. 4.3.3 Adopt Suitable Data Type Try to adopt suitable data type, such as using 8 bit data to instead of 16 bit data, using fraction calculation to instead of float data calculation. In this way, some unnecessary calculations will be reduced, so the power consumption is reduced. 4.3.4 Adopt Fujitsu Math API Try to adopt Fujitsu Math API instead of original Fujitsu Math Lib. Fujitsu Math APIs are available, which can be applied to all series F²MC-8FX 8-Bit Microcontroller. This math API can calculate more efficiently. Compared to F²MC-8FX compiler’s math arithmetic, only multiplication and division APIs which need to be advanced are implemented in this Math API. For details, refer to mcu-an-500073-e-14 and related sample project. Table 4-1 shows the performance of Fujitsu Math API. In this way, many unnecessary calculations will be reduced, so the power consumption is reduced. Table 4-1: Performance Compare between Math API and C Compiler Math Lib C compiler Math Lib Calculation Times MCLK ROM RAM UChar*Uint 10 252 127 10 UInt*Uint 10 252 127 10 ULong*Uchar 10 252 127 10 ULong*Uint 10 252 127 10 ULong/Uchar 0 1614 238 12 ULong/Uint 0 1614 238 12 Times 2 4 4 7 0 0 Math API MCLK ROM 87 40 168 88 157 79 212 107 1327 80 1320 76 Note: 1 Times: how many times math API uses MULU/DIVU 2 MCLK: how many machine clock used by math API 3 ROM: how many bytes ROM used by math API 4 RAM: how many bytes RAM (stack) used by math API MCU-AN-500074-E-13 – Page 15 RAM 8 10 12 12 12 12 Low Power Consumption Strategy V1.3 Chapter 4 Software Strategy 4.4 Close unused Module To reduce power consumption, close MCU I/Os and periphery which are not used, and close MCU I/Os and periphery in time which are used discontinuity. Some periphery modules such as RS232 modules, it will cost power, so 1 I/O pin can be used to control it, when module is not used sometimes, power of module can be turned off by MCU. Set unused I/O pins to input or output, and pull up to Vcc through pull up resistance, because if these pins are not initialized, the leak current will be increased. MCU-AN-500074-E-13 – Page 16 Low Power Consumption Strategy V1.3 Chapter 5 Additional Information 5 Additional Information For more Information on FUJITSU Semiconductor products, visit the following web sites: English version: http://www.fujitsu.com/cn/fsp/services/mcu/mb95/application_notes.html Simplified Chinese Version: http://www.fujitsu.com/cn/fss/services/mcu/mb95/application_notes.html MCU-AN-500074-E-13 – Page 17 Low Power Consumption Strategy V1.3 Chapter 6 Appendix 6 Appendix 6.1 List of Figures and Tables Figure 3-1 Clock Mode State Transition Diagram (Dual External Clock Product).................... 8 Figure 3-2 Clock Mode State Transition Diagram (Single External Clock Product) ................. 9 Figure 3-3 Standby Mode State Transition Diagram (Dual External Clock Product) ............. 12 Figure 3-4 Standby Mode State Transition Diagram (Single External Clock Product) ........... 13 Table 3-1 Operation Conditions Description ............................................................................ 6 Table 3-2 Combinations of Standby Mode and Clock Mode and Internal Operating States (1) ............................................................................................................................. 10 Table 3-3 Combinations of Standby Mode and Clock Mode and Internal Operating States (2) ............................................................................................................................. 11 Table 3-4 Power Consumption of Standby Modes ............................................................... 11 Table 4-1: Performance Compare between Math API and C Compiler Math Lib .................. 15 MCU-AN-500074-E-13 – Page 18