Has anyone tried running the GSL16880 capacitive touchscreen controller with Teensy3?

Status
Not open for further replies.

Tomek

Well-known member
Has anyone tried running the GSL1680 capacitive touchscreen controller with Teensy3?

Ello!

I originally thought I was purchasing a 5" touchscreen module run with the FT5x06 controller chip. That was great, because there was some easily adaptable code over here: https://github.com/hellange/arduino/tree/master/lcd_capacitive_multitouch

I ended up receiving, and I should have noticed it was in the purchase order, a 5" module with the GSL1680 module.

I have found a driver designed for the PCduino, a linux board, that can run the GSL1680 https://github.com/pcduino/modules
However that is substantially enough of a different platform that I'm not sure I'll be able to successfully adapt the code. It is probably beyond me to make a driver from scratch.

So I thought- and this is a stretch- I'd ask if anyone has managed to make the GSL1680 chip running on a teensy 3.1, and whether any of their work was available.

They are both i2c touchscreen modules. The code for the GSL1680 is mostly written in C it seems, but with a number of functions I don't know. I'm not really a programmer (hobbyist) so is a bit full of mystique. I am working on going through the datasheet, though, and seeing what I can understand. https://dl.linux-sunxi.org/touchscreen/GSL1680.pdf
 
Last edited:
Have you tried simply running that library. It uses only the Wire library, so it certainly appears as if it should work.

The only issue I see is this code:

Code:
    // Interrupt
    pinMode(_ctpInt ,INPUT);
    attachInterrupt(0,touch_interrupt,FALLING);

This is almost certainly a bug in the library. It will always use interrupt #0, regardless of which pin you specify. It only works on Arduino Uno because the example uses pin #2, which is interrupt 0 on Uno. If you change to a different pin, even on Arduino Uno, this library will certainly fail.

The simple answer is to use pin 0 on Teensy 3.1 for the GSL1680 interrupt signal.
 
Paul

The simple answer is to use pin 0 on Teensy 3.1 for the GSL1680 interrupt signal.

Hi Paul! I really appreciate your time (it is amazing that you can do this, and I have had the greatest time working with the teensy.)

