Bodmer / TFT_eSPI

Arduino and PlatformIO IDE compatible TFT library optimised for the Raspberry Pi Pico (RP2040), STM32, ESP8266 and ESP32 that supports different driver chips
Other
3.79k stars 1.09k forks source link

The T-Display code is broken #3486

Closed stevexyz closed 1 month ago

stevexyz commented 1 month ago

I just bought the TTGO T-Display v1.1, recognized in Arduino as:

BN: LilyGo T-Display VID: 1a86 PID: 55d4 SN: 589A009269

Installed arduino (on Linux Mint), copied this repository library TFT_eSPI to the Arduino directory and tried some video examples but none seems working. Below the output of the compilation:

WARNING: Category 'Sound' in library ESP_I2S is not valid. Setting to 'Uncategorized'
WARNING: Category 'Sensor' in library ESP_NOW is not valid. Setting to 'Uncategorized'
WARNING: Category 'Sound' in library ESP_SR is not valid. Setting to 'Uncategorized'
WARNING: Category '' in library ESP Insights is not valid. Setting to 'Uncategorized'
WARNING: Category '' in library ESP RainMaker is not valid. Setting to 'Uncategorized'
WARNING: Category '' in library TFLite Micro is not valid. Setting to 'Uncategorized'
WARNING: Category '' in library WiFiProv is not valid. Setting to 'Uncategorized'
In file included from /home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.h:48,
                 from /home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp:17:
/home/steve/Arduino/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.c: In function 'void dc_callback(spi_transaction_t*)':
/home/steve/Arduino/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.h:115:22: error: 'GPIO' was not declared in this scope
  115 |         #define DC_D GPIO.out_w1ts = (1 << TFT_DC)//;GPIO.out_w1ts = (1 << TFT_DC)
      |                      ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.c:652:27: note: in expansion of macro 'DC_D'
  652 |   if ((bool)spi_tx->user) DC_D;
      |                           ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.h:114:22: error: 'GPIO' was not declared in this scope
  114 |         #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
      |                      ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.c:653:8: note: in expansion of macro 'DC_C'
  653 |   else DC_C;
      |        ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp: In member function 'void TFT_eSPI::begin_tft_write()':
/home/steve/Arduino/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.h:159:22: error: 'GPIO' was not declared in this scope
  159 |         #define CS_L GPIO.out_w1tc = (1 << TFT_CS); GPIO.out_w1tc = (1 << TFT_CS)
      |                      ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp:39:5: note: in expansion of macro 'CS_L'
   39 |     CS_L;
      |     ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp: In member function 'void TFT_eSPI::end_tft_write()':
/home/steve/Arduino/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.h:160:22: error: 'GPIO' was not declared in this scope
  160 |         #define CS_H GPIO.out_w1ts = (1 << TFT_CS)//;GPIO.out_w1ts = (1 << TFT_CS)
      |                      ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp:56:7: note: in expansion of macro 'CS_H'
   56 |       CS_H;
      |       ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp: In member function 'void TFT_eSPI::begin_tft_read()':
/home/steve/Arduino/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.h:159:22: error: 'GPIO' was not declared in this scope
  159 |         #define CS_L GPIO.out_w1tc = (1 << TFT_CS); GPIO.out_w1tc = (1 << TFT_CS)
      |                      ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp:77:5: note: in expansion of macro 'CS_L'
   77 |     CS_L;
      |     ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp: In member function 'void TFT_eSPI::end_tft_read()':
/home/steve/Arduino/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.h:160:22: error: 'GPIO' was not declared in this scope
  160 |         #define CS_H GPIO.out_w1ts = (1 << TFT_CS)//;GPIO.out_w1ts = (1 << TFT_CS)
      |                      ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp:97:7: note: in expansion of macro 'CS_H'
   97 |       CS_H;
      |       ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp: In member function 'void TFT_eSPI::writecommand(uint8_t)':
/home/steve/Arduino/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.h:114:22: error: 'GPIO' was not declared in this scope
  114 |         #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
      |                      ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp:548:3: note: in expansion of macro 'DC_C'
  548 |   DC_C;
      |   ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp: In member function 'void TFT_eSPI::writedata(uint8_t)':
