Home

Introduction to STM8L15x power saving modes using the STM8L

image

Contents

1. TI AN3269 YI Application note Introduction to STM8L15x power saving modes using the STM8L DISCOVERY lpp measurement feature Introduction This application note introduces some of the power saving modes available in the STM8L microcontroller family The STM8L DISCOVERY has a built in Ipp measurement feature that is used to demonstrate the real capabilities of the STM8L15x microcontroller s low power modes This application does not require any additional hardware Once the STM8L DISCOVERY is powered up through a USB cable connected to the host PC the application is ready to dynamically display the STM8L power consumption in each of the different modes selected by the user This software example comes preloaded with your STM8L DISCOVERY and is readily accessible at application power up Reference documents m STM8L DISCOVERY evaluation board user manual UM0970 m STM8L DISCOVERY software user manual Developing and debugging your STM8L DISCOVERY application code UM0991 m Application note STM8L family power management AN3147 The above documents are available at http www st com September 2010 Doc ID 17904 Rev 1 1 19 www st com www BDTIC com ST Contents AN3269 Contents 1 Application description e eee 5 1 1 Hardware required nunaa annaa eedw spades Ne Mah eine seeds 5 1 2 STM8L DISCOVERY hardware settings 0 Aa 5 1 3 Application schematics 00 cee ee 5 1
2. Ultra low power mode GPIO Low power config Disable external counter U3 Halt Init function v Starts U3 counter that Enable external counter U3 controls microcontroller Y wakeup HALT instruction amang Interrupt occurred END ps Device in Halt mode ai18622 16 19 Doc ID 17904 Rev 1 a www BDTIC com ST AN3269 Conclusion 3 Conclusion A multitude of new mobile communications based wireless entertainment and computing applications being developed for tomorrow s markets need more and more performance and longer times between battery recharging STM8L both combines high performance core and ultra low power consumption modes This example allows you to evaluate the current consumption of the STM8L microcontroller in various operating conditions and to demonstrate its low power capabilities by directly providing the consumption value to STM8L DISCOVERY users on the LCD panel With this example STM8L DISCOVERY provide a very low cost environment that can be used for additional development projects where device consumption and application autonomy take on their full meaning It can be a useful starting point that can easily expanded to investigate other aspects of the user s target application Doc ID 17904 Rev 1 17 19 www BDTIC com ST Revision history AN3269 4 Revision history Table 2 Doc
3. initialize clear display strings and scrolling messages needed in the application code For some low power mode measurements the LCD controller is turned OFF to minimize the current consumption of STM8L152 Clock The HSI high speed internal 16 MHz oscillator is selected as clock source The application manages the peripheral clocks depending on the selected power saving mode When the device enters low power run mode HSI is switched OFF and LSI acts as the main clock source until the device is woken up by an external event When exiting Low power run mode the device switches the HSI oscillator back ON On the other hand LSE is switched ON during Manufacturing test mode see Section 1 5 3 STM8L 15x standard firmware library configuration The stm8115x cont h file of the STM8L standard firmware library allows you to configure the library by enabling the peripheral functions used by the application Doc ID 17904 Rev 1 11 19 www BDTIC com ST Software description AN3269 The following statements must be present include stm8115x h include stm8l15x_clk h include sitm8 15x exti h include stm8I15x_flash h include stm8115x gpio h include sitm81 15x Icd h include stm8I15x_rtc h include stm8115x tim4 h 2 3 Application software flowcharts 2 3 1 Main application flowchart Figure 4 Main application flowchart START AA Peripheral initialization AA LCD displa
4. resistor is 1001 x R Figure 2 Ipp measurement equivalent circuitry 3 V3 A Gain 50 A PFO IDD meas 4 C te ann STM8L15x ove PE6 EN Pc4 LP wake up GND T ai18616 This resistor is placed in parallel to a high sense operational amplifier A with fixed gain that amplifies the voltage V present on resistors A sample and hold stage is placed behind and Doc ID 17904 Rev 1 ky www BDTIC com ST AN3269 Application description 1 5 1 5 1 then is connected to an analog input of the MCU PFO Ipp Measurement that finally converts the resulting voltage image of the consumption current In low power modes only a counter enabled by STM8L PC4 pin manages the measurement timing while the microcontroller is idle The microcontroller is woken up after a 150 ms delay controlled by the K2 switch While the microcontroller is in one of the power saving modes a capacitor C is able to store the measurement charge so that the microcontroller can later give the value of Low power mode current consumption early on in the microcontroller wake up phase in the first 50 ms Switch S is opened at device start up in order to keep the charge collected in capacitor C intact while the microcontroller is in low power mode The current measurement precision is enhanced by taking into account the bias curr
5. 4 Application principle t lt ve2e4 iuetoswe sees ved tekeuSel oetee Rares 6 1 4 1 OVEIVIOW ana 5 SoG or TA ee se Se wed da ada hae NA 6 1 4 2 Ibp Measurement principle 0 cee eee 6 1 5 Getting started with the application 0 000 eee eee 7 1 5 1 Demo mode lpp measurement 000 cece eee 7 1 5 2 Bias current record eee 9 1 5 3 Manufacturing test n 0 6 tte 9 1 6 LOW power MODES 2 vesset sis eeuwe sede ta bene Siew eegar eee aebate 9 2 Software description 0 00 cece eee eee eee eee 11 2 1 STMB8L peripherals used by the application 0000 11 2 2 STM8L15x standard firmware library configuration 11 2 3 Application software flowcharts 0 00 eee eee 12 2 3 1 Main application flowchart 0 0 2 0 0 00 eee 12 2 3 2 Demo mode lpp measurement 0 0 0 ee eee 13 3 CONCIUSION sa cs wana aw et KG BANGKA ek ge Rbk esa WG AA 17 4 REVISION history Xa maka eee ede eee eee eR ek awe 18 2 19 Doc ID 17904 Rev 1 ky www BDTIC com ST AN3269 List of tables List of tables Table 1 Bars and LCD display linked to functions 00 cece eee 8 Table 2 Document revision history 000 0c cee eee eee 18 ky Doc ID 17904 Rev 1 3 19 www BDTIC com ST List of figures AN3269 List of figures Figure 1 Figure 2 Figure 3 Figure 4 Figure 5 Figure 6 Figure 7 Figure 8 4 19 Application schematics 0 0
6. Executed from RAM Lo Includes in Halt Init function Regulator Ultra low power mode GPIO Low power config Disable external counter U3 y Switch ON LSI Switch OFF HSI Enable interrupts Switch OFF flash memory Switch OFF regulator WFE set to external interrupt from PE6 Enable external counter U3 y p Includes in LPR_Init function and RAM segment Wait For Event instruction L Interrupt occurred Clear interrupt Disable WFE Switch ON regulator y Switch ON HSI END ai18621 In Figure 7 the part of the flowchart in purple shading only concerns Low power run mode without LCD for which it is useful to disable additional modules like RTC and LCD The part in light green shading is executed from RAM so that Flash memory and regulator can be switched OFF and thus save more power as the LSI oscillator also switched to be the main clock source 4 Doc ID 17904 Rev 1 15 19 www BDTIC com ST Software description AN3269 In Halt mode the device reaches a deeper level of energy saving level by disabling the oscillators The device is woken up from this mode by an external interrupt generated by the U3 counter Figure 8 Halt mode flowchart Halt mode START Sa A LCD disable RTC clock source None RTC clock OFF LCD clock OFF LSI disable Regulator
7. Lowe t SS AS J IDD measurement amp display l END Hi ai18619 Run mode Low power AN Ne lbp measurement and display The following flowchart describes the Ipp measurement and display steps Doc ID 17904 Rev 1 13 19 www BDTIC com ST Software description AN3269 Figure 6 Measurement and display flowchart START k IDD measurement amp display y Disable interrupts y ADC init y Get conversion NO 8 times YES y Disable external counter U3 y Disable ADC peripheral v Perform average convert value display on LCD END ai18620 As shown in Figure 6 the ADC conversion is performed 8 times in succession and an average value is computed at the end before to be converted and displayed on LCD Run Low power run amp Halt modes For Ipp measurement in Run mode there is no particular setup needed other that performed during the STM8L152 power on initialization For this function the application goes directly to Ipp measurement and display routine For other functions such as Low power run with or without LCD and Halt here are detailed the flowcharts of the specific device configuration 14 19 Doc ID 17904 Rev 1 ky www BDTIC com ST AN3269 Software description Figure 7 Low power run mode flowchart PU Without LCD only N Ha START Low power mode
8. THOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION OR INFRINGEMENT OF ANY PATENT COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT UNLESS EXPRESSLY APPROVED IN WRITING BY AN AUTHORIZED ST REPRESENTATIVE ST PRODUCTS ARE NOT RECOMMENDED AUTHORIZED OR WARRANTED FOR USE IN MILITARY AIR CRAFT SPACE LIFE SAVING OR LIFE SUSTAINING APPLICATIONS NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY DEATH OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE ST PRODUCTS WHICH ARE NOT SPECIFIED AS AUTOMOTIVE GRADE MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USER S OWN RISK Resale of ST products with provisions different from the statements and or technical features set forth in this document shall immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever any liability of ST ST and the ST logo are trademarks or registered trademarks of ST in various countries Information in this document supersedes and replaces all information previously supplied The ST logo is a registered trademark of STMicroelectronics All other names are the property of their respective owners 2010 STMicroelectronics All rights reserved STMicroelectronics group of companies Australia Belgium Brazil Canada China Czech Republic Finland France Ge
9. ccc ttt 5 lbp measurement equivalent circuitry 0 0 02 eee 6 Function Change state diagram 000 cece tees 8 Main application flowchart 00 ce eee 12 Demo mode sequence 2 ccc eee 13 Measurement and display flowchart 0 0 c eee eee 14 Low power run mode flowchart 0 0 cece teens 15 Halt mode flowchart 0 0 cee nett 16 Doc ID 17904 Rev 1 ky www BDTIC com ST AN3269 Application description 1 1 1 2 Note 1 3 Application description Hardware required This application uses the STM8L DISCOVERY on board LEDs green LD3 and blue LD4 the 6 digit 4 bar LCD glass display and the user push button No additional components are required STM8L DISCOVERY hardware settings The Ipp jumper JP1 must be placed in position ON for standard operation except for bias current record operation see Section 1 5 2 All solder bridges SB11 to SB17 must be shorted bottom side of STM8L DISCOVERY Application schematics Figure 1 shows the application electrical schematics Figure 1 Application schematics IDD measurement circuitry PFO PE6 PC4 ser push button STM8L152C6T6 LCD controller LCDCOM 3 0 LCDSEG 28 0 M Mi Me Y y pd BAR LCD ai18615 Doc ID 17904 Rev 1 5 19 www BDTIC com ST Application description AN3269 1 4 1 4 1 1 4 2 6 19 Application princi
10. ent of its own operational amplifier When JP1 is placed in OFF position Ipp measurement circuitry disabled a special test invoked by the user at device start up measures this current value and stores it in the non volatile memory Once this value is stored in the device it is deducted from the next Ipp measurement to compensate errors due to bias current see Section 1 5 2 Bias current record For additional information related to the Ipp measurement feature please refer to STM8L DISCOVERY evaluation board user manual UM0970 Getting started with the application This STM8L DISCOVERY example application has 3 application modes that can be run Demo mode lpp measurement e Bias current record e Manufacturing test Demo mode is available at application power up while the two other ones are called by the user according to a specific procedure that is detailed later in this chapter However for best performance it is recommended to control and record the Bias current before starting precise Ipp measurement displays Demo mode Ipp measurement Once the application is powered up via the USB cable or by external power supply it starts displaying a welcoming message and then after a few seconds the value of the Vpp voltage applied to the STM8L device LD3 green LED and LD4 blue LED blink alternately As soon as Ipp consumption values are displayed both LEDs are turned off The User push button allow you to change t
11. he functions as described in the state diagram in Figure 3 Each function consists of configuring the device with any required settings and then measuring and displaying the result on the LCD panel Doc ID 17904 Rev 1 7 19 www BDTIC com ST Application description AN3269 8 19 Figure 3 Function Change state diagram CU l za Mak mode mode ae gt gy User push button pressed with LCD without LCD IDD PLA a BARO to BAR3 are used by the application to indicate ongoing measurements as shown in Table 1 Low power In order to save power during the Ipp measurement in Low power run without LCD and Halt modes the LCD is switched off Once the measurement performed it is then switched on to display the power consumption value Table 1 Bars and LCD display linked to functions Function Bars LCD blinking VDD Run mode T Low power run with LCD Hg HA Low power run without LCD Ham X Hang ez Halt mode X E Doc ID 17904 Rev 1 ky www BDTIC com ST AN3269 Application description 1 5 2 1 5 3 Note 1 6 Bias current record This operation consists of storing in memory the value of the bias current inherent to operational amplifier A see Figure 2 of your STM8L DISCOVERY The bias current value is taken into account for low power measurements in order to minimize measurement errors Once recorded this value d
12. oes not need to be refreshed and is kept in non volatile memory for future use It is recommended to perform this operation when you start your evaluation in order to obtain the best precision This mode is only accessible at application power up by executing the following actions in the order below Switch OFF STM8L DISCOVERY Place JP1 in OFF position Ipp measurement disabled Maintain USER push button pressed while switching ON the STM8L DISCOVERY At power on a scrolling message Bias Current is displayed Release the USER push button the bias current value is displayed and immediately stored in non volatile memory Once this operation completed replace JP1 in ON position so that the measurement circuitry connects again to STM8L152 Ipp measurement enabled Manufacturing test You can access this mode while Demo mode is running by pressing the USER push button for more than 3 seconds and by releasing it This allows you to verify that the hardware modules needed by the STM8L DISCOVERY for this example are working properly In this mode application checks the LSE oscillator Low Speed External Vpp voltage value Ipp RUN Ipp HALT and LP low power Ipp currents The currents are tested with lower and upper limits For each test function the application displays OK and the measured values when available If all checks are successfully completed then the message TEST OK is continuously displayed If one of the test
13. ower management AN3147 10 19 Doc ID 17904 Rev 1 ki www BDTIC com ST AN3269 Software description 2 2 1 2 2 Software description STM8L peripherals used by the application This application example uses the following STM8L peripherals with the settings described below ADC ADC performs analog to digital conversions of the internal reference voltage Vpp voltage display and of the voltage coming from the operational amplifier that is the image of Ipp current ADC resolution 12 bit ADC conversion mode single e ADC sampling time 9 cycles TIM4 TIM4 is used to generating the delays needed for display or wait loops GPIOs Port C and Port E are connected to the USER push button and the LEDs e 5 PC1 set as an input floating pin with interrupt USER push button e PC7 and PE7 set as an output push pull pin LD4 and LD3 LEDs respectively e PE6 set as an input floating pin with interrupt Ipp Wakeup with detection on rising edge e During the low power modes I Os are placed in output push pull to reduce power consumption except for a few pins related to the hardware interface buttons PFO Ipp measurement pin PE6 LP WakeUp pin and PC4 All Schmitt triggers on standard I O pins are disabled to reduce power consumption The Schmitt trigger on PFO is disabled in order to avoid measurement errors LCD controller The different functions available in the firmware library for LCD are used to
14. ple Overview STM8L DISCOVERY includes specific analog and logic hardware that is connected to STM8L152 microcontroller and which is intended to measure and display the supply Ipp current when the device is placed in different power consumption modes such as Run mode e LPR Low power run mode with LCD display ON e LPR Low power run mode with LCD display OFF e Halt mode The user reads the value displayed on the STM8L DISCOVERY s LCD panel to know how much power the device is currently consuming With this demonstration you can obtain a precise and dynamic measurement of the STM8L152 supply current depending on the low power mode used It also includes a manufacturing test mode for performing a quick diagnosis of the STM8L DISCOVERY related to this application example See Section 1 5 3 Manufacturing test to have details regarding the test activation and meaning lbp measurement principle The STM8L DISCOVERY Ipp measurement circuitry consists of measuring precisely the voltage value V at the terminals of a high precision serial resistor 1 inserted between the 3V3 power supply and the Vpp pin of the MCU Depending of the device power modes the application uses R or 1000 1 x R as the equivalent resistor value by closing or opening K1 In Run mode the current is in the range of mA K1 is closed and the equivalent resistor is R In low power modes the current is in the range of pA K1 is opened and the equivalent
15. rmany Hong Kong India Israel Italy Japan Malaysia Malta Morocco Philippines Singapore Spain Sweden Switzerland United Kingdom United States of America www st com ki Doc ID 17904 Rev 1 19 19 www BDTIC com ST
16. s fails then the application alerts the user by continuously displaying the test name followed by NO Ok To exit this manufacturing test press the RESET button Generally if the manufacturing test is not successtul first check that JP1 is placed in the ON position and that solder bridges SB11 to SB17 are shorted If errors are found in the Low power and Halt modes Ipp measurements the bias current record operation should be performed again Low power modes The low power modes used in this application example are e Low power run mode with or without LCD In this mode the CPU and some of the peripherals are running As selected the LCD can be used or not In the latter case the LCD and the RTC clock are disabled to save power and GPIOs are placed in output push pull configuration to limit consumption During Low power run mode the code is executed from RAM and CPU is clocked by the LSI oscillator Flash and data EEPROM are stopped and the voltage regulator is configured in Ultra low power mode The Doc ID 17904 Rev 1 9 19 www BDTIC com ST Application description AN3269 microcontroller can be woken up from this power saving mode by an external event generated by a GPIO e Halt mode CPU oscillator and peripherals are stopped device remains powered on Voltage regulator is configured in Ultra low power mode Device wakeup is done with external interrupt For further information please refer to STM8L family p
17. ument revision history Date Revision Changes 16 Sep 2010 1 Initial release 18 19 Doc ID 17904 Rev 1 ky www BDTIC com ST AN3269 Please Read Carefully Information in this document is provided solely in connection with ST products STMicroelectronics NV and its subsidiaries ST reserve the right to make changes corrections modifications or improvements to this document and the products and services described herein at any time without notice All ST products are sold pursuant to ST s terms and conditions of sale Purchasers are solely responsible for the choice selection and use of the ST products and services described herein and ST assumes no liability whatsoever relating to the choice selection or use of the ST products and services described herein No license express or implied by estoppel or otherwise to any intellectual property rights is granted under this document If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein UNLESS OTHERWISE SET FORTH IN ST S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY WITH RESPECT TO THE USE AND OR SALE OF ST PRODUCTS INCLUDING WI
18. y init YES PAN NO pressed Bias current Demo mode IDD measurement Auto test selected ai18618 12 19 Doc ID 17904 Rev 1 ky www BDTIC com ST AN3269 Software description 2 3 2 As detailed in the flowchart after starting the STM8L DISCOVERY the initialization of the peripherals and LCD display is performed and then the application immediately checks whether the USER push button is pressed If pressed then the application goes to the Bias current record operation Otherwise the Demo mode Ipp measurement is automatically selected If during Demo mode the user presses the USER key for more than 3 seconds then the application enters manufacturing test To exit manufacturing test the application needs to be restarted by pressing the RESET button Demo mode Ipp measurement When Demo mode is launched it starts displaying a welcoming message and then after a few seconds the Vpp value The user then selects one of the Ipp measurement functions by pressing successively on the USER pushbutton as described in Section 1 5 1 These functions are mainly divided in 2 steps Configuring the device according to the selected power mode Ibp measurement and display this part is common for all power modes The Demo mode sequence is as follows Figure 5 Demo mode sequence ka Demo mode C START E IDD measurement sae ee ee Hi a T 4 l 1 Low power Halt __ Configuration without LCD steps I I l laana

Download Pdf Manuals

image

Related Search

Related Contents

Montage Mode d`emploi  PROMATIC  Rexel 2101946 paper shredder  Operação e manutenção de estações elevatórias de água  pdf  Samsung CS2930PF/HAC دليل المستخدم  Networks Div - Academy Technical Services Ltd  EDS-408A/405A Hardware Installation Guide    新株式発行届出目論見書(PDF:671 KB)  

Copyright © All rights reserved.
Failed to retrieve file