DUE mit Adafruit RA8875 Breakout und AF 7" Toch Display - Problem mit Touch

Hallo,

nach mehreren Versuchen mit Fernost Händlern habe ich nun ein 7" Touch Display von Adafruit mit entsprechendem RA885 Board gekauft.
Zunächst das Positive: Die Kombination läuft ohne externe Spannungsversorgung und ohne, dass das DUE Board irgendwo heiss wird. Andere 7" Display musste ich bisher immer separat Versorgen, sonst drohte der Spannungsregler auf dem Arduino zu verheizen.
Mit der RA8875 und der GFX library von Adafruit habe ich sofort ein schönes Testprogramm laufen lassen.
Jetzt möchte ich mein eigenes Skript schreiben und habe ein Problem, das sich auch Hardwareseitig messen lässt.
Hier einmal das buildtest Skript von ADAFRUIT:

/******************************************************************
 This is an example for the Adafruit RA8875 Driver board for TFT displays
 ---------------> http://www.adafruit.com/products/1590
 The RA8875 is a TFT driver for up to 800x480 dotclock'd displays
 It is tested to work with displays in the Adafruit shop. Other displays
 may need timing adjustments and are not guanteed to work.
 
 Adafruit invests time and resources providing this open
 source code, please support Adafruit and open-source hardware
 by purchasing products from Adafruit!
 
 Written by Limor Fried/Ladyada for Adafruit Industries.
 BSD license, check license.txt for more information.
 All text above must be included in any redistribution.
 ******************************************************************/

#include <SPI.h>
#include "Adafruit_GFX.h"
#include "Adafruit_RA8875.h"


// Library only supports hardware SPI at this time
// Connect SCLK to UNO Digital #13 (Hardware SPI clock)
// Connect MISO to UNO Digital #12 (Hardware SPI MISO)
// Connect MOSI to UNO Digital #11 (Hardware SPI MOSI)
#define RA8875_INT 3
#define RA8875_CS 10
#define RA8875_RESET 9

Adafruit_RA8875 tft = Adafruit_RA8875(RA8875_CS, RA8875_RESET);
uint16_t tx, ty;

void setup() 
{
  Serial.begin(9600);
  Serial.println("RA8875 start");

  /* Initialise the display using 'RA8875_480x272' or 'RA8875_800x480' */
  if (!tft.begin(RA8875_800x480)) {
    Serial.println("RA8875 Not Found!");
    while (1);
  }

  Serial.println("Found RA8875");

  tft.displayOn(true);
  tft.GPIOX(true);      // Enable TFT - display enable tied to GPIOX
  tft.PWM1config(true, RA8875_PWM_CLK_DIV1024); // PWM output for backlight
  tft.PWM1out(255);

  // With hardware accelleration this is instant
  tft.fillScreen(RA8875_WHITE);

  // Play with PWM
  for (uint8_t i=255; i!=0; i-=5 ) 
  {
    tft.PWM1out(i); 
    delay(10);
  }  
  for (uint8_t i=0; i!=255; i+=5 ) 
  {
    tft.PWM1out(i); 
    delay(10);
  }
  tft.PWM1out(255); 
  
  tft.fillScreen(RA8875_RED);
  delay(500);
  tft.fillScreen(RA8875_YELLOW);
  delay(500);
  tft.fillScreen(RA8875_GREEN);
  delay(500);
  tft.fillScreen(RA8875_CYAN);
  delay(500);
  tft.fillScreen(RA8875_MAGENTA);
  delay(500);
  tft.fillScreen(RA8875_BLACK);
  
  // Try some GFX acceleration!
  tft.drawCircle(100, 100, 50, RA8875_BLACK);
  tft.fillCircle(100, 100, 49, RA8875_GREEN);
  
  tft.fillRect(11, 11, 398, 198, RA8875_BLUE);
  tft.drawRect(10, 10, 400, 200, RA8875_GREEN);
  tft.fillRoundRect(200, 10, 200, 100, 10, RA8875_RED);
  tft.drawPixel(10,10,RA8875_BLACK);
  tft.drawPixel(11,11,RA8875_BLACK);
  tft.drawLine(10, 10, 200, 100, RA8875_RED);
  tft.drawTriangle(200, 15, 250, 100, 150, 125, RA8875_BLACK);
  tft.fillTriangle(200, 16, 249, 99, 151, 124, RA8875_YELLOW);
  tft.drawEllipse(300, 100, 100, 40, RA8875_BLACK);
  tft.fillEllipse(300, 100, 98, 38, RA8875_GREEN);
  // Argument 5 (curvePart) is a 2-bit value to control each corner (select 0, 1, 2, or 3)
  tft.drawCurve(50, 100, 80, 40, 2, RA8875_BLACK);  
  tft.fillCurve(50, 100, 78, 38, 2, RA8875_WHITE);
  
  pinMode(RA8875_INT, INPUT);
  digitalWrite(RA8875_INT, HIGH);
  
  tft.touchEnable(true);
    
  Serial.print("Status: "); Serial.println(tft.readStatus(), HEX);
  Serial.println("Waiting for touch events ...");
}

