Construction of capacitive touch sensor systems based on MSP430. Touch and sound sensors

A capacitive sensor is one of the types of non-contact sensors, the operating principle of which is based on a change in the dielectric constant of the medium between two capacitor plates. One covering serves touch sensor circuits in the form of a metal plate or wire, and the second is an electrically conductive substance, such as metal, water or the human body.

When developing a system automatic switching on supply of water to the toilet for a bidet, it became necessary to use a capacitive presence sensor and switch with high reliability, resistance to change external temperature, humidity, dust and supply voltage. I also wanted to eliminate the need for a person to touch the system controls. The requirements presented could only be met by touch sensor circuits operating on the principle of changing capacitance. I couldn’t find a ready-made scheme that satisfied the necessary requirements, so I had to develop it myself.

The result is a universal capacitive touch sensor that does not require configuration and responds to approaching electrically conductive objects, including a person, at a distance of up to 5 cm. The scope of application of the proposed touch sensor is not limited. It can be used, for example, to turn on lighting, systems burglar alarm, determining the water level and in many other cases.

Electrical circuit diagrams

To control the water supply in the toilet bidet, two capacitive touch sensors were needed. One sensor had to be installed directly on the toilet; it had to produce a logical zero signal in the presence of a person, and in the absence of a logical one signal. The second capacitive sensor was supposed to serve as a water switch and be in one of two logical states.

When the hand was brought to the sensor, the sensor had to change the logical state at the output - from the initial one state to the logical zero state, when the hand was touched again, from the zero state to the logical one state. And so on ad infinitum, as long as the touch switch receives a logical zero enabling signal from the presence sensor.

Capacitive touch sensor circuit

The basis of the capacitive touch presence sensor circuit is a master rectangular pulse generator, made according to the classical scheme on two logical elements of the microcircuit D1.1 and D1.2. The generator frequency is determined by the ratings of the elements R1 and C1 and is selected around 50 kHz. The frequency value has virtually no effect on the operation of the capacitive sensor. I changed the frequency from 20 to 200 kHz and visually did not notice any effect on the operation of the device.

From pin 4 of the D1.2 chip rectangular shape through resistor R2 it goes to inputs 8, 9 of microcircuit D1.3 and through variable resistor R3 to inputs 12,13 of D1.4. The signal arrives at the input of microcircuit D1.3 with a slight change in the slope of the pulse front due to installed sensor, which is a piece of wire or metal plate. At input D1.4, due to capacitor C2, the front changes for the time required to recharge it. Thanks to the presence of trimming resistor R3, it is possible to set the pulse edge at input D1.4 equal to the pulse edge at input D1.3.

If you bring your hand or a metal object closer to the antenna (touch sensor), the capacitance at the input of the DD1.3 microcircuit will increase and the front of the incoming pulse will be delayed in time relative to the front of the pulse arriving at the DD1.4 input. In order to “catch” this delay, the inverted pulses are fed to the DD2.1 chip, which is a D flip-flop that works as follows. Along the positive edge of the pulse arriving at the input of microcircuit C, the signal that was at that moment at input D is transmitted to the output of the trigger. Consequently, if the signal at input D does not change, the incoming pulses at the counting input C do not affect the level of the output signal. This property of the D trigger made it possible to make a simple capacitive touch sensor.

When the antenna capacitance, due to the approach of the human body to it, at the input of DD1.3 increases, the pulse is delayed and this fixes the D trigger, changing its output state. LED HL1 is used to indicate the presence of supply voltage, and LED HL2 is used to indicate proximity to the touch sensor.

Touch switch circuit

The capacitive touch sensor circuit can also be used to operate the touch switch, but with a little modification, since it needs not only to respond to the approach of the human body, but also to remain in a steady state after the hand is removed. To solve this problem, we had to add another D trigger, DD2.2, to the output of the touch sensor, connected using a divider by two circuit.

The capacitive sensor circuit has been slightly modified. To exclude false alarms, since a person can bring and remove his hand slowly, due to the presence of interference, the sensor can output several pulses to the counting input D of the trigger, violating the required operating algorithm of the switch. Therefore, an RC chain of elements R4 and C5 was added, which for a short time blocked the ability to switch the D trigger.


