This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Setting of interrupt for touch screen

I am currently working on AM335x skEVM using Starterware. In Starterware, there is a sample example call "touchSreen" (tscCalibrate.c).

I have done some modification to try to enable the interrupt event for "TSCADC_PEN_UP_EVENT_INT" for testing. Just by looking at the definition, this interrupt event should be generated when user's finger is withdrawn from the touchscreen.

Below is the related modification in "tscCalibrate.c" (code in red are the actual modification) .

...

/******************************************************************************                       
**              GLOBAL VARIABLE DEFINITIONS                                                           
******************************************************************************/                       
volatile unsigned int x_val[2];                                                                       
volatile unsigned int y_val[2];                                                                       
volatile unsigned int error;                                                                          
volatile unsigned int IsTSPress;                                                                      
volatile unsigned int numOfInt = 0;                                                                   
volatile unsigned int Index =0;                                                                       
                                                                                                                                                                               
volatile unsigned int TSPenUpInt = 0, TSPenUpInt_Show = 0;  

....

static void TouchScreenInit(void)

{

                …..

               TSCADCEventInterruptEnable(TSC_ADC_INSTANCE, TSCADC_FIFO1_THRESHOLD_INT|TSCADC_PEN_UP_EVENT_INT);

                …..

}

static void TouchScreenIsr()

{

   …..

   if(status & TSCADC_PEN_UP_EVENT_INT)

   {

        TSPenUpInt++;

        TSCADCIntStatusClear(TSC_ADC_INSTANCE,  TSCADC_PEN_UP_EVENT_INT);

   }

   …..

}

static void ReadTouchScreenPress(void)

{

   …..

   if(TSPenUpInt_Show != TSPenUpInt)

   {

      TSPenUpInt_Show = TSPenUpInt;

      UARTPuts("TSPenUpInt_Show=",-1);

      UARTPutNum(TSPenUpInt_Show);

      UARTPuts("\r\n", -1);

   }

   …..

}

Base on the testing, it was found that the "TSCADC_PEN_UP_EVENT_INT" event is not generated with user withdraw his finger from the touchscreen.

However, it was found that "TSCADC_PEN_UP_EVENT_INT" event is generated continuously if the users finger is remained press down on the touchscreen.

Is this normal behavior?

  • Joseph,

    Configure the Charge step with the same settings as the Idle step. This should solve the continuous interrupts issue. Also, since touchscreens are a mechanical device they can bounce like a switch. There is no debounce mechanism in hardware so if you do see a false pen-up every once in a while it might be worth implementing some type of software debounce mechanism to help reduce false detections.

    Regards,

    Tyler

  • Hi Tyler,

    Thanks for the information.

    I will take a look at the function "TSchargeStepConfig()" and "IdleStepConfig()" in the sample code.

    I will adjust the parameters in the "TSchargeStepConfig()" according to "IdleStepConfig()" for further testing.

    From Joseph Lee.