ESP32 Display 4.3" V2.1 Touch Stops Working Randomly

I'm trying out the drawing board example in the series and the touch function stopped working after the second upload. I tried changing the radius of the circle and it worked fine for the first two uploads. The third time the touch stopped working and the getTouch function constantly returns:

X:44,Y:43
X:44,Y:43
X:44,Y:43

Reconnecting the USB and/or re-uploading the sketch might get it to work after multiple attempts. It is so hit or miss that I'm rethinking whether I should be using it in production. This happened on the first unit that I'm testing.

I have copied the snippet from the Wiki into gfx_conf.h and the main code is as follows:

#include <LovyanGFX.hpp>
#include <lgfx/v1/platforms/esp32s3/Panel_RGB.hpp>
#include <lgfx/v1/platforms/esp32s3/Bus_RGB.hpp>

#include "gfx_conf.h"

LGFX tft;

void setup() {
  Serial.begin(9600);
  tft.begin();
}

void loop() {
  uint x, y;
  if (tft.getTouch(&x, &y))
    tft.fillCircle(x, y, 2, TFT_WHITE);
  Serial.printf("X:%d,Y:%d\n", x, y);
}

Comments

  • UPDATE: I am able to reproduce the issue consitently:
    1. Unplug and plug in the display until touch stops working
    2. Unplug → Plug in immediately → Touch does not work
    3. Unplug → Wait around 5s → Plug in → Touch works

  • Hello @npc6789998212
    May I ask if you are using our sample code?
    Can you share what code you are using?

    Based on the steps you've outlined, it seems like the touch functionality is intermittently failing after certain conditions. Here are a few suggestions to help you troubleshoot the issue:

    Consistency Check: Ensure that the connections are consistent. Sometimes, a loose or intermittent connection can cause such issues. Make sure the USB and power connections are stable.

    Reset the Board: Perform a hard reset on the board to clear any temporary glitches that might be causing the issue.

    Inspect the USB cable: Inspect the usb cable for any signs of damage or loose connections.

    Test with Another Unit: If you have access to another unit, test to see if the issue is isolated to the current unit.

    Monitor Logs: Keep a log of the behavior, noting the steps before the failure occurs. This can help identify patterns leading to the issue.

Sign In or Register to comment.