Trigger DD2.2 works in the same way as DD2.1, but the signal to input D is supplied not from other elements, but from the inverse output of DD2.2. As a result, along the positive edge of the pulse arriving at input C, the signal at input D changes to the opposite. For example, if in the initial state there was a logical zero at pin 13, then by raising your hand to the sensor once, the trigger will switch and a logical one will be set at pin 13. The next time you interact with the sensor, pin 13 will again be set to logical zero.

To block the switch in the absence of a person on the toilet, a logical unit is supplied from the sensor to the R input (setting zero at the output of the trigger, regardless of the signals at all its other inputs). A logical zero is set at the output of the capacitive switch, which is supplied through the harness to the base of the key transistor for turning on the solenoid valve in the Power and Switching Unit.

Resistor R6, in the absence of a blocking signal from the capacitive sensor in the event of its failure or a break in the control wire, blocks the trigger at the R input, thereby eliminating the possibility of spontaneous water supply in the bidet. Capacitor C6 protects input R from interference. LED HL3 serves to indicate water supply in the bidet.

Design and details of capacitive touch sensors

When I began to develop a sensor system for water supply in a bidet, the most difficult task seemed to me to be the development of a capacitive occupancy sensor. This was due to a number of installation and operation restrictions. I didn’t want the sensor to be mechanically connected to the toilet lid, since it needs to be removed periodically for washing, and would not interfere with sanitization the toilet itself. That’s why I chose a container as a reacting element.

Presence sensor

Based on the above published diagram, I made a prototype. The parts of the capacitive sensor are assembled on a printed circuit board; the board is placed in a plastic box and closed with a lid. To connect the antenna, a single-pin connector is installed in the case; a four-pin connector RSh2N is installed to supply the supply voltage and signal. The printed circuit board is connected to the connectors by soldering copper conductors in fluoroplastic insulation.

The capacitive touch sensor is assembled on two KR561 series microcircuits, LE5 ​​and TM2. Instead of the KR561LE5 microcircuit, you can use the KR561LA7. 176 series microcircuits and imported analogues are also suitable. Resistors, capacitors and LEDs will suit any type. Capacitor C2, for stable operation of the capacitive sensor when operating in conditions of large temperature fluctuations environment need to be taken with a small TKE.

The sensor is installed under the toilet platform on which it is installed cistern in a place where, in the event of a leak from the tank, water cannot enter. The sensor body is glued to the toilet using double-sided tape.


The antenna sensor of the capacitive sensor is a piece of copper stranded wire 35 cm long insulated with fluoroplastic, glued with transparent tape to the outer wall of the toilet bowl a centimeter below the plane of the glasses. The sensor is clearly visible in the photo.

To adjust the sensitivity of the touch sensor, after installing it on the toilet, change the resistance of the trimming resistor R3 so that the HL2 LED goes out. Next, place your hand on the toilet lid above the location of the sensor, the HL2 LED should light up, if you remove your hand, it should go out. Since the human thigh by mass more hands, then during operation the touch sensor, after such adjustment, will be guaranteed to work.

Design and details of capacitive touch switch

The capacitive touch switch circuit has more parts and a larger housing was required to accommodate them, and for aesthetic reasons, appearance The housing in which the presence sensor was located was not very suitable for installation in a visible place. The rj-11 wall socket for connecting a telephone attracted attention. It was the right size and looked good. Having removed everything unnecessary from the socket, I placed a printed circuit board for a capacitive touch switch in it.


To secure printed circuit board A short stand was installed at the base of the case and a printed circuit board with touch switch parts was screwed to it using a screw.


The capacitive sensor was made by gluing a sheet of brass to the bottom of the socket cover with Moment glue, having previously cut out a window for the LEDs in them. When closing the lid, the spring (taken from a flint lighter) comes into contact with the brass sheet and thus ensures electrical contact between the circuit and the sensor.


The capacitive touch switch is mounted on the wall using one self-tapping screw. For this purpose, a hole is provided in the housing. Next, the board and connector are installed and the cover is secured with latches.


Setting up a capacitive switch is practically no different from setting up the presence sensor described above. To set it up, you need to apply the supply voltage and adjust the resistor so that the HL2 LED lights up when a hand is brought to the sensor, and goes out when it is removed. Next, you need to activate the touch sensor and move and remove your hand to the switch sensor. The HL2 LED should blink and the red HL3 LED should light up. When the hand is removed, the red LED should remain illuminated. When you raise your hand again or move your body away from the sensor, the HL3 LED should go out, that is, turn off the water supply in the bidet.