void loop() 
{
  float xScale = 1024.0F/tft.width();
  float yScale = 1024.0F/tft.height();

  /* Wait around for touch events */
  if (! digitalRead(RA8875_INT)) 
  {
    if (tft.touched()) 
    {
      Serial.print("Touch: "); 
      tft.touchRead(&tx, &ty);
      Serial.print(tx); Serial.print(", "); Serial.println(ty);
      /* Draw a circle */
      tft.fillCircle((uint16_t)(tx/xScale), (uint16_t)(ty/yScale), 4, RA8875_WHITE);
    } 
  }
}

Mit

#define RA8875_INT 3

und später im Setup mit

pinMode(RA8875_INT, INPUT);
  digitalWrite(RA8875_INT, HIGH);

wird Pin3 für die Erkennung eines Touch Ereignisses als Input mit Pullup gesetzt. Wenn der Pin gegen GND gezogen wird, ist das das Zeichen für ein neues Touch Ereignis und verhindert so, dass das Display prellt.
Funktioniert prima und ich konnte den Pin3 sehr zuverlässig am Oszi verfolgen.

Jetzt habe ich den grundlegenden Code in mein eigenes Skript übernommen, und der verdammt Pin3 bleib einfach immer HIGH! Suche jetzt seit zwei Tagen nach einem Tipfehler o.ä. und komme auf keinen grünen Zweig.
Leiht Ihr mir Eure Augen und öffnet meine? Ich sehe den Wald vor lauter Bäumen nicht mehr!

Mein Skript poste ich im nächsten Post, sonst wird dieses hier zu lang!

Hier mein Skript (ist natürlich noch alles andere als fertig, aber die grundlegende Touch Funktion sollte eigentlich laufen / ein paar Seiten kann man auch hin und herblättern):

/******************************************************************
 This is an example for the Adafruit RA8875 Driver board for TFT displays
 ---------------> http://www.adafruit.com/products/1590
 The RA8875 is a TFT driver for up to 800x480 dotclock'd displays
 It is tested to work with displays in the Adafruit shop. Other displays
 may need timing adjustments and are not guanteed to work.
 
 Adafruit invests time and resources providing this open
 source code, please support Adafruit and open-source hardware
 by purchasing products from Adafruit!
 
 Written by Limor Fried/Ladyada for Adafruit Industries.
 BSD license, check license.txt for more information.
 All text above must be included in any redistribution.
 ******************************************************************/

#include <SPI.h>
#include "Adafruit_GFX.h"
#include "Adafruit_RA8875.h"


// Library only supports hardware SPI at this time
// Connect SCLK to UNO Digital #13 (Hardware SPI clock)
// Connect MISO to UNO Digital #12 (Hardware SPI MISO)
// Connect MOSI to UNO Digital #11 (Hardware SPI MOSI)
#define RA8875_INT 3
#define RA8875_CS 10
#define RA8875_RESET 9

Adafruit_RA8875 tft = Adafruit_RA8875(RA8875_CS, RA8875_RESET);
uint16_t tx, ty;
//tsPoint_t       _tsLCDPoints[3]; 
//tsPoint_t       _tsTSPoints[3];

int switcher = 0;

int lastScreen;

char sicherheitsstufeEins[19] = "Sicherheitsstufe 1";
char sicherheitsstufeZwei[19] = "Sicherheitsstufe 2";
char sicherheitsstufeDrei[19] = "Sicherheitsstufe 3";
char seiteEins[8] = "Seite 1";
char zurueck[8] = "zurueck";
char vor[4] = "vor";
char produktName[11] = "Prod. Name";
char eins[2] = "1";
char zwei[2] = "2";
char drei[2] = "3";
char vier[2] = "4";
char fuenf[2] = "5";
char sechs[2] = "6";
char sieben[2] = "7";
char acht[2] = "8";
char neun[2] = "9";
char zero[2] = "0";
char passwort[10] = "Passwort:";
char keyEins[5] = "1155";
char keyAbfrage[5];
int abfrageZaehler = 1;

char blinkZahl[2];
char keyZeichen[2] = "*";
char falsePassword[18] = "FALSCHES PASSWORT";

//int touchX;
//int touchY;
float xScale = 1024.0F/tft.width();
float yScale = 1024.0F/tft.height();
  
