static const tsi_config_t tsi_HwConfig =
{
.ps = kTsiElecOscPrescaler_2div, /*!< Electrode oscillator frequency divided by 2 */
.extchrg = kTsiExtOscChargeCurrent_16uA, /*!< External oscillator charge current is 16uA */
.refchrg = kTsiRefOscChargeCurrent_16uA, /*!< Reference oscillator charge current is 16uA */
.nscn = kTsiConsecutiveScansNumber_8time, /*!< 8 times consecutive scan */
.mode = kTsiAnalogModeSel_Capacitive, /*!< Active TSI capacitive sensing mode */
.dvolt = kTsiOscVolRails_Dv_029, /*!< DV = 0.29 V; VP = 0.95 V; Vm = 0.67 V */
.thresh = 100,
.thresl = 200,
};
Hi Lucian,
It is a RO (relaxation based) CAP sensing mode. It means that you loading the external oscillator and change its oscillation frequency.
Just a few parameters are important for the basic analog tunning.
-extchrg, is the external current generated on electrode. If this current is DECREASED (weaker oscillator signal), then the sensitivitivity INCREASES, because you can influence this weak signal much easier by the external loading
-refchrg is the internal oscillator reference, INCREASING this current causing internal ref. oscillator ticks on faster frequency. Use 16uA or 32uA for best sensitivity and play with the extchrg to get the appropriate sensitivity.
-ps & nscn are acting as prescaler. If you set larger .ps, then the Accumulation time will be longer, resultiong to the higher accumulated numbers. But be carefull to stay in the 16-bit TSI counter range (65535)
So basically the accumulated counter TSCNT value (SENSITIVITY) will be proportional to the following value:
ExtCap * (refchrg/extchrg) * PS * NSCN < 65535
If you download the NXP TOuch sensing library, you can run the FreeMASTER and watch the signals here.
Then you can play with the sensitivity easily.
Ideally, if you touch, the Delta signal value should be several Thousands of counts, where the signal doesn't attack very high levels, i.e. above the 50.000 counts (To have some reserves for signal offset changes due enviromental changes)
Thanks,
Michael