AN4316
Application note
Tuning a STMTouch-based application
1
Introduction
This document is intended for touch sensing application designers and provides guidelines
on how to tune their system. STM Studio tool is introduced and information is provided on
how to use it in order to monitor the variables. A particular emphasis will be placed on
providing a methodology to configure the STMTouch library parameters.
This document shows how to trim firmware parameters and adjust hardware components to
optimize the performance of your application.
This document is not intended to replace product documentation and library user manual
All values given in this document are for guidance only. Please, refer to the related
datasheet to get guaranteed values.
Note:
STMicroelectronics is providing free STMTouch touch sensing firmware libraries which are
available either as standalone packages (STM8L-TOUCH-LIB) or directly integrated into the
corresponding STM32Cube package (STM32CubeL0, STM32CubeF0, …).
Table 1. Applicable products
Type
Microcontrollers
Applicable products
STM32F0 series, STM32F3 series, STM32L0 series, STM32L1 series,
STM8L series, STM8AL series.
June 2014
DocID024847 Rev 2
1/26
www.st.com
Contents
AN4316
Contents
1
2
3
4
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
STM Studio overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Monitoring STMTouch driver variables using STM Studio . . . . . . . . . . 6
Tuning of the thresholds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.1
4.2
Use of a standard test finger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11
Threshold definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11
4.2.1
4.2.2
4.2.3
Touchkeys thresholds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Linear and rotary touch sensors thresholds . . . . . . . . . . . . . . . . . . . . . . 14
Proximity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.3
Debounce settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5
6
Charge transfer period tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Hardware trimming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6.1
6.2
Cs trimming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Shield adjustment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
7
8
Performance comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Appendix A
9
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2/26
DocID024847 Rev 2
AN4316
List of tables
List of tables
Table 1.
Table 2.
Applicable products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
DocID024847 Rev 2
3/26
3
List of figures
AN4316
List of figures
Figure 1.
Figure 2.
Figure 3.
Figure 4.
Figure 5.
Figure 6.
Figure 7.
Figure 8.
Figure 9.
Figure 10.
Figure 11.
Figure 12.
Figure 13.
Figure 14.
Figure 15.
STM Studio variable selection window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
VarViewers with variable name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Data log setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Standard 8mm diameter finger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Threshold position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Rotary sensor log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Sensor log before balancing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Debouncing example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Metallic coin probe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Ideal charge transfers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Non-ideal charge transfers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Active shield Cs trimming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Active shield Rs trimming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
SNR computation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Recommended standard finger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4/26
DocID024847 Rev 2
AN4316
STM Studio overview
2
STM Studio overview
STM Studio is a free software tools that helps to debug and diagnose STM8 and STM32
applications while they are running by reading and displaying their variables in real-time.
Running on a PC, STM Studio interfaces with STM8 and STM32 MCUs via standard
development tools, such as the low cost ST-LINK and RLink along with the high-end STM8
STice emulation system.
STM Studio is a non-intrusive tool, preserving the real-time behavior of applications.
STM Studio perfectly complements traditional debugging tools to fine tune applications. It is
well suited for debugging applications which cannot be stopped, such as motor control
applications.
Different graphic views are available to match the needs of debugging and diagnosis or to
demonstrate application behavior. This tool works with STM8 microcontrollers through
SWIM (single wire interface module) and with STM32 microcontrollers through JTAG or
SWD (serial wire debug) interface.
It is a graphical user interface for probing and visualizing in real time application's variables
while it is running. It is designed to run on a computer with Microsoft
®
Windows operating
systems.
Please refer to STM Studio release notes to know the host PC system requirements and
supported hardware.
For advanced information on how to use STM Studio, please refer to its user manual
(UM1025; Getting started with STM Studio).
DocID024847 Rev 2
5/26
25