GSL1680

Hello Friends,
I am trying to use 5 inch display from 'BuyDisplay' with 'Capacitive Touch Panel' and am trying to use the GitHub - Skallwar/GSL1680: Arduino driver for GSL1680 - For anthology, this is my first real piece of code library from Woulfmanjm.

But the program does not compile, it gives lots of errors. When contacted to the author, he checked up and confirmed that this is Arduino Library problem not his repository problem.

Can anyone help me please ? Thank you...

The error message I get is :
Arduino: 1.8.5 (Windows 8.1), Board: "Arduino/Genuino Uno"

C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp: In member function 'void GSL1680::begin(uint8_t, uint8_t)':

C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:31:5: error: 'Serial' was not declared in this scope

Serial.println("Starting TS boot up");

^

C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:32:19: error: 'OUTPUT' was not declared in this scope

pinMode(WAKE, OUTPUT); //

^

C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:32:25: error: 'pinMode' was not declared in this scope

pinMode(WAKE, OUTPUT); //

^

C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:33:24: error: 'LOW' was not declared in this scope

digitalWrite(WAKE, LOW); //

^

C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:33:27: error: 'digitalWrite' was not declared in this scope

digitalWrite(WAKE, LOW); //

^

C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:34:21: error: 'INPUT_PULLUP' was not declared in this scope

pinMode(INTRPT, INPUT_PULLUP); // Startup sequence PIN part

^

C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:35:14: error: 'delay' was not declared in this scope

delay(100);

^

C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:37:21: error: 'HIGH' was not declared in this scope

digitalWrite(WAKE, HIGH);

^

C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp: In member function 'void GSL1680::clear_reg()':

C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:67:14: error: 'class TwoWire' has no member named 'send'

