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.53k stars 1.02k forks source link

ILI9486 display connected to nodeMCU-32S only flashes white #3021

Closed Tiltolein closed 6 months ago

Tiltolein commented 7 months ago

I hope someone can help me as I´m by now clueless to the point I don´t even know what infos to provide and how to further investigate and potential errors on my side.

To minimise effort to resolve issues the following should be provided as a minimum:

  1. A description of the problem and the conditions that cause it to occur When connecting the display and running any program the display will simple stay white or flash between black and white

  2. IDE (e.g. Arduino or PlatformIO) The issue appears on both Arduino and PlatformIO

  3. TFT_eSPI library version (try the latest, the problem may have been resolved!) from the Manage Libraries... menu I´m using version 2.5.34

  4. Board package version (e.g. 2.0.3) available from the Boards Manager... menu I´m using version 2.0.14

  5. Procesor, e.g RP2040, ESP32 S3 etc The processor is an nodeMCU-32S

  6. TFT driver (e.g. ILI9341), a link to the vendors product web page is useful too. The TFT driver is ILI9486 :https://www.berrybase.de/3-5-display-fuer-raspberry-pi-mit-resistivem-touchscreen

  7. Interface type (SPI or parallel) Tbh I have no idea but I think its SPI. Should be clear regarding the product-page for someone more clever than me :)

Plus further information as appropriate to the problem:

  1. TFT to processor connections used I have tried liking up the display using multiple different setups, all have led to the same result.

    My current setup is as follows: image

  2. A zip file containing your setup file (just drag and drop in message window - do not paste in long files!) I don´t know what file exactly is meant. At this point I´ve tried at least 10 different combinations of code but none of them seem to work for me

  3. A zip file containing a simple and complete example sketch that demonstrates the problem but needs no special hardware sensors or libraries.

  4. Screen shot pictures showing the problem (just drag and drop in message window)

The idea is to provide sufficient information so I can setup the exact same (or sufficiently similar) scenario to investigate and resolve the issue without having a tedious ping-pong of Q&A.

DO NOT paste code directly into the issue. To correctly format code put three ticks ( ` character on key next to "1" key) at the start and end of short pasted code segments to avoid format/markup anomolies. See here:

Example output:

  Serial.begin(115200);
  tft.init();
Bodmer commented 7 months ago

Run the Read_User_Setup test and diagnostic sketch. This will only output to the serial monitor window at 115200 baud. Check the output against the settings. Post the output here if uoy are not sure.

Tiltolein commented 7 months ago

Thanks for the fast reply! This is my output

[code] TFT_eSPI ver = 2.5.34 Processor = ESP32 Frequency = 240MHz Transactions = Yes Interface = SPI Display driver = 9486 Display width = 320 Display height = 480

MOSI = GPIO 12 MISO = GPIO 2 SCK = GPIO 14 TFT_CS = GPIO 5 TFT_DC = GPIO 15 TFT_RST = GPIO 13 TOUCH_CS = GPIO 18

Font GLCD loaded Font 2 loaded Font 4 loaded Font 6 loaded Font 7 loaded Font 8 loaded Smooth font enabled

Display SPI frequency = 26.00 Touch SPI frequency = 2.50

Bodmer commented 7 months ago

I would avoid using GPIO 12 because the display may bias it high at startup and then the processor will not boot.

See here: https://randomnerdtutorials.com/esp32-pinout-reference-gpios/

Tiltolein commented 7 months ago

Thanks, I´ve now changed to GPIO 16 but I´m still facing the same problem.

The output is now as follows:

[code] TFT_eSPI ver = 2.5.34 Processor = ESP32 Frequency = 240MHz Transactions = Yes Interface = SPI Display driver = 9486 Display width = 320 Display height = 480

MOSI = GPIO 16 MISO = GPIO 2 SCK = GPIO 14 TFT_CS = GPIO 5 TFT_DC = GPIO 15 TFT_RST = GPIO 13 TOUCH_CS = GPIO 18

Font GLCD loaded Font 2 loaded Font 4 loaded Font 6 loaded Font 7 loaded Font 8 loaded Smooth font enabled

Display SPI frequency = 26.00 Touch SPI frequency = 2.50 [/code]

I have attached a zip file of my User_Setup File in hopes of it may being helpfull. I don´t have any other idea what might be the problem except for the wiring, but I can´t tell really. At this point I´ve redone the wiring about 10 times :) user_setup.zip

Bodmer commented 7 months ago

You need to add this line to the setup file:

define RPI_DISPLAY_TYPE

and change the SPI clock rate to 20MHz:

define SPI_FREQUENCY 20000000

Tiltolein commented 7 months ago

I´ve changed the mentioned values.

Now I´m getting the following errors while compiling any code.

In file included from c:\Users\benj\Documents\Arduino\libraries\TFT_eSPI\TFT_eSPI.cpp:24: c:\Users\benj\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.c: In member function 'bool TFT_eSPI::initDMA(bool)': c:\Users\benj\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.c:805:3: warning: missing initializer for member 'spi_bus_config_t::data4_io_num' [-Wmissing-field-initializers] }; ^ c:\Users\benj\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.c:805:3: warning: missing initializer for member 'spi_bus_config_t::data5_io_num' [-Wmissing-field-initializers] c:\Users\benj\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.c:805:3: warning: missing initializer for member 'spi_bus_config_t::data6_io_num' [-Wmissing-field-initializers] c:\Users\benj\Documents\Arduino\libraries\TFT_eSPI\Processors/TFT_eSPI_ESP32.c:805:3: warning: missing initializer for member 'spi_bus_config_t::data7_io_num' [-Wmissing-field-initializers]

Bodmer commented 7 months ago

It appears you have changed to another earlier board package. Update to 2.0.14 again and the warnings should go away.

Bodmer commented 6 months ago

I have looked into this further and it is board package version related. Try changing you library code to disable this line thus by adding the "x": https://github.com/Bodmer/TFT_eSPI/blob/master/Processors/TFT_eSPI_ESP32.c#L796

I have temporarily updated the master library with this but I am not sure if this will cause problems with older ESP32 board packages.

Tiltolein commented 6 months ago

Hey again thanks a lot for the effort. However I was always using version 2.0.14. The changed code including the "x" sadly didn´t help either. I appreciate the effort a lot

Edit: I did however have an older version (2.0.13) by Arduino installed, I´ve now uninstalled said version but the warnings still appear

Tiltolein commented 6 months ago

I´ve just got it to work, thank you so much for your patience and time

Bodmer commented 6 months ago

Great!

DoctorU commented 5 months ago

This is just a small "thank you" comment for posting this problem and also helping: this issue works as a nice "how to troubleshoot" example.

For context:

  1. I'm new to all this! (although plenty of other programming experience: Java, JS, Python).
  2. My LilyGo T4 is a new toy :)
  3. My display suddenly stopped working when I switched Arduino workspace settings. It's showing either black or all white. I assumed I'd fried it with static and would have to buy a new one!

So now I have hope again. :)