/home/steve/Arduino/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.h:115:22: error: 'GPIO' was not declared in this scope
  115 |         #define DC_D GPIO.out_w1ts = (1 << TFT_DC)//;GPIO.out_w1ts = (1 << TFT_DC)
      |                      ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp:567:3: note: in expansion of macro 'DC_D'
  567 |   DC_D;        // Play safe, but should already be in data mode
      |   ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp: In member function 'uint8_t TFT_eSPI::readcommand8(uint8_t, uint8_t)':
/home/steve/Arduino/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.h:114:22: error: 'GPIO' was not declared in this scope
  114 |         #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
      |                      ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp:604:3: note: in expansion of macro 'DC_C'
  604 |   DC_C; tft_Write_8(0xD9);
      |   ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp: In member function 'uint16_t TFT_eSPI::readPixel(int32_t, int32_t)':
/home/steve/Arduino/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.h:160:22: error: 'GPIO' was not declared in this scope
  160 |         #define CS_H GPIO.out_w1ts = (1 << TFT_CS)//;GPIO.out_w1ts = (1 << TFT_CS)
      |                      ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp:740:3: note: in expansion of macro 'CS_H'
  740 |   CS_H;
      |   ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp: In member function 'void TFT_eSPI::readRect(int32_t, int32_t, int32_t, int32_t, uint16_t*)':
/home/steve/Arduino/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.h:160:22: error: 'GPIO' was not declared in this scope
  160 |         #define CS_H GPIO.out_w1ts = (1 << TFT_CS)//;GPIO.out_w1ts = (1 << TFT_CS)
      |                      ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp:855:3: note: in expansion of macro 'CS_H'
  855 |   CS_H;
      |   ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp: In member function 'void TFT_eSPI::readRectRGB(int32_t, int32_t, int32_t, int32_t, uint8_t*)':
/home/steve/Arduino/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.h:160:22: error: 'GPIO' was not declared in this scope
  160 |         #define CS_H GPIO.out_w1ts = (1 << TFT_CS)//;GPIO.out_w1ts = (1 << TFT_CS)
      |                      ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp:1577:3: note: in expansion of macro 'CS_H'
 1577 |   CS_H;
      |   ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp: In member function 'void TFT_eSPI::setWindow(int32_t, int32_t, int32_t, int32_t)':
/home/steve/Arduino/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.h:114:22: error: 'GPIO' was not declared in this scope
  114 |         #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
      |                      ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp:2633:3: note: in expansion of macro 'DC_C'
 2633 |   DC_C; tft_Write_8(TFT_CASET);
      |   ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp: In member function 'void TFT_eSPI::readAddrWindow(int32_t, int32_t, int32_t, int32_t)':
/home/steve/Arduino/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.h:114:22: error: 'GPIO' was not declared in this scope
  114 |         #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
      |                      ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp:2666:3: note: in expansion of macro 'DC_C'
 2666 |   DC_C; tft_Write_8(TFT_CASET);
      |   ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp: In member function 'virtual void TFT_eSPI::drawPixel(int32_t, int32_t, uint32_t)':
/home/steve/Arduino/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.h:114:22: error: 'GPIO' was not declared in this scope
  114 |         #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
      |                      ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp:2707:5: note: in expansion of macro 'DC_C'
 2707 |     DC_C; tft_Write_8(TFT_CASET);
      |     ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.h:114:22: error: 'GPIO' was not declared in this scope
  114 |         #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
      |                      ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp:2714:5: note: in expansion of macro 'DC_C'
 2714 |     DC_C; tft_Write_8(TFT_PASET);
      |     ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/Processors/TFT_eSPI_ESP32.h:114:22: error: 'GPIO' was not declared in this scope
  114 |         #define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
      |                      ^~~~
/home/steve/Arduino/libraries/TFT_eSPI/TFT_eSPI.cpp:2720:3: note: in expansion of macro 'DC_C'
 2720 |   DC_C; tft_Write_8(TFT_RAMWR);
      |   ^~~~
exit status 1
Error compiling for board LilyGo T-Display.

I checked and in User_Setup_Select.h just Setup25_TTGO_T_Display.h is selected. Board "LiliGo T-Display" is selected.

I tried to comment the offending code in TFT_eSPI/Processors/TFT_eSPI_ESP32.h (putting false as condition at line 99 and 154) and it compiled:

