MOD-LCD2.8RTP touch not working with github example

Started by mihaiadrian, July 11, 2023, 12:21:03 AM

Previous topic - Next topic

mihaiadrian

I am using MOD-LCD2.8RTP  connected via UEXT to an Olimex ESP32 Poe Board.  I run this example  https://github.com/OLIMEX/MOD-LCD2.8RTP/tree/master/SOFTWARE/Arduino/graphicstest_olimex in Arduino to which I added this line in the graphicstest_olimex.ino at the begining of the file :

    #define ARDUINO_ESP32_POE 1

So , this makes proper defines to be selected from Board_Pinout.h . ( otherwise, nothing is visible on the screen)

I also uncommented this line from Adafruit_STMPE610.cpp :

    Serial.print("0x"); Serial.print(data, HEX); Serial.print(" / ");

The result is that I see the demo on the screen , but the touch is not working at all, even if I touch it or not, on the serial I see:

0xFF / 0xFF / 0xFF / 0xFF /
0xFF / 0xFF / 0xFF / 0xFF /
0xFF / 0xFF / 0xFF / 0xFF /


So, my problem is that touch is not working.

Please help

LubOlimex

Did you read the README at this location:

https://github.com/OLIMEX/MOD-LCD2.8RTP/tree/master/SOFTWARE

Especially this part:

"Folder "graphicstest_olimex_NS2009" contains demo for NS2009 touchscreen.

Folder "graphicstest_olimex" contains demo for STMPE610 touchscreen component.

Basically if touch is not working try the demo in the other folder.

If you use the demo with an ESP32 boards remember to prepare your Arduino IDE environment according to the arduino for ESP32 repository here: https://github.com/espressif/arduino-esp32#installation-instructions

NOTE: You might need to edit the pins in board_pinout.h - for example, if you use ESP32-POE instead of ESP32-EVB, you need to change TFT_CS from 17 to 5 (since ESP32-POE uses pin #5 for chip select)."
Technical support and documentation manager at Olimex

mihaiadrian

#2
Yes, I read the readme. But I cannot tell for sure my env is set correctly.  With the other example, is even worse, nothing is visible on the screen and touch not working

3 points:

1.
Now, what is not clear to me is .... is it expected to add this line    #define ARDUINO_ESP32_POE 1   at the beginning of *.ino file  ?  or it should somehow have this define already  somewhere else defined ? Because if I don;t add this define, nothing is visible on the screen with first example and touch is not working. If I add it, the screen does show but touch is not working.  My current configuration is the following:  ( copy paste from board_pinout.h )

   // This is pinouts for ESP32-PoE(-ISO)
  #define TFT_DC 15
  #define TFT_CS 5
  #define TFT_MOSI 2
  #define TFT_CLK 14
  #define TFT_MISO -1
  #define TFT_RST -1

and #define TS_I2C_ADDRESS 0x4d   ( although this does not matter much - it is anyway hardcodded in other parts of the code )




2. any way to identify if my touch hardware is STMPE610  or   NS2009  ?    so MOD-LCD2.8RTP can be in 2 hw variants ?


3.  touch still not working. Everything else is working ( cable network, display, BME280 sensor readings )

LubOlimex

No, you don't need to add the define IF you have selected ESP32-PoE-ISO from the board selector in Arduino IDE.

> any way to identify if my touch hardware is STMPE610  or   NS2009  ?

Only the empirical test. If it is not working test the other demo. I will also test here and make a video later.
Technical support and documentation manager at Olimex

LubOlimex

Seems to work fine. Got the two boards brand new from the shop. Hardware setup can be seen here:

https://imgur.com/iaWvK4q

Software used: Arduino IDE 1.8.12; Adafruit library 1.2.3 (had to roll back this one since using latest version there was a compilation error); ESP32 for Arudino version 2.0.9.

ESP32-POE-ISO selected in board selector.

Used graphicstest_olimex_NS2009 folder and ino.

Didn't change anything in the code.

The example is kind of buggy I guess the touch is not calibrated but the touchscreen works you can see in video here:

https://www.youtube.com/watch?v=OFlSDKP5Fec

Try at the same terms.

Technical support and documentation manager at Olimex

mihaiadrian

Thank you

I do not have ESP32 POE ISO board in Ardunino.   I have instead ESP32 DEV Module . Is this ok or I should have "ESP32 POE ISO" ?  And I followed the instructions

Clearly, something is different since , I need to add that define manually ( which makes LCD work but not the touch )  while for you it worked out of the box

mihaiadrian

#6
Ok, problem SOLVED so so !

I followed the https://www.olimex.com/Products/Duino/_resources/Arduino_instructions.pdf  again, added all 3-4-5 json's tu arduino, in Board Manager searched for Olimex, installed the package and still not showing the Olimex board ... I had to stop and start ( restart ) the Arduino and voilla, the Olimex ESP32-POE-ISO appeared. Now, trying the examples ... first one shows display but no touch, the second ( NS2009) seems to have touch working - I can see in serial some coordinates that matches my touch location .... but there is nothing visible on the screen. Yet, when I upload the first example again, I ca see for 1 second the second one on the screen. Seems to be a mixure between two - that;s ok, I can analyse the code and to a merge/integration - I expect to work. Good until now.

Now, what is deceiving is that, for my already made app,  I CANNOT anymore reduce the frecvency to 10Mhz ( it crashes  ).  I had to increase freq to 80Mhz./ 240mhz....  Also the communication seems to be limited to 115200 - I might be wrong but ESP32-Generic could support faster upload but serial output was not working after - which is needed during dev for debug ofcourse.


Later edit: I added this code at the end of setup function, seems to do the job in reducing the freq  to 10Mhz ( from 240 ) and working( cable network, BME280 sensor , display are working. Touch code not integrated yet in my code )  . Seems to work if instead of reducing freq immediate after boot, I wait 3 seconds. Although I have threads in my app, I don;t is related to any race condition in my code but rather either I am wrongly initializing something OR some peripheral in the board  during startup makes a races condition with network and BME280 initialization - and if is unable to finish before network initialization/sensors , it causes all board to crash.   But ok, seems to be able to workaround it, just that is increasing startup time. For me is ok. For other might not be ...

  delay(3000);
  setCpuFrequencyMhz(10);
  Serial.begin(115200);

If you wonder I am so cocerned about power consumption - is because I plan to have several  devices like this, and each saved W means some savings for a 24/24 operation


But to summarise: touch is working for me. Thank you