ra8875/GSL1680 .teensy 4.0 ..touch panel functional but an issue

Keith_M

Well-known member
Okay I have the GSL1680 up and running from the github example ..there were array bounds issues which I corrected in clear_Reg(0 and reset() ..and the code compiles fine

The touch function works but y axis is not functioning correctly .. my display is 800 x 480 and the x axis is fine but the y axis position and screen function is way out ...and only 1/4 of the screen is touch functional so only about 1/4 of the screen is working with touch ..

has anybody else experienced this behaviour ..?

getting frustrated could use a few pointers other then "buy another screen" but darn I think I may have to do that ..

I've tried at least 3 library variants .. all have the same bounds array issue ...

open to thoughts ...

Thanks
 
Last edited:
I'm using the ra8875 5" display from buydisplay ..with i2c ..on a teensy 4.0.. I have tried the libraries from Wolfman, the Scallwar release and the ESTBLC release ...all of them have the same boundry array limitation issue in the cpp file the clear_reg() and reset() ...I pulled all of these off guthub ..and used them one at a time to avoid conflicts ..the touch is working , the display is 800 x 480 ..but it identifies the "y" position 2/3rds of the way down the screen ..the touch works from that position to the bottom of the screen ..Touch does not function in the top 2/3 of tge screen ..Im running the stock GSL1680 sketch ..

Has me really puzzled ..I received a second display identical to the first one and its shows the same behaviour ..I could see anything in the sketch that would cause this behaviour ..and the corrections I made in the cpp file should not effect it I would think ...Open to suggestions .Thanks for getting back to me KurtE appreciate your time ...
 
I probably have one of these although it came with a small ribbon cable and small adapter part which I never tried and probably lost... I have a 5" with their resistive.
I also have a couple of their 4.3" capacitive touch display, but it uses a different touch controller chip and support for that other chip is built into our RA8875 library which is an update of the Sumotoy version.

Not sure what to suggest. I installed the Arduino library for you controller, But it looks like a bunch of gunk where it maybe reprograms the whole controller? Not sure why or what are the configuration information associated with it.

Is it only seeing the touch, that it translates into only 1/4 of the display or does the touching in the other areas still generate the touch response, but is mapped wrong?

Again probably can not help much here, but maybe one of the other owners of these displays has more experience with this controller.

Good Luck
 
Well ..what has happened is there are 2 versions of the touch controller gsl1680E and fsl 1680F ..."E" has been discontinued .."F" is the current which means that there is new firmware ..which is available in an .h file ..anyhow trying to sort it out..
 
@Keith I too have been having problems with this display, ER-TFTM050A2-3 from BuyDisplay.com.

I find that in the Wolfman (based on Skallwar) release that the Reset and clear reg routines are written incorrectly giving error 3 or 4 in the I2C stuff. Change them to this:

Code:
    for (i = 0; i < 2; ++i) {
        Wire.write(REG[i]);
        Wire.write(DATA[i]);
        r = Wire.endTransmission();             // move to inside the loop before the delay(x)
        delay(TIMER[i]);
    }

There is some other stuff in there that needs attention too.

Now I still have yet to get this to work as intended, but, I have been able to take the arduino download package from the BuyDisplay website and change things in the DUE code to use the SumoToy release of the RA8875 driver that comes with TeensyDuino. So at least I can see I have not fried my display. NOTE the different settings for SPI & I2C stuff.

View attachment ER-TFTM050A2-3-Teensy.ino
 
Thanks for posting that up ...I got as far as getting the display up and running fine with the exception I could only get 1/3 of the touchscreen to work ..Initially thought the display was faulty but had a secind brand new display , same model and type and it exhibited the same issues ..The best zi can figure is the firmware that initially gets loaded is different from the model revision from the rev "E" to the rev "F"..have you managed to push up the firmware load from buydisplay up to the card ?
 
ive not had much time to , get back to it yet ...I was hoping the there would be a patch available or a library update on github ..regrettably , Ive not had "time" to really work through it ...
 
Thanks for posting that up ...I got as far as getting the display up and running fine with the exception I could only get 1/3 of the touchscreen to work ..Initially thought the display was faulty but had a secind brand new display , same model and type and it exhibited the same issues ..The best zi can figure is the firmware that initially gets loaded is different from the model revision from the rev "E" to the rev "F"..have you managed to push up the firmware load from buydisplay up to the card ?

As stated in #6 above I have modified the BuyDisplay code example given fro the Arduino DUE. My mod uses the SumoToy RA8875 driver contained in Teensyduino along with different pin assignments. I attached it to post #6. Change the pin defines at the top to reflect the pins that you use for SPI and I2C (to connect the display) and in >void setup< for the I2C and SPI startup definitions. This worked for me and I now get at least 5 finger touch points across the whole screen. I'm doing this on a Teensy 3.5

This is not currently a driver as we know it, but it does give me a starting point to figure out how to fix up the wolfmanjm or skallwar driver packages. I've had my display about 1-year and it does work with this demo code I posted here.
 
As stated in #6 above I have modified the BuyDisplay code example given fro the Arduino DUE. My mod uses the SumoToy RA8875 driver contained in Teensyduino along with different pin assignments. I attached it to post #6. Change the pin defines at the top to reflect the pins that you use for SPI and I2C (to connect the display) and in >void setup< for the I2C and SPI startup definitions. This worked for me and I now get at least 5 finger touch points across the whole screen. I'm doing this on a Teensy 3.5

This is not currently a driver as we know it, but it does give me a starting point to figure out how to fix up the wolfmanjm or skallwar driver packages. I've had my display about 1-year and it does work with this demo code I posted here.


I'll run up your sketch this weekend and see how it goes..will post back ..

Thank-you for all the hard work and sleuthing to get it going ...!!

cheers
 
A big thank-you to Greased Lightning ..Ive been struggling with the gsl1680 touch code , and he managed to get me up and running...Ive been on another project and only found today to give it a good go ! Again thankyou very much !
I do find it bizarre that you need to load all those lines of code to support the firmware to use the touch ..but its running.? So my 2 5" screens will no longer be collecting dust ..
 
The RA8875 5" with GSL1680 controller is quite simple, build many projects with this RA8875 display.
Best regards,
Johan


Code:
#include <SPI.h>
#include <RA8875.h>
#include <GSL1680.h>
#define TC_INT   8

// install : ILI9341_fonts-master

#include "font_LiberationMono.h"
#include "font_DroidSansMono.h"
#include "font_AwesomeF000.h"
#include "font_AwesomeF200.h"
#include "font_AwesomeF180.h"
#include "font_AwesomeF100.h"
#include "font_AwesomeF080.h"
uint16_t buttons_time =100;
#define WAKE 255
GSL1680 TS = GSL1680();
uint16_t TouchY;
uint16_t TouchX;
bool     TouchZ = false;


#define RA8875_RESET 255    //Not used
#define RA8875_CS 10
RA8875 tft = RA8875(RA8875_CS, RA8875_RESET, 11, 13, 12);   // 11=MOSI   13=SCLK   12=MISO  10=CS

void setup() {
  tft.begin(RA8875_800x480);
  tft.setRotation(0);   
  tft.setCursor(200,350);
  tft.setFont(DroidSansMono_16);
  tft.print("Touch test wait for I2C bus");
  delay(3500); // time for I2C bus
  TS.begin(-1, TC_INT);
  tft.clearScreen();
 }

void loop() {
    
    tft.setCursor(200,250);
    tft.print(TouchX);
    tft.setCursor(200,350);
    tft.print(TouchY);
 
 if (digitalRead(TC_INT) == HIGH) {
    int NBFinger = TS.dataread();

    for (int i = 0; i < NBFinger; i++) {
      TouchX  = (TS.readFingerX(i));
      TouchY  = (TS.readFingerY(i));
      
    }
  }
  TouchZ = TS.dataread();

 
}
 
The RA8875 5" with GSL1680 controller is quite simple, build many projects with this RA8875 display.
Best regards,
Johan


Code:
#include <SPI.h>
#include <RA8875.h>
#include <GSL1680.h>
#define TC_INT   8

// install : ILI9341_fonts-master

#include "font_LiberationMono.h"
#include "font_DroidSansMono.h"
#include "font_AwesomeF000.h"
#include "font_AwesomeF200.h"
#include "font_AwesomeF180.h"
#include "font_AwesomeF100.h"
#include "font_AwesomeF080.h"
uint16_t buttons_time =100;
#define WAKE 255
GSL1680 TS = GSL1680();
uint16_t TouchY;
uint16_t TouchX;
bool     TouchZ = false;


#define RA8875_RESET 255    //Not used
#define RA8875_CS 10
RA8875 tft = RA8875(RA8875_CS, RA8875_RESET, 11, 13, 12);   // 11=MOSI   13=SCLK   12=MISO  10=CS

void setup() {
  tft.begin(RA8875_800x480);
  tft.setRotation(0);   
  tft.setCursor(200,350);
  tft.setFont(DroidSansMono_16);
  tft.print("Touch test wait for I2C bus");
  delay(3500); // time for I2C bus
  TS.begin(-1, TC_INT);
  tft.clearScreen();
 }

void loop() {
    
    tft.setCursor(200,250);
    tft.print(TouchX);
    tft.setCursor(200,350);
    tft.print(TouchY);
 
 if (digitalRead(TC_INT) == HIGH) {
    int NBFinger = TS.dataread();

    for (int i = 0; i < NBFinger; i++) {
      TouchX  = (TS.readFingerX(i));
      TouchY  = (TS.readFingerY(i));
      
    }
  }
  TouchZ = TS.dataread();

 
}


I did manage to get the touch panel to work .. but the problem being only 800 X 200 pixels of the panel were supporting touch .. half of the screen would not respond . I could get the panel to work ..and the touch working but I could not get the touch to work over the full 800 X 480 pixel display .. Only half of it
 
Hi Keith, do you have a 800x480 display? please look at the backside if it shows E257834 than you are good!

Best,
Johan
 
I'm going to take another shot at the gsl1680 ... and try the code you have posted ... I was able to get touch to work but only half the screen was responding.. Thankyou for posting up ..

Where did you get the font libraries in your code?
 
@Keith_M Would you please clarify the <half of screen. . . . > Is that like top/bottom half or every other one, (even/odd lines only)? I'm doing a Teensy 3.5 project and will look at that.
 
Keith, please confirm if you have a E257834 display, because there are also 480x272 displays from Buydisplay.
The font library is ILI9341_fonts-master and have the font Awesome.
Best,
Johan
 
Two screens, a 5" with GSL1680 controller and a 7" with FT5206 controller both displays are awesome.

Johan it's achoice .jpg
 
Things I notice using the GSL1680 touch screen.

The GSL1680 touch chip is only a touch sensor. It does not encode pressure information .

When detecting more than 1 finger information, position matters. Say I'm touching the screen with two fingers. Place one in the middle, don't move it, and the other is sweeping along the wide axis of the display. The X and Y values will swap depending on where the second finger is in relation to the first one. Could this explain what @Keith_M is observing?

The GSL chip is not programmed to detect gestures.

I'm not looking for these fancy functions in my application, so this display suits my needs.
 
> the Scallwar release and the ESTBLC release
@Keith_M Skallwar = ESTBLC (https://github.com/Skallwar/GSL1680)

> I find that in the Wolfman (based on Skallwar) release that the Reset and clear reg routines are written incorrectly giving error 3 or 4 in the I2C stuff. Change them to this:
@grease_lighting Are you referring to this line? If yes there should be a problem because on the second iteration of the loop, the transition will have already been terminated.
> Wolfman (based on Skallwar)
It is the other way around

The library used to work for my final year project but there was some I2C API change if I remember correctly

I remember that getting the GSL1680 chip to work was a nightmare so please, if the library is not working, open an issue and you have a fix for it, open a pull request. I will happily create a new release with the fix. If one of you guys want to become a maintainer, please PM me
 
I just re-downloaded the GSL1680 library from the arduino site, and ran the example.

Using a T4 and the 5 inch buy display screen.

The issue with mine, only the bottom of the touch screen will register and report touch x and y.

The x scales fine from 0-799, but the y only has a range of 1 to bout 60, so the top 4/5ths of the touch screen is non responsive.

That said, I did get this CT screen working with the example sketch from BuyDisplay, that is 4000 lines or more of code and not very user friendly for my marginal (at best) coding skills.
Point is the hardware is fine, just need to figure out why the library either doesn't like the T4 or just doesnt like me...

I also tried modifying the library as recomended :

for (i = 0; i < 2; ++i) {
Wire.write(REG);
Wire.write(DATA);
r = Wire.endTransmission(); // move to inside the loop before the delay(x)
delay(TIMER);
}

Just putting the " r = Wire.endTransmission(); " in the for loop threw an error because r wasn't defined
i defined r " int r;" before the for loop and that cleared the code, however none of that changed the behavior of the touch panel.

Going to try the Skallwar library next and see if that plays nice, though i think ive already tried that....

any thoughts?
 
Just tried the Skallwar version and got the exact same results...

When i get home tonight ill try it on my T3.6 and see if there is any difference.
 
I looked more into the code example that does work; I cut selective snippets from the Arduino Due example sketch provided by BuyDisplay.

https://www.buydisplay.com/arduino/Libraries-Examples_ER-TFTM050A2-3.zip

The examples and libraries work fine right out of the box with an arduino DUE,
however, i did run into one issue with this "library" when running it on the Teensy, the position reported for the "y1" variable.
was 0-479 + ~4100.
figuring it was getting an extra bit somehow, at first I simply subtracted 4095 from the y1 data. This worked fine, but since then
I added this code to correct for it :

Code:
ts_event.y1 = (uint16_t)(touch_data[7])<<8 | (uint16_t)touch_data[6];
  ts_event.y1 = ts_event.y1 << 4;                                                                            //  add these two bit shifts to get the right 0-479 range on 
  ts_event.y1 = ts_event.y1 >> 4;                                                                            //  Y1 for Teensy, Have not tested for y2-y5 
  ts_event.x1 = (uint16_t)(touch_data[5])<<8 | (uint16_t)touch_data[4];

This seems to work great and is a more elegant solution i think.

Please don't flame me for not posting the entire sketch, take a look at the example code and you will understand why i didn't. There is no library as such, BuyDisplay
put all the set up and operational code for the GSL1680 in the sketch before the setup() and main() , and its over 4500 lines of code.

This is why i was avoiding using it, that's just annoying.

I will add those two lines to the origional BD examples and see if those work now.

One other note, using the BD code, i have to swap the interrupt and wake pins around from where i had them with the arduino GSL1680 code....
not sure if that is another error in their code or just a brain freeze on my part.

Edit* I just loaded and ran the DUE example on my T4 and it runs perfectly, So i must have broken something when I tried to pair down the code and to the
<RA8875.h> library instead of the adafruitRA8875 library that the BD example uses.....
 
Last edited:
Back
Top