Universal PCB

Presented above capacitive sensors assembled on printed circuit boards, slightly different from the printed circuit board shown below in the photograph. This is due to the combination of both printed circuit boards into one universal one. If you assemble a touch switch, you only need to cut track number 2. If you assemble a touch presence sensor, then track number 1 is removed and not all elements are installed.


The elements necessary for the operation of the touch switch, but interfering with the operation of the presence sensor, R4, C5, R6, C6, HL2 and R4, are not installed. Instead of R4 and C6, wire jumpers are soldered. The chain R4, C5 can be left. It will not affect work.

Below is a drawing of a printed circuit board for knurling using the thermal method of applying tracks to the foil.

It is enough to print the drawing on glossy paper or tracing paper and the template is ready for making a printed circuit board.

The trouble-free operation of capacitive sensors for the touch control system for water supply in a bidet has been confirmed in practice over three years of continuous operation. No malfunctions were recorded.

However, I want to note that the circuit is sensitive to powerful impulse noise. I received an email asking for help setting it up. It turned out that during debugging of the circuit there was a soldering iron with a thyristor temperature controller nearby. After turning off the soldering iron, the circuit started working.

There was another such case. The capacitive sensor was installed in a lamp that was connected to the same outlet as the refrigerator. When it was turned on, the light turned on and when it turned off again. The issue was resolved by connecting the lamp to another outlet.

I received a letter about the successful application of the described capacitive sensor circuit for adjusting the water level in storage tank made of plastic. In the lower and upper parts there was a sensor glued with silicone, which controlled the turning on and off of the electric pump.

In this article, we'll take a close (but not too deep) look at the principles of electricity that allow us to detect the touch of a human finger using little more than just a capacitor.

Capacitors can be touch sensitive

Over the past decade or so, it has become truly difficult to imagine a world with electronics without touch sensors. Smartphones are the most visible and widespread example of this, but of course there are numerous other devices and systems that have touch sensors. Both capacitance and resistance can be used to build touch sensors; in this article we will discuss only capacitive sensors, which are more preferable in implementation.

Although applications based on capacitive sensors can be quite complex, fundamental principles The principles underlying this technology are quite simple. In fact, if you understand the concept of capacitance and the factors that determine the capacitance of a particular capacitor, you are on the right track in understanding the workings of capacitive touch sensors.

Capacitive touch sensors fall into two main categories: mutual capacitance-based and self-capacitance-based. The first of these, in which the sensor capacitor consists of two terminals that act as emitting and receiving electrodes, is more preferable for touch displays. The latter, in which one terminal of the sensor capacitor is connected to ground, is a direct approach that is suitable for a touch button, slider or wheel. In this article we will look at sensors based on intrinsic capacitance.

PCB based capacitor

Capacitors can be various types. We're all used to seeing capacitance in the form of leaded components or surface mount packages, but in reality, all you really need are two conductors separated by an insulating material (i.e. dielectric). Thus, it is quite simple to create a capacitor using only electrically conductive layers separated printed circuit board. For example, consider the following top view and side view of a printed circuit capacitor being used as a touch touch button (note the transition to another PCB layer in the side view illustration).

The insulating separation between the touch button and the surrounding copper is created by a capacitor. In this case, the surrounding copper is connected to ground, and hence our touch button can be modeled as a capacitor between the touch signal pad and ground.

Now you might want to know how much capacitance this PCB layout actually provides. Moreover, how do we calculate it accurately? The answer to the first question is that the capacitance is very small, maybe around 10 pF. Regarding the second question: don't worry if you forgot the electrostatics because the exact value of the capacitance of the capacitor does not matter. We are only looking for changes in capacitance, and we can detect these changes without knowing the capacitance rating of the printed capacitor.

Finger influence

So what is causing these capacitance changes that the touch sensor controller is going to detect? Well, of course, a human finger.

Before we discuss why the finger changes capacitance, it is important to understand that there is no direct electrical contact; the finger is insulated from the capacitor by varnish on the printed circuit board and, usually, by a layer of plastic that separates the device's electronics from the external environment. So the finger does not discharge the capacitor, and furthermore, the amount of charge stored in a capacitor at a certain moment is not of interest - rather, the capacitance at a certain moment is of interest.

So why does the presence of a finger change the capacitance? There are two reasons: the first involves the dielectric properties of the finger, and the second involves its conductive properties.

