 Hello and welcome to this presentation of the SCM32 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 STM32 L5 devices, offers a simple way to manage such interfaces. The TSC supports a charge transfer acquisition principle with up to 22 capacitive sensing channels. It's 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, STM32 F0, STM32 F3, STM32 L0, STM32 L4, STM32 WB and STM32 L5. It supports up to 22 capacitive sensing channels which are split over 8 analog IO groups. The number of channels and IO groups depends on the selected MCU. For optimum performance, up to 8 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 3 capacitive sensing channels. This ensures a reduced bill of materials. 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 STM32 Cube Touch Sensor Library or TSL available in the corresponding STM32 Cube package. This library offers all the processing required to develop a robust capacitive sensing solution and supports proximity, touch-ski, linear and rotary touch sensors. To offer sufficient clock granularity, the TSC is directly clocked using 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. CPIOs supporting touch sensing must be configured in an alternate mode in order to connect them with 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 CX to VDD. Once this capacitor is fully charged, a part of the accumulated charge is transferred into a sampling capacitor CS. The number of charges transferred to the sampling capacitor depends on the factor 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. It's connected to an external capacitor CS commonly called the sampling capacitor. There's 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 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 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 VCS on CS is red. If the voltage is lower than VIH, a logical zero is returned. If it's greater than VIH, a logical one is red. If the return logical value is zero, steps 3 to 7 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 IO must be configured in alternate output open drain mode. In addition to avoid artifacts, the Schmitt trigger hysteresis must be disabled. A channel IO 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 TSCCR register. Synchronized acquisition mode, where the acquisition only starts upon the detection of a falling or rising edge and a high level on the sink input pin. This mode is useful to limit the effect of 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 pulling 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 Schmitt trigger hysteresis of BIOS belonging to analog IO groups. This capability could be useful to implement a different capacitive sensing 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. Max count error, which is set when the acquisition fails in one or several channels. It's 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 0, stop 1, stop 2, standby and shutdown, the touch sensing controller is not operational. In stop modes, the peripheral is frozen, but the register's content is kept. In standby and shutdown modes, the register's content is lost and the peripheral must be reinitialized. This example details a solution with six touch keys and one linear touch sensor. It's 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 C0G 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 to ensure low impedance path. For optimum conducted noise performance, we recommend to use 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 or TSL. This free sea library supports proximity, touch key, linear and rotary touch sensors. It combines capacitive sensing functions with traditional MCU features such as LCD drive, communication with the host device. 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, debounds filtering and a detection exclusion system or DXS. This library offers a simple API to configure the channels and the sensors and to get the state of the sensors. It's MISRA compliant and supports all STM32C compilers. The STM32Cube Touch Sensing Library is composed of several modules. The library relies on the corresponding STM32 series HAL and is configured through a dedicated configuration file. Once 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 AN5105, AN4299, AN4 310, AN4 312 and AN4 316.