Home
AN3413 - STMicroelectronics
Contents
1. YES y Clear interrupt event Switch ON regulator except Stop with RTC Reconfigure clock except Sleep mode only for LP RUN Sleep and LP Sleep END MS19816V1 In Standby mode the device is in its deepest energy saving state The device enters the Cortex M3 deepsleep mode and the voltage regulator is disabled All oscillators are switched off SRAM and register contents are lost with the exception of the RTC registers RTC backup registers and Standby circuitry The device is woken up from this mode by an external wakeup event generated by the U3 counter invoking a system reset d DoclD018933 Rev 2 13 18 Software description AN3413 Figure 6 Standby mode flowchart START LCD disabled RTC disabled Disable clock sources System clock to MSI 32 kHz Configure wake up pin Regulator Ultra low power mode GPIO Low power config Y Enable external counter U3 y Enter Standby mode YES Reset Standby flag et Measure Standby current Continue MS19817V1 Ibp measurement and display The following flowchart describes the Ipp measurement process 14 18 DoclD018933 Rev 2 d AN3413 Software description Figure 7 Measurement and display flowchart START IDD measurement amp display y Disable interrupts ADC init y nversion
2. 4 times YES v Disable external counter U3 y7 Disable ADC peripheral v Perform average display on LCD measured current MS19815V1 As shown in Figure 7 the ADC conversion is performed 4 times in succession and an average value is computed The average value is displayed on the LCD d DoclD018933 Rev 2 15 18 Conclusion AN3413 3 Conclusion This application note shows the demonstration firmware delivered with your STM32L DISCOVERY or 32L152CDISCOVERY kit This example allows you to evaluate the touch sensing capability of STM32L1xx microcontrollers and demonstrate its Ultra low power features by providing the measured current consumption values in selected low power modes directly on the LCD The low cost STM32L DISCOVERY or 32L152CDISCOVERY kit with the firmware example associated with this application note provides a starting point for your own evaluation of current consumption of application specific tasks running on the Ultra low power STM32L1x microcontroller 3 16 18 DoclD018933 Rev 2 AN3413 Revision history 4 Revision history Table 2 Document revision history Date Revision Changes 04 Jul 2011 1 Initial release Added 32L152CDISCOVERY 27 Jun 2013 2 Removed PM0062 and added UM1451 in Reference documents Updated Clock section d DoclD018933 Rev 2 17 18 AN3413 Please Read Carefully Information in this doc
3. Cor AN3413 y TORRE Application note STM32L1x current consumption measurement and touch sensing demonstration firmware Introduction This application note provides an overview of the demonstration firmware delivered with the STM32L DISCOVERY and 32L152CDISCOVERY evaluation boards It allows you to explore the rich set of power saving modes available in the STM32L 1x microcontroller and use the STM32L1xx DISCOVERY embedded IDD measurement circuit to demonstrate the real capabilities of the Ultra low power microcontroller STM32L 1x The demonstration application does not require any additional hardware Once the STM32L1xx DISCOVERY is powered up through a USB cable connected to the host PC the application is ready to display the STM32L1x power consumption of each low power mode selected by the user In addition the demonstration firmware allows you to explore the touch sensing capabilities of the STM32L1x microcontroller demonstrated by sensing the linear touch sensor or the set of four touchkeys Reference documents The current consumption measurement and touch sensing demonstration firmware is included in the STSW STM32072 STM32L 1 discovery firmware package available from http www st com e STM32L1 discovery kits STM32L DISCOVERY and 32L152CDISCOVERY UM1079 e Getting started with software development toolchains for the STM32L DISCOVERY and 32L152CDISCOVERY board UM1451 The above documents are available at http Awww
4. the bias current record operation should be performed again 1 6 Low power modes d The low power modes used in this application are listed below The microcontroller can be woken up from any power saving mode by an external wake up event generated by counter U3 Sleep mode The CPU is stopped the peripherals kept running The system is clocked by the MSI oscillator at a frequency of 4 MHz Low power run mode The CPU and some of the peripherals are running During Low power run mode the code is executed from RAM and the CPU is clocked at a frequency of 32 kHz by the MSI oscillator Flash and data EEPROM are stopped and the voltage regulator is configured in Ultra low power mode Low power sleep mode The CPU is stopped The system clock frequency is reduced to 32 kHz Flash and Data EEPROM are in power down mode and the voltage regulator is configured in Ultra low power mode Stop mode The Core is in Deepsleep mode Flash Data EEPROM and all clocks except LSE are in power down mode All peripherals except the LCD are disabled The voltage regulator is in low power mode Stop mode without LCD This is the same as Stop mode except that the LCD controller is also disabled in this case Standby mode This is the deepest low power mode The voltage regulator is disabled Core peripherals RAM Flash and Data EEPROM are powered off Power is maintained for the RTC registers backup registers and standby circuitry Device wake up is
5. LCD R MS19810V2 1 4 Application principle 1 4 1 Overview STM32L1xx DISCOVERY includes specific analog and logic hardware that is connected to STM32L152 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 e Run mode e Sleep mode e Low power run mode e Low power sleep mode e Stop mode with operating RTC e Stop mode without RTC e Standby mode The user reads the value displayed on the STM32L1xx DISCOVERY s LCD panel to know how much power the device is currently consuming With this demonstration you can obtain an overview of low power modes and supply current requirements for each low power mode available on STM32L152 4 18 DoclD018933 Rev 2 Ly AN3413 Application description 1 4 2 Ly The firmware associated with this application note also provides a demonstration of the touch sensing functionality available on STM32L1xx DISCOVERY The touch sensing electrodes can be configured either as a linear touch sensor to perform linear sensing of finger position displayed as a percentage on the LCD or it can be configured as a group of four independent touchkeys It also includes a manufacturing test mode for performing a quick diagnosis of the STM32L1xx DISCOVERY related to this application example See Section 1 5 3 Manufacturing test for details regarding the test activation and for an explanat
6. OTHER INTELLECTUAL PROPERTY RIGHT ST PRODUCTS ARE NOT AUTHORIZED FOR USE IN WEAPONS NOR ARE ST PRODUCTS DESIGNED OR AUTHORIZED FOR USE IN A SAFETY CRITICAL APPLICATIONS SUCH AS LIFE SUPPORTING ACTIVE IMPLANTED DEVICES OR SYSTEMS WITH PRODUCT FUNCTIONAL SAFETY REQUIREMENTS B AERONAUTIC APPLICATIONS C AUTOMOTIVE APPLICATIONS OR ENVIRONMENTS AND OR D AEROSPACE APPLICATIONS OR ENVIRONMENTS WHERE ST PRODUCTS ARE NOT DESIGNED FOR SUCH USE THE PURCHASER SHALL USE PRODUCTS AT PURCHASER S SOLE RISK EVEN IF ST HAS BEEN INFORMED IN WRITING OF SUCH USAGE UNLESS A PRODUCT IS EXPRESSLY DESIGNATED BY ST AS BEING INTENDED FOR AUTOMOTIVE AUTOMOTIVE SAFETY OR MEDICAL INDUSTRY DOMAINS ACCORDING TO ST PRODUCT DESIGN SPECIFICATIONS PRODUCTS FORMALLY ESCC QML OR JAN QUALIFIED ARE DEEMED SUITABLE FOR USE IN AEROSPACE BY THE CORRESPONDING GOVERNMENTAL AGENCY 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 2
7. 013 STMicroelectronics All rights reserved STMicroelectronics group of companies Australia Belgium Brazil Canada China Czech Republic Finland France Germany Hong Kong India Israel Italy Japan Malaysia Malta Morocco Philippines Singapore Spain Sweden Switzerland United Kingdom United States of America www st com 18 18 DoclD018933 Rev 2 Ly
8. 12V1 BARO to BAR3 are used by the application to indicate ongoing measurements as shown in Table 1 In order to save power during the Ipp measurement in Stop mode without LCD the LCD is Switched off Once the measurement is performed the LCD is switched on to display the power consumption value Table 1 Bars and LCD display linked to functions Function Bars VDD Linear sensor Touch buttons Run mode Sleep mode d DoclD018933 Rev 2 7 18 Application description AN3413 1 5 2 1 5 3 Note 8 18 Table 1 Bars and LCD display linked to functions continued Function Bars Low power run Low power sleep STOP STOP without LCD STANDBY mode Bias current record This operation consists of storing the bias current value of operational amplifier A see Figure 2 in the data memory The bias current value is taken into account for low power measurements in order to minimize measurement errors Once recorded this value is kept in non volatile memory for later 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 steps in the order below 1 Switch OFF STM32L1xx DISCOVERY Place JP1 in OFF position Ipp measurement disabled Keep USER push button pressed while powering ON the STM32L1xx DISCOVERY At power on a scr
9. Manufacturing test Demo mode is available at application power up while the two others are invoked by the user using a specific procedure that is described in detail later in this chapter However for best performance it is recommended to measure and record the bias current before starting evaluation of low power mode lpp current Demo mode Touch sensing demonstration and Ipp measurement Once the application is powered up via the USB cable or by external power supply it starts displaying a welcome message and then after a few seconds the value of the Vpp voltage applied to the STM32L 1x 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 allows you to change the functions as described in the state diagram in Figure 3 The first step is a demonstration of the linear touch sensor function followed by a touchkey demo activated by pressing the user button DoclD018933 Rev 2 Ly AN3413 Application description When the used push button is pressed again the power consumption measurement functions are launched These functions consist of configuring the device for each low power consumption mode and then measuring and displaying the result on the LCD panel Figure 3 Function Change state diagram reset STANDBY IDD TOUCH LINEAR SENSOR User button pressed LPRUN LPSLEEP IDD MS198
10. done by an external wake up event generating a system reset For further information please refer to STM32L 15x reference manual RM0038 where you can find more details about all the available configurations for each STM32L15x low power mode DoclD018933 Rev 2 9 18 Software description AN3413 2 2 1 10 18 Software description STM32L1x peripherals used by the application This application example uses the following STM32L1x 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 e ADC resolution 12 bit e ADC conversion mode single e ADC sampling time 192 cycles SYSTICK Timer The Systick timer is used to generate the delay needed for display or wait loops GPIOs Port C and Port E are connected to the USER push button and the LEDs e PB1 setas an input floating pin with interrupt connected to the USER push button e PB7 green LD3 and PB6 blue LD4 set as an output push pull e PAO set as a wake up pin configured either as an input floating pin with interrupt with detection on rising edge or as an alternate function AFIOO WKUP1 during Standby mode e PAG PAT PCA PC5 PBO PB1 are used for linear touch sensor or touchkeys during the touch sensor demonstration e During the low power modes I Os are placed in analog inp
11. ement 0 00000000008 11 3 enu PP rm 16 4 Revision history usus zukaeA A Ru Ra A x AERE RARE decease 17 2 18 DoclD018933 Rev 2 Ly AN3413 Application description 1 1 1 2 Note 1 3 d Application description STM32L1xx DISCOVERY stands either for STM32L DISCOVERY or 32L152CDISCOVERY evaluation kit throughout the document Used hardware components This application example uses the hardware components available on STM32L1xx DISCOVERY on board LEDs green LD3 and blue LD4 the 6 digit 4 bar LCD glass display the user push button and touch sense slider No additional components are required STM32L1xx DISCOVERY hardware settings The Ipp jumper JP 1 must be placed in position ON for standard operation except for bias current record operation see Section 1 5 2 Both jumpers on CN3 must be fitted to allow communication of STM32L 15x with ST Link debugging tool thru SWD interface All solder bridges must be in the default state as described in UM1079 Application schematics Figure 1 shows the simplified application electrical schematics DoclD018933 Rev 2 3 18 Application description AN3413 Figure 1 Application schematics IDD measurement circuitry PA4 PAO PC13 User push button C25 Touch sensing linear sensor LD3 STM32L152RBT6 Green or STM32L152RCT6 6 PBO 1 PC4 5 LCD controller PA6 7 P LCDCOM B 0 LCDSEG 23 0 RR RE
12. ion of the different test modes lbp measurement principle The STM32L1xx DISCOVERY lpp measurement circuitry consists of measuring the high side shunt voltage value V at the terminals of a high precision serial resistor 196 inserted between the 3V3 power supply and the Vpp pin of the MCU Depending on the device power modes the application uses R or 2000 2 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 pA range K1 is opened and the equivalent resistance is 2002 x R Figure 2 Ibp measurement equivalent circuitry Q14 Q13 PA4 IDD meas Counter n STM32L15x PAO EN PC13 LP wake up MS19811V1 This resistor is connected between the differential inputs of a high side current sense operational amplifier A with a fixed gain that amplifies the voltage V present on the resistors A sample and hold stage is placed at the operational amplifier output and is then DoclD018933 Rev 2 5 18 Application description AN3413 1 5 1 5 1 6 18 connected to an analog input of the MCU PA4 Ipp Measurement that finally converts the resulting voltage image of the consumption current In low power modes only a counter enabled by STM32L15x PC13 pin manages the measurement timing while the microcontroller is idle The microcontroller is woken up after a 150 ms de
13. lay when the rising edge is triggered on a wake up pin PAO controlled by the K2 switch While the microcontroller is in one of the power saving modes a capacitor C is charged with the voltage amplified by the operational amplifier The microcontroller can later sample during its wake up phase 50 ms the value of capacitor voltage proportional to the current consumption of MCU in low power mode 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 current bias of high side current 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 section 4 7 Built in IDD measurement circuit of the STM32L1 discovery kits STM32L DISCOVERY and 32L152CDISCOVERY user manual UM1079 Getting started with the application This STM32L1xx DISCOVERY example application has 3 application modes that can be run e Demo mode touch sensor Ipp measurement e Bias current record e
14. olling message Bias Current is displayed Release the USER push button the bias current value is displayed and immediately stored in non volatile memory ak wh Once this operation completed replace JP1 in ON position so that the measurement circuitry is connected again to the STM32L152 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 STM32L1xx DISCOVERY for this example are working properly In this mode application checks the LSE oscillator Low Speed External Vpp voltage value Ipp RUN OA bias and LP low power Ipp currents The currents are tested for 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 tests 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 successful first check that JP1 is placed in the ON position and that all solder bridges are in default position If errors are found in the Low DoclD018933 Rev 2 Ly AN3413 Application description power and Halt modes Ipp measurements
15. ow include stm32I1xx_adc h include stm32l1xx exti h include stm32l1xx flash h include stm32l1xx gpio h include stm32I1xx_syscfg h include stm32l1xx lcd h include stm32l1xx pwr h include stm32l1xx rcc h include stm32l1xx rtc h zinclude misc h The corresponding library modules has to be present in the project for successful compilation and linking 2 3 Application software flow 2 3 1 Main application After powering up the STM32L1xx 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 Demo mode lpp 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 2 3 2 Demo mode Ipp measurement 3 When Demo mode is launched it starts displaying a welcome 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 e Configuring the device according to the selected power mode e lpp measurement and display this part is common for all power modes The Demo mode se
16. quence is as follows DoclD018933 Rev 2 11 18 Software description AN3413 12 18 Figure 4 Demo mode sequence START Demo mode IDD measurement p ee 11 77 L oomen OR NE i I 1 Run mode LP Run Stop RTC ON Standby Configuration Sleep Mode LP Sleep Stop RTC OFF steps l l I LIII Ll2 l2 l2 Jd J J IDD measurement amp display END MS19814V1 Low power modes configuration For Ipp measurement in Run mode there is no particular setup needed other that performed during the STM32L 1x power on initialization For this function the application goes directly to Ipp measurement and display routine The configuration of device for Low power run Sleep Stop with and without RTC is detailed in Figure 5 Please see RM0038 for more details about low power modes available on STM32L 1x 3 DoclD018933 Rev 2 AN3413 Software description Figure 5 Low power mode flowchart START LCD disable LCD clock OFF RTC clock source None RTC clock OFF i Regulator in Ultra low power mode GPIO Low power config Disable external counter U3 Disable fast wakeup Configure LP clock Configure interrupt even Switch OFF flash memory Switch OFF regulator WFE set to external event from PAO Enable external counter U3 y Wait For Event or Wait For Interrupt Event o Interrupt occurred
17. st com Table 1 lists the microcontrollers evaluation tools and software concerned by this application note Table 1 Applicable products evaluation tools and software Type Part numbers Microcontrollers STM32L 1 Series Evaluation tools STM32L DISCOVERY 32L152CDISCOVERY MCU software STSW STM32072 June 2013 DoclD018933 Rev 2 1 18 www st com Contents AN3413 Contents 1 Application description 000 cee eee ee 3 1 1 Used hardware components 00000 cece eee eee eee 3 1 2 STM32L1xx DISCOVERY hardware settings 0000 3 1 3 Application schematics 0 000 c cee ees 3 1 4 Application principle 2 2 2 0 0 ees 4 1 4 1 OVEWIEW uses ene Ry ease ERI TCREAX PE eR Eee ein de E 4 1 4 2 lpp measurement principle 000000002 eee 5 1 5 Getting started with the application 00 ee eee 6 1 5 1 Demo mode Touch sensing demonstration and Ipp measurement 6 1 5 2 Bias current record oeiesrirereiser tite hh tbe ee 8 1 5 3 Manufacturing test 0 eae 8 1 6 Low power modes 0 0000 cee eee 9 2 Software description 000 ce eee eee 10 2 1 STM32L1x peripherals used by the application 10 2 2 STM32L1x standard firmware library configuration 11 2 3 Application software flow 0 000 cece eens 11 2 3 1 Main application 0 0 0 II 11 2 3 2 Demo mode lpp measur
18. ument 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 WITHOUT 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
19. ut mode to reduce power consumption except for a few pins related to the hardware interface PB7 green LD3 PB6 blue LD4 PA4 Ibp measurement pin PAO LP WakeUp pin and PC13 IDD timer enable This means that all Schmitt triggers on unused standard I O pins are disabled to reduce power consumption LCD controller The different functions available in the firmware library for LCD are used to 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 the STM32L152 Clock The MSI the multi speed internal oscillator 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 MSI is switched to range 0 until the device is woken up by an external event When exiting Low power run mode the MCU switches the HSI oscillator back ON LSE is switched ON during Manufacturing test mode see Section 1 5 3 to check its functionality 3 DoclD018933 Rev 2 AN3413 Software description 2 2 STM32L1x standard firmware library configuration The stm32 1xx_conf h file of the STM32L1x standard firmware library allows you to configure the library by enabling the peripheral functions used by the application The header files of library modules are included in the stm32 1xx conf h file as listed bell
Download Pdf Manuals
Related Search
Related Contents
MANUAL DE INSTRUÇÕES MANUAL DE INSTRUÇÕES MANUAL Sony VAIO VPCEB27FD MINISTERIO DE TRABAJO Y PROMOCION DEL EMPLEO MTPE Copyright © All rights reserved.
Failed to retrieve file