AnsweredAssumed Answered

MKW30Z TSI Stuck Key Detection implementation

Question asked by Lucian Firan on Apr 4, 2017
Latest reply on Apr 26, 2017 by Gerardo Rodríguez

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 ?       

Outcomes