Finger is like a dielectric

We usually think of a capacitor as having a fixed value, determined by the area of ​​the two conducting plates, the distance between them, and the dielectric constant of the material between the plates. We, of course, cannot change the physical dimensions of the capacitor simply by touching it, but we Can change the dielectric constant, since the human finger has di electrical characteristics, different from the material (presumably air) it displaces. It is true that the finger will not be in the actual dielectric region, i.e. in the insulating space directly between the conductors, but such “invasion” into the capacitor is not necessary:

As shown in the figure, to change the dielectric characteristics, there is no need to place a finger between the plates, since electric field capacitor is distributed into the environment.

It turns out that human flesh is a pretty good dielectric because our bodies are made mostly of water. The relative dielectric constant of vacuum is 1, and the relative dielectric constant of air is only slightly higher (about 1.0006 at sea level at room temperature). The relative permittivity of water is much higher, around 80. Thus, the interaction of the finger with the electric field of the capacitor represents an increase in the relative permittivity, and therefore results in an increase in capacitance.

Finger as a guide

Anyone who has been hit electric current, knows that human skin conducts current. I already mentioned above that there is no direct contact between the finger and the touch button (that is, the situation when the finger discharges the printed capacitor). However, this does not mean that finger conductivity is not important. It is actually quite important, since the finger becomes the second conductive plate in the additional capacitor:

In practice, we can assume that this new finger capacitor is connected in parallel with the existing printed capacitor. This situation is a little more complicated because the person using the sensing device is not electrically connected to ground on the circuit board, and thus the two capacitors are not connected in parallel in the usual circuit analysis sense.

However, we can think of the human body as providing virtual ground because it has a relatively large capacity to absorb electrical charge. In any case, we don't need to worry about the exact electrical connection between the finger capacitor and the printed capacitor; important point is that the pseudo-parallel connection of these two capacitors means that the finger will increase the total capacitance as the capacitor is added in parallel.

Thus, we can see that both influence mechanisms between the finger and the capacitive touch sensor contribute to the increase in capacitance.

Close distance or contact

The previous discussion leads us to interesting feature capacitive touch sensors: the measured change in capacitance can be caused not only contact between the finger and the sensor, but also close distance between them. I usually think of a touch device as replacing a mechanical switch or button, but capacitive touch sensor technology actually introduces a new level of functionality by allowing the system to sense the distance between the sensor and your finger.

Both capacitance changing mechanisms described above have an effect that depends on distance. For a dielectric constant-based mechanism, the amount of "meat" dielectric interaction with the capacitor's electric field increases as your finger approaches the conductive parts of the printed capacitor. For a conductive mechanism, the capacitance of a finger capacitor (like any other capacitor) is inversely proportional to the distance between the conductive plates.

Please note that this method is not suitable for measuring absolute distance between the sensor and the finger; Capacitive sensors do not provide the data needed to make accurate absolute distance calculations. I suppose it would be possible to calibrate a capacitive sensor system for rough distance measurements, but since the capacitive sensor circuit was designed to detect changes containers, it follows that this technology is particularly suitable for detecting changes in distances, i.e. when the finger approaches or moves away from the sensor.

Conclusion

You should now clearly understand the fundamental principles on which capacitive touch systems are built. In the next article, we'll look at methods to implement these fundamentals to help you move from theory to practice.

I hope the article was useful. Leave comments!

As is known, any metal surface, for example, a metal object, plate or door knob. The sensors have no mechanical elements, which in turn gives them significant reliability.

The scope of use of such devices is quite wide, including turning on a bell, light switch, control electronic devices, a group of alarm sensors, etc. When necessary, the use of a touch sensor allows for hidden placement of the switch.

Description of the touch sensor operation

The operation of the sensor circuit below is based on the use of the electromagnetic field present in houses, which is created by electrical wiring located in the walls.

Touching the sensor sensor with your hand is equivalent to connecting an antenna to the sensitive input of the amplifier. As a result, the induced network electricity enters the gate of the field-effect transistor, which plays the role of an electronic switch.

The touch touch sensor quite simple due to the use of field-effect transistor KP501A (B, C). This transistor provides current transmission up to 180 mA at a maximum source-drain voltage of up to 240V for letter A and 200V for letters B and C. To protect against static electricity there is a diode at its input.