WARNING: Category 'Sound' in library ESP_I2S is not valid. Setting to 'Uncategorized'
WARNING: Category 'Sensor' in library ESP_NOW is not valid. Setting to 'Uncategorized'
WARNING: Category 'Sound' in library ESP_SR is not valid. Setting to 'Uncategorized'
WARNING: Category '' in library ESP Insights is not valid. Setting to 'Uncategorized'
WARNING: Category '' in library ESP RainMaker is not valid. Setting to 'Uncategorized'
WARNING: Category '' in library TFLite Micro is not valid. Setting to 'Uncategorized'
WARNING: Category '' in library WiFiProv is not valid. Setting to 'Uncategorized'
Archiving built core (caching) in: /tmp/arduino_cache_27425/core/core_esp32_esp32_lilygo_t_display_PSRAM_disabled,LoopCore_1,EventsCore_1,PartitionScheme_default,CPUFreq_40,FlashMode_qio,FlashFreq_40,FlashSize_4M,UploadSpeed_921600,DebugLevel_none,EraseFlash_none_5fd6343b5b760e70216422255bff19df.a
Sketch uses 311541 bytes (23%) of program storage space. Maximum is 1310720 bytes.
Global variables use 20668 bytes (6%) of dynamic memory, leaving 307012 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.6
Serial port /dev/ttyACM0
Connecting.....
Chip is ESP32-D0WDQ6-V3 (revision v3.1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: a0:dd:6c:74:f4:f8
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00007fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x0005cfff...
Compressed 24880 bytes to 16255...
Writing at 0x00001000... (100 %)
Wrote 24880 bytes (16255 compressed) at 0x00001000 in 0.6 seconds (effective 352.8 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 146...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.1 seconds (effective 462.8 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 621.2 kbit/s)...
Hash of data verified.
Compressed 311904 bytes to 171895...
Writing at 0x00010000... (9 %)
Writing at 0x0001a6d4... (18 %)
Writing at 0x00028c45... (27 %)
Writing at 0x0002e1d2... (36 %)
Writing at 0x00033878... (45 %)
Writing at 0x000391e0... (54 %)
Writing at 0x0003e49f... (63 %)
Writing at 0x000438c5... (72 %)
Writing at 0x00048e74... (81 %)
Writing at 0x00051a9d... (90 %)
Writing at 0x0005952a... (100 %)
Wrote 311904 bytes (171895 compressed) at 0x00010000 in 3.2 seconds (effective 773.2 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

BUT the only board effect is to light up the display!

Did I do something wrong? In case, can you elaborate in the homepage instructions?

Thank you

praegustator commented 1 month ago

I think I had/have the same issue as you; in the end though I was able to upload and partially see the rendered images (so far, analog clock and PNG). Mine is probably a chinese clone of LilyGo (since there is no label on it). It is though detected as LilyGo T-Display.

image

I can only advice to double-check these files:

.../Arduino/libraries/TFT_eSPI/User_Setup_Select.h

#include <User_Setups/Setup25_TTGO_T_Display.h>

.../Arduino/libraries/TFT_eSPI/User_Setup.h

#define USER_SETUP_INFO "User_Setup"

// ...

#define ILI9341_DRIVER 

// ...

#define TFT_MISO  PIN_D6
#define TFT_MOSI  PIN_D7
#define TFT_SCLK  PIN_D5 

#define TFT_CS    PIN_D8
#define TFT_DC    PIN_D3
#define TFT_RST   PIN_D4

// ...

These settings I used in Arduino IDE:

Board: LilyGo T-Display
JTAG Adapter: Disbled
PSRAM: Disbled
Partition Scheme: Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
CPU Frequency: 240MHz
Flash Mode: QIO
Flash Frequency: 80 MHz
Flash Size: 4MByte (32Mbit)
Upload Speed: 921600
Arduino Runs On: Core 1
Events Runs On: Core 1
Core Debug Level: None
Erase All Flash: Disabled

Note: script it validated and uploaded, and I got an image on the screen; however, those scripts from library examples were cropped/ panned/ zoomed/ showed only particularly. I might not be uploading correctly, in the end. I also tried this fork (or is it?) with no luck.

Will be interested in others' experience on this topic.

stevexyz commented 1 month ago

I checked and they are ok, but I just realized now that this issue should have been opened on the T-Display specific repository, so closing it here and open it there!