Newhaven Display Forum

Newhaven Products => TFTs => Topic started by: Chris Electronics on May 13, 2016, 02:24:20 AM

Title: NHD-4.3-480272EF-ASXN#-CTP touch controller interrupt signal
Post by: Chris Electronics on May 13, 2016, 02:24:20 AM
Hello,

I've been using your forum for some helpful tips on getting my NHD-4.3-480272EF-ASXN#-CTP display going. The display part is fine, I am having trouble getting a interrupt response from the ft5306 controller.

I have been using my micro-controller(PIC32mz2048efm) working great with the microchip development board meb 11, which has a newhaven screen and observed the touch signals via oscilloscope to and from the on board touch chip that it uses, the interrupt signal and I2C SCL/SDA, so I have an idea on what response is expected, i.e the same as documented in the  NHD-4.3-480272EF-ASXN#-CTP data sheet.

I have implemented a ft5306 driver with my micro-controller(PIC32mz2048efm), however I don't get a interrupt signal pull down from the ft5306 controller when the screen is touched, so the I2C is never initiated.

I have created a wake signal as suggested in the data sheet and elaborated on your forum, that pulls down for 200ms from high to low back to high, this should turn the ft5x06 controller into the correct operational mode. I have used 10K pull up resistors as suggested,  but there is no interrupt signal response from the ft5306 touch controller. Would you have any suggestions? There should at least be a interrupt response from the ft5306 when the screen is touched regardless of the I2C host driver, after a wake up signal initiation.....?

Hope you can help,
Chris
Title: Re: NHD-4.3-480272EF-ASXN#-CTP touch controller interrupt signal
Post by: Michael_L on May 13, 2016, 08:50:45 AM
Chris,

Have you been referring to the proper datasheet for the NHD-4.3-480272EF-ASXN#-CTP?  The pinout for the CTP is shown on page 4, and the /WAKE signal is not brought out to the 6-pin FFC.
You will notice pin 6 is the /RESET signal for the FocalTech controller IC.  A logic HIGH needs to be present on this pin for the CTP to operate correctly.
Typically, a pull-down resistor is put on this signal, so on start-up the CTP's IC is in reset, then you would have your microcontroller drive it high before use.
Please find my Arduino example code below to help show how to use the CTP:

Code: [Select]
/***********************************************************************\
CTP_Register_Test_Due.ino

(c)2016 Michael LaVine | Newhaven Display International, Inc.

This code is meant to serve as an example of how to communicate with
Newhaven Display's FT5x06 based capacitive touch panels.

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.
\***********************************************************************/
#include <Wire.h>

#define RESET 18
#define INT 19
#define slaveAddress_FT5x06 0x38

unsigned char readValue1, readValue2, readValue3, readValue4;

void resetCTP()
{
  delay(5);
  digitalWrite(RESET, HIGH);
  delay(400);
}

void writeI2C(unsigned char slaveAddress, unsigned char registerAddress, unsigned char registerData)      // I2C routine to write to 1 register
{
  Wire.beginTransmission(slaveAddress);
  Wire.write(registerAddress);
  Wire.write(registerData);
  while(Wire.endTransmission());
}

unsigned char readI2C(unsigned char slaveAddress, unsigned char registerAddress)     // I2C routine to read 1 register
{
  unsigned char readValue;
  Wire.beginTransmission(slaveAddress);
  Wire.write(registerAddress);
  while(Wire.endTransmission());
  Wire.requestFrom(slaveAddress, 1);
  while(Wire.available())
  {
    readValue = Wire.read();
  }
  return readValue;
}

void read4I2C(unsigned char slaveAddress, unsigned char registerAddress)     // I2C routine to read 4 consecutive registers
{
  Wire.beginTransmission(slaveAddress);
  Wire.write(registerAddress);
  while(Wire.endTransmission());
  Wire.requestFrom(slaveAddress, 4);
  while(Wire.available())
  {
    readValue1 = Wire.read();
    readValue2 = Wire.read();
    readValue3 = Wire.read();
    readValue4 = Wire.read();
  }
}
/*****************************************************/
/*****************************************************/
/*****************************************************/
void setup()
{
  pinMode(RESET, OUTPUT);
  pinMode(INT, INPUT);
  Wire.begin();
  Serial.begin(9600);
  resetCTP();
}

void loop()
{
  unsigned char dummy = 0, gesture = 0, numpoints = 0, t1xh = 0, t1xl = 0, t1yh = 0, t1yl = 0;
  unsigned int t1x = 0, t1y = 0;
 
  while(1)
  {
    while((digitalRead(INT)) == LOW)
    {
      read4I2C(slaveAddress_FT5x06, 0x00);
      dummy = readValue1;                       // Dummy read
      gesture = readValue2;                     // Gesture value
      numpoints = readValue3;                   // Number of touch points
      t1xh = readValue4;                        // Upper 8 bits of X-axis touch location
      read4I2C(slaveAddress_FT5x06, 0x04);
      t1xl = readValue1;                        // Lower 8 bits of X-axis touch location
      t1yh = readValue2;                        // Upper 8 bits of Y-axis touch location
      t1yl = readValue3;                        // Lower 8 bits of Y-axis touch location
      dummy = readValue4;                       // Dummy read
      t1x = t1xl | (t1xh << 8);                 // Get the 16 bit X-axis touch location
      t1y = t1yl | (t1yh << 8);                 // Get the 16 bit Y-axis touch location
         
      //****************************************************************************//
      //  UNCOMMENT THE LINE BELOW THAT YOU WANT TO BE SHOWN ON THE SERIAL MONITOR  //
      //****************************************************************************//
         
          //Serial.println(gesture, DEC);delay(25);    // Show gesture value
          //Serial.println(numpoints, DEC);delay(25);  // Show number of touch points
          Serial.println(t1x&0x0FFF, DEC);delay(25);   // Show 16-bit X-axis touch location
          //Serial.println(t1y&0x0FFF, DEC);delay(25);   // Show 16-bit Y-axis touch location
    }
  }
}
Title: Re: NHD-4.3-480272EF-ASXN#-CTP touch controller interrupt signal
Post by: Chris Electronics on May 20, 2016, 07:38:45 AM
Cheers Michael, it turned out to be a faulty connector not making contact with the ribbon cable.

Thank you for your response