Touch Lib PDF
Touch Lib PDF
STMTouch library
Data brief
Features Description
• Complete free C source code library with STMicroelectronics touch-sensing libraries
firmware examples for STM8L, STM8TL5x, provide a complete robust free source-code
STM32F0xx, STM32F3xx and STM32L1xx solution to be used on STM8L, STM8TL5x,
microcontrollers STM32F0xx, STM32F3xx and STM32L1xx
• Both surface Charge Transfer (CT) and microcontrollers. This solution allows designers
ProxSenseTM (PXS) acquisition principles familiar with the use of standard microcontrollers
supported to create higher-end human interfaces by
replacing conventional electromechanical
• Multifunction capability to combine capacitive switches by capacitive sensors.
sensing functions with traditional MCU features
The xxxx-TOUCH-LIB is part of the application
• Modular architecture allowing easy addition of
firmware. It allows combining various capacitive
new acquisitions or sensors
sensing touchkeys, linear or rotary touch sensors
• Acquisition, filtering and calibration functions with traditional MCU features (communications,
• Enhanced processing features for optimized control of LEDs, beeper or LCD) in the same
sensitivity and immunity application.
– Environment Control System (ECS) Two capacitive acquisition principles, surface
– Detection Time Out (DTO) Charge Transfer (CT) and ProxSenseTM, are
– Detection Exclusion System (DXS) available and can be configured at compiling
– Noise filter level. Both acquisition principles offer the same
advanced processing algorithms to filter out noise
• Flexible touchkey/linear/rotary touch sensors and to compensate environmental parameters
configuration and combination such as temperature, humidity, and power supply
– Unlimited number of sensors supported variation.
– Each sensor can have its own state
Note: ProxSense is a trademark of Azoteq (Pty)
machine
Ltd.
• Active shield feature
• Compliant with MISRA Table 1. Device summary
• Compliant with Cosmic, IAR, Raisonance, Keil, Reference Part number
Altium and Atollic C compilers
STM8L-TOUCH-LIB
STM8TL-TOUCH-LIB
xxxx-TOUCH-LIB 32F0-TOUCH-LIB
32F3-TOUCH-LIB
32L1-TOUCH-LIB
Contents
4 MCU resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
6 Memory footprint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
6.1 STM8L . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
6.2 STM8TL5x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
6.3 STM32F0xx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
6.4 STM32F3xx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
6.5 STM32L1xx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
7 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
List of tables
List of figures
This peripheral operates in Projected mode which is used to measure the charge
transferred by a driven electrode to a second electrode.
This acquisition principle is only available on STM8TL5x devices.
For more information see the STM8TL5x Reference Manual (RM0312).
The surface charge transfer acquisition consists in charging the electrode capacitance (CX)
and transferring part of the accumulated charge into a sampling capacitor (CS). This
sequence is repeated until the voltage across CS reaches a given threshold. The number of
transfers required to reach the threshold depends on the size of the electrode capacitance.
The CT acquisition can be managed in three different ways:
• using the touch sensing controller (TSC) on STM32F0xx and STM32F3xx devices
• using the routing interface (RI) only for STM8L and STM32L1xx devices with software
acquisition
• using the routing interface (RI) and two 16-bits timers for STM8L and STM32L1xx
devices with hardware acquisition.
Please see the Table 2 for more details about the peripherals used.
$SSOLFDWLRQ
8VHUDSSOLFDWLRQH[DPSOHV
OD\HU
6707RXFKGULYHU
+DUGZDUH
$EVWUDFWLRQ
OD\HU+$/
6WDQGDUGSHULSKHUDOVOLEUDU\
+DUGZDUH
0&8
/D\HU
069
$SSOLFDWLRQ 6707RXFKGULYHU
8VHUDSSOLFDWLRQ
OD\HU FRQILJXUDWLRQ
3URFHVVLQJ
(&6 )LOWHUV
OD\HU
6707RXFK
GULYHU 7RXFK.H\ /LQHDUDQG
VHQVRU URWDU\VHQVRUV
6WDQGDUGSHULSKHUDOV
OLEUDU\
069
MCU resources
Table 2 shows the peripherals that are used by the STMTouch driver. Care must be taken when using them to avoid any unwanted
behavior.
xxxx-TOUCH-LIB
xxxx-TOUCH-LIB Touch-sensing channels availability
5.1 STM8L
STM8L101F[23]U
Part numbers STM8L101G[23]U STM8L101K3[UT]
STM8L101F[23]P
G1_IO1 PB0 10 7 12 13
2 channels 3 channels 3 channels
G1_IO2 PB1 11 8 with 1 13 with 1 14 with 1
Group1 3 4 4
G1_IO3 PD0 9 6 sampling 8 sampling 9 sampling
capacitor capacitor capacitor
DocID023933 Rev 4
G1_IO4 PD1 - - 9 10
G2_IO1 PB2 12 9 14 15
1 channel 3 channels 3 channels
G2_IO2 PB3 13 10 with 1 15 with 1 16 with 1
Group2 2 4 4
G2_IO3 PD2 - - sampling 10 sampling 11 sampling
capacitor capacitor capacitor
G2_IO4 PD3 - - 11 12
Maximum number of channels 3 with 2 sampling capacitors 6 with 2 sampling capacitors 6 with 2 sampling capacitors
STM8L151F[23]U(1) STM8L151G[346]U(1)
(UFQFPN) (UFQFPN)
Part numbers STM8L152K[46][UT]
STM8L151F[23]P(1) STM8L151G[46]Y
(TSSOP) (WLCSP)
G1_IO1 PA6 - - - - 6
DocID023933 Rev 4
xxxx-TOUCH-LIB
cannot be used 1 channel with 2 channels with
Group 4 G4_IO2 PD4 - - 1 for 20 C1 2 1 sampling 21 3 1 sampling
touch sensing capacitor capacitor
G4_IO3 PB7 14 17 19 E1 20
Table 4. Available touch-sensing channels for STM8L15x / STM8L16x (table 1/2) (continued)
xxxx-TOUCH-LIB
Subfamily STM8L151F STM8L151G STM8L151K
STM8L151F[23]U(1) STM8L151G[346]U(1)
(UFQFPN) (UFQFPN)
Part numbers STM8L152K[46][UT]
STM8L151F[23]P(1) STM8L151G[46]Y
(TSSOP) (WLCSP)
G5_IO1 PB6 13 16 18 F1 19
2 channels 2 channels with 2 channels with
DocID023933 Rev 4
STM8L151C[468][UT]
STM8L152C[468][UT]
(48 pins)
STM8L151R[68]T
(1) STM8L152R[68]T
STM8L151K3U
Part numbers STM8L162R8T STM8L151C3T(1)
STM8L151K[46][UT]
(64 pins)
DocID023933 Rev 4
STM8L151M8T
STM8L152M8T
STM8L162M8T
(80 pins)
G1_IO1 PA6 6 7 7 11 7
G1_IO2 PA5 5 2 channels with 6 6 10 2 channels with 6 3 channels with
Group 1 3 1 sampling 3 1 sampling 4 1 sampling
G1_IO3 PA4 4 capacitor 5 5 9 capacitor 5 capacitor
(2) (2) (2)
G1_IO4 PA7 - 8
xxxx-TOUCH-LIB
G2_IO1 PC7 - 46 62 74 46
G2_IO2 PC4 29 1 channel with 43 59 71 2 channels with 43 3 channels with
Group 2 2 1 sampling 3 1 sampling 4 1 sampling
G2_IO3 PC3 28 capacitor 42 58 70 capacitor 42 capacitor
(2) (2) (2)
G2_IO4 PE7 - 48
Table 5. Available touch-sensing channels for STM8L15x / STM8L16x (table 2/2) (continued)
xxxx-TOUCH-LIB
STM8L151C medium/medium+/high density
STM8L151R/M
Subfamily STM8L151K STM8L151C low density
STM8L152C/R/M
STM8L162R/M
STM8L151C[468][UT]
STM8L152C[468][UT]
(48 pins)
STM8L151R[68]T
(1) STM8L152R[68]T
STM8L151K3U
Part numbers STM8L162R8T STM8L151C3T(1)
STM8L151K[46][UT]
(64 pins)
DocID023933 Rev 4
STM8L151M8T
STM8L152M8T
STM8L162M8T
(80 pins)
G5_IO3 PB4 17 28 35 43 28
Table 5. Available touch-sensing channels for STM8L15x / STM8L16x (table 2/2) (continued)
16/59
STM8L151C[468][UT]
STM8L152C[468][UT]
(48 pins)
STM8L151R[68]T
(1) STM8L152R[68]T
STM8L151K3U
Part numbers STM8L162R8T STM8L151C3T(1)
STM8L151K[46][UT]
(64 pins)
DocID023933 Rev 4
STM8L151M8T
STM8L152M8T
STM8L162M8T
(80 pins)
G6_IO1 PB3 16 27 34 42 27
2 channels with 2 channels with 2 channels with
Group 6 G6_IO2 PB2 15 3 1 sampling 26 33 41 3 1 sampling 26 3 1 sampling
capacitor capacitor capacitor
G6_IO3 PB1 14 25 32 40 25
G7_IO1 PB0 13 24 31 39 24
G7_IO2 PD3 12 2 channels with 23 28 32 2 channels with 23 3 channels with
Group 7 3 1 sampling 3 1 sampling 4 1 sampling
xxxx-TOUCH-LIB
G7_IO3 PD2 11 capacitor 22 27 31 capacitor 22 capacitor
(2) (2) (2)
G7_IO4 PE3 - 17
Table 5. Available touch-sensing channels for STM8L15x / STM8L16x (table 2/2) (continued)
17/59
STM8L151C[468][UT]
STM8L152C[468][UT]
(48 pins)
STM8L151R[68]T
(1) STM8L152R[68]T
STM8L151K3U
Part numbers STM8L162R8T STM8L151C3T(1)
STM8L151K[46][UT]
(64 pins)
DocID023933 Rev 4
STM8L151M8T
STM8L152M8T
STM8L162M8T
(80 pins)
G8_IO1 PD1 10 21 26 30 21
G8_IO2 PD0 9 1 channel with 20 25 29 2 channels with 20 3 channels with
Group 8 2 1 sampling 3 1 sampling 4 1 sampling
G8_IO3 PE5 - capacitor 19 24 28 capacitor 19 capacitor
G8_IO4 PE4 - (2) (2) (2)
18
Maximum number of 14 channels with 16 channels with 20 channels with
xxxx-TOUCH-LIB
channels 8 sampling capacitors 8 sampling capacitors 8 sampling capacitors
1. The product has an hardware acceleration cell for touch sensing.
2. This IO does not belong to the analog IO group.
Touch-sensing channels availability xxxx-TOUCH-LIB
5.2 STM8TL5x
STM8TL52F4P STM8TL52G4U
Part numbers STM8TL53C4U
STM8TL53F4P STM8TL53G4U
PXS function GPIO Pin Pin Usage Pin Pin Usage Pin Usage
RX0a - 11 11 10 10 13
RX1a - 12 12 11 11 15
RX2a - 13 13 12 12 17
RX3a - - - 13 13 19
RX6a - 14 14 16 16 25
RX7a - 15 15 17 17 27
RX8a - - - - - 29
RX9a - - - - - 31
RX0b - - - - - 14
RX1b - - - - - 16
RX2b - - - - - 18
RX3b - - - - - 20
RX6b - - - - - 26
RX7b - - - - - 28
RX8b - - - - - 30
RX9b - - - - - 32
STM8TL52F4P STM8TL52G4U
Part numbers STM8TL53C4U
STM8TL53F4P STM8TL53G4U
PXS function GPIO Pin Pin Usage Pin Pin Usage Pin Usage
TX0 PD0 16 16 18 18 33
TX1 PD1 17 17 19 19 34
(2)
TX2 PD2 - - 20 20 35
(2)
TX3 PD3 - - 21 21 36
TX4 PD4 18(2) 18 22(2) 22 39
TX5 PD5 19(2) 19 23(2) 23 40
STM8TL52F4P: STM8TL52G4U:
TX6 PD6 20(2) 20 2 Transmitters 24(2) 24 2 Transmitters 41
Transmitte (2)
TX7 PD7 - - 27 27 42 15 Transmitters
r
STM8TL53F4P: (2) STM8TL53G4U:
TX8 PB0 - - 28 28 43
5 Transmitters 9 Transmitters
TX9 PB1 - - - - 44
TX10 PB2 - - - - 45
TX11 PB3 - - - - 46
TX12 PB4 - - - - 47
TX13 PB5 - - - - 48
TX14 PB6 - - - - 1
STM8TL52F4P: 12 channels STM8TL52G4U: 25 channels
with a 4RX*3TX matrix with a 5RX*5TX matrix
Maximum number 300 channels with a
of channels 20RX*15TX matrix
STM8TL53F4P: 25 channels STM8TL53G4U: 72 channels
with a 5RX*5TX matrix with a 8RX*9TX matrix
1. The receivers can also be used as transmitters. This is used to define the square matrix to address the maximum number of
channels (please refer to product datasheet for further information).
2. On STM8TL52 devices, this GPIO is present but does not support the PXS alternate function.
5.3 STM32F0xx
G1_IO1 PA0 6 6 6 6 F6 10
3 3
3 channels 3 channels 3 channels
G1_IO2 PA1 7 channels 7 7 7 D4 channels 11
with 1 with 1 with 1
Group 1 4 with 1 4 4 4 with 1 4
G1_IO3 PA2 8 8 sampling 8 8 sampling sampling
sampling E4 sampling 12
capacitor capacitor capacitor
capacitor capacitor
G1_IO4 PA3 9 9 9 9 F5 13
G2_IO1 PA4(1) 10 10 10 10
DocID023933 Rev 4
C3 14
3 3
3 channels 3 channels 3 channels
G2_IO2 PA5(1) 11 channels 11 with 1 11 11 with 1 D3 channels 15 with 1
Group 2 4 with 1 4 4 4 with 1 4
G2_IO3 PA6 12 12 sampling 12 12 sampling sampling
sampling E3 sampling 16
capacitor capacitor capacitor
capacitor capacitor
G2_IO4 PA7 13 13 13 13 F4 17
G3_IO1 - - - - - - -
1/2
Cannot be 1 channels 2channels 2 channels
G3_IO2 PB0 - 14 14 14 channels F3 18
used for with 1 with 1 with 1
Group 3 1 2 2/3 with 1 3 3
G3_IO3 PB1 14 touch 15 sampling 15 15 sampling sampling
sensing capacitor sampling F2 19 capacitor
capacitor
G3_IO4 PB2 - - - 16 capacitor
C2 20
G4_IO1 PA9 17(2) 19(2) 19 19 D1 30
3 3
3 channels 3 channels 3 channels
G4_IO2 PA10 18(2) channels 20(2) with 1 20 20 with 1 D2 channels 31 with 1
Group 4 4 with 1 4 4 4 with 1 4
G4_IO3 PA11 17(2) 19(2) sampling sampling sampling
sampling 21 21 C1 sampling 32
capacitor capacitor capacitor
(2)
capacitor (2) capacitor
G4_IO4 PA12 18 20 22 22 A1 33
G5_IO1 PB3 - 24 26 26 B3 39
3
Cannot be 3 channels 3 channels 3 channels
xxxx-TOUCH-LIB
G5_IO2 PB4 - 25 27 27 A3 channels 40
used for with 1 with 1 with 1
Group 5 0 4 4 4 with 1 4
G5_IO3 PB6 - touch 27 sampling sampling sampling
sensing capacitor 29 29 capacitor C4 sampling 42
capacitor
G5_IO4 PB7 - 28 capacitor
30 30 A4 43
Table 7. Available touch sensing channels for STM32F042 (continued)
24/59
- - - - - -
Cannot be Cannot be Cannot be Cannot be Cannot be
- used for - used for - - used for - used for - used for
Group 6 0 0 0 0 0
- touch - Touch - - Touch - Touch - Touch
sensing sensing sensing sensing sensing
- - - - - -
- - - - - -
DocID023933 Rev 4
- - - - - -
Cannot be Cannot be Cannot be Cannot be Cannot be
- used for - used for - - used for - used for - used for
Group 8 0 0 0 0 0
Touch - Touch - - Touch - Touch - Touch
- sensing sensing sensing sensing sensing
- - - - - -
Maximum number of 9 with 3 sampling capacitors 13 with 5 sampling capacitors 14 with 5 sampling capacitors
13/14 with 5 sampling capacitors 14 with 5 sampling capacitors
channels
1. This GPIO offers a reduced touch sensing sensitivity. It is thus recommended to use it as sampling capacitor I/O.
2. Pin pair PA11/PA12 can be remapped instead of pin pair PA9/PA10 using SYS_CTRL register.
xxxx-TOUCH-LIB
25/59
Number Number
Analog Number of Number of
Pin Pin of of
I/O Gx_IOy GPIO Usage Pin Usage Pin available Usage Pin available Usage
LQFP UFQFPN available available
group pins pins
pins pins
G1_IO1 PA0 6 6 10 14 23
3 channels 3 channels 3 channels 3 channels
G1_IO2 PA1 7 7 with 1 11 with 1 15 with 1 24 with 1
Group 1 4 4 4 4
G1_IO3 PA2 8 8 sampling 12 sampling sampling sampling
16 25
capacitor capacitor capacitor
DocID023933 Rev 4
capacitor
G1_IO4 PA3 9 9 13 17 26
G2_IO1 PA4(1) 10 10 14 20 29
3 channels 3 channels 3 channels 3 channels
G2_IO2 PA5(1) 11 11 with 1 15 with 1 21 with 1 30 with 1
Group 2 4 4 4 4
G2_IO3 PA6 12 12 sampling 16 sampling sampling sampling
22 31
capacitor capacitor capacitor capacitor
G2_IO4 PA7 13 13 17 23 32
G3_IO1 PC5 - - 1/2 - 25 34
2 channels 3 channels 3 channels
G3_IO2 PB0 14 14 channels 18 26 35
with 1 with 1 with 1
Group 3 2/3 with 1 3 4 4
G3_IO3 PB1 15 15 19 sampling sampling sampling
sampling 27 36
capacitor capacitor capacitor
G3_IO4 PB2 - 16 capacitor 20 28 37
G4_IO1 PA9 19 19 30 42 68
3 channels 3 channels 3 channels 3 channels
G4_IO2 PA10 20 20 with 1 31 with 1 43 with 1 69 with 1
Group 4 4 4 4 4
G4_IO3 PA11 21 21 sampling 32 sampling sampling sampling
44 70
xxxx-TOUCH-LIB
capacitor capacitor capacitor capacitor
G4_IO4 PA12 22 22 33 45 71
Table 8. Available touch sensing channels for STM32F051 and STM32F072 (continued)
26/59
Number Number
Analog Number of Number of
Pin Pin of of
I/O Gx_IOy GPIO Usage Pin Usage Pin available Usage Pin available Usage
LQFP UFQFPN available available
group pins pins
pins pins
G5_IO1 PB3 26 26 39 55 89
3 channels 3 channels 3 channels 3 channels
G5_IO2 PB4 27 27 with 1 40 with 1 56 with 1 90 with 1
Group 5 4 4 4 4
G5_IO3 PB6 29 29 sampling 42 sampling sampling sampling
58 92
capacitor capacitor
DocID023933 Rev 4
capacitor capacitor
G5_IO4 PB7 30 30 43 59 93
G6_IO1 PB11 - - 22 30 48
Cannot be 3 channels 3 channels 3 channels
G6_IO2 PB12 - - used for 25 with 1 33 with 1 51 with 1
Group 6 0 4 4 4
G6_IO3 PB13 - - touch 26 sampling sampling sampling
34 52
sensing capacitor capacitor capacitor
G6_IO4 PB14 - - 27 35 53
G7_IO1 PE2 - - - - 1
Cannot be Cannot be Cannot be 3 channels
G7_IO2 PE3 - - used for - used for - used for 2 with 1
Group 7 0 0 0 4
Touch - Touch - Touch 3 sampling
G7_IO3 PE4 - -
sensing sensing sensing capacitor
G7_IO4 PE5 - - - - 4
G8_IO1 PD12 - - - - 59
Cannot be Cannot be Cannot be 3 channels
G8_IO2 PD13 - - used for - used for - used for 60 with 1
Group 8 0 0 0 4
Touch - Touch - Touch 61 sampling
G8_IO3 PD14 - -
sensing sensing sensing capacitor
xxxx-TOUCH-LIB
G8_IO4 PD15 - - - - 62
5.4 STM32F3xx
G1_IO1 PA0 7 10 14 23
G1_IO2 PA1 8 11 15 24
DocID023933 Rev 4
G1_IO4 PA3 10 13 17 26
(1)
G2_IO1 PA4 11 14 20 29
(1)
G2_IO2 PA5 12
3 channels with
15
3 channels with
21
3 channels with
30
3 channels with
Group 2 4 4 4 4
G2_IO3 PA6 13 1 sampling capacitor 16 1 sampling capacitor 22 1 sampling capacitor 31 1 sampling capacitor
G2_IO4 PA7 14 17 23 32
G3_IO4 PB2 - 20 28 37
G4_IO1 PA9 19 30 42 68
G4_IO2 PA10 20 3 channels with 31 3 channels with 43 3 channels with 69 3 channels with
Group 4 4 4 4 4
1 sampling capacitor 1 sampling capacitor 1 sampling capacitor 1 sampling capacitor
G4_IO3 PA13 23 34 46 72
G4_IO4 PA14 24 37 49 76
29/59
Table 9. Available touch sensing channels for STM32F30x (continued)
30/59
G5_IO1 PB3 26 39 55 89
G5_IO2 PB4 27 3 channels with 40 3 channels with 56 3 channels with 90 3 channels with
DocID023933 Rev 4
Group 5 4 4 4 4
1 sampling capacitor 1 sampling capacitor 1 sampling capacitor 1 sampling capacitor
G5_IO3 PB6 29 42 58 92
G5_IO4 PB7 30 43 59 93
G6_IO1 PB11 - 22 30 48
G6_IO4 PB14 - 27 35 53
G7_IO1 PE2 - - - 1
G7_IO2 PE3 - Cannot be used for - Cannot be used for - Cannot be used for 2
3 channels with
Group 7 0 0 0 4
touch sensing touch sensing touch sensing 1 sampling capacitor
G7_IO3 PE4 - - - 3
G7_IO4 PE5 - - - 4
G8_IO1 PD12 - - - 59
G8_IO2 PD13 - Cannot be used for - Cannot be used for - Cannot be used for 60
3 channels with
Group 8 0 0 0 4
touch sensing touch sensing touch sensing 1 sampling capacitor
G8_IO3 PD14 - - - 61
xxxx-TOUCH-LIB
G8_IO4 PD15 - - - 62
Maximum number
12 with 4 sampling capacitors 17 with 6 sampling capacitors 18 with 6 sampling capacitors 24 with 8 sampling capacitors
of channels
1. This GPIO offers a reduced touch sensing sensitivity. It is thus recommended to use it as sampling capacitor I/O.
.
xxxx-TOUCH-LIB
Table 10. Available touch sensing channels for STM32F37x
Subfamily STM32F37x
G1_IO1 PA0 10 14 23 L2
G1_IO2 PA1 11 3 channels with 15 3 channels with 24 M2 3 channels with
Group 1 4 4 4
G1_IO3 PA2 12 1 sampling capacitor 16 1 sampling capacitor 25 K3 1 sampling capacitor
G1_IO4 PA3 13 18 26 L3
G2_IO4 PA7 - 23 32 M4
G3_IO1 PC4 - 24 33 K5
G3_IO2 PC5 - 1 channel with 25 3 channels with 34 L5 3 channels with
Group 3 2 4 4
G3_IO3 PB0 18 1 sampling capacitor 26 1 sampling capacitor 35 M5 1 sampling capacitor
G3_IO4 PB1 19 27 36 M6
31/59
Table 10. Available touch sensing channels for STM32F37x (continued)
32/59
G5_IO4 PB7 43 59 93 B4
G6_IO1 PB14 26 34 53 K11
G6_IO2 PB15 27 35 54 K10
xxxx-TOUCH-LIB
2 channels with 2 channels with 3 channels with
Group 6 3 3 4
G6_IO3 PD8 28 1 sampling capacitor 36 1 sampling capacitor 55 K9 1 sampling capacitor
G6_IO4 PD9 - - 56 K8
Table 10. Available touch sensing channels for STM32F37x (continued)
33/59
G7_IO1 PE2 - - 1 B2
G7_IO2 PE3 - Cannot be used for - Cannot be used for 2 A1 3 channels with
Group 7 0 0 4
G7_IO3 PE4 - touch sensing - touch sensing 3 B1 1 sampling capacitor
G7_IO4 PE5 - - 4 C2
G8_IO1 PD12 - - 59 J10
G8_IO2 PD13 - Cannot be used for - Cannot be used for 60 H12 3 channels with
Group 8 0 0 4
G8_IO3 PD14 - touch sensing - touch sensing 61 H11 1 sampling capacitor
xxxx-TOUCH-LIB
1. This GPIO offers a reduced touch sensing sensitivity. It is thus recommended to use it as sampling capacitor I/O.
Touch-sensing channels availability xxxx-TOUCH-LIB
5.5 STM32L1xx
G1_IO1 PA0 14 3 23 K9 3 L2 3 34 3
channels channels channels channels
G1_IO2 PA1 15 24 L9 M2 35
with with with with
Group 1 4 4 4 4
G1_IO3 PA2 16 1 25 J8 1 K3 1 36 1
DocID023933 Rev 4
xxxx-TOUCH-LIB
G3_IO5 PF12 - - - J7 50
Table 11. Available touch sensing channels for STM32L1xx 512K (continued)
xxxx-TOUCH-LIB
Subfamily STM32L1xx 512K
L1
with with with with
Group 7 G7_IO4 PB15 36 4 54 K2 4 K10 5(2) 76 5(2)
1 1 1 1
G7_IO5 PG2(3) - sampling - - sampling G10 sampling 87 sampling
capacitor capacitor capacitor capacitor
G7_IO6 PG3(3) - - - F9 88
G7_IO7 PG4(3) - - - F10 89
G8_IO1 PC0 8 3 15 F6 3 H1 3 26 3
channels channels channels channels
G8_IO2 PC1 9 with 16 H9 with J2 with 27 with
Group 8 4 4 4 4
G8_IO3 PC2 10 1 17 G9 1 J3 1 28 1
sampling sampling sampling sampling
G8_IO4 PC3 11 capacitor 18 G8 capacitor K2 capacitor 29 capacitor
G9_IO1 PC4 24 1 33 L7 1 K5 3 44 3
channel channel channels channels
G9_IO2 PC5 25 with 34 M7 with L5 with 45 with
Group 9 2 2 4 4
1 1 1 1
xxxx-TOUCH-LIB
G9_IO3 PF13 - - - K7 53
sampling sampling sampling sampling
G9_IO4 PF14 - capacitor - - capacitor J8 capacitor 54 capacitor
Table 11. Available touch sensing channels for STM32L1xx 512K (continued)
xxxx-TOUCH-LIB
Subfamily STM32L1xx 512K
G2
sampling sampling sampling sampling
G10_IO4 PC9 40 capacitor 66 F4 capacitor D12 capacitor 99 capacitor
G11_IO1 PF6 - - - G3 18
3 4
Cannot Cannot
G11_IO2 PF7 - - - G4 channels 19 channels
be used be used
with with
Group 11 G11_IO3 PF8 - 0 for - - 0 for H4 4 20 5
1 1
touch touch
G11_IO4 PF9 - - - J6 sampling 21 sampling
sensing sensing
capacitor capacitor
G1_IO1 PA0 14 F6 3 23 3 L2 3 34 3
channels channels channels channels
G1_IO2 PA1 15 E6 24 M2 35
with with with with
Group 1 4 4 4 4
G1_IO3 PA2 16 H8 1 25 1 K3 1 36 1
DocID023933 Rev 4
xxxx-TOUCH-LIB
Table 12. Available touch sensing channels for STM32L1xx 384K (continued)
xxxx-TOUCH-LIB
Subfamily STM32L1xx 384K
xxxx-TOUCH-LIB
sampling sampling sampling sampling
G9_IO4 PF14 - - capacitor - capacitor J8 capacitor 54 capacitor
Table 12. Available touch sensing channels for STM32L1xx 384K (continued)
43/59
xxxx-TOUCH-LIB
Table 13. Available touch sensing channels for STM32L1xx 256K (table 1/2)
44/59
STM32L151RC
Part numbers STM32L152CC STM32L151UC STM32L152RC
STM32L162RC
G1_IO1 PA0 10 E4 14 F6
G1_IO2 PA1 11 3 channels with G5 3 channels with 15 E6 3 channels with
Group 1 4 1 sampling 4 1 sampling 4 1 sampling
G1_IO3 PA2 12 capacitor H6 capacitor 16 H8 capacitor
DocID023933 Rev 4
(1)
G1_IO4 PA3 13 J7 17 G7
G2_IO1 PA6 16 G4 22 G5
G2_IO2 PA7 17 J5 23 G4
1 channel with 1 channel with 1 channel with
Group 2 G2_IO3 PF15 - 2 1 sampling - 2 1 sampling - - 2 1 sampling
capacitor capacitor capacitor
G2_IO4 PG0(2) - - - -
G2_IO5 PG1(2) - - - -
(1)
G3_IO1 PB0 18 J3 26 H4
G3_IO2 PB1 19 H3 27 F4
2 channels with 2 channels with 2 channels with
Group 3 G3_IO3 PB2 20 3 1 sampling G3 3 1 sampling 28 H3 3 1 sampling
capacitor capacitor capacitor
G3_IO4 PF11 - - - -
G3_IO5 PF12 - - - -
xxxx-TOUCH-LIB
G4_IO1 PA8 29 E3 41 E4
2 channels with 2 channels with 2 channels with
Group 4 G4_IO2 PA9 30 3 1 sampling C1 3 1 sampling 42 D2 3 1 sampling
capacitor capacitor capacitor
G4_IO3 PA10 31 D2 43 D3
Table 13. Available touch sensing channels for STM32L1xx 256K (table 1/2) (continued)
45/59
STM32L151RC
Part numbers STM32L152CC STM32L151UC STM32L152RC
STM32L162RC
G5_IO1 PA13 34 C2 46 D4
2 channels with 2 channels with 2 channels with
Group 5 G5_IO2 PA14 37 3 1 sampling C3 3 1 sampling 49 B2 3 1 sampling
capacitor capacitor capacitor
G5_IO3 PA15 38 A2 50 C3
DocID023933 Rev 4
G6_IO1 PB4 40 D4 56 B4
G6_IO2 PB5 41 3 channels with A5 3 channels with 57 A5 3 channels with
Group 6 4 1 sampling 4 1 sampling 4 1 sampling
G6_IO3 PB6 42 capacitor B5 capacitor 58 B5 capacitor
G6_IO4 PB7 43 C5 59 C5
G7_IO1 PB12 25 G2 33 G2
G7_IO2 PB13 26 G1 34 G1
G7_IO3 PB14 27 F3 35 F2
3 channels with 3 channels with 3 channels with
Group 7 G7_IO4 PB15 28 4 1 sampling F2 4 1 sampling 36 F1 4 1 sampling
capacitor capacitor capacitor
G7_IO5 PG2(2) - - - -
G7_IO6 PG3(2) - - - -
(2)
G7_IO7 PG4 - - - -
xxxx-TOUCH-LIB
Table 13. Available touch sensing channels for STM32L1xx 256K (table 1/2) (continued)
46/59
STM32L151RC
Part numbers STM32L152CC STM32L151UC STM32L152RC
STM32L162RC
G8_IO1 PC0 - E6 8 E8
G8_IO2 PC1 - E5 3 channels with 9 F8 3 channels with
Group 8 0 4 1 sampling 4 1 sampling
G8_IO3 PC2 - G7 capacitor 10 D6 capacitor
DocID023933 Rev 4
G8_IO4 PC3 - G6 11 F7
G9_IO1 PC4 - F4 24 H6
G9_IO2 PC5 - J4 1 channel with 25 H5 1 channel with
Group 9 0 2 1 sampling 2 1 sampling
G9_IO3 PF13 - - capacitor - - capacitor
G9_IO4 PF14 - - - -
Cannot be used for
G10_IO1 PC6 - F1 37 E1
touch sensing
G10_IO2 PC7 - E1 3 channels with 38 E2 3 channels with
Group 10 0 4 1 sampling 4 1 sampling
G10_IO3 PC8 - D1 capacitor 39 E3 capacitor
G10_IO4 PC9 - E2 40 D1
G11_IO1 PF6 - - - -
G11_IO2 PF7 - - - -
Cannot be used Cannot be used
xxxx-TOUCH-LIB
Group11 G11_IO3 PF8 - 0 - 0 for - - 0 for
touch sensing touch sensing
G11_IO4 PF9 - - - -
G11_IO5 PF10 - - - -
Table 13. Available touch sensing channels for STM32L1xx 256K (table 1/2) (continued)
47/59
STM32L151RC
Part numbers STM32L152CC STM32L151UC STM32L152RC
STM32L162RC
2. This GPIO can only be configured as sampling capacitor I/O when using HW acquisition mode and as channel I/O when using SW acquisition mode.
xxxx-TOUCH-LIB
48/59
Number Number
Number of
Analog LQFP BGA of BGA LQFP of
Gx_IOy GPIO Usage available Usage Usage
I/O group pin ball available ball pin available
pins
pins pins
G1_IO1 PA0 23 L2 L2 34
G1_IO2 PA1 24 M2 3 channels with M2 3 channels with 35 3 channels with
Group 1 4 1 sampling 4 1 sampling 4 1 sampling
G1_IO3 PA2 25 K3 K3 36
DocID023933 Rev 4
xxxx-TOUCH-LIB
G4_IO1 PA8 67 D11 D11 100
2 channels with 2 channels with 2 channels with
Group 4 G4_IO2 PA9 68 D10 3 1 sampling D10 3 1 sampling 101 3 1 sampling
capacitor capacitor capacitor
G4_IO3 PA10 69 C12 C12 102
Table 14. Available touch sensing channels for STM32L1xx 256K (table 2/2) (continued)
49/59
Number Number
Number of
Analog LQFP BGA of BGA LQFP of
Gx_IOy GPIO Usage available Usage Usage
I/O group pin ball available ball pin available
pins
pins pins
xxxx-TOUCH-LIB
G8_IO1 PC0 15 H1 H1 26
G8_IO2 PC1 16 J2 3 channels with J2 3 channels with 27 3 channels with
Group 8 4 1 sampling 4 1 sampling 4 1 sampling
G8_IO3 PC2 17 J3 capacitor J3 capacitor 28 capacitor
G8_IO4 PC3 18 K2 K2(3) 29(3)
Table 14. Available touch sensing channels for STM32L1xx 256K (table 2/2) (continued)
50/59
Number Number
Number of
Analog LQFP BGA of BGA LQFP of
Gx_IOy GPIO Usage available Usage Usage
I/O group pin ball available ball pin available
pins
pins pins
G9_IO1 PC4 33 K5 K5 44
G9_IO2 PC5 34 L5 1 channel with L5 3 channels with 45 3 channels with
Group 9 2 1 sampling 4 1 sampling 4 1 sampling
G9_IO3 PF13 - - capacitor K7 capacitor 53 capacitor
DocID023933 Rev 4
G9_IO4 PF14 - - J8 54
G10_IO1 PC6 63 E12 E12 96
G10_IO2 PC7 64 E11 3 channels with E11 3 channels with 97 3 channels with
Group 10 4 1 sampling 4 1 sampling 4 1 sampling
G10_IO3 PC8 65 E10 capacitor E10 capacitor 98 capacitor
G10_IO4 PC9 66 D12 D12 99
G11_IO1 PF6 - - G3 18
G11_IO2 PF7 - - G4 19
Cannot be used 3 channels with 4 channels with
Group11 G11_IO3 PF8 - - 0 for H4 4 1 sampling 20 5 1 sampling
touch sensing capacitor capacitor
G11_IO4 PF9 - - J6 21
G11_IO5 PF10 - - - 22
23 channels with 10 33 channels with 11 34 channels with 11
Maximum number of channels
xxxx-TOUCH-LIB
sampling capacitors sampling capacitors sampling capacitors
1. This GPIO offers a reduced touch sensing sensitivity. It is thus recommended to use it as sampling capacitor I/O.
2. Not all the pins are available simultaneously on this group.
3. This GPIO can only be configured as sampling capacitor I/O when using HW acquisition mode and as channel I/O when using SW acquisition mode.
51/59
STM32L151C6 STM32L151R6
STM32L151C8 STM32L151R8 STM32L151V8
STM32L151CB STM32L151RB STM32L151VB
Part numbers
STM32L152C6 STM32L152R6 STM32L152V8
STM32L152C8 STM32L152R8 STM32L152VB
STM32L152CB STM32L152RB
G1_IO1 PA0 10 14 G2 23 L2
G1_IO2 PA1 11 3 channels with 15 H2 3 channels with 24 M2 3 channels with
Group 1 4 1 sampling 4 1 sampling 4 1 sampling
G1_IO3 PA2 12 capacitor 16 F3 capacitor 25 K3 capacitor
G1_IO4 PA3 13 17 G3 26 L3
G2_IO1 PA6 16 1 channel with 22 G4 1 channel with 31 L4 1 channel with
Group 2 2 1 sampling 2 1 sampling 2 1 sampling
G2_IO2 PA7 17 capacitor 23 H4 capacitor 32 M4 capacitor
G3_IO1 PB0 18 1 channel with 26 F5 1 channel with 35 M5 1 channel with
Group 3 2 1 sampling 2 1 sampling 2 1 sampling
G3_IO2 PB1 19 capacitor 27 G5 capacitor 36 M6 capacitor
G4_IO1 PA8 29 41 D7 67 D11
2 channels with 2 channels with 2 channels with
Group 4 G4_IO2 PA9 30 3 1 sampling 42 C7 3 1 sampling 68 D10 3 1 sampling
capacitor capacitor capacitor
G4_IO3 PA10 31 43 C6 69 C12
xxxx-TOUCH-LIB
G5_IO1 PA13 34 46 A8 72 A11
2 channels with 2 channels with 2 channels with
Group 5 G5_IO2 PA14 37 3 1 sampling 49 A7 3 1 sampling 76 A10 3 1 sampling
capacitor capacitor capacitor
G5_IO3 PA15 38 50 A6 77 A9
Table 15. Available touch sensing channels for STM32L15x 32K to 128K (continued)
52/59
STM32L151C6 STM32L151R6
STM32L151C8 STM32L151R8 STM32L151V8
STM32L151CB STM32L151RB STM32L151VB
Part numbers
STM32L152C6 STM32L152R6 STM32L152V8
STM32L152C8 STM32L152R8 STM32L152VB
STM32L152CB STM32L152RB
xxxx-TOUCH-LIB
Table 15. Available touch sensing channels for STM32L15x 32K to 128K (continued)
53/59
STM32L151C6 STM32L151R6
STM32L151C8 STM32L151R8 STM32L151V8
STM32L151CB STM32L151RB STM32L151VB
Part numbers
STM32L152C6 STM32L152R6 STM32L152V8
STM32L152C8 STM32L152R8 STM32L152VB
STM32L152CB STM32L152RB
G8_IO1 PC0 - 8 E3 15 H1
G8_IO2 PC1 - 9 E2 3/2 channels with 16 J2 3 channels with
Group 8 0 4/3 1 sampling 4 1 sampling
G8_IO3 PC2 - 10 F2 capacitor 17 J3 capacitor
G8_IO4 PC3 - 11 - 18 K2
G9_IO1 PC4 - Cannot be used 24 H5 1 channel with 33 K5 1 channel with
Group 9 0 for 2 1 sampling 2 1 sampling
G9_IO2 PC5 - touch sensing 25 H6 capacitor 34 L5 capacitor
G10_IO1 PC6 - 37 F6 63 E12
G10_IO2 PC7 - 38 E7 3 channels with 64 E11 3 channels with
Group 10 0 4 1 sampling 4 1 sampling
G10_IO3 PC8 - 39 E8 capacitor 65 E10 capacitor
G10_IO4 PC9 - 40 D8 66 D12
Maximum number of 13 channels with 7 20/19 channels with 10 20 channels with 10
channels sampling capacitors sampling capacitors sampling capacitors
xxxx-TOUCH-LIB
Memory footprint xxxx-TOUCH-LIB
6 Memory footprint
6.1 STM8L
The Cosmic STM8 C compiler v4.3.6 has been used with the following command line
options:
+modsl0 -pxp +compact + split -pp
Table 19 shows the memory footprint taken by the STMTouch driver for different
configurations.
6.2 STM8TL5x
The Cosmic STM8 C compiler v4.3.6 has been used with the following command line
options:
+modsl0 -pxp +compact + split -pp
Table 19 shows the memory footprint taken by the STMTouch driver for different
configurations.
6.3 STM32F0xx
The IAR ANSI C/C++ compiler V6.40.1 for ARM® has been used with the following
command line options:
optimization high-balanced
Table 20 shows the memory footprint taken by the STMTouch driver for different
configurations.
6.4 STM32F3xx
The IAR ANSI C/C++ compiler V6.40.1 for ARM® has been used with the following
command line options:
optimization high-balanced
Table 21 and Table 22 show the memory footprint taken by the STMTouch driver for different
configurations.
6.5 STM32L1xx
The IAR ANSI C/C++ compiler V6.30.1 for ARM® has been used with the following
command line options:
optimization high-balanced
Table 23 shows the memory footprint taken by the STMTouch driver using the hardware
acquisition mode (using Timers) on STM32L1xx High-density devices:
Table 24 shows the memory footprint taken by the STMTouch driver using the software
acquisition mode on STM32L1xx Medium-density devices:
7 Revision history
Information in this document 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 OTHER INTELLECTUAL PROPERTY RIGHT.
ST PRODUCTS ARE NOT 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.