Wire.send(REG*);*

  • ^*
    C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:68:14: error: 'class TwoWire' has no member named 'send'
    _ Wire.send(DATA*);_
    _
    ^_
    C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:69:23: error: 'delay' was not declared in this scope
    _ delay(TIMER);
    ^
    C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:72:13: error: 'Serial' was not declared in this scope
    Serial.print("i2c write error: "); Serial.print(r); Serial.print(" "); Serial.println(REG, HEX);
    ^
    C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp: In member function 'void GSL1680::reset()':
    C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:84:14: error: 'class TwoWire' has no member named 'send'
    Wire.send(REG);
    ^
    C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:85:14: error: 'class TwoWire' has no member named 'send'
    Wire.send(DATA);
    ^
    C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:86:23: error: 'delay' was not declared in this scope
    delay(TIMER);
    ^
    C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:89:13: error: 'Serial' was not declared in this scope
    Serial.print("i2c write error: "); Serial.print(r); Serial.print(" "); Serial.println(REG, HEX);
    ^
    C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:98:13: error: 'delay' was not declared in this scope
    delay(10);
    ^
    C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp: In member function 'void GSL1680::loadfw()':
    C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:105:5: error: 'uint' was not declared in this scope_

    uint source_line = 0;
    _ ^_
    C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:106:10: error: expected ';' before 'source_len'
    uint source_len = sizeof(GSLX680_FW) / sizeof(struct fw_data);
    _ ^_
    C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:109:10: error: 'source_line' was not declared in this scope
    for (source_line = 0; source_line < source_len; source_line++) {
    _ ^_
    C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:109:41: error: 'source_len' was not declared in this scope
    for (source_line = 0; source_line < source_len; source_line++) {
    _ ^
    C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp: In member function 'void GSL1680::startchip()':
    C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:126:9: error: 'Serial' was not declared in this scope
    Serial.print("i2c write error: "); Serial.print(r); Serial.print(" "); Serial.println(0xE0, HEX);
    ^_

    C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp: In member function 'void GSL1680::datasend(uint8_t, uint8_t, uint16_t)':

    C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:144:9: error: 'Serial' was not declared in this scope
    * Serial.print("i2c write error: "); Serial.print(r); Serial.print(" "); Serial.println(REG, HEX);*
    * ^*
    C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp: In member function 'uint8_t GSL1680::dataread()':
    C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:156:9: error: 'Serial' was not declared in this scope
    * Serial.print("i2c write error: "); Serial.print(n); Serial.print(" "); Serial.println(DATA_REG, HEX);
    _ ^
    C:\Program Files (x86)\arduino-1.8.5\libraries\GSL1680-master\GSL1680.cpp:161:9: error: 'Serial' was not declared in this scope
    Serial.print("i2c read error: did not get expected count "); Serial.print(n); Serial.print("/"); Serial.println("24");
    ^*

    exit status 1
    Error compiling for board Arduino/Genuino Uno._

ark1944:
When contacted to the author, he checked up and confirmed that this is Arduino Library problem not his repository problem.

He lied. It is absolutely an obvious bug in the GSL1680 library, which would have been clear if the author had done the most minimal testing. It's really just a horrible piece of code in multiple ways.

The first bug is that they called Arduino core library functions without adding an #include directive for Arduino.h. The odd thing is that there is an #include directive for that file, but it's commented out.

Next there was the use of the invalid type "uint". Perhaps they weren't sure which type to use and left that code unfinished?

Then they were reading past the end of a couple arrays.

After fixing the bugs, the example sketch does compile but the library is a real memory hog. I added a way to switch off the serial debug output they left in the code but even after that it still exceeds the available SRAM of all AVR-based boards, including the ATmega1284P with 16 kB of SRAM! Perhaps it was intended for a more resource rich non-AVR board.

I've attached my version of the library. Note this is untested because I don't own the hardware.

GSL1680-master.zip (49.4 KB)

Hi Pert, Many Thanks for your reply, and am sorry for little delay in replying from my side, I fully agree that the original GSL1680 Github repository by Woulfmannj has many problems and I am struggling a lot to make it work. Thank you for ur support, let me try your improved version, I will come back to you after testing....Arun

Hi Pert...I checked up the modified version of "GSL1680-master", it does show lot of improvements, most of the errors showed earlier are gone, yet looks some memory issues...first I tried Arduino Uno board, then I tried Arduino Mega board...I am getting these error messages...

Error Message:

Arduino: 1.8.5 (Windows 8.1), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

Build options changed, rebuilding all
Archiving built core (caching) in: C:\Users\Admin\AppData\Local\Temp\arduino_cache_83004\core\core_arduino_avr_mega_cpu_atmega2560_0f9aadba3bcfd33bf3bd94684305daf8.a
Sketch uses 32814 bytes (12%) of program storage space. Maximum is 253952 bytes.

Global variables use 27846 bytes (339%) of dynamic memory, leaving -19654 bytes for local variables. Maximum is 8192 bytes.
Not enough memory; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing your footprint.
Error compiling for board Arduino/Genuino Mega or Mega 2560.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Any suggestions please ?
Can we reduce use of memory to some minimum need, may be sensing only one finger in-place of multi touch..I am just thinking a loud....

Yes, I already warned you about that. I don't know anything about this library or the hardware. The memory use is caused by the GSLX680_FW object created in gslX680firmware.h. I see the original author wrote this:

The firmware file is big so it needed to be compressed to fit in an Uno flash memory.

I see what appears to have been an effort to put the firmware in flash memory via the gslx680_fw object created in gslfw.h but then I don't see that object used anywhere in the library.

Hi Pert, Many thanks agn, yes u had indicated the memory problem, but since I am now stuck, I am looking for any help.....I do not expect any support from original author...if possible please guide me further....I am trying to read and understand GSL1680.pdf datasheet, but it is too much to do from scratch ......

You know as much as I do on this topic. I don't own the hardware and have never used it or the library. Maybe someone else here will be able to help you.

Hi,
What is the display unit?
Link to where you bought it/data/spec sheet would help.

Thanks.. Tom.. :slight_smile:

Hi Tom,
Many Thanks for coming to my rescue, I am trying to use the 5 inch display from "BuyDisplay" that is mounted with 'Capacitive Touch Panel'..the touch panel is controlled by the IC -GSL1680.
The only Library or Github I found on the net for this application is GitHub - wolfmanjm/GSL1680: Arduino library for the GSL1680 touch panel controller or GitHub - Skallwar/GSL1680: Arduino driver for GSL1680 - For anthology, this is my first real piece of code.
But as you save the library and try to run the included example, it just not compiles...gives lots of errors
I am using Arduino IDE 1.8.5 version and Arduino Mega board.
Unfortunately the author of repository does not agree that his program has bugs....I am stuck up....please help....Arun

Hi Tom,
While searching the web, I just got some information that

"GitHub - hellange/GSL1680: Arduino library for the GSL1680 touch panel controller"

is a modified version of original library.
I am in the process of trying that, just in case you have any better idea or any experience on this Library, please do share...Thank you...

Hi Friends,
The library at "GitHub - hellange/GSL1680: Arduino library for the GSL1680 touch panel controller" works well up to a certain limit, that is.. it compiles and was successfully loaded into Arduino Mega....however when I tried to run the GSL1680.ino sketch, I finally got i2c error writing during init_chip function, and i2c error reading, I checked up the connections etc...I do not understand why do we have to write a long data into program chip....can any one explain the need for this data writing into the chip program memory....Thank you...Arun

ark1944:
The library at "GitHub - hellange/GSL1680: Arduino library for the GSL1680 touch panel controller"

To be clear, this is not a library. It's a sketch. The intent was to eventually turn it into a library but it's not clear that will ever happen.

ark1944:
I finally got i2c error writing during init_chip function, and i2c error reading,

Post the errors.

ark1944:
I do not understand why do we have to write a long data into program chip....can any one explain the need for this data writing into the chip program memory....

I don't understand it either. The "long data" is the firmware for the GSL1680. There's some mention of it on the blog post:

The firmware is an integrated part of the sketch. Instead of using ram, it is put in the flash memory using PROGMEM. Some, to me, special memory magic is used to read the firmware from the sketch flash (Thanks to CosR1). There might be other ways, but I haven’t investigated further. From there it is easy to write the firmware to the GSL1680 though the I2C bus.

But it doesn't actually explain the need for the firmware.

Hi Pert,
The errors on Serial Monitor I get while compiling are something like this;

i2c error write: 2 0xC0;
i2c error write: 2 0xF2; etc

And I think this happens when executing load_fw(); block, it displays hundreds of such errors and then executes reset_chip(); then startup_chip(); and finally displays "init done" then follows read errors....I am planning to avoid the shield used in between the Arduino Board and the display, there may be some wiring/connection problems....any suggestions please ?

Hi Pert,
By the way, some information about the firmware for GSL1680 is available at site ;

http://linux-sunxi.org/GSL1680

Though it does not help much...

Sorry upping this, but some explanation are needed here.

I'm the author of the GSL1680 library (ESTBLC/GSL1680).

First of all I don't remember any conversations with ark1944 but maybe I'm wrong and this can be resolved by PM.

For the library itself, it is not actively maintained (I don't have the screen anymore) so I was not aware of some changes in Wire library making the function "send" decrepete and replaced by "write". I would add that at the time of first release the code was working with the latest version of Arduino IDE since I've used the example sketch to test the sensor and all whent fine.

I have released a patch that fixs the Wire issue (and other odd things as I was 16 years old at the time of the first release and not really experienced at this time in programming). It's compiling on my side, but I can't say for sure if the library is working (should be though)

As I'm not currently active in Arduino community, if any problem appears in the future, please feel free to open an issue on github.