AN4102
Application note
Introducing the low-power concept in automotive applications using
the STM8AL board of the STM8A-DISCOVERY
Introduction
This application note illustrates the power consumption benefits of the STM8AL devices
included with the STM8A-DISCOVERY. This new family of devices has been designed to
comply with AEC-Q100 rev G. automotive requirements and offer high performance with
ultra-low power management capabilities.
The STM8AL board of the STM8A-DISCOVERY has a built-in I
DD
measurement feature that
is used to demonstrate the efficiency of the low power modes of the STM8AL devices.
This application does not require any additional hardware or software. Once the STM8AL
board is powered-up through a USB cable connected to the host PC with the USER1 button
pressed, the user can access the low power software resources of the standard
demonstration package.
This low-power software example comes preloaded with your STM8A-DISCOVERY, but is
accessible when the USER1 or USER2 buttons are pressed during the board’s power
supply sequence.
Reference documents
●
●
STM8A-DISCOVERY user manual (UM1574).
Application note
Power management in STM8L and STM8AL
(AN3147).
The above documents are available from
http://www.st.com.
Table 1.
Applicalble products
Type
Microcontrollers
Evaluation tools
STM8ALxxx
STM8A-DISCOVERY
Part numbers
December 2012
Doc ID 023129 Rev 1
1/16
www.st.com
Contents
AN4102
Contents
1
Application description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1
1.2
1.3
1.4
Hardware required . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Hardware settings of the STM8AL board . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Application schematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Application principles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4.1
1.4.2
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
I
DD
measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
IDD measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Bias current record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.5
Getting started with the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.5.1
1.5.2
1.6
Low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.6.1
1.6.2
Low-power run mode (without LCD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Halt mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2
Software description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.1
STM8AL peripherals used by the application . . . . . . . . . . . . . . . . . . . . . . 10
2.1.1
2.1.2
2.1.3
2.1.4
2.1.5
ADC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
TIM4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
GPIOs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
LCD controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.2
STM8Lx standard firmware library configuration . . . . . . . . . . . . . . . . . . . 11
3
Managing power consumption in automotive applications . . . . . . . . 12
3.1
Low-power application description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4
5
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2/16
Doc ID 023129 Rev 1
AN4102
Application description
1
1.1
Application description
Hardware required
This application uses STM8AL on-board LEDs (red LD3 and green LD4), a 4-digit/4-bar
LCD glass display and two USER push-buttons, USER1 and USER2. No additional
components are required.
Note:
The low-power demonstration software can be executed with the STM8AF board either
connected or disconnected (included with the STM8A-Discovery). Once the low-power
demonstration is completed, the application automatically launches the LIN communication
demonstration software included in the same initial software package. An STM8AF board
must be connected for correct operation of the LIN communication software otherwise a
communication error is displayed.
1.2
Hardware settings of the STM8AL board
The IDD jumper JP1 must be placed in the ON position for standard operation (except for
bias current record operation. See
Section 1.5.2: Bias current record).
Note:
Solder bridges SB6 to SB8 must be shorted (bottom side of the STM8AL board). This
enables the IDD measurement circuitry hardware.
1.3
Application schematics
Figure 1
shows the electrical schematics used in the low-power demonstration section.
Figure 1.
Application schematics
IDD measurement circuitry
LD3
USER
1
STM8AL3L68T
MCU
LD4
USER
2
LEDs
User buttons
1234
4-digit / 4-bar LCD display
Doc ID 023129 Rev 1
3/16
Application description
AN4102
1.4
1.4.1
Application principles
Overview
The STM8AL board embeds specific analog and logic hardware connected to the
STM8AL3L68T microcontroller, which allows measuring and displaying the IDD current
supply when the device is placed in different power consumption modes, such as:
●
●
●
Run mode
Halt mode
LPR (low-power run mode) with LCD display OFF.
To see how much power the device is using, the user simply needs to read the value
displayed on the STM8AL board's LCD panel. The units of measurement are displayed
accordingly.
With this demonstration software you can obtain a precise and dynamic measurement of the
STM8AL3L68T’s supply current depending on the power mode used.
1.4.2
I
DD
measurement
The STM8AL board IDD measurement circuitry consists in measuring precisely the voltage
value V at the terminals of a high precision serial resistor (1%) inserted between the +3.3 V
power supply and the VDD pin of the MCU. Depending on the device’s power mode, 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 µA, K1 is opened, and the equivalent
resistor is 1001 x R.
Figure 2.
I
DD
measurement equivalent circuitry
+3V3
IDD
R
K1
Gain=50
V
A
S
C
1%
1%
1000R
Q14
Q13
VDD
PF0
IDD Meas
Counter
EN
STM8AL3L68T
PC4
PE6
LP WakeUp
+3V3
K2
GND
MS30843V1
4/16
Doc ID 023129 Rev 1
AN4102
Application description
The resistor is placed in parallel to a high-sense operational amplifier (A) with fixed gain that
amplifies the voltage (V) present on the resistors. A sample-and-hold stage is then inserted
and connected to an analog input of the MCU (PF0 I
DD
measurement) that finally converts
the resulting voltage, which reflects the consumption current.
In low-power modes only, a counter enabled by the STM8AL (PC4 pin) manages the
measurement timing while the microcontroller is idle. The microcontroller is woken-up after a
150 ms delay through 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 the low-
power mode current consumption during the microcontroller’s wake-up phase (in the first 50
ms). Switch S is opened at the device start-up so as to keep the charge collected in the
capacitor (C) intact while the microcontroller is in low-power mode.
The current measurement precision is enhanced by taking into account the I bias current of
its own operational amplifier. When JP1 is placed in the OFF position (I
DD
measurement
circuitry disabled), a special test invoked by the USER2 push-button at the 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 I
DD
measurement to compensate errors
due to I bias current (see
Section 1.5.2: Bias current record).
For additional information related to the I
DD
measurement feature, refer to the
STM8A-DISCOVERY user manual (UM1574).
1.5
Getting started with the application
Two modes can be run within the STM8AL low-power application example.
●
●
I
DD
measurement in different power modes.
Bias current record.
The I
DD
measurement is available when the application is powered-up with the USER1
push-button pressed while the bias current record is available when the application is
powered-up with the USER2 push-button pressed.
However, for best performances, it is recommended to control and record the I bias current
before starting the I
DD
measurement mode.
1.5.1
IDD measurement
Firstly, check that JP2 is set to the ON position. Before applying power to the STM8AL board
through the USB cable (or through an external power supply), press the USER1 button and
maintain it pressed while the USB cable is connected. The I
DD
mode is selected and the
green LED LD4 is set. The "** TEST **" message is displayed. You are entering the I
DD
measurement sequence. Once this mode is launched, the different steps automatically
unfold as described in the diagram below. If one of the measurements is outside the range
of the specification, the sequence ends with an error message related to the failing
measurement.
Doc ID 023129 Rev 1
5/16