Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By TechShopJim
#65102 I'm having real trouble getting the 2.4" TFT with SPI touchscreen to work with any form of the ESP8266-12E or F. I can get the TFT display working just fine, but even with the display pins disconnected, I get no touch response at all.

There are a lot of posts on the web about people having trouble getting touch to work with the ESP8266, and some posts where people get it working, but provide somewhat cryptic or less-than-complete information on how they did it, including the one on this board at viewtopic.php?f=32&t=5560.

However, I have read these posts over and over, tried and retried the instructions many times, tried every library I can get my hands on, and I really believe that I followed the steps exactly, but I'm not getting any touch response at all.

I have tried a half dozen different of these 2.4" SPI TFT touch display units (all the same 2.4" TFT with SPI touch, same board, etc.), and many different ESP8266-12Es. I am using the Adafruit Huzzah Feather and I've tried all three that I have (I removed the stock ESP8266-12E module and soldered a couple of 1x8 female headers where the ESP used to be and I solder 1x8 2mm make pins on all my ESPs so I can plug them into the Huzzah Feather to program them, then pop them into my project board. I've been doing this for a long time and it works really well. I even wrote an instructable on it at http://www.instructables.com/id/Foolproof-ESP8266-12E-Programming-and-Use/).

Anyway, I have tried to really boil this problem down to the bare essence.

I wrote[/url] a really simple sketch, and put together a super basic test PCB that uses the wiring from spapadim's post in the thread above (viewtopic.php?f=32&t=5560&start=4#p29431).

Here's my circuit (schematic and board):

Image

Here's my single-sided PCB (cut on an OtherMill):

PCB bottom view:
Image

PCB top view:
Image

The PCB has traces only on the bottom, and female headers on the top to plug in the Huzzah Feather, the TFT display, and the voltage regulator which is actually a buck converter mounted on a small PCB to have the same pinout as an LM317). Super simple.

Here's my Arduino sketch for the ESP8266-12E:

Code: Select all/*
 * Super-Simple ESP8266-12E/F + 2.4" TFT SPI Touchscreen Test
 * Why Doesn't This Work?
 * A touch is never received it seems.
 *
 * Using an Adafruit Huzzah Feather with ESP8266-12E
 *
 * Wiring is:
 * TFT/TOUCH      ESP-8266-12E
 * ------------   ------------
 * VCC            +3.3v from external regulator
 * GND            GND
 * CS             GPIO4
 * RESET          GPIO5
 * D/C            GPIO2
 * SDI (MOSI)     GPIO13 (Also to T_DIN)
 * SCK            GPIO14 (Also to T_CLK)
 * LED            +3.3v from external regulator
 * SDO (MISO)     GPIO12 (Also to T_DO)
 * T_CLK          GPIO14 (Also to SCK)
 * T_CS           GPIO16
 * T_DIN          GPIO13 (Also to SDI (MOSI))
 * T_DO           GPIO12 (Also to SDO (MISO))
 * T_IRQ          GPIO0
 */
 
#include <XPT2046.h>

XPT2046 touch(/*cs=*/ 16, /*irq=*/ 0);

void setup() {

  pinMode(2, OUTPUT); // Blue LED on the ESP8266 -- Will flash quickly until touch is detected, then go solid ON

  WDTreset();
  delay(1000);
  WDTreset();
  touch.begin(240, 320);

  while (!touch.isTouching()) {
    WDTreset();
    delay(50);
    digitalWrite(2, LOW); // ESP's blue LED ON
    WDTreset();
    delay(50);
    digitalWrite(2, HIGH); // ESP's blue LED OFF
  }

  // We are out of the loop now, so a touch must have been detected!
  digitalWrite(2, LOW); // ESP's blue LED ON
}

void loop() {
  // Do nothing
}

void WDTreset() {
  ESP.wdtEnable(15000); // Cause the WDT to wait 15 seconds before trying to reset.
                        // Works great, is an alternative to trying to disable the ESP's WDT.
}


When I run the sketch, I would expect that no matter where I touch, the LED should immediately stop flashing.
However, I don't get any response to the touch on the screen. It should break out of the while loop and turn the LED on (or even off). But it just keeps flashing indicating that it is still in the WHILE loop.

Can anyone see what I'm doing wrong here, or why it isn't working?

Thank you so much!