KW40Z_Connectivity_Software_1.0.1 (KSDK_1.3.0); IAR 7.50
There is some stuck key detection algo implemented in framework ?
There is the Initial Start-up Calibration witch is a low value calibration.
Occurs every time the device resets. The first key detection cycle is used as a baseline
capacitance value for all remaining calculations.
Thus, a touch is detected by taking the difference between this baseline value and a sensitivity value
compared with current capacitance on the electrode.
I guess that the Stuck Key Detection can be a counter (timer) of continuous press events (not interrupted by idle).
When this value goes above a set value it triggers a recalibration - but should be high value calibration.
Got some inspiration from (pag 24):
http://www.nxp.com/assets/documents/data/en/data-sheets/MPR084.pdf
and tried something like:
#if (gUseStuckButtonCounter_d)
stuckBtnCnt++;
/* trigger recalibration */
if (stuckBtnCnt > stuckBtnCntMax)
{
/* Calibrate electrode channel - try lower threshold */
if(threshold > sensitivity) { threshold = threshold - sensitivity; }
else { TsiCalibrate(); }
stuckBtnCnt=0;
}
#endif
where threshold is first measured low + sensitivity and the counter fires of about ~5 minutes.
The framework contains a high value calibration demo example ?
Hi Lucian,
As far as I know, the Connectivity Framework for KW40Z doesn’t implement TSI functionality.
Have you looked at the Kinetis Peripheral Module Quick Reference? There is a chapter about the TSI module with useful reference material on how to implement the TSI module.
Regards,
Gerardo