 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 STM32L4 devices offers a simple way to manage such interfaces. The TSC supports a robust charge transfer acquisition principle with up to 24 capacitive changing 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 and robust charge transfer acquisition principle which is available on several STM32MCU series, STM32F0, STM32F3, STM32L0, and STM32L4. Supports up to 24 capacitive sensing channels which are split over eight analog IO groups. The number of channels and IO groups depends on the selected MCU. For optimum performance, up to eight 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 VOM. 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 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 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 red. 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 IO must be configured in alternate output open drain mode. In addition to avoid artifacts, the Schmidt 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 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 IOs belonging to analog IO 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. In standby and shutdown modes, the register's content is lost, and the peripheral must be re-initialized. This table lists the number of capacitive sensing channels, depending on the STM32L4 device. 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 capacity.