
Application description AN3413
6/18 DocID018933 Rev 2
connected to an analog input of the MCU (PA4 IDD 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.
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 (IDD
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 IDD measurement to compensate errors
due to I bias current (see Section 1.5.2: Bias current record).
For additional information related to the IDD 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).
1.5 Getting started with the application
This STM32L1xx DISCOVERY example application has 3 application modes that can be
run:
•Demo mode (touch sensor, IDD measurement)
•Bias current record
•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 IDD current.
1.5.1 Demo mode - Touch sensing demonstration and IDD 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 VDD voltage
applied to the STM32L1x device.
LD3 (green LED) and LD4 (blue LED) blink alternately. As soon as IDD 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.