STMPE321 Capacitance compensation
Doc ID 15791 Rev 3 7/40
2.1 Calibration algorithm
The STMPE321 maintains 2 parameters for each touch channel: TVR and CALIBRATED
IMPEDANCE. CALIBRATED IMPEDANCE is an internal reference which, if the currently
measured IMPEDANCE exceeds the CALIBRATED IMPEDANCE by a magnitude of TVR, is
considered a “TOUCH”.
If the IMPEDANCE is higher than the CALIBRATED IMPEDANCE, but the magnitude does
not exceed CALIBRATED IMPEDANCE by TVR, it is not considered a TOUCH. In this case,
2 scenarios are possible:
1. Environmental changes have caused the IMPEDANCE to increase
2. Finger is near the sensing pad, but not near enough
In case 1, the change in IMPEDANCE is expected to be small, as environmental changes
are normally gradual. A value "EVR" is maintained to specify the maximum IMPEDANCE
change that is still considered an environmental change.
‘IMP’ and ‘CALIBRATED IMP’ used in this table is not the direct register read-out.
IMP = 127 - impedance register readout
CALIBRATED IMP = 127 - calibrated impedance register readout.
The ETC WAIT register states a period of time for which all TOUCH inputs must remain "NO
TOUCH" for the next calibration to be carried out.
The CAL INTERVAL states the period of time between successive calibrations when there
are prolonged NO TOUCH conditions.
Table 3. Calibration action under different scenarios
Scenario Touch sensing and calibration action
IMP>CALIBRATED IMP + TVR
TOUCH,
no calibration
IMP<CALIBRATED IMP + TVR
IMP>CALIBRATED IMP + EVR
NO TOUCH,
no calibration
IMP<CALIBRATED IMP + TVR
IMP<CALIBRATED IMP + EVR
IMP>CALIBRATED IMP
NO TOUCH,
new CALIBRATED IMP = previous CALIBRATED
IMP + change in IMP
IMP>CALIBRATED IMP CALIBRATED IMP + change in IMP
IMP<CALIBRATED IMP
NO TOUCH,
new CALIBRATED IMP = new IMP