I am really sorry if I was not clear in the message, especially to waste your (and anyone else's time.) I believe the library you looked, was the FT5x06 library / FT5206, which I actually posted about a few weeks ago and you showed me how to properly fix the attach interrupt code to be agnostic. It only would work on the UNO because it was hardcoded to pin2. The FT5x06 is a nice cap touchscreen and I believe suitable for anyone buying the 7" screens from "east rising" / "buy-display.com" However they actually ship [and say so on the page] a different controller for their 5" screens. The other controller is the GSL1680.

The GSL1680 does not have an arduino family driver anywhere. Just a linux "pcDuino" driver I found.

The code for the GSL1680 is just some linux driver, written mostly in C but with a bunch of linux wire libraries I think. However after spending 2 hours reading all the docs I could about the GSL1680, and trying to read the linux driver code, I think adapting the code to the teensy is not going to work. There are many more sections of the GSL1680 that I have no idea how they work. I was hoping I might be able to simply change the basic parts, like the particular i2c commands to be like the wire library. But even those I cannot reason out all parts of the code (there are no comments. I am sure it is sensible to a real programmer- it looks like nice code- but it is not for a newb.)

Please correct me if I am wrong. but I think you were looking at the Ft5x06 code, not the GSL1680 code. I linked to two different code sources.

Here's another link to the GSL1680. I linked further up the hierarchy, but here is a little more direct to show it's not designed for arduino family: https://github.com/pcduino/modules/blob/master/touch/gslX680.c
 
Last edited:
What screen and touch option did you go with? I mean what controller chips and supplier?

Thanks
Ex

Ra8875, spi mode, buy-display.com (5" 480x800.). Great screen.

I also suggest the adafruit ra8875 options. Pricier but great supplier and much faster. I heavily used their code for running my screen. Which is meh BC I didn't buy their screen, but in the end it didn't really fit for my needs for this specific project. But in the end I am happy with anything I get from adafruit. Hope that was clear enough, replying from phone and gtg.
 
Has anyone ever followed up on this? I am just beginning to take a look at it, but if it's been done I'd love to get ahold of some working code. Otherwise I'll see if I can work through it and post here.

Oh, and if someone who is a better coder than I (ahem, PaulStoffregen) wants to take it on I would be happy to 'll send you a screen :)

Thanks,

DougM
 
Sorry, I simply can't dedicate time to writing a brand new library for this chip. I already have far too much stuff on my TO-DO list.
 
Has anyone ever followed up on this?

Sorry Doug, I just had too much on and I am currently using the 7" screen with the RA8875. It was bigger than I wanted but I just have not got the time to develop a library for the 5" at present, still very interested though. The 7" is a great screen though and I am very happy with it (them)

Ex
 
Experimentalist, you have code for the 7" using the 1680 touch controller? If so can you send it to me or post it? Should be easy to port to the 5" screen. Right now I'm writing it from scratch, but porting existing code would be a lot faster.

Thanks,

DougM
 
Doug, sorry, no, the chip on the 7" for the touch controller is FT5206. I just didn't have time to take on what you have and my C/C++ programming skills are not great :0)
Ex
 
@Ex, assuming I am successful yes, I will.

So are any of you guys SPI experts?

The Linux Driver documentation (http://linux-sunxi.org/GSL1680) says this:

- - - - - - - - -
The CPU can read or write in several eight-bit registers, allocated inside the GSL1680.
Each time an I2C transmission starts, the first byte contains a register number, and
the other bytes contain data to be stored in that register and the next ones. This is,
if we send:

START(W) 0x10 0x00 0x01 0xF5 0x41 0xFF STOP

the chip will store a 0x00 value in register 0x10; a 0x01 value in register 0x11; a 0xF5
value in register 0x12, and so on.
- - - - - - - - -

I found the firmware and it's in this format:

{0xf0,0x3},
{0x00,0xa5a5ffc0},
{0x04,0x00000000},
{0x08,0xe810c4e1},
{0x0c,0xd3dd7f4d},

the first line (0xF0) is setting the page and the next lines are sending 4 bytes of data
(0xa5a5ffc0) starting at the address specified (0x00).

But my question is how does it know that, for instance, 0x04 is a memory location and
not just data byte 5? Is there a formal "SPI transmission stopped" signal or is there
a timeout that I should honor?

Thanks,

DougM
 
It is actually I2C not SPI, and I think it is using fixed byte transfers.

I am about to start working on an arduino driver for this chip as I have the 5" 800x480 buydisplay.com with the capacitive touch screen.

However it will not be teensy specific as I could not get my teensy 3 to work with the display. I tried the two RA
8875 libraries which work fine with my UNO and level shifters, but the teensy3 seems to not work, probably a timing issue.

But anything I do for arduino should work with teensy3.

The biggest issue is that firmware file. It seems it needs to be generated for different displays and there is not one for a 5" display and the actual data for the chip appears to be proprietary and not documented.

I will base my implementation off this... https://github.com/rastersoft/gsl1680 which is for linux but should be convertible to arduino.
if the firmware file is not an issue it should work. If it is an issue then I need to contact buydisplay.com/eastrising and get them to either publish the documentation for the chip or provide the firmware for the 5" display.

Right now I am waiting on some breakout boards so I can connect the tiny FFC connector to a breadboard. Should get that next week.

@Ex, assuming I am successful yes, I will.

So are any of you guys SPI experts?

The Linux Driver documentation (http://linux-sunxi.org/GSL1680) says this:

...

Thanks,

DougM
 
Wolfmanjm,

There is a set of firmware specific to the 5" display, there's one for 480x272 and 800x480 and they are different. They are at the bottom of the web page for the specific display you bought and are in a zip file.

My 480x272 is here:

http://www.buydisplay.com/download/...ch_Panel_Font_Chip_Flash_MicroSD_DemoCode.rar in gslX680.h

I was able to get the display to work with the Teensy on a breadboard but it was super-finicky. Once I switched to FFC it came up fine. Let me know if you need the pinouts/code I used to get it running (with the Adafruit library - I've not been able to get it to work with the 8875 lib.)

If you want to send me any preliminary/proposed code for loading the file into the device I'm happy to try it out for you.

Thanks,

DougM
 
hi dougm, Yea I found the gslX680.h file, that is what I was going to use. I didn't notice the firmware was different for the two displays though, I'll make sure I include both.

I tried everything with both the adafruit library and the RA8875, the closest I got was by adding the reset line and disabling the test code in the adafruit library, then at least the backlight came on. With my Uno they both just worked with and without the reset line. It is ok as I got a bunch of level converters on order and I can use the Uno. I'll save my teensy3 for something else:)
 
@dougm
I have done an initial test sketch for it, I have not tested this yet but this repo will eventually have the library.

https://github.com/wolfmanjm/GSL1680

There was an issue with the firmware file, it is so big 27kB that it did not fit in an Uno flash as is, so I wrote a little tool that compresses the firmware structure so it just fits. Should not be an issue for teensy3 though. I may compress it further with some kind of run length encoding.

It compiles for Uno and teensy3, and right now I have hard coded the firmware for the 800x640 panel. I'll fix that once I test this and fix any bugs, and convert it to a library.
Unfortunately I lost the tiny FPC socket they sent, so that held me up a bit.
 
@Wolfmanjm - you are incredible!

I won't have a chance to look at it until next week, but I have no doubt it's way ahead of what I had.

Thank you!

DougM
 
This is very frustrating, I am doing everything that the sample code does, the I2C seems to be working and it is setting the registers and uploading the firmware, but it never registers any touches, and any reads are always 0. I'm wondering of the firmware is correct? I may try a random other one to see if I get any response from it at all.
 
This is very frustrating, I am doing everything that the sample code does, the I2C seems to be working and it is setting the registers and uploading the firmware, but it never registers any touches, and any reads are always 0. I'm wondering of the firmware is correct? I may try a random other one to see if I get any response from it at all.

Please forgive me for asking this again, if it's already mentioned above, but exactly which hardware and software are you using?

Just a couple days ago, this problem seemed to be fully resolved on another thread, with the Adafruit display, where the problem turned out to be the SDA & SCL signals were on the far 2 pins, rather than A4 & A5 like pre-R3 Arduino Uno.

Are you using the Adafruit library? Do you have that Adafruit product (#1947), or something else?

I really would like to get this fully resolved. To do so, extremely specific details about *exactly* what hardware and software you're using are needed. One or more clear photos showing the actual wiring would also really improve the odds of finding a solution.
 
If I'm not mistaken he's running the exact same configuration I am (except for screen resolution) which is as follows:

The display is a BuyDisplay.com 8875 based 5" panel:

http://www.buydisplay.com/default/5-tft-ssd1963-lcd-module-touch-screen-display-480x272-mcu-arduino
http://www.buydisplay.com/default/5-inch-tft-lcd-module-800x480-display-w-controller-i2c-serial-spi

Then the capacitive touch screen option is added. Standalone capacitive touch panels (800x480 and 480x272) are here:
http://www.buydisplay.com/default/5-inch-multi-touch-screen-panel-with-controller-gsl1680
http://www.buydisplay.com/default/5-inch-capacitive-touch-panel-with-controller-gsl1680

My reverse engineering showed that the GLS1680 pins are as follows:

1 scl
2 sda
3 v3.3
4 shdn
5 irq
6 gnd

on the teensy I've mapped these:
1 --> 13
2 --> 12
4 --> 19
5 --> 17

Work got in the way so I haven't had a chance to try Wolfmanjm's code but I might be able to give it a run tomorrow.

a couple of resources for sample code are:
http://linux-sunxi.org/GSL1680
https://code.google.com/p/yuandao-n...browse/drivers/input/touchscreen/gslx680_ts.c
http://www.buydisplay.com/download/...ch_Panel_Font_Chip_Flash_MicroSD_DemoCode.rar

thank you,

DougM
 
Oh, I'm confusing this with the similar thread using the Adafruit library for a capacitive touch screen.

Yeah, looks like Wolfmanjm's code is the best hope.

Things are definitely more expensive but much easier with Adafruit !!
 
Status
Not open for further replies.
Back
Top