7.2 Charge Time Tuning
Ensure each sensor is fully charged during each measurement to get correct results. Most devices have a configurable Charge Share Delay (CSD) to adjust the charge time during each measurement. Increasing the CSD increases charge time. Some devices do not have CSD option. For such devices, the Prescaler can be used to increase the charge time. Increasing the Prescaler increases charge time.
Get Autotuned Value
- Build the auto-tune enabled project and program the hex file
- Using the MPLAB® Data Visualizer, monitor the auto-tuned value (Prescaler or CSD)
-
Power OFF and power ON a couple of times to ensure that the same Prescaler/CSD values are obtained
Note: For certain designs where parasitic capacitances are higher, auto-tune may not provide optimal results. Auto-tune CSD values may be too much (e.g., > 20). If such values are observed, assume that auto-tune has failed and proceed with manual tuning. - Now the auto-tuned value is
available. Configure the auto-tuned values to the project generated without
auto-tune option.
- Open the project with the auto-tune charge option disabled.
- Configure the
Prescaler/CSD noted in the previous step. To take tolerance into
account, use higher values than the auto-tuned values.
- In the case of CSD, use a 20% higher value. E.g., If auto-tune CSD value is 10, then use 12.
- In the case
of the Prescaler, use one higher Prescaler value. E.g., If
the auto-tune Prescaler is
PRSC_DIV_SEL_1
, then usePRSC_DIV_SEL_2
.
- Program the project and monitor the touch parameters in Data Visualizer.
- Proceed with manual tuning.
Manual Tuning
- If auto-tune was used, start with the values obtained from auto-tune. Otherwise, keep a higher CSD value such as 30 and observe the touch delta.
- Observe the delta with CSD values 25, 20, 15, 10, 5 and zero.
- From these values, find the CSD for which the delta is not significantly less comparing to the delta with CSD of 30.
- Use that CSD value.
- With CSD = 30, the touch delta is 40 counts.
- With CSD = 25, 20, 15, the touch delta is 40 counts.
- With CSD = 10, the touch delta is 30 counts.
In this example, the highest delta value of 40 is found with a CSD value of 15. Increasing CSD beyond 15 does not help to increase the delta. Thus, it is better to use CSD = 15.
It is possible to fine-tune CSD by comparing the delta with CSD 14, 13, 12, and 11.
- In the case of CSD, use a 20% higher value. E.g., If auto-tune CSD value is 10, then use 12.
- In the case of the Prescaler,
use one higher Prescaler value. E.g., If the auto-tune Prescaler is
PRSC_DIV_SEL_1
, then usePRSC_DIV_SEL_2
.
touch.h
file with CSD set equal to 5.
If the CSD is not available, this field will be
blank.#define NODE_0_PARAMS { X(1), Y(3), 5, NODE_RSEL_PRSC(RSEL_VAL_0, PRSC_DIV_SEL_1), NODE_GAIN(GAIN_1, GAIN_1), FILTER_LEVEL_16 }
touch.h
file with the Prescaler set equal to
PRSC_DIV_SEL_1
.#define NODE_0_PARAMS { X(1), Y(3), 0, NODE_RSEL_PRSC(RSEL_VAL_0, PRSC_DIV_SEL_1), NODE_GAIN(GAIN_1, GAIN_1), FILTER_LEVEL_16 }