The field-effect transistor has a high input resistance, and in order to control it, a static voltage that is greater than the threshold value is enough. For this type of field-effect transistor, the nominal threshold voltage is 1...3 V, and the maximum permissible is 20 V.

When you touch sensor E1 with your hand, the degree of induced potential on the gate is sufficient to open the transistor. In this case, at the drain VT1 there will be electrical pulses lasting 35 ms, and having a frequency electrical network 50 Hz. Most electromagnetic relays require only 3...25 ms to switch. To prevent the relay contacts from bouncing at the moment of contact, capacitor C2 is included in the circuit. Due to the accumulated charge on the capacitor, the relay will be turned on even during that half-cycle of the mains voltage when VT1 is closed. As long as there is a touch to the sensor sensor, the relay will be on.

Capacitor C1 increases the sensor's immunity to high-frequency radio interference. You can change the sensitivity of touching the sensor by changing the capacitance C1 and resistance R1. Contact group K1.1 controls external electronic devices.

By adding a trigger and a network load switching node to this circuit, you can get.

Touch sensor for Arduino

The module is a touch button; a digital signal is generated at its output, the voltage of which corresponds to the levels of logical one and zero. Refers to capacitive touch sensors. We encounter this kind of data input devices when working with the display of a tablet, iPhone or touchscreen monitor. If on the monitor we click on an icon with a stylus or finger, then here we use an area of ​​the board surface the size of a Windows icon, touching it only with a finger, the stylus is excluded. The basis of the module is the TTP223-BA6 chip. There is a power indicator.

Controlling the rhythm of melody playback

When installed in the device, the touch area of ​​the surface of the module board is covered with a thin layer of fiberglass, plastic, glass or wood. The advantages of a capacitive touch button include long term service and the ability to seal the front panel of the device, anti-vandal properties. This allows the touch sensor to be used in devices operating outdoors in conditions of direct contact with water droplets. For example, a doorbell button or household appliances. Interesting application in equipment smart House- replacement of lighting switches.

Characteristics

Supply voltage 2.5 - 5.5 V
Touch response time in various current consumption modes
low 220 ms
normal 60 ms
Output signal
Voltage
high log. level 0.8 X supply voltage
low log level 0.3 X supply voltage
Current at 3 V supply and logical levels, mA
low 8
high -4
Board dimensions 28 x 24 x 8 mm

Contacts and signal

No touch - the output signal has a low logical level, touch - the sensor output is logical one.

Why does it work or a little theory

The human body, like everything around us, has electrical characteristics. When a touch sensor is triggered, our capacitance, resistance, and inductance appear. On the bottom side of the module board there is a section of foil connected to the input of the microcircuit. Between the operator's finger and the foil on the bottom side there is a layer of dielectric - the material of the supporting base of the module's printed circuit board. At the moment of contact, the human body is charged with a microscopic current flowing through a capacitor formed by a section of foil and a person’s finger. In a simplified view, current flows through two series-connected capacitors: foil, a finger located on opposite surfaces of the board, and the human body. Therefore, if the surface of the board is covered with a thin layer of insulator, this will lead to an increase in the thickness of the dielectric layer of the foil-finger capacitor and will not disrupt the operation of the module.
The TTP223-BA6 microcircuit detects an insignificant microcurrent pulse and registers a touch. Due to the properties of the microcircuit, working with such currents does not cause any harm. When we touch the body of a working TV or monitor, microcurrents of greater magnitude pass through us.

Low consumption mode

After power is applied, the touch sensor is in low power mode. After triggering for 12 seconds, the module goes into normal mode. If no further contact occurs, the module will return to low current consumption mode. The speed of the module's response to touch in various modes is given in the characteristics above.

Working together with Arduino UNO

Load the following program into the Arduino UNO.

#define ctsPin 2 // Contact for connecting the touch sensor signal line
int ledPin = 13; // Contact for LED

Void setup() (
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(ctsPin, INPUT);
}

Void loop() (
int ctsValue = digitalRead(ctsPin);
if (ctsValue == HIGH)(
digitalWrite(ledPin, HIGH);
Serial.println("TOUCHED");
}
else(
digitalWrite(ledPin,LOW);
Serial.println("not touched");
}
delay(500);
}

