RA8875 Up/Down/Left/Right touch gesture not working

KenHahn

Well-known member
I am working on a new product which includes an RA8875 7" LCD with capacitive touch from BuyDisplay (ER0TFTM070-5) on the front side and mounts a Teensy 4.1, adapter boards and various I/O on the back side.

I am using the RA8875 library that comes with Teensyduino. The LCD is on SPI1 and touch is on the default I2C (pins 18/19).

While testing the hardware, I found that the touchscreen works for single touches or multiple finger touches and also works with multiple finger gestures like using two fingers to zoom in/out. Single finger gestures like swipe up/down/left/right however just return 0.

Seems like a possible library issue? Wondering if anyone can confirm or deny? I tried going through the library, but it's above my software pay grade.

The simplist test case is to just run the RA8875/_CapacitiveTouchScreen/FT5206_gesture.ino example. In my case, I am running it on SPI1, so complete code below:
Code:
```cpp
/*
Demonstrate FT5206 gesture ID's
Works in all orientations

one finger swipe -> up, down ,left, right
two finger pinch -> zoom in, zoom out
three finger tap -> change screen rotation
*/

#include <SPI.h>
#include <RA8875.h>

/*
Teensy3.x and Arduino's
You are using 4 wire SPI here, so:
 MOSI:  11//Teensy3.x
 MISO:  12//Teensy3.x
 SCK:   13//Teensy3.x
 the rest of pin below:
*/

const int RA8875_MISO    =  39;     
const int RA8875_MOSI    =  26;     
const int RA8875_SCLK    =  27;     
const int RA8875_CS      =   5; 
const int RA8875_RESET   =   9;                
const int RA8875_INT     =   2;

#define MAXTOUCHLIMIT     3 //1...5

RA8875 tft = RA8875(RA8875_CS, RA8875_RESET, RA8875_MOSI, RA8875_SCLK, RA8875_MISO);


void setup(){
  //  begin display: Choose from: RA8875_480x272, RA8875_800x480, RA8875_800x480ALT, Adafruit_480x272, Adafruit_800x480
  tft.begin(RA8875_800x480);
  tft.setRotation(0);
  #if defined(USE_FT5206_TOUCH)
  tft.useCapINT(RA8875_INT);
  tft.setTouchLimit(MAXTOUCHLIMIT);
  tft.enableCapISR(true);
  tft.setTextColor(RA8875_WHITE,RA8875_BLACK);
  printHeader();
  #else
  tft.print("you should open RA8875UserSettings.h file and uncomment USE_FT5206_TOUCH!");
  #endif
}

void loop(){
  #if defined(USE_FT5206_TOUCH)
  static uint8_t rot = 0;
  static uint8_t prev_touches = 0;
  if (tft.touched()){
    tft.updateTS();
    if(tft.getTouches() == 3 && prev_touches < 3){
      if(++rot > 3) rot = 0;
      tft.setRotation(rot);
      printHeader();
    }else{
      uint8_t gesture = tft.getGesture();
      tft.setFontScale(1);
      switch (gesture) {
        case 0x10: //up
        tft.setCursor(CENTER,CENTER);
        tft.print("UP      ");
        break;
        case 0x14: //left
        tft.setCursor(CENTER,CENTER);
        tft.print("LEFT    ");
        break;
        case 0x18: //down
        tft.setCursor(CENTER,CENTER);
        tft.print("DOWN    ");
        break;
        case 0x1C: //right
        tft.setCursor(CENTER,CENTER);
        tft.print("RIGHT   ");
        break;
        case 0x48: //zoom in
        tft.setCursor(CENTER,CENTER);
        tft.print("ZOOM IN ");
        break;
        case 0x49: //zoom out
        tft.setCursor(CENTER,CENTER);
        tft.print("ZOOM OUT");
        break;
      }
    }
    prev_touches = tft.getTouches();
  }
  #endif
}
void printHeader(){
  tft.fillWindow(RA8875_BLACK);
  tft.setFontScale(0);
  tft.setCursor(0, 0);
  tft.print("Swipe or Pinch.");
  tft.setCursor(0, 25);
  tft.print("Tap 3 fingers to rotate.");
}

```
 
The FT5206 touch chip used on these displays has gone EOL. The new displays are starting to ship with the FT5316 touch chip that is suppose to be fully compatible per my communications with BuyDisplay.

I just tested one with the new FT5316 touch chip and the basic touch portion does appear to work the same using the RA8875 library in Teensyduino, however ALL gestures now return 0 including zoom in / zoom out that had worked before. Going forward, the problem statement now seems to apply to all gestures.
 
Read into that sumotoy and that is what he was finding: Old controller two finger gestures zoom in/out worked - but new controller failed to have those and neither has the expected U/D/L/R slide detect.
 
I came across the title of the post and got curious what a gesture was. I have the 10" with the Goodix GT9271 touch controller. The GT9271 registers only mention gestures twice in a very vague way so I am thinking they have a different strategy to handle swipes. I was thinking of getting the 7" for smaller projects later down the road however I currently do NOT own the 7" display and CPT so I can't test and help too much.
Reading through the FT5x06 and the FT5x16 register manuals the Ft5x16 has more parameters for the gestures than the older chip. I highlighted some on pages 10-16. Highlights on bottom of page 11 references a valid Gesture ID. On pages 14-15 indicates gestures work when in "mode of continuous reporting" but I can find what that actually means. Maybe these will help... attached FTX16 Registers and for reference FT5x06 (you may already have both of these).
 

Attachments

  • FT5x16_registers.pdf
    765.8 KB · Views: 19
  • FT5x06_registers.pdf
    229.9 KB · Views: 12
Back
Top