void setup() 
{
  Serial.begin(9600);
  Serial.println("RA8875 start");

  /* Initialise the display using 'RA8875_480x272' or 'RA8875_800x480' */
  if (!tft.begin(RA8875_800x480)) {
    Serial.println("RA8875 Not Found!");
    while (1);
  }

  Serial.println("Found RA8875");

  tft.displayOn(true);
  tft.GPIOX(true);      // Enable TFT - display enable tied to GPIOX
  tft.PWM1config(true, RA8875_PWM_CLK_DIV1024); // PWM output for backlight
  tft.PWM1out(255);

  // With hardware accelleration this is instant
  tft.fillScreen(RA8875_WHITE);

  // Play with PWM
  for (uint8_t i=255; i!=0; i-=5 ) 
  {
    tft.PWM1out(i); 
    delay(10);
  }  
  for (uint8_t i=0; i!=255; i+=5 ) 
  {
    tft.PWM1out(i); 
    delay(10);
  }
  tft.PWM1out(255); 
  
  pinMode(RA8875_INT, INPUT);
  digitalWrite(RA8875_INT, HIGH);
 
  tft.touchEnable(true);
    
  Serial.print("Status: "); Serial.println(tft.readStatus(), HEX);
  Serial.println("Waiting for touch events ...");

}

void touchWarten()
{
  float xScale = 1024.0F/tft.width();
  float yScale = 1024.0F/tft.height();
  Serial.println("Waiting for touch events ...2");
  if (! digitalRead(RA8875_INT)) 
  {   
    if (tft.touched()) 
    {
      Serial.print("Touch: "); 
      tft.touchRead(&tx, &ty);
      delay (300);
      Serial.print(tx); Serial.print(", "); Serial.println(ty);
      Serial.print((uint16_t)(tx/xScale)); Serial.print(", "); Serial.println((uint16_t)(ty/yScale));
      if (((uint16_t)(tx/xScale) != -1) and ((uint16_t)(ty/yScale) != -1))
      {
        if (lastScreen == 0) 
        {
          Serial.print("geschafft!!!");
          if (75 < (uint16_t)(tx/xScale) && (uint16_t)(tx/xScale) < 275 && 150 < (uint16_t)(ty/yScale) && (uint16_t)(ty/yScale) < 330)
          {
            tx = 0;
            ty = 0;
            switcher = 1;
          }
 //Code gekürzt wegen max Länge Post!

/*void touchInitialization()
{
  Serial.print("Touch: "); 
  tft.touchRead(&tx, &ty);
  Serial.print(tx); Serial.print(", "); Serial.println(ty);
  touchX = tx;
  touchY = ty;
  if ((touchX != -1) and (touchY != -1))
  {
    if (switcher = 0) 
    {
      if (75 < touchX && touchX < 275 && 150 < touchY && touchY < 330)
      {
        sStufeEins();
      }
      if (300 < touchX && touchX < 500 && 150 < touchY && touchY < 330)
      {
        sStufeZwei();
      }
      if (525 < touchX && touchX < 725 && 150 < touchY && touchY < 330)
      {
        sStufeDrei();
      }
    }
  }
}*/

void startseite()
{
  tft.fillScreen(RA8875_WHITE);
    //black boxes
  tft.fillRoundRect(75,150,200,180,5,RA8875_BLACK);
  tft.fillRoundRect(300,150,200,180,5,RA8875_BLACK);
  tft.fillRoundRect(525,150,200,180,5,RA8875_BLACK);
    //red boxes
  tft.fillRoundRect(80,155,190,170,5,RA8875_RED);
  tft.fillRoundRect(305,155,190,170,5,RA8875_RED);
  tft.fillRoundRect(530,155,190,170,5,RA8875_RED);
    //text
  tft.textMode();
      
  tft.textSetCursor(100,235);
  tft.textEnlarge(0);

  tft.textTransparent(RA8875_WHITE);
  tft.textWrite(sicherheitsstufeEins);
  
  tft.textSetCursor(325,235);

  tft.textTransparent(RA8875_WHITE);
  tft.textWrite(sicherheitsstufeZwei);
  
  tft.textSetCursor(550,235);

  tft.textTransparent(RA8875_WHITE);
  tft.textWrite(sicherheitsstufeDrei);
  lastScreen = 0; 
  switcher = 4;
}

//Code musste hier gekürzt werden, da Post sonst zu lang wurde!!!

void loop() 
{
  switch (switcher) {
  case 0:
    startseite();
    break;
  case 1:
    sStufeEins();
    break;
  case 2:
    sStufeZwei();
    break;
  case 3:
    sStufeDrei();
    break;
  case 4:
    touchWarten();
    break;
  case 5:
    sStufeEinsSeiteZwei();
    break;
  case 6:
    keyAbfrageStufeEins();
    break;
  case 7:
    sStufeZweiEingeloggt();
    break;
  }
}