Connect the touch sensor and Arduino UNO as shown in the figure. The circuit can be supplemented with an LED that turns on when the sensor is touched, connected through a 430 Ohm resistor to pin 13. Touch buttons are often equipped with a touch indicator. This makes it more convenient for the operator to work. When we press a mechanical button, we feel a click regardless of the reaction of the system. Here the novelty of the technology is a little surprising because of our motor skills that have developed over the years. The pressure indicator saves us from an excessive feeling of novelty.

How to attach a capacitive touch sensor to a microcontroller. This idea seemed quite promising to me; for some devices, touch keys would be much better suited than mechanical ones. In this article I will talk about my implementation of this useful technology based on the STM32 Discovery development board.

So, just starting to master the STM32, I decided to add touch detection to the device as an exercise. Having started to understand the theory and practice in the above-mentioned article, I repeated the circuit of comrade "a. It worked perfectly, but I, a lover of minimalism, wanted to simplify it by getting rid of unnecessary elements. In my opinion, an external resistor and a power supply path turned out to be superfluous. All this already found in most microcontrollers, including AVR and STM32. I mean pull-up resistors of I/O ports. Why not charge the plate and our fingers through them? In anticipation of the catch, I assembled a circuit on a breadboard, which, to my To my surprise, it worked the first time. In fact, it’s even funny to call it a circuit, because all we need is to simply connect the contact plate to the leg of the debug board. The microcontroller will do all the work.

What is the program? First two functions:
The first outputs a logical “0” to the sensor pin (zero pin of register C)

Void Sensor_Ground (void) ( GPIOC->CRL = 0x1; GPIOC->BRR |= 0x1; )

The second configures the same output as an input, with a pull-up to the power supply.

Void Sensor_InPullUp (void) ( GPIOC->CRL = 0x8; GPIOC->BSRR |= 0x1; )

Now at the beginning of the polling cycle we will call Sensor_Ground(), and wait a while to discharge all the residual charge on the sensor to the ground. Then we will reset the count variable, which will be used to calculate the charging time of the sensor, and call Sensor_InPullUp().

Sensor_Ground(); Delay(0xFF); //simple empty counter count = 0; Sensor_InPullUp();

Now the sensor begins to charge through an internal pull-up resistor with a nominal value of about tens of KOhms (30..50KOhms for STM32). The time constant of such a circuit will be equal to a few clock cycles, so I changed the quartz resonator on the debug board to a faster one, 20 MHz (by the way, I did not immediately notice that on the STM32 Discovery the quartz is changed without soldering). So we count the processor cycles until a logical one appears at the input:

While(!(GPIOC->IDR & 0x1)) ( count++; )

After exiting this loop, the count variable will store a number proportional to the capacity of the sensor plate. In my case with a 20 MHz chip, the count value is 1 when there is no pressure, 7-10 with the lightest touch, 15-20 with a normal touch. All that remains is to compare it with the threshold value and do not forget to call Sensor_Ground() again, so that by the next polling cycle the sensor will already be discharged.
The resulting sensitivity is enough to confidently detect touches on bare metal pads. When covering the sensor with a sheet of paper or plastic, the sensitivity drops three to four times; only confident presses are clearly detected. To increase sensitivity in cases where the sensor needs to be covered with protective material, you can increase the clock frequency of the microcontroller. With the STM32F103 series chip, capable of operating at frequencies up to 72 MHz, millimeter barriers between the finger and the sensor will not be an obstacle.
Compared to implementation "a, my approach works much faster (about a dozen clock cycles per poll of one sensor), so I did not complicate the program by setting up timer interrupts.

Finally, a video demonstrating how the sensor works.

Main.c test program.

To microcontroller

Thanks to the user for the very useful article ARM microcontrollers STM32F. Quick start with STM32-Discovery, to the user for the idea and intelligible theoretical description.

UPD. After comments "a I decided to look into the clocking and found that by default the STM32 Discovery is set to the clock frequency
(HSE / 2) * 6 = 24 MHz, where HSE is the external crystal frequency. Accordingly, changing the quartz from 8 to 20 MHz, I forced the poor STM to work at 60 MHz. So, firstly, some of the conclusions are obviously not entirely correct, and secondly, what I was doing could lead to chip failures. In case of such failures in the microcontroller there is a HardFault interrupt, using it, I checked higher frequencies. So, the chip starts to fail only at 70 MHz. But although the controller processes this particular program at 60 MHz, when using peripherals or working with Flash memory it can behave unpredictably Conclusion: treat this topic as an experiment, repeat only at your own peril and risk.