AnsweredAssumed Answered

How to code several cap-touch buttons as GPIO input interrupt button or switch

Question asked by M I on Apr 2, 2019
Latest reply on May 10, 2019 by M I

RE: How to code several cap-touch buttons as several "random/asynchronous" GPIO input interrupt button or switch press   (no scanning to detect) - MCU = MKL28Z512VLL7

 

Hello,

 

 I need help about “converting” self-cap touch to GPIO interrupt input trigger just like any other button or switch press/release action, rather than scanning method which will not be feasible to my product development.  

 

I have at least 3 cap-touch buttons to BEHAVE AS GPIO together with other regular electromechanical buttons & switches & probes contact – BY HARDWARE INTERRUPT INPUT TRIGGER.   I have 80+ pin I have setup/routed using the MCUXpresso pin tool, 3 out of 81 I/Os are capacitive touch buttons.

 

I cannot & should not scan or poll as the trigger will be missed because MCU will be under FreeRTOS multitasking & doing MANY OTHER THINGS other than waiting for touch buttons.

 

I’m using MCUXpresso & I don’t have IAR or other IDE & I do NOTwant to install anything anymore as “temporary” IDE, etc.

 

But AN4637 using Touch Sensing Software in GPIO method specifies TSS library that cannot be installed in MCUXpresso.

 

I opened some tickets on this but technical support has been Unsupportive except for the most recent one who gave me link to the folder on NXP that has some (but not all) of the FRDM-KL25 demo source code files, *.c & *.h.

 I've started tracing & analyzing this code logic in order to apply GPIO interrupt input method trigger (ala-button press) on the MKL28Z using its FRDM-KL28Z eval-bd.

 

There are plenty of source files on the directory you pointed me to but for some reason, I can't find all the definition for the functions that's paired with the prototype header file "TSS_API.h".  

 

I don't see "TSS_API.c" C-source file which is where I think a big chunk of the setup, configuration, initialization functions of the touch pins to behave as GPIO are.

 

For example, the missing functions I would like to view the source code which are missing from any of the source files are:

               TSS_Init() - how to code setup, configuration of a touch-capable pin to behave like GPIO input?

               TSS_SetSystemConfig() - other necessary configuration code?

               TSS_Task() - how does it catches the touch event like a button press???

... just to name a few.

 

Where & which source code file can I find them? 

 

If you don't know where the code is, does anyone who actually have solid experience in programming such setup explain how they did it?

 

Based on my trial & errors using SDK imported code project of "touch" sensing, they have to specify an "electrode" first & then do a "timer interrupt" handler (link electrode scan to timer tick, if I understand that correctly), then in the handler function, verify if the touch was that electrode that is waited on.    But with MKL28 it seems that you can only specify ONE & ONLY 1 electrode at a time!  which means TSI module only scans for ONE electrode at a time?   Because this is a 16-bit register BIT-MAPPING, & parsed by MASKING each bit.   So no 2 or more bits can be set AT A TIME or else the value of channel count is >15 which is invalid channel # (valid is only 0-15, for 16 channels for this MCU).

 

Long story short, I've exhausted many ways I can think of how to make touch channel behave like RANDOM GPIO interrupt input event so please help me so this MCU can handle at least 3 cap-touch trigger at any random time not by scanning electrode 1-then 2- then 3 in sequence - THIS WILL CAUSE a touch event to be missed because as I said I have 81 GPIO operations that needs to be taken cared of.

 

Thanks for the help.

 

MI

 

 

Outcomes