 Hello, and welcome to this presentation of the STM32 Touch Sensing Controller, or TSC, which enables the designer to simply add touch sensing functionality to any application. Over recent years, touch sensing has become quite common in many applications, such as mobile phones, induction cooktops and ovens, coffee machines, etc. This type of interface is more flexible and reliable compared to standard push buttons because mechanical parts are no longer needed. The Touch Sensing Controller, or TSC, embedded in STM32WB devices offers a simple way to manage such interfaces. The TSC supports a robust charge transfer acquisition principle with up to 21 capacitive sensing channels. It is fully configurable, and only a few external components are required to design a user-friendly interface. The key features of the Touch Sensing Controller are proven charge transfer acquisition principle, which is available on several STM32 MCU series, STM32F0, STM32F3, STM32L0, and STM32L4. Supports up to 21 capacitive sensing channels, which are split over seven analog IO groups. The number of channels and IO groups depends on the selected MCU. For optimum performance, up to seven capacitive sensing channels can be acquired in parallel. This offers a very good response time. Only one sampling capacitor is needed to manage up to three capacitive sensing channels. This ensures a reduced BOM. The charge transfer acquisition is fully managed by hardware to reduce CPU overhead. A spread spectrum feature is available to improve system robustness in noisy environments. Finally, the Touch Sensing Controller is designed to operate with the free STM32Cube Touch Sensing Library available in the corresponding STM32Cube package. This library offers all the processing required to develop a robust capacitive sensing solution and supports proximity, touch key, linear and rotary touch sensors. To offer sufficient clock granularity, the TSC is directly clocked under the AHB clock. This clock is used by the spread spectrum block, while the clock feeding the pulse generator is reduced using a pre-scaler. GPIOs supporting touch sensing must be configured in an alternate mode in order to connect them to the Touch Sensing Controller. The sync input pin is used to synchronize the capacitive sensing acquisition with an external stimulus without the need for CPU interaction. One counter per analog IO group is used to store the result of the acquisition. An interrupt can be generated upon the end of acquisition of all the enabled analog IO groups or when an error is detected. This interrupt helps limit CPU overhead. The charge transfer acquisition technique works using the electrical properties of the capacitor. It consists in charging the sensor capacitor or CX to VDD. Once this capacitor is fully charged, a part of the accumulated charge is transferred into a sampling capacitor or CS. The number of charges transferred to the sampling capacitor depends on the factors CX divided by CS. The charge transfer cycle is repeated n times until the voltage on the sampling capacitor reaches a threshold, VIH, in our case. The number n represents the size of CX. When there is a touch, the sensor capacitor is increased, and thus the amount of charge transferred from the sensor capacitor to the sampling capacitor is higher, leading to a decrease in the number of charge transfer cycles. The charge transfer is performed through analog switches embedded in the GPIO. The measuring circuit is simple. Let's consider one analog IO group composed of four IOs. One of these IOs is the sampling capacitor IO. It is connected to an external capacitor, CS, commonly called the sampling capacitor. There is a single sampling capacitor per analog IO group. The sampling capacitor value depends on the channel sensitivity. The higher the CS, the higher the sensitivity, and the longer the acquisition time. The three other IOs are dedicated to channels. Each of them is connected to a sensor electrode through a serial resistor, or RS. RS is used to improve the ESD robustness of the application. Within one analog IO group, only one channel is acquired at a time. This means that if three channels are implemented, three consecutive acquisitions will be required to get the image of the three sensors. For optimum performance, the sensor capacitance should be as low as possible. We often consider this capacitor value to be in the tens of picofarads. A touch leads to an increase in the sensor capacitance by a few picofarads, for example, five picofarads. The charge transfer acquisition sequence is composed of seven steps. First, the sampling capacitor and the sensor capacitor are discharged to get a stable starting point by closing the analog switch S1 and enabling S3. Between each major step, an intermediate step is inserted to avoid an acquisition artifact. This step, called dead time, consists of opening all active analog switches and disabling all active transistors. Next, the sensor capacitor, or CX, is charged to VDD by closing S2. After the dead time, a portion of the charge accumulated in CX is transferred into the sampling capacitor, CS, by closing the analog switch S1. Once the charge is transferred, the voltage on CS, VCS, is read. If the voltage is lower than VIH, a logical zero is returned. If it is greater than VIH, a logical one is read. If the returned logical value is zero, steps three to seven are repeated. After each charge transfer loop, a counter is incremented, representing the capacitance of the sensor. In order for a touch-sensing GPIO to be controlled by the TSC, a sampling capacitor I.O. must be configured in alternate output open drain mode. In addition to avoid artifacts, the Schmidt trigger hysteresis must be disabled. A channel I.O. must be configured in alternate output push-pull mode. To reduce the CPU load, two acquisition modes are supported. Normal acquisition mode, where the acquisition starts by setting the start bit of the TSC-CR register. Synchronized acquisition mode, where the acquisition only starts upon the detection of a falling or rising edge and a high level on the sync input pin. This mode is useful to limit the effective noise in some applications such as an induction cooktop. In both modes, the end of acquisition and or max count error can be managed either by polling or interrupt. In addition to managing the charge transfer capacitive acquisition principle, the TSC peripheral allows the designer to individually control the analog switch and Schmidt trigger hysteresis of I.O.s belonging to analog I.O. groups. This capability could be useful to implement a different capacitive sense of acquisition principle or for other purposes such as an analog multiplexer. The TSC peripheral offers two interrupt sources. End of acquisition, which notifies the CPU when all the active channels are acquired. And max count error, which is set when the acquisition fails on one or several channels. It is useful in preventing an infinite acquisition which can occur in the event of a hardware failure. The touch sensing controller is active in run, sleep, low power run and low power sleep modes. This means that charge transfer acquisition can only be performed in these modes. In all other modes, stop zero, stop one, stop two, standby and shutdown, the touch sensing controller is not operational. In stop modes, the peripheral is frozen, but the register's content is kept. When standby and shutdown modes, the register's content is lost and the peripheral must be re-initialized. This example details a solution with six touch keys and one linear touch sensor. It is important to note that a dedicated voltage regulator is used and that the solution also uses the active shield for optimum conducted noise robustness. A cog type capacitor is used for the sampling capacitors as they offer a good stability over the temperature range and no memory effect. A voltage regulator used to power the touch controller is strongly recommended. It will minimize the measurement noise induced by power supply variations. For optimum sensitivity, the parasitic capacitance to ground must be minimized. This implies short and thin sensing tracks. Serial resistors, RS and sampling capacitors, CS, must be placed as close as possible to the MCU. The sensing tracks driving sensors which are acquired at the same time should be grouped together in a bank and kept separated from other banks. Finally, a bypass capacitor should be used in case of high impedance drive, such as an LED driven through an open drain circuitry to ensure a low impedance path. For optimum conducted noise performance, we recommend use of an active shield around tracks and sensor pads combined with spread spectrum. Finally, conductive paint must be avoided and a stable mechanical assembly is required to avoid false or spurious touch detections. As previously indicated, the TSC peripheral is designed to operate with the touch sensing library. This free sea library supports proximity, touch key, linear and rotary touch sensors. It allows combining of capacitive sensing functions with traditional MCU features such as LCD drive, communication with a host device, etc. This library offers all the processing required to get optimum sensitivity and to design a robust application. Some of the features include power on calibration, environment control system or ECS, debounce filtering and a detection exclusion system or DXS. This library offers a simple API to configure the channels, sensors and to get the state of the sensors. It is MISRA compliant and it supports all STM32C compilers. The STM32Cube touch sensing library is composed of several modules. The library relies on the corresponding STM32 series HAL and it is configured through a dedicated configuration file. As included into your project, the STM32Cube touch sensing library is part of the overall application and each C function can be launched to get the appropriate behavior. For further details on the STM32Cube touch sensing library, please refer to the corresponding user manual. This is a list of peripherals related to the STM32 touch sensing controller. Please refer to these peripheral trainings for more information if needed. For more details, please refer to application notes AN4299, AN4 310, AN4 312 and AN4 316. Thank you.