ST STM32L1 Series Application Note
ST STM32L1 Series Application Note

ST STM32L1 Series Application Note

Current consumption measurement and touch sensing demonstration firmware
Hide thumbs Also See for STM32L1 Series:

Advertisement

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 STM32L1x microcontroller and
use the STM32L1xx DISCOVERY embedded IDD measurement circuit to demonstrate the
real capabilities of the Ultra low power microcontroller STM32L1x.
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 STM32L1 discovery firmware package available from
http://www.st.com.
• STM32L1 discovery kits: STM32L-DISCOVERY and 32L152CDISCOVERY (UM1079)
• Getting started with software development toolchains for the STM32L-DISCOVERY and
32L152CDISCOVERY board (UM1451)
The above documents are available at http://www.st.com.
Table 1
lists the microcontrollers, evaluation tools and software concerned by this
application note.
Microcontrollers
Evaluation tools
MCU software
June 2013
STM32L1x current consumption measurement
and touch sensing demonstration firmware
Table 1. Applicable products, evaluation tools and software
Type
STM32L1 Series
STM32L-DISCOVERY, 32L152CDISCOVERY
STSW-STM32072
DocID018933 Rev 2
Application note
Part numbers
AN3413
1/18
www.st.com

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32L1 Series and is the answer not in the manual?

Questions and answers

Summary of Contents for ST STM32L1 Series

  • Page 1 • STM32L1 discovery kits: STM32L-DISCOVERY and 32L152CDISCOVERY (UM1079) • Getting started with software development toolchains for the STM32L-DISCOVERY and 32L152CDISCOVERY board (UM1451) The above documents are available at http://www.st.com. Table 1 lists the microcontrollers, evaluation tools and software concerned by this application note.
  • Page 2: Table Of Contents

    Contents AN3413 Contents Application description ........3 Used hardware components .
  • Page 3: Application Description

    JP1 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 STM32L15x with ST-Link debugging tool thru SWD interface. Note: All solder bridges must be in the default state as described in UM1079.
  • Page 4: Application Principle

    Application description AN3413 Figure 1. Application schematics IDD measurement circuitry User push-button PC13 100 nF Touch sensing 10 k linear sensor STM32L152RBT6 Green or STM32L152RCT6 PB0..1, PC4..5, Blue LCD controller PA6..7 LCDCOM[3:0] LCDSEG[23:0] MS19810V2 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 I current when the device is placed in different power consumption modes such as: •...
  • Page 5: Idd Measurement Principle

    AN3413 Application description 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.
  • Page 6: Getting Started With The Application

    Application description AN3413 connected to an analog input of the MCU (PA4 I 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 delay when the rising edge is triggered on a wake-up pin (PA0) controlled by the K2 switch.
  • Page 7 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.
  • Page 8: Bias Current Record

    Application description AN3413 Table 1. Bars and LCD display linked to functions (continued) Function Bars Low power run / Low power sleep STOP / STOP without LCD STANDBY mode 1.5.2 Bias current record This operation consists of storing the bias current value of operational amplifier A (see Figure 2) in the data memory.
  • Page 9: Low Power Modes

    AN3413 Application description power and Halt modes I measurements, the bias current record operation should be performed again. Low power modes 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 •...
  • Page 10: Software Description

    Software description AN3413 Software description STM32L1x peripherals used by the application This application example uses the following STM32L1x peripherals with the settings described below: ADC performs analog-to-digital conversions of the internal reference voltage (V voltage display) and of the voltage coming from the operational amplifier that is the image of I current.
  • Page 11: Stm32L1X Standard Firmware Library Configuration

    AN3413 Software description STM32L1x standard firmware library configuration The stm32l1xx_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 stm32l1xx_conf.h file as listed bellow. #include stm32l1xx_adc.h #include stm32l1xx_exti.h #include stm32l1xx_flash.h...
  • Page 12 Software description AN3413 Figure 4. Demo mode sequence Demo mode START measurement) Stop - RTC ON Configuration Run mode LP Run Standby steps Stop - RTC OFF LP Sleep Sleep Mode measurement & display MS19814V1 Low power modes configuration For I measurement in Run mode, there is no particular setup needed other that performed during the STM32L1x power on initialization.
  • Page 13 AN3413 Software description Figure 5. Low power mode flowchart START LCD disable LCD clock OFF RTC clock source None * RTC clock OFF * Regulator in Ultra low power mode **) GPIO Low power config Disable external counter U3 Disable fast wakeup Configure LP clock Configure interrupt/event Switch OFF flash memory ***)
  • Page 14 Software description AN3413 Figure 6. Standby mode flowchart START Reset LCD disabled RTC disabled Disable clock sources System clock to MSI 32 kHz Standby Configure wake-up pin flag? Regulator Ultra low power mode GPIO Low power config Measure Standby current Enable external counter U3 Enter Standby mode Continue...
  • Page 15 AN3413 Software description Figure 7. Measurement and display flowchart START IDD measurement & display Disable interrupts ADC init Get conversion 4 times? Disable external counter U3 Disable ADC peripheral 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.
  • Page 16: Conclusion

    Conclusion AN3413 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.
  • Page 17: Revision History

    AN3413 Revision history Revision history Table 2. Document revision history Date Revision Changes 04-Jul-2011 Initial release Added 32L152CDISCOVERY. 27-Jun-2013 Removed PM0062 and added UM1451 in Reference documents. Updated Clock section. DocID018933 Rev 2 17/18...
  • Page 18 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.

This manual is also suitable for:

Stm32l-discovery32l152cdiscovery

Table of Contents